fix(shadow): repair UTC sampling and persist v3 diagnostics

This commit is contained in:
zgw
2026-09-07 10:12:41 +08:00
parent 5ce6393337
commit 79e0db29f9
15 changed files with 678 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "PUSHD_ACTIVE=0"
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
@@ -41,15 +42,20 @@ if exist "%OUTPUT_DIR%" (
pushd "%REPO_ROOT%" >nul
if errorlevel 1 (call :fail "cannot enter REPO_ROOT" & exit /b 1)
set "PUSHD_ACTIVE=1"
(
echo export_started_utc=%DATE% %TIME%
echo export_started_local=%DATE% %TIME%
echo expected_branch=test/ft546wms-shadow-v3-20260903
git branch --show-current
git rev-parse HEAD
git status --porcelain
) > "%OUTPUT_DIR%\deployment.txt" 2>&1
if errorlevel 1 (call :fail "cannot create deployment evidence" & exit /b 1)
git branch --show-current >> "%OUTPUT_DIR%\deployment.txt" 2>&1
if errorlevel 1 (call :fail "cannot collect Git branch evidence" & exit /b 1)
git rev-parse HEAD >> "%OUTPUT_DIR%\deployment.txt" 2>&1
if errorlevel 1 (call :fail "cannot collect Git commit evidence" & exit /b 1)
git status --porcelain >> "%OUTPUT_DIR%\deployment.txt" 2>&1
if errorlevel 1 (call :fail "cannot collect Git deployment evidence" & exit /b 1)
popd >nul
set "PUSHD_ACTIVE=0"
jps -lv > "%OUTPUT_DIR%\runtime-processes.txt" 2>&1
if errorlevel 1 (call :fail "cannot collect JVM process evidence" & exit /b 1)
@@ -61,8 +67,14 @@ if errorlevel 1 (call :fail "cannot collect environment variable evidence" & exi
call :require_output "environment-variable-names.txt"
if errorlevel 1 exit /b 1
sqlcmd -S "%SQL_SERVER%" -d "%DATABASE%" -E -b -r1 -w 65535 -y 0 -Y 0 -v WarehouseId="%WAREHOUSE_ID%" StartUtc="%START_UTC%" OutputDir="%OUTPUT_DIR%" -i "%SQL_FILE%"
rem sqlcmd 13 does not reliably expand variables in :out paths. Use literal names under OUTPUT_DIR.
pushd "%OUTPUT_DIR%" >nul
if errorlevel 1 (call :fail "cannot enter OUTPUT_DIR" & exit /b 1)
set "PUSHD_ACTIVE=1"
sqlcmd -S "%SQL_SERVER%" -d "%DATABASE%" -E -b -r1 -w 65535 -y 0 -Y 0 -v WarehouseId="%WAREHOUSE_ID%" StartUtc="%START_UTC%" -i "%SQL_FILE%"
if errorlevel 1 (call :fail "read-only SQL export failed" & exit /b 1)
popd >nul
set "PUSHD_ACTIVE=0"
set "LOG_CANDIDATE="
for /f "delims=" %%L in ('dir /s /b "%LOG_DIR%\*.log" "%LOG_DIR%\*.txt" 2^>nul') do set "LOG_CANDIDATE=%%L"
@@ -82,6 +94,7 @@ call :require_output "shadow-warnings.txt"
if errorlevel 1 exit /b 1
echo EXPORT_OK output=%OUTPUT_DIR%
echo EXPORT_OK means files were collected, not approval to switch algorithms.
exit /b 0
:require_output
@@ -94,5 +107,6 @@ exit /b 2
:fail
echo EXPORT_FAILED %~1 1>&2
popd >nul 2>nul
if "%PUSHD_ACTIVE%"=="1" popd >nul 2>nul
set "PUSHD_ACTIVE=0"
exit /b 1