Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
Remove finished temporary public validation workflow without publishing any private source or binaries
davoodmehraban89 committed
Oct 19, 2026 at 18:48 UTC
b36aa756549343fc4354879a4e9910e826f56a2f
1 file changed
-253
.github/workflows/private-v6-builder-ephemeral-20261018.yml
deleted
-253
@@ -1,253 +0,0 @@
1
-name: Ephemeral private V6 builder verification (no uploads)
2
-on:
3
- push:
4
- paths:
5
- - .github/workflows/private-v6-builder-ephemeral-20261018.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='dev/v6-sql-editor-assertion-repair-20261017'
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
- foreach($path in $paths){
38
- $url="https://api.github.com/repos/$private/contents/${path}?ref=$branch"
39
- $api=Invoke-RestMethod -Uri $url -Headers @{ Authorization="Bearer $env:TF_VALIDATION_READ_TOKEN"; Accept='application/vnd.github+json'; 'User-Agent'='TreasuryFlow-private-qa' }
40
- if(!$api.content -or $api.encoding -ne 'base64'){throw 'PRIVATE_TEXT_FETCH_FAILED'}
41
- $dest=Join-Path $work $path
42
- New-Item -ItemType Directory -Path (Split-Path $dest -Parent) -Force | Out-Null
43
- [IO.File]::WriteAllBytes($dest,[Convert]::FromBase64String(($api.content -replace '\s','')))
44
- }
45
- $archive=Join-Path $work 'TreasuryFlow_Validation_Staging_20261017.zip'
46
- & gh release download validation-inputs-20261017 --repo $private --pattern TreasuryFlow_Validation_Staging_20261017.zip --dir $work *> (Join-Path $work 'release-fetch.log')
47
- if($LASTEXITCODE -ne 0){throw 'PRIVATE_RELEASE_DOWNLOAD_FAILED'}
48
- # The private read-only GitHub token is ONLY for fetching inputs.
49
- # electron-builder can infer an unintended publish/update provider
50
- # from GH_TOKEN after NSIS has otherwise successfully built.
51
- Remove-Item Env:GH_TOKEN -ErrorAction SilentlyContinue
52
- Remove-Item Env:GITHUB_TOKEN -ErrorAction SilentlyContinue
53
- Remove-Item Env:TF_VALIDATION_READ_TOKEN -ErrorAction SilentlyContinue
54
- Write-Host 'GATE_PASS_PRIVATE_DOWNLOAD_TOKEN_CLEARED_BEFORE_PACKAGING'
55
- $destination=Join-Path $work 'run-once-candidate'
56
- $privateLog=Join-Path $work 'full-builder-log-private.txt'
57
- $errors=$null
58
- $tokens=$null
59
- [void][Management.Automation.Language.Parser]::ParseFile((Join-Path $work $paths[0]),[ref]$tokens,[ref]$errors)
60
- if($errors.Count -gt 0){throw 'PRIVATE_BUILDER_POWERSHELL_PARSE_FAILED'}
61
- & pwsh -NoProfile -File (Join-Path $work $paths[0]) -SourceArchive $archive -OutputRoot $destination *> $privateLog
62
- if($LASTEXITCODE -ne 0) {
63
- $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'
64
- $nsisLog=Join-Path $destination 'private-local-logs/private-nsis.log'
65
- if(Test-Path -LiteralPath $nsisLog){
66
- $nsisText=Get-Content -LiteralPath $nsisLog -Raw
67
- $knownClasses=[ordered]@{
68
- NSIS_PROCESS='(?i)makensis|nsis'
69
- NETWORK='(?i)ETIMEDOUT|ECONNRESET|socket hang up|download failed'
70
- FILE_PATH='(?i)ENOENT|not found|cannot find module'
71
- SIGNING='(?i)signing|certificate|winCodeSign'
72
- ACCESS='(?i)EPERM|EACCES|access denied'
73
- NATIVE_DEPENDENCY='(?i)node-gyp|npmRebuild|native dependency'
74
- CONFIGURATION='(?i)configuration|invalid config|schema'
75
- ASAR='(?i)asar|cannot pack'
76
- WINDOWS_PATH_LENGTH='(?i)path too long|filename too long'
77
- UNKNOWN_BUILDER_ERROR='(?i)error|failed|⨯'
78
- }
79
- $specificClasses=[ordered]@{
80
- ASAR_ENTRY_MISSING='(?i)(?:Application entry file|main entry file|entry file.*does not exist)'
81
- ELECTRON_MAIN_MISSING='(?i)(?:main\.cjs.*not found|main\.js.*not found|entrypoint.*missing)'
82
- ELECTRON_APP_PACKAGE='(?i)(?:app\.asar.*does not exist|no app\.asar|invalid app package)'
83
- FILE_ALREADY_EXISTS='(?i)(?:file already exists|EEXIST)'
84
- PATH_IS_TOO_LONG='(?i)(?:ENAMETOOLONG|path too long|filename or extension is too long)'
85
- UNRESOLVED_DEPENDENCY='(?i)(?:unresolved dependenc|missing dependenc|cannot resolve)'
86
- APP_BUILDER_EXIT='(?i)(?:exit status [0-9]+|exit code [0-9]+|errorOut=)'
87
- CODE_SIGN_FAILURE='(?i)(?:failed to sign|signing failed|signtool.*error)'
88
- NSIS_MAKENSIS_FAILURE='(?i)(?:makensis.*failed|NSIS Error|failed to compile script)'
89
- INTEGRITY_FAILURE='(?i)(?:integrity checksum failed|incorrect integrity|checksum mismatch)'
90
- ZIP_FAILURE='(?i)(?:7zip.*error|failed to extract|archive corrupted)'
91
- RUNNER_RESOURCE_FAILURE='(?i)(?:out of memory|ENOMEM|disk full|ENOSPC)'
92
- WINDOWS_PROCESS_FAILURE='(?i)(?:spawn.*fail|The system cannot find|CreateProcess)'
93
- PACKAGING_REBUILD_FAILURE='(?i)(?:failed to rebuild|rebuilding native|node-gyp failed)'
94
- AFTER_PACK_HOOK_FAILURE='(?i)(?:afterPack.*fail|afterSign.*fail)'
95
- PUBLISH_FAILURE='(?i)(?:publish.*fail|upload.*fail)'
96
- }
97
- foreach($name in $specificClasses.Keys){
98
- Write-Host ('PRIVATE_QA_NSIS_SPECIFIC_'+$name+'='+[bool]($nsisText -match $specificClasses[$name]))
99
- }
100
- $releasePath=Join-Path $env:RUNNER_TEMP 'private-stage/release'
101
- $binCount=@(Get-ChildItem -LiteralPath $releasePath -File -Filter '*.exe' -ErrorAction SilentlyContinue).Count
102
- Write-Host ('PRIVATE_NSIS_RESULT_EXE_PRESENT='+[bool]($binCount -gt 0))
103
- $lastLineCount=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|fail|exit|throw'}).Count
104
- Write-Host ('PRIVATE_NSIS_ERROR_LIKE_LINE_COUNT='+[Math]::Min($lastLineCount,100))
105
- $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')
106
- $codes=@($shortCodes | ForEach-Object {$_.Value} | Select-Object -Unique | Select-Object -First 8)
107
- if($codes.Count -gt 0){Write-Host ('PRIVATE_QA_NSIS_SAFE_ERROR_CODES='+($codes -join ','))}
108
- foreach($name in $knownClasses.Keys){
109
- Write-Host ('PRIVATE_QA_NSIS_DIAGNOSTIC_'+$name+'='+[bool]($nsisText -match $knownClasses[$name]))
110
- }
111
- }
112
- $record=Get-Content $privateLog -Raw
113
- $attempts=[regex]::Matches($record,'PRIVATE_QA_PHASE=NSIS_DIRECT_(?:BINARY_RETRY|RETRY_SUCCEEDED|RETRY_FAILED)')
114
- Write-Host ('PRIVATE_QA_DIRECT_RETRY_MARKERS='+($attempts.Count))
115
- foreach($a in $attempts){Write-Host ('PRIVATE_QA_ATTEMPT='+$a.Value)}
116
- if(Test-Path -LiteralPath $nsisLog){
117
- # Preapproved generic English vocabulary only. No raw log,
118
- # private paths, URLs, source lines, values, IDs or credentials.
119
- $allowed=@('error','failed','failure','fatal','exit','code','status','process','terminated',
120
- 'command','cannot','could','not','find','found','missing','invalid','unrecognized',
121
- 'unexpected','argument','unknown','required','option','file','directory','path',
122
- 'package','module','dependency','native','rebuild','electron','builder','nsis',
123
- 'sign','signing','certificate','installer','installation','configuration',
124
- 'config','schema','archive','asar','version','runtime','windows','win','setup',
125
- 'permission','access','denied','exception','execution','message','warning',
126
- 'artifact','output','input','executable','target','release','publish',
127
- 'upload','download','network','timeout','certificate','digest','hash',
128
- 'checksum','integrity','symlink','extract','copy','rename','remove',
129
- 'read','write','create','open','close','unsupported','environment',
130
- 'value','type','object','null','undefined','function','property','properties',
131
- 'string','number','boolean','parse','syntax','operation','system','is',
132
- 'was','with','at','to','in','from','for','and','or','of','on','the','a','an',
133
- 'after','before','during','while','as','due','because','by','already',
134
- 'exists','cannot','isnt','doesnt','trying','use','using','please',
135
- 'cannot','build','building','built','pack','packaging','unpack',
136
- 'not','proper','invalid','has','have','had','failed','called')
137
- $failureLines=@($nsisText -split '\r?\n' | Where-Object {$_ -match '(?i)error|failed|exception|⨯'})
138
- $terminalLine=if($failureLines.Count -gt 0){[string]$failureLines[$failureLines.Count-1]}else{''}
139
- $words=@([regex]::Matches($terminalLine,'[A-Za-z]{2,24}') |
140
- ForEach-Object {$_.Value.ToLowerInvariant()} |
141
- Where-Object {$allowed -contains $_} | Select-Object -First 30)
142
- Write-Host ('PRIVATE_QA_SAFE_ERROR_WORDS='+($words -join '_'))
143
- }
144
- $phases=[regex]::Matches($record,'PRIVATE_QA_PHASE=[A-Z_]+')
145
- $lastPhase=if($phases.Count -gt 0){$phases[$phases.Count-1].Value}else{'PRIVATE_QA_PHASE=BEFORE_ARCHIVE_PREFLIGHT'}
146
- Write-Host ('DIAGNOSTIC_LAST_VERIFIED_PHASE='+$lastPhase)
147
- $match=[regex]::Match($record,$known)
148
- $code=if($match.Success){$match.Value}else{'PRIVATE_BUILD_FAILED_DETAILS_RETAINED_ONLY_ON_EPHEMERAL_WINDOWS_RUNNER'}
149
- try {
150
- $probeRelease=Join-Path $env:RUNNER_TEMP 'private-stage/release'
151
- $cand=@(Get-ChildItem -LiteralPath $probeRelease -Filter 'TreasuryFlow*.exe' -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1000000})
152
- Write-Host ('DIAGNOSTIC_INSTALLER_COUNT='+$cand.Count)
153
- if($cand.Count -eq 1){
154
- $testHome=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-installed'
155
- $testData=Join-Path $env:RUNNER_TEMP 'v6-diagnostic-data'
156
- New-Item -ItemType Directory -Path $testData -Force | Out-Null
157
- $p=Start-Process -FilePath $cand[0].FullName -ArgumentList @('/S',('/D='+$testHome)) -PassThru
158
- if(!$p.WaitForExit(120000)){try{$p.Kill()}catch{};throw 'TEST_INSTALL_TIMED_OUT'}
159
- if($p.ExitCode -ne 0){throw 'TEST_INSTALL_EXIT'}
160
- $installedExe=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
161
- if($installedExe.Count -ne 1){throw 'TEST_EXE_NOT_INSTALLED'}
162
- Write-Host 'PROBE_PASS_NSIS_INSTALL_WHILE_PACKAGER_EXIT_NONZERO'
163
- & node (Join-Path $work $paths[3]) $installedExe[0].FullName $testData *> (Join-Path $work 'private-gui-probe.log')
164
- if($LASTEXITCODE -eq 0){
165
- $data=Get-Content (Join-Path $testData 'private-gui-report.json') -Raw | ConvertFrom-Json
166
- if($data.status -eq 'PASS' -and $data.osClipboard){
167
- Write-Host 'PROBE_PASS_REAL_WINDOWS_CLIPBOARD_WHILE_PACKAGER_EXIT_NONZERO'
168
- }else{Write-Host 'PROBE_FAIL_GUI_ASSERTION'}
169
- }else{Write-Host 'PROBE_FAIL_GUI_EXECUTION'}
170
- $un=@(Get-ChildItem -LiteralPath $testHome -Recurse -File -Filter 'Uninstall*.exe' -ErrorAction SilentlyContinue)
171
- if($un.Count -eq 1){
172
- $up=Start-Process -FilePath $un[0].FullName -ArgumentList '/S' -PassThru
173
- if($up.WaitForExit(90000) -and $up.ExitCode -eq 0){Write-Host 'PROBE_PASS_NSIS_UNINSTALL_WHILE_PACKAGER_EXIT_NONZERO'}
174
- }
175
- }
176
- }catch{
177
- Write-Host 'PROBE_FAIL_DIAGNOSTIC_INSTALL_OR_GUI'
178
- }
179
- throw $code
180
- }
181
- $deliverables=Join-Path $destination 'PRIVATE_QA_DELIVERABLES'
182
- $proof=Get-Content (Join-Path $deliverables 'NONFINAL_QA_SHA256_MANIFEST.json') -Raw | ConvertFrom-Json
183
- $source=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Source.zip'
184
- $exe=Join-Path $deliverables 'TreasuryFlow_V6_1.0.1_Patched_NONFINAL_QA_Setup.exe'
185
- 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'}
186
- if((Get-FileHash $source -Algorithm SHA256).Hash -ne $proof.patchedSourceSha256 -or
187
- (Get-FileHash $exe -Algorithm SHA256).Hash -ne $proof.patchedInstallerSha256){throw 'NONFINAL_MANIFEST_DIGEST_MISMATCH'}
188
- Write-Host 'PRIVATE_V6_PATCHED_SOURCE_AND_WINDOWS_SETUP_BUILD_PASS'
189
- Write-Host 'PRIVATE_V6_NPM_SECURITY_TEST_TYPECHECK_LINT_BUILD_SMOKE_PASS'
190
- Write-Host 'NO_SOURCE_OR_BINARY_UPLOADED_TO_PUBLIC_ARTIFACTS'
191
- # Replay installed native GUI/clipboard acceptance on this exact built EXE.
192
- & node --check (Join-Path $work $paths[3])
193
- if($LASTEXITCODE -ne 0){throw 'INSTALLED_GUI_HARNESS_SYNTAX_FAILED'}
194
- $env:BANK_ADAPTER_MODE='disabled'
195
- $env:TREASURYFLOW_DESKTOP_LOCAL='1'
196
- $env:TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ='0'
197
- $env:TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ='0'
198
- $env:TREASURYFLOW_ENABLE_SQL_LAB='0'
199
- $isolation=Join-Path $env:RUNNER_TEMP 'v6-gui-test-data'
200
- $installDir=Join-Path $env:RUNNER_TEMP 'TreasuryFlow-V6-Isolated-Installed'
201
- New-Item -ItemType Directory -Path $isolation -Force | Out-Null
202
- $install=Start-Process -FilePath $exe -ArgumentList @('/S',('/D='+$installDir)) -PassThru
203
- if(!$install.WaitForExit(240000)){try{$install.Kill()}catch{};throw 'V6_NSIS_INSTALL_TIMEOUT'}
204
- if($install.ExitCode -ne 0){throw 'V6_NSIS_NONZERO_EXIT'}
205
- $installed=@(Get-ChildItem -LiteralPath $installDir -Recurse -Filter 'TreasuryFlow.exe' -File -ErrorAction SilentlyContinue)
206
- if($installed.Count -ne 1){throw 'INSTALLED_V6_EXE_NOT_UNIQUE'}
207
- Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_INSTALL'
208
- $guiLog=Join-Path $work 'private-installed-gui-log.txt'
209
- & node (Join-Path $work $paths[3]) $installed[0].FullName $isolation *> $guiLog
210
- if($LASTEXITCODE -ne 0){
211
- $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
212
- $safe=$guiRecord.failure -replace '[^A-Z0-9_ ]',''
213
- if(!$safe){$safe='UNKNOWN'}
214
- throw ('V6_SAME_ARTIFACT_INSTALLED_GUI_FAILED_'+$safe)
215
- }
216
- $guiRecord=Get-Content (Join-Path $isolation 'private-gui-report.json') -Raw | ConvertFrom-Json
217
- if($guiRecord.status -ne 'PASS' -or !$guiRecord.osClipboard -or !$guiRecord.bankDisabled -or
218
- !$guiRecord.copyButton -or !$guiRecord.writable -or !$guiRecord.select){throw 'V6_SAME_ARTIFACT_GUI_REPORT_FAIL'}
219
- Write-Host 'GATE_PASS_SAME_ARTIFACT_INSTALLED_WINDOWS_OS_CLIPBOARD'
220
- # Independently exercise real installed Electron 10-route navigation,
221
- # three synthetic actions, restart persistence and audit on same EXE.
222
- & node --check (Join-Path $work $paths[4])
223
- if($LASTEXITCODE -ne 0){throw 'INSTALLED_10_ROUTE_HARNESS_SYNTAX_FAILED'}
224
- $uat=Join-Path $env:RUNNER_TEMP 'v6-full-native-uat'
225
- New-Item -ItemType Directory -Path $uat -Force | Out-Null
226
- & node (Join-Path $work $paths[4]) $installed[0].FullName $uat *> (Join-Path $work 'private-native-10route-uat.log')
227
- $uatReportFile=Join-Path $uat 'treasuryflow-native-gui.json'
228
- if(!(Test-Path -LiteralPath $uatReportFile)){throw 'INSTALLED_10_ROUTE_UAT_REPORT_MISSING'}
229
- $uatReport=Get-Content -LiteralPath $uatReportFile -Raw | ConvertFrom-Json
230
- if($LASTEXITCODE -ne 0 -or $uatReport.outcome -ne 'REAL_INSTALLED_ELECTRON_GUI_PASS' -or
231
- $uatReport.visitedRoutes.Count -ne 10 -or !$uatReport.syntheticAccount -or
232
- !$uatReport.syntheticBeneficiary -or !$uatReport.syntheticDraft -or
233
- !$uatReport.durableData -or !$uatReport.auditPersisted -or !$uatReport.appReopened){
234
- $safeStage=[string]$uatReport.stage -replace '[^a-zA-Z0-9_-]',''
235
- throw ('V6_SAME_ARTIFACT_NATIVE_UAT_FAILED_AT_'+$safeStage)
236
- }
237
- Write-Host 'GATE_PASS_SAME_ARTIFACT_INSTALLED_10_ROUTES_3_SYNTHETIC_ACTIONS_RESTART_AUDIT'
238
-
239
- $uninstall=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -ErrorAction SilentlyContinue |
240
- Where-Object {$_.Name -match '^uninstall.*[.]exe$'})
241
- if($uninstall.Count -ne 1){throw 'V6_NSIS_UNINSTALLER_NOT_FOUND'}
242
- $uninstallProcess=Start-Process -FilePath $uninstall[0].FullName -ArgumentList '/S' -PassThru
243
- if(!$uninstallProcess.WaitForExit(90000)){try{$uninstallProcess.Kill()}catch{};throw 'V6_UNINSTALL_TIMEOUT'}
244
- if($uninstallProcess.ExitCode -ne 0){throw 'V6_UNINSTALL_NONZERO'}
245
- for($i=0;$i -lt 90;$i++){
246
- $remaining=@(Get-ChildItem -LiteralPath $installDir -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
247
- if($remaining.Count -eq 0){break}
248
- Start-Sleep -Seconds 1
249
- }
250
- if($remaining.Count -gt 0){throw 'V6_UNINSTALL_LEFT_BINARY'}
251
- Write-Host 'GATE_PASS_SAME_ARTIFACT_NSIS_UNINSTALL'
252
- Write-Host 'V6_NONFINAL_PRIVATE_QA_10_PLUS_GATES_FULL_PASS'
253
-