Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
Run private V6 full installed Electron financial actions, restart persistence and audit using public verified harness
davoodmehraban89 committed
Oct 18, 2026 at 14:07 UTC
5b65c0188b8b73c4c18d1c912de20e910ad840f3
1 file changed
+145
.github/workflows/v6-installed-financial-persistence-once.yml
new
+145
@@ -0,0 +1,145 @@
1
+name: V6 installed financial GUI persistence smoke on Windows 2022 (NOT V7)
2
+on:
3
+ push:
4
+ branches: ['ci/public-windows-bridge-probe-20261017']
5
+ paths: ['.github/workflows/v6-installed-financial-persistence-once.yml']
6
+permissions:
7
+ contents: read
8
+concurrency:
9
+ group: treasuryflow-v6-financial-gui-one-shot
10
+ cancel-in-progress: false
11
+jobs:
12
+ financial-gui:
13
+ runs-on: windows-2022
14
+ timeout-minutes: 75
15
+ defaults:
16
+ run:
17
+ shell: pwsh
18
+ env:
19
+ BANK_ADAPTER_MODE: disabled
20
+ TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ: '0'
21
+ TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ: '0'
22
+ TREASURYFLOW_ENABLE_SQL_LAB: '0'
23
+ TREASURYFLOW_DESKTOP_LOCAL: '1'
24
+ NEXT_TELEMETRY_DISABLED: '1'
25
+ steps:
26
+ - name: Get public standalone acceptance harness (no secrets)
27
+ uses: actions/checkout@v4
28
+ with:
29
+ ref: ci/windows-dual-app-lab-20261016
30
+ path: public-harness
31
+ persist-credentials: false
32
+ - name: Download SHA-pinned private ZIP and private guarded patch
33
+ env:
34
+ GH_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
35
+ run: |
36
+ $ErrorActionPreference='Stop'
37
+ if([string]::IsNullOrWhiteSpace($env:GH_TOKEN)){throw 'MISSING_READ_ONLY_TOKEN'}
38
+ $zip=Join-Path $env:RUNNER_TEMP 'TreasuryFlow_Validation_Staging_20261017.zip'
39
+ $stage=Join-Path $env:RUNNER_TEMP 'tf-v6-private'
40
+ 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
41
+ if($LASTEXITCODE -ne 0){throw 'PRIVATE_DOWNLOAD_FAILED'}
42
+ if((Get-FileHash $zip -Algorithm SHA256).Hash -ine '9ce46ce2d2a437e08cbf28146b2cf2ac0ed078c71f1aeb537764390cdd3c552f'){throw 'PRIVATE_ZIP_SHA_FAILED'}
43
+ Expand-Archive -LiteralPath $zip -DestinationPath $stage -Force
44
+ $raw=gh api 'repos/davoodmehraban89/TreasuryFlow-Validation-Private/contents/qa/patches/v6-sql-assertion-fix.mjs?ref=2265e7e370d254eaa09988164559b2cd0c10c0d7' 2>$null | ConvertFrom-Json
45
+ if($LASTEXITCODE -ne 0 -or !$raw.content){throw 'PRIVATE_PATCH_NOT_AVAILABLE'}
46
+ $patch=Join-Path $env:RUNNER_TEMP 'tf-sql-assertion-patch.mjs'
47
+ [IO.File]::WriteAllBytes($patch,[Convert]::FromBase64String(($raw.content -replace '\s','')))
48
+ "TF_STAGE=$stage" >> $env:GITHUB_ENV
49
+ "TF_PATCH=$patch" >> $env:GITHUB_ENV
50
+ Write-Host 'GATE_PASS_PRIVATE_SOURCE_SHA_AND_PATCH'
51
+ - name: Setup Node 22
52
+ uses: actions/setup-node@v4
53
+ with:
54
+ node-version: '22'
55
+ - name: Build V6 installer from private staging with reproducible gated patch
56
+ run: |
57
+ $ErrorActionPreference='Continue'
58
+ $PSNativeCommandUseErrorActionPreference=$false
59
+ Set-Location $env:TF_STAGE
60
+ node $env:TF_PATCH $env:TF_STAGE *> (Join-Path $env:RUNNER_TEMP 'private-patch.log')
61
+ if($LASTEXITCODE -ne 0){throw 'PATCH_FAILED'}
62
+ npm ci --no-audit --no-fund *> (Join-Path $env:RUNNER_TEMP 'private-npm.log')
63
+ if($LASTEXITCODE -ne 0){throw 'NPM_CI_FAILED'}
64
+ npm test -- --reporter=dot *> (Join-Path $env:RUNNER_TEMP 'private-unit.log')
65
+ if($LASTEXITCODE -ne 0){throw 'UNIT_GATES_FAILED'}
66
+ npm run build *> (Join-Path $env:RUNNER_TEMP 'private-next.log')
67
+ if($LASTEXITCODE -ne 0){throw 'NEXT_BUILD_FAILED'}
68
+ node scripts/prepare-standalone.mjs *> (Join-Path $env:RUNNER_TEMP 'private-bundle.log')
69
+ if($LASTEXITCODE -ne 0){throw 'STANDALONE_FAILED'}
70
+ & npx --no-install electron-builder --win nsis --x64 --publish never *> (Join-Path $env:RUNNER_TEMP 'private-nsis.log')
71
+ if($LASTEXITCODE -ne 0){throw 'NSIS_BUILD_FAILED'}
72
+ $exe=@(Get-ChildItem (Join-Path $env:TF_STAGE 'release') -File -Filter 'TreasuryFlow*.exe' -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1000000})
73
+ if($exe.Count -ne 1){throw 'PRIVATE_INSTALLER_NOT_UNIQUE'}
74
+ "TF_SETUP=$($exe[0].FullName)" >> $env:GITHUB_ENV
75
+ Write-Host ('REBUILT_NSIS_SHA256='+((Get-FileHash $exe[0].FullName -Algorithm SHA256).Hash))
76
+ Write-Host 'GATE_PASS_REBUILT_V6_NSIS'
77
+ - name: Install the rebuilt NSIS on disposable Windows VM
78
+ id: install
79
+ run: |
80
+ $ErrorActionPreference='Stop'
81
+ $destination=Join-Path $env:RUNNER_TEMP 'tf-v6-financial-installed'
82
+ $p=Start-Process -FilePath $env:TF_SETUP -ArgumentList @('/S',('/D='+$destination)) -PassThru
83
+ if(!$p.WaitForExit(240000)){try{$p.Kill()}catch{};throw 'INSTALL_TIMEOUT'}
84
+ if($p.ExitCode -ne 0){throw 'INSTALL_NONZERO'}
85
+ $apps=@(Get-ChildItem $destination -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
86
+ if($apps.Count -ne 1){throw 'INSTALLED_EXE_NOT_UNIQUE'}
87
+ "TF_INSTALLED_EXE=$($apps[0].FullName)" >> $env:GITHUB_ENV
88
+ "TF_INSTALLED_ROOT=$destination" >> $env:GITHUB_ENV
89
+ Write-Host 'GATE_PASS_NSIS_INSTALLED'
90
+ - name: Real installed Electron full route synthetic financial writes and restart persistence
91
+ timeout-minutes: 16
92
+ run: |
93
+ $ErrorActionPreference='Continue'
94
+ $PSNativeCommandUseErrorActionPreference=$false
95
+ $src=Join-Path $env:GITHUB_WORKSPACE 'public-harness/qa/windows/electron-native-gui-smoke.mjs'
96
+ $probe=Join-Path $env:RUNNER_TEMP 'public-financial-smoke-temporary.mjs'
97
+ $script=Get-Content -LiteralPath $src -Raw
98
+ $marker=" await go('/login','ورود به محیط محلی امن');"
99
+ if(!$script.Contains($marker)){throw 'PUBLIC_HARNESS_STARTUP_ANCHOR_MISSING'}
100
+ $script=$script.Replace($marker, " await sleep(12000);`n"+$marker)
101
+ Set-Content -LiteralPath $probe -Encoding utf8 -Value $script
102
+ $helpers=Join-Path $env:RUNNER_TEMP 'qa-windows-helpers'
103
+ New-Item -ItemType Directory -Path $helpers -Force | Out-Null
104
+ Copy-Item -Path $env:GITHUB_WORKSPACE/public-harness/qa/windows/gui-readiness.mjs -Destination $helpers
105
+ Copy-Item -Path $env:GITHUB_WORKSPACE/public-harness/qa/windows/synthetic-iban.mjs -Destination $helpers
106
+ $script=(Get-Content -LiteralPath $probe -Raw).Replace("'./gui-readiness.mjs'","'./qa-windows-helpers/gui-readiness.mjs'").Replace("'./synthetic-iban.mjs'","'./qa-windows-helpers/synthetic-iban.mjs'")
107
+ Set-Content -LiteralPath $probe -Encoding utf8 -Value $script
108
+ $reports=Join-Path $env:RUNNER_TEMP 'private-financial-test'
109
+ New-Item -ItemType Directory -Force -Path $reports | Out-Null
110
+ node $probe $env:TF_INSTALLED_EXE $reports *> (Join-Path $env:RUNNER_TEMP 'private-financial-test.log')
111
+ $code=$LASTEXITCODE
112
+ $json=Join-Path $reports 'treasuryflow-native-gui.json'
113
+ if(!(Test-Path $json)){throw 'FINANCIAL_GUI_JSON_ABSENT'}
114
+ $x=Get-Content -LiteralPath $json -Raw | ConvertFrom-Json
115
+ $allow=@('cdp','localOrigin','integrations','queryEditor','copyQuery','copyExactlyEditedSql','syntheticAccount','syntheticBeneficiary','syntheticDraft','appReopened','durableData','auditPersisted')
116
+ foreach($key in $allow){Write-Host ("NATIVE_GUI_"+$key+"="+[bool]$x.$key)}
117
+ Write-Host ('NATIVE_GUI_ROUTE_PASS_COUNT='+@($x.visitedRoutes | Where-Object {$_.status -eq 'PASS'}).Count)
118
+ Write-Host ('NATIVE_GUI_RESTART_ROUTE_COUNT='+@($x.postRestartRoutes).Count)
119
+ $allowedOutcomes=@('REAL_INSTALLED_ELECTRON_GUI_PASS','FAILED')
120
+ Write-Host ('NATIVE_GUI_GATE='+ $(if($x.outcome -eq 'REAL_INSTALLED_ELECTRON_GUI_PASS'){'PASS'}else{'FAIL'}))
121
+ if($code -ne 0 -or $x.outcome -ne 'REAL_INSTALLED_ELECTRON_GUI_PASS'){throw 'INSTALLED_FINANCIAL_GUI_ACCEPTANCE_FAILED'}
122
+ Write-Host 'GATE_PASS_FINANCIAL_GUI_PERSISTENCE_AUDIT'
123
+ - name: Uninstall the rebuilt NSIS even when GUI testing fails
124
+ if: ${{ always() && steps.install.outcome == 'success' }}
125
+ run: |
126
+ $ErrorActionPreference='Stop'
127
+ @(Get-Process -Name TreasuryFlow -ErrorAction SilentlyContinue) | ForEach-Object {try{Stop-Process -Id $_.Id -Force}catch{}}
128
+ $xs=@(Get-ChildItem $env:TF_INSTALLED_ROOT -Recurse -File -ErrorAction SilentlyContinue | Where-Object {$_.Name -match '^uninstall.*[.]exe$'})
129
+ if($xs.Count -ne 1){throw 'UNINSTALLER_NOT_UNIQUE'}
130
+ $p=Start-Process -FilePath $xs[0].FullName -ArgumentList '/S' -PassThru
131
+ if(!$p.WaitForExit(90000)){try{$p.Kill()}catch{};throw 'UNINSTALL_TIMEOUT'}
132
+ if($p.ExitCode -ne 0){throw 'UNINSTALL_NONZERO'}
133
+ $gone=$false
134
+ for($i=0;$i -lt 90;$i++){
135
+ if(@(Get-ChildItem $env:TF_INSTALLED_ROOT -Recurse -File -Filter TreasuryFlow.exe -ErrorAction SilentlyContinue).Count -eq 0){$gone=$true;break}
136
+ Start-Sleep -Seconds 1
137
+ }
138
+ if(!$gone){throw 'UNINSTALL_FILE_NOT_GONE'}
139
+ Write-Host 'GATE_PASS_SYNTHETIC_NSIS_UNINSTALL'
140
+ - name: Keep private source and evidence off public repository
141
+ if: always()
142
+ run: |
143
+ Write-Host 'SCOPE=PRIVATE_V6_FINANCIAL_GUI_SYNTHETIC_ONLY'
144
+ Write-Host 'SQL_SERVER_APPLICATION_ADAPTER=NOT_TESTED; EXCEL_IMPORT=NOT_TESTED; V7=NOT_TESTED'
145
+ Write-Host 'NO_PRIVATE_BINARY_SOURCE_OR_SCREENSHOT_UPLOADS'