Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

Run hardened Excel route through known-good real installed Electron GUI UAT and file input DOM check

davoodmehraban89 committed Oct 20, 2026 at 08:39 UTC 5b20b22cdeedabb42c4430bd065d8598bdeb680e
1 file changed +292
.github/workflows/v6-excel-native-full-route-uat-once.yml new
+292
@@ -0,0 +1,292 @@
1 +name: V6 hardened Excel native route + full UAT Windows
2 +on:
3 + push:
4 + paths:
5 + - .github/workflows/v6-excel-native-full-route-uat-once.yml
6 + workflow_dispatch:
7 +permissions:
8 + contents: read
9 +jobs:
10 + private-builder:
11 + runs-on: windows-2022
12 + timeout-minutes: 70
13 + steps:
14 + - name: Install Node 22
15 + uses: actions/setup-node@v4
16 + with:
17 + node-version: '22'
18 + - name: Verify private V6 builder from validated short staging path, no uploads
19 + shell: pwsh
20 + env:
21 + TF_VALIDATION_READ_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
22 + run: |
23 + $ErrorActionPreference='Stop'
24 + if([string]::IsNullOrWhiteSpace($env:TF_VALIDATION_READ_TOKEN)){throw 'PRIVATE_READ_TOKEN_NOT_AVAILABLE'}
25 + $env:GH_TOKEN=$env:TF_VALIDATION_READ_TOKEN
26 + $private='davoodmehraban89/TreasuryFlow-Validation-Private'
27 + $branch='07407c24ec5af7bb00a0eb1f2b7555470bbcbeee'
28 + $work=Join-Path $env:RUNNER_TEMP 'v6-protected-builder'
29 + New-Item -ItemType Directory -Path $work -Force | Out-Null
30 + $paths=@('qa/scripts/rebuild-v6-private-nonfinal-qa.ps1',
31 + 'qa/patches/v6-sql-assertion-fix.mjs',
32 + 'qa/patches/v6-add-readonly-sqlserver-adapter.mjs',
33 + 'qa/windows/v6-installed-native-gui-os-clipboard.mjs',
34 + 'qa/windows/v6-full-installed-gui-and-persistence.mjs',
35 + 'qa/windows/gui-readiness.mjs',
36 + 'qa/windows/synthetic-iban.mjs',
37 + 'qa/windows/v6-installed-excel-ui-negative-gate.mjs',
38 + 'qa/patches/v6-add-excel-isolated-preview.mjs',
39 + 'qa/tests/v6-excel-preview-validators.test.mjs')
40 + foreach($path in $paths){
41 + $url="https://api.github.com/repos/$private/contents/${path}?ref=$branch"
42 + $api=Invoke-RestMethod -Uri $url -Headers @{ Authorization="Bearer $env:TF_VALIDATION_READ_TOKEN"; Accept='application/vnd.github+json'; 'User-Agent'='TreasuryFlow-private-qa' }
43 + if(!$api.content -or $api.encoding -ne 'base64'){throw 'PRIVATE_TEXT_FETCH_FAILED'}
44 + $dest=Join-Path $work $path
45 + New-Item -ItemType Directory -Path (Split-Path $dest -Parent) -Force | Out-Null
46 + [IO.File]::WriteAllBytes($dest,[Convert]::FromBase64String(($api.content -replace '\s','')))
47 + }
48 + $archive=Join-Path $work 'TreasuryFlow_Validation_Staging_20261017.zip'
49 + & gh release download validation-inputs-20261017 --repo $private --pattern TreasuryFlow_Validation_Staging_20261017.zip --dir $work *> (Join-Path $work 'release-fetch.log')
50 + if($LASTEXITCODE -ne 0){throw 'PRIVATE_RELEASE_DOWNLOAD_FAILED'}
51 + # The private read-only GitHub token is ONLY for fetching inputs.
52 + # electron-builder can infer an unintended publish/update provider
53 + # from GH_TOKEN after NSIS has otherwise successfully built.
54 + Remove-Item Env:GH_TOKEN -ErrorAction SilentlyContinue
55 + Remove-Item Env:GITHUB_TOKEN -ErrorAction SilentlyContinue
56 + Remove-Item Env:TF_VALIDATION_READ_TOKEN -ErrorAction SilentlyContinue
57 + Write-Host 'GATE_PASS_PRIVATE_DOWNLOAD_TOKEN_CLEARED_BEFORE_PACKAGING'
58 + $destination=Join-Path $work 'run-once-candidate'
59 + $privateLog=Join-Path $work 'full-builder-log-private.txt'
60 + $errors=$null
61 + $tokens=$null
62 + [void][Management.Automation.Language.Parser]::ParseFile((Join-Path $work $paths[0]),[ref]$tokens,[ref]$errors)
63 + if($errors.Count -gt 0){throw 'PRIVATE_BUILDER_POWERSHELL_PARSE_FAILED'}
64 + & pwsh -NoProfile -File (Join-Path $work $paths[0]) -SourceArchive $archive -OutputRoot $destination -EnableExcelPreview *> $privateLog
65 + if($LASTEXITCODE -ne 0) {
66 + $known='ORIGINAL_PRIVATE_SOURCE_HASH_MISMATCH|UNSAFE_ZIP_ENTRY_PATH|ARCHIVE_ENTRY_COUNT_LIMIT|ZIP_UNCOMPRESSED_SIZE_LIMIT|ZIP_SYMLINK_DISALLOWED|DUPLICATE_ZIP_ENTRY|EXTRACTED_REPARSE_POINT_DISALLOWED|OFFICIAL_XLSX_PACKAGE_LOCK_INTEGRITY_NOT_PINNED_TO_VERIFIED_ARCHIVE|SHEETJS_OFFICIAL_VENDOR_SHA256_MISMATCH|INITIAL_NPM_CI_FAILED|REMOVE_VULNERABLE_XLSX_FAILED|INSTALL_PINNED_OFFICIAL_XLSX_FAILED|PATCHED_LOCK_NPM_CI_FAILED|KNOWN_PRODUCTION_DEPENDENCY_ADVISORIES_REMAIN|V6_UNIT_REGRESSION_FAILED|V6_GATE_FAILED_[A-Z]+|V6_NSIS_BUILDER_FAILED|READ_ONLY_SQL_ADAPTER_PATCH_FAILED|SQL_EDITOR_TEST_PATCH_FAILED'
67 + $nsisLog=Join-Path $destination 'private-local-logs/private-nsis.log'
68 + if(Test-Path -LiteralPath $nsisLog){
69 + $nsisText=Get-Content -LiteralPath $nsisLog -Raw
70 + $knownClasses=[ordered]@{
71 + NSIS_PROCESS='(?i)makensis|nsis'
72 + NETWORK='(?i)ETIMEDOUT|ECONNRESET|socket hang up|download failed'
73 + FILE_PATH='(?i)ENOENT|not found|cannot find module'
74 + SIGNING='(?i)signing|certificate|winCodeSign'
75 + ACCESS='(?i)EPERM|EACCES|access denied'
76 + NATIVE_DEPENDENCY='(?i)node-gyp|npmRebuild|native dependency'
77 + CONFIGURATION='(?i)configuration|invalid config|schema'
78 + ASAR='(?i)asar|cannot pack'
79 + WINDOWS_PATH_LENGTH='(?i)path too long|filename too long'
80 + UNKNOWN_BUILDER_ERROR='(?i)error|failed|⨯'
81 + }
82 + $specificClasses=[ordered]@{
83 + ASAR_ENTRY_MISSING='(?i)(?:Application entry file|main entry file|entry file.*does not exist)'
84 + ELECTRON_MAIN_MISSING='(?i)(?:main\.cjs.*not found|main\.js.*not found|entrypoint.*missing)'
85 + ELECTRON_APP_PACKAGE='(?i)(?:app\.asar.*does not exist|no app\.asar|invalid app package)'
86 + FILE_ALREADY_EXISTS='(?i)(?:file already exists|EEXIST)'
87 + PATH_IS_TOO_LONG='(?i)(?:ENAMETOOLONG|path too long|filename or extension is too long)'
88 + UNRESOLVED_DEPENDENCY='(?i)(?:unresolved dependenc|missing dependenc|cannot resolve)'
89 + APP_BUILDER_EXIT='(?i)(?:exit status [0-9]+|exit code [0-9]+|errorOut=)'
90 + CODE_SIGN_FAILURE='(?i)(?:failed to sign|signing failed|signtool.*error)'
91 + NSIS_MAKENSIS_FAILURE='(?i)(?:makensis.*failed|NSIS Error|failed to compile script)'
92 + INTEGRITY_FAILURE='(?i)(?:integrity checksum failed|incorrect integrity|checksum mismatch)'
93 + ZIP_FAILURE='(?i)(?:7zip.*error|failed to extract|archive corrupted)'
94 + RUNNER_RESOURCE_FAILURE='(?i)(?:out of memory|ENOMEM|disk full|ENOSPC)'
95 + WINDOWS_PROCESS_FAILURE='(?i)(?:spawn.*fail|The system cannot find|CreateProcess)'
96 + PACKAGING_REBUILD_FAILURE='(?i)(?:failed to rebuild|rebuilding native|node-gyp failed)'
97 + AFTER_PACK_HOOK_FAILURE='(?i)(?:afterPack.*fail|afterSign.*fail)'
98 + PUBLISH_FAILURE='(?i)(?:publish.*fail|upload.*fail)'
99 + }
100 + foreach($name in $specificClasses.Keys){
101 + Write-Host ('PRIVATE_QA_NSIS_SPECIFIC_'+$name+'='+[bool]($nsisText -match $specificClasses[$name]))
102 + }
103 + $releasePath=Join-Path $env:RUNNER_TEMP 'private-stage/release'
104 + $binCount=@(Get-ChildItem -LiteralPath $releasePath -File -Filter '*.exe' -ErrorAction SilentlyContinue).Count
105 + Write-Host ('PRIVATE_NSIS_RESULT_EXE_PRESENT='+[bool]($binCount -gt 0))
106 + $lastLineCount=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|fail|exit|throw'}).Count
107 + Write-Host ('PRIVATE_NSIS_ERROR_LIKE_LINE_COUNT='+[Math]::Min($lastLineCount,100))
108 + $shortCodes=[regex]::Matches($nsisText,'\\b(?:ERR_[A-Z0-9_]{4,64}|E(?:ACCES|PERM|NOENT|EXIST|CONNRESET|TIMEDOUT|NOTFOUND|NOSPC|NAMETOOLONG|PROTO|AI_AGAIN))\\b')
109 + $codes=@($shortCodes | ForEach-Object {$_.Value} | Select-Object -Unique | Select-Object -First 8)
110 + if($codes.Count -gt 0){Write-Host ('PRIVATE_QA_NSIS_SAFE_ERROR_CODES='+($codes -join ','))}
111 + foreach($name in $knownClasses.Keys){
112 + Write-Host ('PRIVATE_QA_NSIS_DIAGNOSTIC_'+$name+'='+[bool]($nsisText -match $knownClasses[$name]))
113 + }
114 + }
115 + $record=Get-Content $privateLog -Raw
116 + $attempts=[regex]::Matches($record,'PRIVATE_QA_PHASE=NSIS_DIRECT_(?:BINARY_RETRY|RETRY_SUCCEEDED|RETRY_FAILED)')
117 + Write-Host ('PRIVATE_QA_DIRECT_RETRY_MARKERS='+($attempts.Count))
118 + foreach($a in $attempts){Write-Host ('PRIVATE_QA_ATTEMPT='+$a.Value)}
119 + if(Test-Path -LiteralPath $nsisLog){
120 + # Preapproved generic English vocabulary only. No raw log,
121 + # private paths, URLs, source lines, values, IDs or credentials.
122 + $allowed=@('error','failed','failure','fatal','exit','code','status','process','terminated',
123 + 'command','cannot','could','not','find','found','missing','invalid','unrecognized',
124 + 'unexpected','argument','unknown','required','option','file','directory','path',
125 + 'package','module','dependency','native','rebuild','electron','builder','nsis',
126 + 'sign','signing','certificate','installer','installation','configuration',
127 + 'config','schema','archive','asar','version','runtime','windows','win','setup',
128 + 'permission','access','denied','exception','execution','message','warning',
129 + 'artifact','output','input','executable','target','release','publish',
130 + 'upload','download','network','timeout','certificate','digest','hash',
131 + 'checksum','integrity','symlink','extract','copy','rename','remove',
132 + 'read','write','create','open','close','unsupported','environment',
133 + 'value','type','object','null','undefined','function','property','properties',
134 + 'string','number','boolean','parse','syntax','operation','system','is',
135 + 'was','with','at','to','in','from','for','and','or','of','on','the','a','an',
136 + 'after','before','during','while','as','due','because','by','already',
137 + 'exists','cannot','isnt','doesnt','trying','use','using','please',
138 + 'cannot','build','building','built','pack','packaging','unpack',
139 + 'not','proper','invalid','has','have','had','failed','called')
140 + $failureLines=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|failed|exception|⨯'})
141 + $terminalLine=if($failureLines.Count -gt 0){[string]$failureLines[$failureLines.Count-1]}else{''}
142 + $words=@([regex]::Matches($terminalLine,'[A-Za-z]{2,24}') |
143 + ForEach-Object {$_.Value.ToLowerInvariant()} |
144 + Where-Object {$allowed -contains $_} | Select-Object -First 30)
145 + Write-Host ('PRIVATE_QA_SAFE_ERROR_WORDS='+($words -join '_'))
146 + }
147 + $phases=[regex]::Matches($record,'PRIVATE_QA_PHASE=[A-Z_]+')
148 + $lastPhase=if($phases.Count -gt 0){$phases[$phases.Count-1].Value}else{'PRIVATE_QA_PHASE=BEFORE_ARCHIVE_PREFLIGHT'}
149 + Write-Host ('DIAGNOSTIC_LAST_VERIFIED_PHASE='+$lastPhase)
150 + $match=[regex]::Match($record,$known)
151 + $code=if($match.Success){$match.Value}else{'PRIVATE_BUILD_FAILED_DETAILS_RETAINED_ONLY_ON_EPHEMERAL_WINDOWS_RUNNER'}
152 + try {
153 + $probeRelease=Join-Path $env:RUNNER_TEMP 'private-stage/release'
154 + $cand=@(Get-ChildItem -LiteralPath $probeRelease -Filter 'TreasuryFlow*.exe' -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1000000})
155 + Write-Host ('DIAGNOSTIC_INSTALLER_COUNT='+$cand.Count)
156 + if($cand.Count -eq 1){
157 + $testHome=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-installed'
158 + $testData=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-data'
159 + New-Item -ItemType Directory -Path $testData -Force | Out-Null
160 + $p=Start-Process -FilePath $cand[0].FullName -ArgumentList @('/S',('/D='+$testHome)) -PassThru
161 + if(!$p.WaitForExit(120000)){try{$p.Kill()}catch{};throw 'TEST_INSTALL_TIMED_OUT'}
162 + if($p.ExitCode -ne 0){throw 'TEST_INSTALL_EXIT'}
163 + $installedExe=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
164 + if($installedExe.Count -ne 1){throw 'TEST_EXE_NOT_INSTALLED'}
165 + Write-Host 'PROBE_PASS_NSIS_INSTALL_WHILE_PACKAGER_EXIT_NONZERO'
166 + & node (Join-Path $work $paths[3]) $installedExe[0].FullName $testData *> (Join-Path $work 'private-gui-probe.log')
167 + if($LASTEXITCODE -eq 0){
168 + $data=Get-Content (Join-Path $testData 'private-gui-report.json') -Raw | ConvertFrom-Json
169 + if($data.status -eq 'PASS' -and $data.osClipboard){
170 + Write-Host 'PROBE_PASS_REAL_WINDOWS_CLIPBOARD_WHILE_PACKAGER_EXIT_NONZERO'
171 + }else{Write-Host 'PROBE_FAIL_GUI_ASSERTION'}
172 + }else{Write-Host 'PROBE_FAIL_GUI_EXECUTION'}
173 + $un=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'Uninstall*.exe' -ErrorAction SilentlyContinue)
174 + if($un.Count -eq 1){
175 + $up=Start-Process -FilePath $un[0].FullName -ArgumentList '/S' -PassThru
176 + if($up.WaitForExit(90000) -and $up.ExitCode -eq 0){Write-Host 'PROBE_PASS_NSIS_UNINSTALL_WHILE_PACKAGER_EXIT_NONZERO'}
177 + }
178 + }
179 + }catch{
180 + Write-Host 'PROBE_FAIL_DIAGNOSTIC_INSTALL_OR_GUI'
181 + }
182 + throw $code
183 + }
184 + $deliverables=Join-Path $destination 'PRIVATE_QA_DELIVERABLES'
185 + $proof=Get-Content (Join-Path $deliverables 'NONFINAL_QA_SHA256_MANIFEST.json') -Raw | ConvertFrom-Json
186 + $source=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Source.zip'
187 + $exe=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Setup.exe'
188 + if(!(Test-Path $source) -or !(Test-Path $exe) -or $proof.finalRelease -ne $false -or $proof.v7FinalAccepted -ne $false -or $proof.productionNpmVulnerabilities -ne 0){throw 'NONFINAL_MANIFEST_POLICY_FAILED'}
189 + if((Get-FileHash $source -Algorithm SHA256).Hash -ne $proof.patchedSourceSha256 -or
190 + (Get-FileHash $exe -Algorithm SHA256).Hash -ne $proof.patchedInstallerSha256){throw 'NONFINAL_MANIFEST_DIGEST_MISMATCH'}
191 + Write-Host 'PRIVATE_V6_PATCHED_SOURCE_AND_WINDOWS_SETUP_BUILD_PASS'
192 + Write-Host 'PRIVATE_V6_NPM_SECURITY_TEST_TYPECHECK_LINT_BUILD_SMOKE_PASS'
193 + Write-Host 'NO_SOURCE_OR_BINARY_UPLOADED_TO_PUBLIC_ARTIFACTS'
194 + $env:TF_QA_STAGE_ROOT=Join-Path $env:RUNNER_TEMP 'private-stage'
195 + & node --experimental-strip-types --test (Join-Path $work $paths[9]) *> (Join-Path $work 'private-validator-unit.log')
196 + if($LASTEXITCODE -ne 0){throw 'EXCEL_PREVIEW_VALIDATOR_BEHAVIOR_TESTS_FAILED'}
197 + Write-Host 'GATE_PASS_EXCEL_PREVIEW_IBAN_MOD97_AND_DATE_EDGE_UNIT_TESTS'
198 + # Replay installed native GUI/clipboard acceptance on this exact built EXE.
199 + & node --check (Join-Path $work $paths[3])
200 + if($LASTEXITCODE -ne 0){throw 'INSTALLED_GUI_HARNESS_SYNTAX_FAILED'}
201 + $env:BANK_ADAPTER_MODE='disabled'
202 + $env:TREASURYFLOW_DESKTOP_LOCAL='1'
203 + $env:TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ='0'
204 + $env:TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ='0'
205 + $env:TREASURYFLOW_ENABLE_SQL_LAB='0'
206 + $isolation=Join-Path $env:RUNNER_TEMP 'v6-gui-test-data'
207 + $installDir=Join-Path $env:RUNNER_TEMP 'TreasuryFlow-V6-Isolated-Installed'
208 + New-Item -ItemType Directory -Path $isolation -Force | Out-Null
209 + $install=Start-Process -FilePath $exe -ArgumentList @('/S',('/D='+$installDir)) -PassThru
210 + if(!$install.WaitForExit(240000)){try{$install.Kill()}catch{};throw 'V6_NSIS_INSTALL_TIMEOUT'}
211 + if($install.ExitCode -ne 0){throw 'V6_NSIS_NONZERO_EXIT'}
212 + $installed=@(Get-ChildItem -LiteralPath $installDir -Recurse -Filter 'TreasuryFlow.exe' -File -ErrorAction SilentlyContinue)
213 + if($installed.Count -ne 1){throw 'INSTALLED_V6_EXE_NOT_UNIQUE'}
214 + Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_INSTALL'
215 + $guiLog=Join-Path $work 'private-installed-gui-log.txt'
216 + & node (Join-Path $work $paths[3]) $installed[0].FullName $isolation *> $guiLog
217 + if($LASTEXITCODE -ne 0){
218 + $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
219 + $safe=$guiRecord.failure -replace '[^A-Z0-9_ ]',''
220 + if(!$safe){$safe='UNKNOWN'}
221 + throw ('V6_SAME_ARTIFACT_INSTALLED_GUI_FAILED_'+$safe)
222 + }
223 + $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
224 + if($guiRecord.status -ne 'PASS' -or !$guiRecord.osClipboard -or !$guiRecord.bankDisabled -or
225 + !$guiRecord.copyButton -or !$guiRecord.writable -or !$guiRecord.select){throw 'V6_SAME_ARTIFACT_GUI_REPORT_FAIL'}
226 + Write-Host 'GATE_PASS_SAME_ARTIFACT_INSTALLED_WINDOWS_OS_CLIPBOARD'
227 + # Extend the already-proven Windows native UAT harness in the disposable runner.
228 + $originalNative=Join-Path $work $paths[4]
229 + $excelNative=Join-Path $work 'qa/windows/v6-native-excel-route-check.mjs'
230 + $nativeText=Get-Content -LiteralPath $originalNative -Raw
231 + $known="['/reports','گزارش‌های خزانه‌داری']"
232 + if(!$nativeText.Contains($known)){throw 'NATIVE_UAT_KNOWN_ROUTE_ANCHOR_MISSING'}
233 + $nativeText=$nativeText.Replace($known,"['/excel-preview','پیش‌نمایش امن فایل اکسل'],"+$known)
234 + $homeMarker=' const home=await wait(()=>conn.evaluate'
235 + if(!$nativeText.Contains($homeMarker)){throw 'NATIVE_UAT_VALIDATION_ANCHOR_MISSING'}
236 + $nativeCheck=' await go("/excel-preview","پیش‌نمایش امن فایل اکسل");'+[Environment]::NewLine+
237 + ' report.excelFileInput=await conn.evaluate("!!document.querySelector('+"'input[type=file]'"+')");'+[Environment]::NewLine+
238 + ' assert(report.excelFileInput,"NATIVE_XLSX_FILE_INPUT_NOT_HYDRATED");'+[Environment]::NewLine
239 + $nativeText=$nativeText.Replace($homeMarker,$nativeCheck+$homeMarker)
240 + [IO.File]::WriteAllText($excelNative,$nativeText,[Text.UTF8Encoding]::new($false))
241 + & node --check $excelNative
242 + if($LASTEXITCODE -ne 0){throw 'NATIVE_XLSX_UAT_SYNTAX_FAILED'}
243 + $excelFixture=Join-Path $env:RUNNER_TEMP 'nonfinal-excel-native-route'
244 + New-Item -ItemType Directory -Path $excelFixture -Force | Out-Null
245 + & node $excelNative $installed[0].FullName $excelFixture *> (Join-Path $work 'excel-native-route-private.log')
246 + $nativeReport=Get-Content (Join-Path $excelFixture 'treasuryflow-native-gui.json') -Raw | ConvertFrom-Json
247 + if($LASTEXITCODE -ne 0 -or $nativeReport.outcome -ne 'REAL_INSTALLED_ELECTRON_GUI_PASS' -or !$nativeReport.excelFileInput -or
248 + @($nativeReport.visitedRoutes|Where-Object {$_.route -eq '/excel-preview' -and $_.status -eq 'PASS'}).Count -ne 1){
249 + throw ('NATIVE_XLSX_UAT_FAILED_AT_'+([string]$nativeReport.stage -replace '[^A-Z0-9_]',''))
250 + }
251 + Write-Host 'GATE_PASS_SAME_ARTIFACT_NATIVE_ELECTRON_EXCEL_FILE_INPUT_HYDRATED'
252 + Write-Host 'GATE_PASS_NATIVE_11_ROUTES_THREE_SYNTHETIC_ACTIONS_PERSISTENCE_AUDIT'
253 + # Isolate SSR route availability independently of the CDP file-picker.
254 + # This gate is deliberately NOT treated as positive workbook import.
255 + $env:TREASURYFLOW_DATA_FILE=Join-Path $isolation 'excel-ssr-probe-only.sqlite'
256 + $browser=Start-Process -FilePath $installed[0].FullName -PassThru
257 + try {
258 + $ready=$false
259 + for($n=0;$n -lt 90;$n++){
260 + try{
261 + $health=Invoke-RestMethod -Uri 'http://127.0.0.1:3210/api/ready' -TimeoutSec 2
262 + if($health.status -eq 'ready' -and $health.bankAdapter -eq 'disabled'){$ready=$true;break}
263 + }catch{}
264 + Start-Sleep -Seconds 1
265 + }
266 + if(!$ready){throw 'INSTALLED_EXCEL_SSR_STARTUP_FAILED'}
267 + Write-Host 'GATE_PASS_EXCEL_SSR_LOCAL_APP_READY_BANK_DISABLED'
268 + $page=Invoke-WebRequest -Uri 'http://127.0.0.1:3210/excel-preview' -TimeoutSec 20 -UseBasicParsing
269 + Write-Host ('QA_EXCEL_ROUTE_HTTP_STATUS='+[int]$page.StatusCode)
270 + $hasInput=$page.Content.Contains('xlsx-preview-upload')
271 + Write-Host ('QA_EXCEL_ROUTE_SSR_HAS_FILE_INPUT='+[bool]$hasInput)
272 + if($page.StatusCode -ne 200 -or !$hasInput){throw 'INSTALLED_EXCEL_SSR_ROUTE_INPUT_MISSING'}
273 + Write-Host 'GATE_PASS_SAME_ARTIFACT_EXCEL_SSR_FILE_INPUT'
274 + }finally{
275 + if($browser -and !$browser.HasExited){& taskkill.exe /T /F /PID $browser.Id *> $null}
276 + }
277 + Write-Host 'NOT_TESTED_EXCEL_NATIVE_FILE_PICKER_IMPORT_EXPORT'
278 + $uninstall=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -ErrorAction SilentlyContinue |
279 + Where-Object {$_.Name -match '^uninstall.*[.]exe$'})
280 + if($uninstall.Count -ne 1){throw 'V6_NSIS_UNINSTALLER_NOT_FOUND'}
281 + $uninstallProcess=Start-Process -FilePath $uninstall[0].FullName -ArgumentList '/S' -PassThru
282 + if(!$uninstallProcess.WaitForExit(90000)){try{$uninstallProcess.Kill()}catch{};throw 'V6_UNINSTALL_TIMEOUT'}
283 + if($uninstallProcess.ExitCode -ne 0){throw 'V6_UNINSTALL_NONZERO'}
284 + for($i=0;$i -lt 90;$i++){
285 + $remaining=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
286 + if($remaining.Count -eq 0){break}
287 + Start-Sleep -Seconds 1
288 + }
289 + if($remaining.Count -gt 0){throw 'V6_UNINSTALL_LEFT_BINARY'}
290 + Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_UNINSTALL'
291 + Write-Host 'V6_NONFINAL_EXCEL_NATIVE_FILE_PICKER_ONLY_PASS_NOT_IMPORT_EXPORT'
292 +