Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
Attempt safe nonfinal candidate persistence to private prerelease after full Windows acceptance, never public artifacts
davoodmehraban89 committed
Oct 20, 2026 at 09:06 UTC
73ec82dfd9e74966c81ff61816bec718985ef45d
1 file changed
+312
.github/workflows/v6-private-protected-candidate-persist-once.yml
new
+312
@@ -0,0 +1,312 @@
1
+name: Protected private V6 candidate build verify and private-only persistence
2
+on:
3
+ push:
4
+ paths:
5
+ - .github/workflows/v6-private-protected-candidate-persist-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='f51f1d6e2a64906f8d2887c32e4d935b8ffaf3e4'
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
+ 'qa/windows/v6-native-excel-clipboard-acceptance.fragment.txt',
41
+ 'qa/tests/v6-excel-security-and-fuzz.test.mjs')
42
+ foreach($path in $paths){
43
+ $url="https://api.github.com/repos/$private/contents/${path}?ref=$branch"
44
+ $api=Invoke-RestMethod -Uri $url -Headers @{ Authorization="Bearer $env:TF_VALIDATION_READ_TOKEN"; Accept='application/vnd.github+json'; 'User-Agent'='TreasuryFlow-private-qa' }
45
+ if(!$api.content -or $api.encoding -ne 'base64'){throw 'PRIVATE_TEXT_FETCH_FAILED'}
46
+ $dest=Join-Path $work $path
47
+ New-Item -ItemType Directory -Path (Split-Path $dest -Parent) -Force | Out-Null
48
+ [IO.File]::WriteAllBytes($dest,[Convert]::FromBase64String(($api.content -replace '\s','')))
49
+ }
50
+ $archive=Join-Path $work 'TreasuryFlow_Validation_Staging_20261017.zip'
51
+ & gh release download validation-inputs-20261017 --repo $private --pattern TreasuryFlow_Validation_Staging_20261017.zip --dir $work *> (Join-Path $work 'release-fetch.log')
52
+ if($LASTEXITCODE -ne 0){throw 'PRIVATE_RELEASE_DOWNLOAD_FAILED'}
53
+ # The private read-only GitHub token is ONLY for fetching inputs.
54
+ # electron-builder can infer an unintended publish/update provider
55
+ # from GH_TOKEN after NSIS has otherwise successfully built.
56
+ Remove-Item Env:GH_TOKEN -ErrorAction SilentlyContinue
57
+ Remove-Item Env:GITHUB_TOKEN -ErrorAction SilentlyContinue
58
+ Remove-Item Env:TF_VALIDATION_READ_TOKEN -ErrorAction SilentlyContinue
59
+ Write-Host 'GATE_PASS_PRIVATE_DOWNLOAD_TOKEN_CLEARED_BEFORE_PACKAGING'
60
+ $destination=Join-Path $work 'run-once-candidate'
61
+ $privateLog=Join-Path $work 'full-builder-log-private.txt'
62
+ $errors=$null
63
+ $tokens=$null
64
+ [void][Management.Automation.Language.Parser]::ParseFile((Join-Path $work $paths[0]),[ref]$tokens,[ref]$errors)
65
+ if($errors.Count -gt 0){throw 'PRIVATE_BUILDER_POWERSHELL_PARSE_FAILED'}
66
+ & pwsh -NoProfile -File (Join-Path $work $paths[0]) -SourceArchive $archive -OutputRoot $destination -EnableExcelPreview *> $privateLog
67
+ if($LASTEXITCODE -ne 0) {
68
+ $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'
69
+ $nsisLog=Join-Path $destination 'private-local-logs/private-nsis.log'
70
+ if(Test-Path -LiteralPath $nsisLog){
71
+ $nsisText=Get-Content -LiteralPath $nsisLog -Raw
72
+ $knownClasses=[ordered]@{
73
+ NSIS_PROCESS='(?i)makensis|nsis'
74
+ NETWORK='(?i)ETIMEDOUT|ECONNRESET|socket hang up|download failed'
75
+ FILE_PATH='(?i)ENOENT|not found|cannot find module'
76
+ SIGNING='(?i)signing|certificate|winCodeSign'
77
+ ACCESS='(?i)EPERM|EACCES|access denied'
78
+ NATIVE_DEPENDENCY='(?i)node-gyp|npmRebuild|native dependency'
79
+ CONFIGURATION='(?i)configuration|invalid config|schema'
80
+ ASAR='(?i)asar|cannot pack'
81
+ WINDOWS_PATH_LENGTH='(?i)path too long|filename too long'
82
+ UNKNOWN_BUILDER_ERROR='(?i)error|failed|⨯'
83
+ }
84
+ $specificClasses=[ordered]@{
85
+ ASAR_ENTRY_MISSING='(?i)(?:Application entry file|main entry file|entry file.*does not exist)'
86
+ ELECTRON_MAIN_MISSING='(?i)(?:main\.cjs.*not found|main\.js.*not found|entrypoint.*missing)'
87
+ ELECTRON_APP_PACKAGE='(?i)(?:app\.asar.*does not exist|no app\.asar|invalid app package)'
88
+ FILE_ALREADY_EXISTS='(?i)(?:file already exists|EEXIST)'
89
+ PATH_IS_TOO_LONG='(?i)(?:ENAMETOOLONG|path too long|filename or extension is too long)'
90
+ UNRESOLVED_DEPENDENCY='(?i)(?:unresolved dependenc|missing dependenc|cannot resolve)'
91
+ APP_BUILDER_EXIT='(?i)(?:exit status [0-9]+|exit code [0-9]+|errorOut=)'
92
+ CODE_SIGN_FAILURE='(?i)(?:failed to sign|signing failed|signtool.*error)'
93
+ NSIS_MAKENSIS_FAILURE='(?i)(?:makensis.*failed|NSIS Error|failed to compile script)'
94
+ INTEGRITY_FAILURE='(?i)(?:integrity checksum failed|incorrect integrity|checksum mismatch)'
95
+ ZIP_FAILURE='(?i)(?:7zip.*error|failed to extract|archive corrupted)'
96
+ RUNNER_RESOURCE_FAILURE='(?i)(?:out of memory|ENOMEM|disk full|ENOSPC)'
97
+ WINDOWS_PROCESS_FAILURE='(?i)(?:spawn.*fail|The system cannot find|CreateProcess)'
98
+ PACKAGING_REBUILD_FAILURE='(?i)(?:failed to rebuild|rebuilding native|node-gyp failed)'
99
+ AFTER_PACK_HOOK_FAILURE='(?i)(?:afterPack.*fail|afterSign.*fail)'
100
+ PUBLISH_FAILURE='(?i)(?:publish.*fail|upload.*fail)'
101
+ }
102
+ foreach($name in $specificClasses.Keys){
103
+ Write-Host ('PRIVATE_QA_NSIS_SPECIFIC_'+$name+'='+[bool]($nsisText -match $specificClasses[$name]))
104
+ }
105
+ $releasePath=Join-Path $env:RUNNER_TEMP 'private-stage/release'
106
+ $binCount=@(Get-ChildItem -LiteralPath $releasePath -File -Filter '*.exe' -ErrorAction SilentlyContinue).Count
107
+ Write-Host ('PRIVATE_NSIS_RESULT_EXE_PRESENT='+[bool]($binCount -gt 0))
108
+ $lastLineCount=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|fail|exit|throw'}).Count
109
+ Write-Host ('PRIVATE_NSIS_ERROR_LIKE_LINE_COUNT='+[Math]::Min($lastLineCount,100))
110
+ $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')
111
+ $codes=@($shortCodes | ForEach-Object {$_.Value} | Select-Object -Unique | Select-Object -First 8)
112
+ if($codes.Count -gt 0){Write-Host ('PRIVATE_QA_NSIS_SAFE_ERROR_CODES='+($codes -join ','))}
113
+ foreach($name in $knownClasses.Keys){
114
+ Write-Host ('PRIVATE_QA_NSIS_DIAGNOSTIC_'+$name+'='+[bool]($nsisText -match $knownClasses[$name]))
115
+ }
116
+ }
117
+ $record=Get-Content $privateLog -Raw
118
+ $attempts=[regex]::Matches($record,'PRIVATE_QA_PHASE=NSIS_DIRECT_(?:BINARY_RETRY|RETRY_SUCCEEDED|RETRY_FAILED)')
119
+ Write-Host ('PRIVATE_QA_DIRECT_RETRY_MARKERS='+($attempts.Count))
120
+ foreach($a in $attempts){Write-Host ('PRIVATE_QA_ATTEMPT='+$a.Value)}
121
+ if(Test-Path -LiteralPath $nsisLog){
122
+ # Preapproved generic English vocabulary only. No raw log,
123
+ # private paths, URLs, source lines, values, IDs or credentials.
124
+ $allowed=@('error','failed','failure','fatal','exit','code','status','process','terminated',
125
+ 'command','cannot','could','not','find','found','missing','invalid','unrecognized',
126
+ 'unexpected','argument','unknown','required','option','file','directory','path',
127
+ 'package','module','dependency','native','rebuild','electron','builder','nsis',
128
+ 'sign','signing','certificate','installer','installation','configuration',
129
+ 'config','schema','archive','asar','version','runtime','windows','win','setup',
130
+ 'permission','access','denied','exception','execution','message','warning',
131
+ 'artifact','output','input','executable','target','release','publish',
132
+ 'upload','download','network','timeout','certificate','digest','hash',
133
+ 'checksum','integrity','symlink','extract','copy','rename','remove',
134
+ 'read','write','create','open','close','unsupported','environment',
135
+ 'value','type','object','null','undefined','function','property','properties',
136
+ 'string','number','boolean','parse','syntax','operation','system','is',
137
+ 'was','with','at','to','in','from','for','and','or','of','on','the','a','an',
138
+ 'after','before','during','while','as','due','because','by','already',
139
+ 'exists','cannot','isnt','doesnt','trying','use','using','please',
140
+ 'cannot','build','building','built','pack','packaging','unpack',
141
+ 'not','proper','invalid','has','have','had','failed','called')
142
+ $failureLines=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|failed|exception|⨯'})
143
+ $terminalLine=if($failureLines.Count -gt 0){[string]$failureLines[$failureLines.Count-1]}else{''}
144
+ $words=@([regex]::Matches($terminalLine,'[A-Za-z]{2,24}') |
145
+ ForEach-Object {$_.Value.ToLowerInvariant()} |
146
+ Where-Object {$allowed -contains $_} | Select-Object -First 30)
147
+ Write-Host ('PRIVATE_QA_SAFE_ERROR_WORDS='+($words -join '_'))
148
+ }
149
+ $phases=[regex]::Matches($record,'PRIVATE_QA_PHASE=[A-Z_]+')
150
+ $lastPhase=if($phases.Count -gt 0){$phases[$phases.Count-1].Value}else{'PRIVATE_QA_PHASE=BEFORE_ARCHIVE_PREFLIGHT'}
151
+ Write-Host ('DIAGNOSTIC_LAST_VERIFIED_PHASE='+$lastPhase)
152
+ $match=[regex]::Match($record,$known)
153
+ $code=if($match.Success){$match.Value}else{'PRIVATE_BUILD_FAILED_DETAILS_RETAINED_ONLY_ON_EPHEMERAL_WINDOWS_RUNNER'}
154
+ try {
155
+ $probeRelease=Join-Path $env:RUNNER_TEMP 'private-stage/release'
156
+ $cand=@(Get-ChildItem -LiteralPath $probeRelease -Filter 'TreasuryFlow*.exe' -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1000000})
157
+ Write-Host ('DIAGNOSTIC_INSTALLER_COUNT='+$cand.Count)
158
+ if($cand.Count -eq 1){
159
+ $testHome=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-installed'
160
+ $testData=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-data'
161
+ New-Item -ItemType Directory -Path $testData -Force | Out-Null
162
+ $p=Start-Process -FilePath $cand[0].FullName -ArgumentList @('/S',('/D='+$testHome)) -PassThru
163
+ if(!$p.WaitForExit(120000)){try{$p.Kill()}catch{};throw 'TEST_INSTALL_TIMED_OUT'}
164
+ if($p.ExitCode -ne 0){throw 'TEST_INSTALL_EXIT'}
165
+ $installedExe=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
166
+ if($installedExe.Count -ne 1){throw 'TEST_EXE_NOT_INSTALLED'}
167
+ Write-Host 'PROBE_PASS_NSIS_INSTALL_WHILE_PACKAGER_EXIT_NONZERO'
168
+ & node (Join-Path $work $paths[3]) $installedExe[0].FullName $testData *> (Join-Path $work 'private-gui-probe.log')
169
+ if($LASTEXITCODE -eq 0){
170
+ $data=Get-Content (Join-Path $testData 'private-gui-report.json') -Raw | ConvertFrom-Json
171
+ if($data.status -eq 'PASS' -and $data.osClipboard){
172
+ Write-Host 'PROBE_PASS_REAL_WINDOWS_CLIPBOARD_WHILE_PACKAGER_EXIT_NONZERO'
173
+ }else{Write-Host 'PROBE_FAIL_GUI_ASSERTION'}
174
+ }else{Write-Host 'PROBE_FAIL_GUI_EXECUTION'}
175
+ $un=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'Uninstall*.exe' -ErrorAction SilentlyContinue)
176
+ if($un.Count -eq 1){
177
+ $up=Start-Process -FilePath $un[0].FullName -ArgumentList '/S' -PassThru
178
+ if($up.WaitForExit(90000) -and $up.ExitCode -eq 0){Write-Host 'PROBE_PASS_NSIS_UNINSTALL_WHILE_PACKAGER_EXIT_NONZERO'}
179
+ }
180
+ }
181
+ }catch{
182
+ Write-Host 'PROBE_FAIL_DIAGNOSTIC_INSTALL_OR_GUI'
183
+ }
184
+ throw $code
185
+ }
186
+ $deliverables=Join-Path $destination 'PRIVATE_QA_DELIVERABLES'
187
+ $proof=Get-Content (Join-Path $deliverables 'NONFINAL_QA_SHA256_MANIFEST.json') -Raw | ConvertFrom-Json
188
+ $source=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Source.zip'
189
+ $exe=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Setup.exe'
190
+ 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'}
191
+ if((Get-FileHash $source -Algorithm SHA256).Hash -ne $proof.patchedSourceSha256 -or
192
+ (Get-FileHash $exe -Algorithm SHA256).Hash -ne $proof.patchedInstallerSha256){throw 'NONFINAL_MANIFEST_DIGEST_MISMATCH'}
193
+ Write-Host 'PRIVATE_V6_PATCHED_SOURCE_AND_WINDOWS_SETUP_BUILD_PASS'
194
+ Write-Host 'PRIVATE_V6_NPM_SECURITY_TEST_TYPECHECK_LINT_BUILD_SMOKE_PASS'
195
+ Write-Host 'NO_SOURCE_OR_BINARY_UPLOADED_TO_PUBLIC_ARTIFACTS'
196
+ $env:TF_QA_STAGE_ROOT=Join-Path $env:RUNNER_TEMP 'private-stage'
197
+ & node --experimental-strip-types --test (Join-Path $work $paths[9]) *> (Join-Path $work 'private-validator-unit.log')
198
+ if($LASTEXITCODE -ne 0){throw 'EXCEL_PREVIEW_VALIDATOR_BEHAVIOR_TESTS_FAILED'}
199
+ Write-Host 'GATE_PASS_EXCEL_PREVIEW_IBAN_MOD97_AND_DATE_EDGE_UNIT_TESTS'
200
+ & node --experimental-strip-types --test (Join-Path $work $paths[11]) *> (Join-Path $work 'private-excel-fuzz.log')
201
+ if($LASTEXITCODE -ne 0){throw 'EXCEL_SECURITY_FUZZ_TESTS_FAILED'}
202
+ Write-Host 'GATE_PASS_EXCEL_SECURITY_AND_500_CASE_IBAN_FUZZ_TESTS'
203
+ $oldGuiSource=Get-Content (Join-Path $work $paths[3]) -Raw
204
+ $xlsFragment=Get-Content (Join-Path $work $paths[10]) -Raw
205
+ $insertBefore=" report.status='PASS';"
206
+ if(!$oldGuiSource.Contains($insertBefore)){throw 'WINDOWS_NATIVE_GUI_PATCH_ANCHOR_MISSING'}
207
+ $xlsGuiHarness=Join-Path $work 'qa/windows/v6-clipboard-xlsx-roundtrip.mjs'
208
+ [IO.File]::WriteAllText($xlsGuiHarness,
209
+ $oldGuiSource.Replace($insertBefore,$xlsFragment+$insertBefore),
210
+ [Text.UTF8Encoding]::new($false))
211
+ $env:TF_PRIVATE_STAGE=Join-Path $env:RUNNER_TEMP 'private-stage'
212
+ # Replay installed native GUI/clipboard acceptance on this exact built EXE.
213
+ & node --check $xlsGuiHarness
214
+ if($LASTEXITCODE -ne 0){throw 'INSTALLED_GUI_HARNESS_SYNTAX_FAILED'}
215
+ $env:BANK_ADAPTER_MODE='disabled'
216
+ $env:TREASURYFLOW_DESKTOP_LOCAL='1'
217
+ $env:TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ='0'
218
+ $env:TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ='0'
219
+ $env:TREASURYFLOW_ENABLE_SQL_LAB='0'
220
+ $isolation=Join-Path $env:RUNNER_TEMP 'v6-gui-test-data'
221
+ $installDir=Join-Path $env:RUNNER_TEMP 'TreasuryFlow-V6-Isolated-Installed'
222
+ New-Item -ItemType Directory -Path $isolation -Force | Out-Null
223
+ $install=Start-Process -FilePath $exe -ArgumentList @('/S',('/D='+$installDir)) -PassThru
224
+ if(!$install.WaitForExit(240000)){try{$install.Kill()}catch{};throw 'V6_NSIS_INSTALL_TIMEOUT'}
225
+ if($install.ExitCode -ne 0){throw 'V6_NSIS_NONZERO_EXIT'}
226
+ $installed=@(Get-ChildItem -LiteralPath $installDir -Recurse -Filter 'TreasuryFlow.exe' -File -ErrorAction SilentlyContinue)
227
+ if($installed.Count -ne 1){throw 'INSTALLED_V6_EXE_NOT_UNIQUE'}
228
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_INSTALL'
229
+ $guiLog=Join-Path $work 'private-installed-gui-log.txt'
230
+ & node $xlsGuiHarness $installed[0].FullName $isolation *> $guiLog
231
+ if($LASTEXITCODE -ne 0){
232
+ $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
233
+ $safe=$guiRecord.failure -replace '[^A-Z0-9_ ]',''
234
+ if(!$safe){$safe='UNKNOWN'}
235
+ throw ('V6_SAME_ARTIFACT_INSTALLED_GUI_FAILED_'+$safe)
236
+ }
237
+ $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
238
+ if($guiRecord.status -ne 'PASS' -or !$guiRecord.osClipboard -or !$guiRecord.bankDisabled -or
239
+ !$guiRecord.copyButton -or !$guiRecord.writable -or !$guiRecord.select){throw 'V6_SAME_ARTIFACT_GUI_REPORT_FAIL'}
240
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_INSTALLED_WINDOWS_OS_CLIPBOARD'
241
+ if(!$guiRecord.excelNativeInput -or !$guiRecord.excelInvalidRejected -or
242
+ !$guiRecord.excelValidPreview -or !$guiRecord.excelNoPaymentSideEffects -or
243
+ !$guiRecord.excelRoundtrip -or !$guiRecord.excelUnsafeNumericRejected -or
244
+ !$guiRecord.excelInvalidDateRejected -or !$guiRecord.excelCaseFoldDuplicateRejected){throw ('NATIVE_EXCEL_ROUNDTRIP_FAILED_AT_'+([string]$guiRecord.stage -replace '[^A-Z0-9_]',''))}
245
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_REAL_XLSX_FILE_INPUT_NEGATIVE_POSITIVE_EXPORT_ROUNDTRIP'
246
+
247
+ # Isolate SSR route availability independently of the CDP file-picker.
248
+ # This gate is deliberately NOT treated as positive workbook import.
249
+ $env:TREASURYFLOW_DATA_FILE=Join-Path $isolation 'excel-ssr-probe-only.sqlite'
250
+ $browser=Start-Process -FilePath $installed[0].FullName -PassThru
251
+ try {
252
+ $ready=$false
253
+ for($n=0;$n -lt 90;$n++){
254
+ try{
255
+ $health=Invoke-RestMethod -Uri 'http://127.0.0.1:3210/api/ready' -TimeoutSec 2
256
+ if($health.status -eq 'ready' -and $health.bankAdapter -eq 'disabled'){$ready=$true;break}
257
+ }catch{}
258
+ Start-Sleep -Seconds 1
259
+ }
260
+ if(!$ready){throw 'INSTALLED_EXCEL_SSR_STARTUP_FAILED'}
261
+ Write-Host 'GATE_PASS_EXCEL_SSR_LOCAL_APP_READY_BANK_DISABLED'
262
+ $page=Invoke-WebRequest -Uri 'http://127.0.0.1:3210/excel-preview' -TimeoutSec 20 -UseBasicParsing
263
+ Write-Host ('QA_EXCEL_ROUTE_HTTP_STATUS='+[int]$page.StatusCode)
264
+ $hasInput=$page.Content.Contains('xlsx-preview-upload')
265
+ Write-Host ('QA_EXCEL_ROUTE_SSR_HAS_FILE_INPUT='+[bool]$hasInput)
266
+ if($page.StatusCode -ne 200 -or !$hasInput){throw 'INSTALLED_EXCEL_SSR_ROUTE_INPUT_MISSING'}
267
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_EXCEL_SSR_FILE_INPUT'
268
+ }finally{
269
+ if($browser -and !$browser.HasExited){& taskkill.exe /T /F /PID $browser.Id *> $null}
270
+ }
271
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_NATIVE_EXCEL_FILE_PICKER_PREVIEW_ROUNDTRIP'
272
+ $uninstall=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -ErrorAction SilentlyContinue |
273
+ Where-Object {$_.Name -match '^uninstall.*[.]exe$'})
274
+ if($uninstall.Count -ne 1){throw 'V6_NSIS_UNINSTALLER_NOT_FOUND'}
275
+ $uninstallProcess=Start-Process -FilePath $uninstall[0].FullName -ArgumentList '/S' -PassThru
276
+ if(!$uninstallProcess.WaitForExit(90000)){try{$uninstallProcess.Kill()}catch{};throw 'V6_UNINSTALL_TIMEOUT'}
277
+ if($uninstallProcess.ExitCode -ne 0){throw 'V6_UNINSTALL_NONZERO'}
278
+ for($i=0;$i -lt 90;$i++){
279
+ $remaining=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
280
+ if($remaining.Count -eq 0){break}
281
+ Start-Sleep -Seconds 1
282
+ }
283
+ if($remaining.Count -gt 0){throw 'V6_UNINSTALL_LEFT_BINARY'}
284
+ Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_UNINSTALL'
285
+ Write-Host 'V6_NONFINAL_EXCEL_PREVIEW_ROUNDTRIP_PASS_FINANCIAL_IMPORT_NOT_TESTED'
286
+
287
+ - name: Persist only accepted nonfinal setup and source to private release
288
+ if: success()
289
+ shell: pwsh
290
+ env:
291
+ TF_VALIDATION_READ_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
292
+ run: |
293
+ $ErrorActionPreference='Stop'
294
+ $private='davoodmehraban89/TreasuryFlow-Validation-Private'
295
+ $artifacts=Join-Path $env:RUNNER_TEMP 'v6-protected-builder/run-once-candidate/PRIVATE_QA_DELIVERABLES'
296
+ $source=Join-Path $artifacts 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Source.zip'
297
+ $installer=Join-Path $artifacts 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Setup.exe'
298
+ $manifest=Join-Path $artifacts 'NONFINAL_QA_SHA256_MANIFEST.json'
299
+ foreach($path in @($source,$installer,$manifest)){if(!(Test-Path -LiteralPath $path)){throw 'PRIVATE_QA_CANDIDATE_FILE_MISSING'}}
300
+ $proof=Get-Content -LiteralPath $manifest -Raw | ConvertFrom-Json
301
+ if($proof.finalRelease -ne $false -or $proof.v7FinalAccepted -ne $false -or $proof.bankMode -ne 'disabled'){throw 'PRIVATE_NONFINAL_RELEASE_POLICY_FAILED'}
302
+ if((Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash -ne $proof.patchedSourceSha256 -or
303
+ (Get-FileHash -LiteralPath $installer -Algorithm SHA256).Hash -ne $proof.patchedInstallerSha256){throw 'PRIVATE_CANDIDATE_HASH_MISMATCH'}
304
+ Write-Host 'GATE_PASS_PRIVATE_CANDIDATE_ALL_HASHES_BEFORE_UPLOAD'
305
+ if([string]::IsNullOrWhiteSpace($env:TF_VALIDATION_READ_TOKEN)){throw 'PRIVATE_RELEASE_WRITE_AUTH_UNAVAILABLE'}
306
+ $env:GH_TOKEN=$env:TF_VALIDATION_READ_TOKEN
307
+ Remove-Item Env:TF_VALIDATION_READ_TOKEN -ErrorAction SilentlyContinue
308
+ $tag='v6-nonfinal-qa-'+$env:GITHUB_RUN_ID
309
+ $privateOutput=Join-Path $env:RUNNER_TEMP 'private-release-upload-output.txt'
310
+ & gh release create $tag $installer $source $manifest --repo $private --target 'dev/v7-seven-items-validation-20261020' --prerelease --title ('V6 NONFINAL isolated QA '+$env:GITHUB_RUN_ID) --notes 'NONFINAL QA candidate. Bank adapter disabled. Not V7. No live Mayan or bank UAT. Do not deploy to production.' *> $privateOutput
311
+ if($LASTEXITCODE -ne 0){throw 'PRIVATE_RELEASE_WRITE_PERMISSION_OR_UPLOAD_FAILED'}
312
+ Write-Host 'GATE_PASS_PROTECTED_PRIVATE_PRERELEASE_STORED'