Refactor code structure for improved readability and maintainability
mandatory-regression-gate / deterministic-tests (push) Has been cancelled
mandatory-regression-gate / protected-performance-path (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-23 15:34:05 +03:00
parent 593522e83f
commit 8447b2d796
21 changed files with 3439 additions and 4 deletions
+54
View File
@@ -0,0 +1,54 @@
@echo off
REM Runs one Cargo command with one synchronized HCIE build-number increment (Windows)
REM Usage: scripts\cargo-with-build-id.bat <cargo-subcommand> [arguments...]
setlocal enabledelayedexpansion
set ROOT_DIR=%~dp0..\
set LOCK_DIR=%ROOT_DIR%.build-id.lock
set COUNTER_FILE=%ROOT_DIR%build.id
if "%~1"=="" (
echo usage: scripts\cargo-with-build-id.bat ^<cargo-subcommand^> [arguments...]
exit /b 2
)
REM Acquire lock (Windows-friendly using a temp file)
:acquire_lock
2>nul (
>>"%LOCK_DIR%\lock.tmp" echo(%DATE% %TIME%
) || (
REM Lock exists; wait and retry
timeout /t 1 /nobreak >nul
goto :acquire_lock
)
del "%LOCK_DIR%\lock.tmp" 2>nul
REM Read current build ID
if exist "%COUNTER_FILE%" (
set /p current=<"%COUNTER_FILE%"
) else (
set current=0
)
REM Validate it's a number
echo %current%| findstr /r "^[0-9][0-9]*$" >nul
if errorlevel 1 (
echo build.id must contain one unsigned integer, found: %current%
exit /b 1
)
set /a next=current+1
REM Write counter files
echo %next%>"%COUNTER_FILE%"
echo %next%>"%ROOT_DIR%hcie-egui-app\build.id"
echo %next%>"%ROOT_DIR%hcie-egui-app\crates\hcie-gui-egui\build.id"
set HCIE_BUILD_ID_OVERRIDE=%next%
echo HCIE build %next%: cargo %*
cd /d "%ROOT_DIR%"
cargo %*
exit /b %ERRORLEVEL%
+18
View File
@@ -0,0 +1,18 @@
@echo off
REM Install repository Git hooks (Windows)
for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set REPO_ROOT=%%i
cd /d "%REPO_ROOT%"
git config --local core.hooksPath .githooks
set CONFIGURED=
for /f "delims=" %%i in ('git config --local --get core.hooksPath') do set CONFIGURED=%%i
if not "%CONFIGURED%"==".githooks" (
echo Failed to configure repository Git hooks.
exit /b 1
)
echo Repository hooks installed: core.hooksPath=.githooks
exit /b 0
+35
View File
@@ -0,0 +1,35 @@
@echo off
REM Pre-commit test gate for Windows
REM Inspects staged .rs files and runs affected crate tests
setlocal enabledelayedexpansion
REM Get staged .rs files
set STAGED_FILES=
for /f "delims=" %%f in ('git diff --cached --name-only --diff-filter=ACMR -- "*.rs"') do (
if exist "%%f" set STAGED_FILES=!STAGED_FILES! %%f
)
if "%STAGED_FILES%"=="" (
echo No staged Rust files; commit regression tests are not required.
exit /b 0
)
echo Checking formatting...
for %%f in (%STAGED_FILES%) do (
rustfmt --edition 2021 --check "%%f"
if errorlevel 1 (
echo Formatting check failed for %%f
exit /b 1
)
)
echo Running deterministic workspace tests...
cargo check --locked --workspace --exclude hcie-io --examples
if errorlevel 1 exit /b %errorlevel%
cargo test --locked --workspace --exclude hcie-io --lib --tests -- --skip benchmark_4k_stroke_on_multilayer_document
if errorlevel 1 exit /b %errorlevel%
echo Mandatory Rust regression gate passed.
exit /b 0