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

Remove completed one-shot private input testing workflow after synthetic upgrade and Excel audit

davoodmehraban89 committed Oct 18, 2026 at 14:22 UTC d2b16fa1fe3f31a02234ab17d43b219e9b090a68
1 file changed -205
.github/workflows/v6-legacy-upgrade-rollback-once.yml deleted
-205
@@ -1,205 +0,0 @@
1 -name: TreasuryFlow V6 synthetic in-place upgrade and rollback compatibility (NOT V7)
2 -on:
3 - push:
4 - branches: ['ci/public-windows-bridge-probe-20261017']
5 - paths: ['.github/workflows/v6-legacy-upgrade-rollback-once.yml']
6 -permissions:
7 - contents: read
8 - actions: read
9 -concurrency:
10 - group: treasuryflow-v6-upgrade-lab-one-shot
11 - cancel-in-progress: false
12 -jobs:
13 - upgrade:
14 - runs-on: windows-2022
15 - timeout-minutes: 85
16 - defaults:
17 - run:
18 - shell: pwsh
19 - env:
20 - BANK_ADAPTER_MODE: disabled
21 - TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ: '0'
22 - TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ: '0'
23 - TREASURYFLOW_ENABLE_SQL_LAB: '0'
24 - TREASURYFLOW_DESKTOP_LOCAL: '1'
25 - NEXT_TELEMETRY_DISABLED: '1'
26 - steps:
27 - - name: Checkout public synthetic GUI harness without credentials
28 - uses: actions/checkout@v4
29 - with:
30 - ref: ci/windows-dual-app-lab-20261016
31 - path: public-harness
32 - persist-credentials: false
33 - - name: Download and verify old 0.1.0 installer from public immutable Actions artifact
34 - env:
35 - GH_TOKEN: ${{ github.token }}
36 - run: |
37 - $ErrorActionPreference='Stop'
38 - $folder=Join-Path $env:RUNNER_TEMP 'public-legacy-installer'
39 - New-Item -ItemType Directory -Force -Path $folder | Out-Null
40 - $run=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/38965182060" | ConvertFrom-Json
41 - if($LASTEXITCODE -ne 0 -or $run.head_sha -ne '0b8e85fb3765fce84e407e0e9c59f70ad901fd8a'){throw 'LEGACY_RUN_SHA_MISMATCH'}
42 - $artifact=gh api "repos/$env:GITHUB_REPOSITORY/actions/artifacts/12075720690" | ConvertFrom-Json
43 - if($LASTEXITCODE -ne 0 -or $artifact.expired -or $artifact.digest -ne 'sha256:70fc35413677ee7a6eaa8698ddd3dfe7f828ce2a5af90a4a24a1364467d2401b'){throw 'LEGACY_ARTIFACT_HASH_OR_RETENTION_FAILED'}
44 - gh run download 38965182060 --repo "$env:GITHUB_REPOSITORY" --name treasuryflow-windows-build-and-evidence --dir $folder *> (Join-Path $env:RUNNER_TEMP 'legacy-download.log')
45 - if($LASTEXITCODE -ne 0){throw 'LEGACY_ARTIFACT_DOWNLOAD_FAILED'}
46 - $setups=@(Get-ChildItem $folder -Recurse -File -Filter 'TreasuryFlow-Setup-0.1.0-Windows-x64.exe')
47 - if($setups.Count -ne 1){throw 'LEGACY_SETUP_NOT_UNIQUE'}
48 - if((Get-FileHash $setups[0].FullName -Algorithm SHA256).Hash -ine 'F4EE8F43D1CBF1181B94B525770A8101E6073486676E7AA54D075AB8CBCC2606'){throw 'LEGACY_SETUP_SHA256_MISMATCH'}
49 - "TF_OLD_SETUP=$($setups[0].FullName)" >> $env:GITHUB_ENV
50 - Write-Host 'GATE_PASS_PINNED_OLD_0_1_0_SETUP'
51 - - name: Download private V6 stage plus strictly scoped private source test patch
52 - env:
53 - GH_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
54 - run: |
55 - $ErrorActionPreference='Stop'
56 - if([string]::IsNullOrWhiteSpace($env:GH_TOKEN)){throw 'MISSING_READ_TOKEN'}
57 - $zip=Join-Path $env:RUNNER_TEMP 'TreasuryFlow_Validation_Staging_20261017.zip'
58 - gh release download validation-inputs-20261017 --repo davoodmehraban89/TreasuryFlow-Validation-Private --pattern TreasuryFlow_Validation_Staging_20261017.zip --dir $env:RUNNER_TEMP 1>$null 2>$null
59 - if($LASTEXITCODE -ne 0){throw 'V6_INPUT_DOWNLOAD_FAILED'}
60 - if((Get-FileHash $zip -Algorithm SHA256).Hash -ine '9ce46ce2d2a437e08cbf28146b2cf2ac0ed078c71f1aeb537764390cdd3c552f'){throw 'V6_INPUT_HASH_MISMATCH'}
61 - $stage=Join-Path $env:RUNNER_TEMP 'v6-private-rebuild'
62 - Expand-Archive -LiteralPath $zip -DestinationPath $stage -Force
63 - $patch=gh api 'repos/davoodmehraban89/TreasuryFlow-Validation-Private/contents/qa/patches/v6-sql-assertion-fix.mjs?ref=2265e7e370d254eaa09988164559b2cd0c10c0d7' 2>$null | ConvertFrom-Json
64 - if($LASTEXITCODE -ne 0 -or !$patch.content){throw 'V6_PATCH_MISSING'}
65 - $patchPath=Join-Path $env:RUNNER_TEMP 'tf-v6-private-patch.mjs'
66 - [IO.File]::WriteAllBytes($patchPath,[Convert]::FromBase64String(($patch.content -replace '\s','')))
67 - "TF_V6_STAGE=$stage" >> $env:GITHUB_ENV
68 - "TF_V6_PATCH=$patchPath" >> $env:GITHUB_ENV
69 - Write-Host 'GATE_PASS_V6_PRIVATE_ZIP_PROVENANCE'
70 - - name: Setup Node 22
71 - uses: actions/setup-node@v4
72 - with:
73 - node-version: '22'
74 - - name: Build ephemeral actual V6 NSIS Setup
75 - run: |
76 - $ErrorActionPreference='Continue'
77 - $PSNativeCommandUseErrorActionPreference=$false
78 - Set-Location $env:TF_V6_STAGE
79 - node $env:TF_V6_PATCH $env:TF_V6_STAGE *> (Join-Path $env:RUNNER_TEMP 'private-patch.log')
80 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_TEST_PATCH_FAILED'}
81 - npm ci --no-audit --no-fund *> (Join-Path $env:RUNNER_TEMP 'private-npm.log')
82 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_NPM_CI_FAILED'}
83 - npm test -- --reporter=dot *> (Join-Path $env:RUNNER_TEMP 'private-test.log')
84 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_UNIT_TESTS_FAILED'}
85 - npm run build *> (Join-Path $env:RUNNER_TEMP 'private-build.log')
86 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_BUILD_FAILED'}
87 - node scripts/prepare-standalone.mjs *> (Join-Path $env:RUNNER_TEMP 'private-standalone.log')
88 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_STANDALONE_FAILED'}
89 - & npx --no-install electron-builder --win nsis --x64 --publish never *> (Join-Path $env:RUNNER_TEMP 'private-nsis.log')
90 - if($LASTEXITCODE -ne 0){throw 'PRIVATE_NSIS_FAILED'}
91 - $list=@(Get-ChildItem (Join-Path $env:TF_V6_STAGE 'release') -File -Filter 'TreasuryFlow*.exe' | Where-Object {$_.Length -gt 1000000})
92 - if($list.Count -ne 1){throw 'PRIVATE_INSTALLER_NOT_UNIQUE'}
93 - "TF_V6_SETUP=$($list[0].FullName)" >> $env:GITHUB_ENV
94 - Write-Host 'GATE_PASS_BUILT_PRIVATE_V6_SETUP'
95 - - name: Install legacy 0.1.0 and populate synthetic account, beneficiary, draft, and audit via Electron
96 - id: legacy
97 - timeout-minutes: 16
98 - run: |
99 - $ErrorActionPreference='Continue'
100 - $PSNativeCommandUseErrorActionPreference=$false
101 - $dir=Join-Path $env:RUNNER_TEMP 'tf-replaceable-install'
102 - $p=Start-Process -FilePath $env:TF_OLD_SETUP -ArgumentList @('/S',('/D='+$dir)) -PassThru
103 - if(!$p.WaitForExit(240000) -or $p.ExitCode -ne 0){throw 'LEGACY_INSTALL_FAILED'}
104 - $app=@(Get-ChildItem $dir -Recurse -File -Filter TreasuryFlow.exe)
105 - if($app.Count -ne 1){throw 'LEGACY_APP_NOT_UNIQUE'}
106 - $h=Join-Path $env:GITHUB_WORKSPACE 'public-harness/qa/windows/electron-native-gui-smoke.mjs'
107 - $probe=Join-Path $env:RUNNER_TEMP 'public-legacy-gui.mjs'
108 - $content=(Get-Content $h -Raw).Replace(" await go('/login','ورود به محیط محلی امن');"," await sleep(12000);`n await go('/login','ورود به محیط محلی امن');")
109 - $content=$content.Replace("'./gui-readiness.mjs'","'./tf-old-public-helpers/gui-readiness.mjs'").Replace("'./synthetic-iban.mjs'","'./tf-old-public-helpers/synthetic-iban.mjs'")
110 - Set-Content $probe $content -Encoding utf8
111 - $helpers=Join-Path $env:RUNNER_TEMP 'tf-old-public-helpers'
112 - New-Item -Force -ItemType Directory -Path $helpers | Out-Null
113 - Copy-Item "$env:GITHUB_WORKSPACE/public-harness/qa/windows/gui-readiness.mjs" $helpers
114 - Copy-Item "$env:GITHUB_WORKSPACE/public-harness/qa/windows/synthetic-iban.mjs" $helpers
115 - $evidence=Join-Path $env:RUNNER_TEMP 'synthetic-legacy-data'
116 - New-Item -ItemType Directory -Force -Path $evidence | Out-Null
117 - node $probe $app[0].FullName $evidence *> (Join-Path $env:RUNNER_TEMP 'legacy-financial-gui.log')
118 - $testResult=$LASTEXITCODE
119 - $resultFile=Join-Path $evidence 'treasuryflow-native-gui.json'
120 - if(!(Test-Path $resultFile)){throw 'LEGACY_GUI_REPORT_ABSENT'}
121 - $r=Get-Content -LiteralPath $resultFile -Raw | ConvertFrom-Json
122 - Write-Host ("LEGACY_SYNTHETIC_DRAFT_CREATED="+[bool]$r.syntheticDraft)
123 - Write-Host ("LEGACY_SYNTHETIC_DATA_PERSISTED="+[bool]$r.durableData)
124 - Write-Host ("LEGACY_SYNTHETIC_AUDIT_PERSISTED="+[bool]$r.auditPersisted)
125 - if($testResult -ne 0 -or $r.outcome -ne 'REAL_INSTALLED_ELECTRON_GUI_PASS'){throw 'LEGACY_SEED_ACCEPTANCE_FAILED'}
126 - "TF_UPGRADE_INSTALL_DIR=$dir" >> $env:GITHUB_ENV
127 - "TF_SHARED_SYNTHETIC_DB=$(Join-Path $evidence 'vm-only-treasuryflow.sqlite')" >> $env:GITHUB_ENV
128 - Write-Host 'GATE_PASS_LEGACY_SYNTHETIC_BASELINE'
129 - - name: Install V6 over old version and check integrity and readability of persistent synthetic data
130 - id: upgrade
131 - timeout-minutes: 14
132 - run: |
133 - $ErrorActionPreference='Stop'
134 - $proc=Start-Process -FilePath $env:TF_V6_SETUP -ArgumentList @('/S',('/D='+$env:TF_UPGRADE_INSTALL_DIR)) -PassThru
135 - if(!$proc.WaitForExit(240000)){try{$proc.Kill()}catch{};throw 'V6_UPGRADE_INSTALL_TIMEOUT'}
136 - if($proc.ExitCode -ne 0){throw 'V6_UPGRADE_INSTALLER_EXIT_NONZERO'}
137 - $app=@(Get-ChildItem $env:TF_UPGRADE_INSTALL_DIR -Recurse -File -Filter TreasuryFlow.exe)
138 - if($app.Count -ne 1){throw 'UPGRADED_EXE_NOT_UNIQUE'}
139 - $env:TREASURYFLOW_DATA_FILE=$env:TF_SHARED_SYNTHETIC_DB
140 - $p=Start-Process -FilePath $app[0].FullName -PassThru
141 - try{
142 - $healthy=$false
143 - for($i=0;$i -lt 90;$i++){
144 - Start-Sleep -Milliseconds 500
145 - try{$r=Invoke-RestMethod http://127.0.0.1:3210/api/ready -TimeoutSec 2;if($r.status -eq 'ready' -and $r.bankAdapter -eq 'disabled'){$healthy=$true;break}}catch{}
146 - }
147 - if(!$healthy){throw 'UPGRADED_V6_READY_FAILED'}
148 - $checks=[ordered]@{accounts='VM-SYNTHETIC-SOURCE';beneficiaries='VM-SYNTHETIC-BENEFICIARY';payments='VM-DRAFT-';audit='ACCOUNT_CREATED'}
149 - foreach($route in $checks.Keys){
150 - $seen=$false
151 - for($i=0;$i -lt 25;$i++){
152 - try{$x=Invoke-WebRequest ("http://127.0.0.1:3210/"+$route) -TimeoutSec 4
153 - if($x.StatusCode -eq 200 -and $x.Content.Contains($checks[$route])){$seen=$true;break}
154 - }catch{}
155 - Start-Sleep -Milliseconds 700
156 - }
157 - Write-Host ("UPGRADED_V6_"+$route+"_PRESERVED="+$seen)
158 - if(!$seen){throw ('V6_UPGRADE_SYNTHETIC_DATA_NOT_PRESERVED_'+$route)}
159 - }
160 - Write-Host 'GATE_PASS_V6_0_1_0_UPGRADE_PERSISTENCE'
161 - }finally{try{taskkill.exe /T /F /PID $p.Id *> $null}catch{}}
162 - - name: Roll back old verified setup on disposable test data and check synthetic data compatibility
163 - id: rollback
164 - timeout-minutes: 14
165 - run: |
166 - $ErrorActionPreference='Stop'
167 - $proc=Start-Process -FilePath $env:TF_OLD_SETUP -ArgumentList @('/S',('/D='+$env:TF_UPGRADE_INSTALL_DIR)) -PassThru
168 - if(!$proc.WaitForExit(240000)){try{$proc.Kill()}catch{};throw 'ROLLBACK_INSTALL_TIMEOUT'}
169 - if($proc.ExitCode -ne 0){throw 'ROLLBACK_INSTALL_NONZERO'}
170 - $app=@(Get-ChildItem $env:TF_UPGRADE_INSTALL_DIR -Recurse -File -Filter TreasuryFlow.exe)
171 - if($app.Count -ne 1){throw 'ROLLED_BACK_EXE_NOT_UNIQUE'}
172 - $env:TREASURYFLOW_DATA_FILE=$env:TF_SHARED_SYNTHETIC_DB
173 - $p=Start-Process -FilePath $app[0].FullName -PassThru
174 - try{
175 - $healthy=$false
176 - for($i=0;$i -lt 90;$i++){
177 - Start-Sleep -Milliseconds 500
178 - try{$r=Invoke-RestMethod http://127.0.0.1:3210/api/ready -TimeoutSec 2;if($r.status -eq 'ready' -and $r.bankAdapter -eq 'disabled'){$healthy=$true;break}}catch{}
179 - }
180 - if(!$healthy){throw 'ROLLED_BACK_APP_NOT_READY'}
181 - $page=Invoke-WebRequest http://127.0.0.1:3210/accounts -TimeoutSec 10
182 - $ok=($page.StatusCode -eq 200 -and $page.Content.Contains('VM-SYNTHETIC-SOURCE'))
183 - Write-Host ('ROLLBACK_ACCOUNT_PRESERVED='+$ok)
184 - if(!$ok){throw 'ROLLBACK_SYNTHETIC_ACCOUNT_NOT_PRESERVED'}
185 - Write-Host 'GATE_PASS_0_1_0_TEST_ROLLBACK'
186 - }finally{try{taskkill.exe /T /F /PID $p.Id *> $null}catch{}}
187 - - name: Uninstall test installation even after failed upgrade or rollback
188 - if: ${{ always() && steps.legacy.outcome == 'success' }}
189 - run: |
190 - $ErrorActionPreference='Stop'
191 - @(Get-Process TreasuryFlow -ErrorAction SilentlyContinue) | ForEach-Object {try{Stop-Process -Id $_.Id -Force}catch{}}
192 - $xs=@(Get-ChildItem $env:TF_UPGRADE_INSTALL_DIR -Recurse -File -ErrorAction SilentlyContinue | Where-Object {$_.Name -match '^uninstall.*[.]exe$'})
193 - if($xs.Count -ne 1){throw 'CURRENT_UNINSTALLER_NOT_UNIQUE'}
194 - $p=Start-Process -FilePath $xs[0].FullName -ArgumentList '/S' -PassThru
195 - if(!$p.WaitForExit(90000) -or $p.ExitCode -ne 0){throw 'CLEANUP_UNINSTALL_FAILED'}
196 - $removed=$false
197 - for($i=0;$i -lt 90;$i++){if(@(Get-ChildItem $env:TF_UPGRADE_INSTALL_DIR -Recurse -File -Filter TreasuryFlow.exe -ErrorAction SilentlyContinue).Count -eq 0){$removed=$true;break};Start-Sleep -Seconds 1}
198 - if(!$removed){throw 'CLEANUP_EXE_NOT_REMOVED'}
199 - Write-Host 'GATE_PASS_TEST_INSTALL_UNINSTALL_AFTER_UPGRADE'
200 - - name: Disclose bounded scope
201 - if: always()
202 - run: |
203 - Write-Host 'SCOPE=DISPOSABLE_SYNTHETIC_0_1_0_TO_1_0_1_UPGRADE_AND_ROLLBACK'
204 - Write-Host 'V7_NOT_TESTED; REAL_SQL_NOT_CONNECTED; BANK_DISABLED; MAYAN_EXTERNAL_READ_DISABLED'
205 - Write-Host 'NO_PRIVATE_CODE_BINARY_FIXTURES_OR_LOGS_UPLOADED'