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

1 name: TreasuryFlow Windows Installed Native Artifact Acceptance
2
3 on:
4 workflow_dispatch:
5
6 permissions:
7 contents: read
8 actions: read
9
10 concurrency:
11 group: treasury-native-installed-artifact
12 cancel-in-progress: false
13
14 jobs:
15 installed-native-artifact:
16 runs-on: windows-latest
17 timeout-minutes: 35
18 env:
19 SOURCE_RUN_ID: '38965182060'
20 SOURCE_SHA: '0b8e85fb3765fce84e407e0e9c59f70ad901fd8a'
21 SOURCE_ARTIFACT_ID: '12075720690'
22 SOURCE_DIGEST: 'sha256:70fc35413677ee7a6eaa8698ddd3dfe7f828ce2a5af90a4a24a1364467d2401b'
23 BANK_ADAPTER_MODE: disabled
24 TREASURYFLOW_DESKTOP_LOCAL: '1'
25 LAB_VERSION: REPO_BRANCH_NOT_V5
26 NEXT_TELEMETRY_DISABLED: '1'
27 steps:
28 - name: Checkout exact native acceptance harness
29 uses: actions/checkout@v4
30 with:
31 persist-credentials: false
32 - name: Install Node 22 for native CDP harness
33 uses: actions/setup-node@v4
34 with:
35 node-version: '22'
36 - name: Validate synthetic-only Iranian IBAN fixtures
37 shell: pwsh
38 run: |
39 node --test qa/windows/synthetic-iban.node.mjs
40 if($LASTEXITCODE -ne 0){throw 'SYNTHETIC_IBAN_FIXTURE_INVALID'}
41 - name: Download and pin genuine installer from previous Windows VM run
42 shell: pwsh
43 env:
44 GH_TOKEN: ${{ github.token }}
45 run: |
46 $ErrorActionPreference='Stop'
47 $source=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN_ID" | ConvertFrom-Json
48 if($LASTEXITCODE -ne 0){throw 'SOURCE_RUN_UNAVAILABLE'}
49 if($source.head_sha -ne $env:SOURCE_SHA){throw 'SOURCE_COMMIT_MISMATCH'}
50 if($source.repository.id -ne $source.head_repository.id){throw 'SOURCE_REPOSITORY_IDENTITY_MISMATCH'}
51 $artifact=gh api "repos/$env:GITHUB_REPOSITORY/actions/artifacts/$env:SOURCE_ARTIFACT_ID" | ConvertFrom-Json
52 if($LASTEXITCODE -ne 0){throw 'SOURCE_ARTIFACT_UNAVAILABLE'}
53 if($artifact.name -ne 'treasuryflow-windows-build-and-evidence' -or $artifact.expired){throw 'UNEXPECTED_OR_EXPIRED_ARTIFACT'}
54 if($artifact.workflow_run.id -ne [long]$env:SOURCE_RUN_ID -or $artifact.workflow_run.head_sha -ne $env:SOURCE_SHA){throw 'ARTIFACT_PROVENANCE_MISMATCH'}
55 if($artifact.digest -ne $env:SOURCE_DIGEST){throw 'ARTIFACT_ZIP_DIGEST_MISMATCH'}
56 $folder=Join-Path $env:RUNNER_TEMP 'treasuryflow-pinned-source-artifact'
57 New-Item -ItemType Directory -Path $folder -Force | Out-Null
58 gh run download $env:SOURCE_RUN_ID --repo $env:GITHUB_REPOSITORY --name treasuryflow-windows-build-and-evidence --dir $folder
59 if($LASTEXITCODE -ne 0){throw 'ARTIFACT_DOWNLOAD_FAILED'}
60 $setup=@(Get-ChildItem -LiteralPath $folder -Recurse -File -Filter 'TreasuryFlow-Setup-*-Windows-x64.exe')
61 if($setup.Count -ne 1 -or $setup[0].Length -lt 1000000){throw 'REAL_NSIS_SETUP_MISSING'}
62 $original=@(Get-ChildItem -LiteralPath $folder -Recurse -File -Filter 'installed-runtime.json')
63 if($original.Count -ne 1){throw 'ORIGINAL_INSTALL_TEST_REPORT_MISSING'}
64 $prior=Get-Content $original[0].FullName -Raw | ConvertFrom-Json
65 $actualHash=(Get-FileHash $setup[0].FullName -Algorithm SHA256).Hash
66 if(!$prior.installerSha256 -or $actualHash -ne $prior.installerSha256){throw 'SETUP_SHA256_MISMATCH'}
67 $release=Join-Path $env:GITHUB_WORKSPACE 'release'
68 New-Item -ItemType Directory -Path $release -Force | Out-Null
69 Copy-Item -LiteralPath $setup[0].FullName -Destination $release -Force
70 $reportDir=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
71 New-Item -ItemType Directory -Path $reportDir -Force | Out-Null
72 [ordered]@{schema='treasuryflow-replayed-installer-v1';sourceRun=$env:SOURCE_RUN_ID;sourceSha=$env:SOURCE_SHA;artifactId=$env:SOURCE_ARTIFACT_ID;artifactDigest=$env:SOURCE_DIGEST;setupFile=$setup[0].Name;setupSha256=$actualHash;bankAdapter='disabled';outcome='PINNED_SOURCE_PASS'} | ConvertTo-Json | Set-Content (Join-Path $reportDir 'source-provenance.json') -Encoding utf8
73 "Pinned verified setup from run $env:SOURCE_RUN_ID SHA $env:SOURCE_SHA" >> $env:GITHUB_STEP_SUMMARY
74 - name: Install actual NSIS Setup and verify installed HTTP readiness
75 id: installed_setup
76 shell: pwsh
77 run: |
78 & "$env:GITHUB_WORKSPACE/scripts/windows-vm-treasury-install-smoke.ps1" -SourceRoot "$env:GITHUB_WORKSPACE"
79 - name: Run actual installed Electron CDP native financial matrix and persistence test
80 shell: pwsh
81 run: |
82 $root=Join-Path $env:RUNNER_TEMP 'TreasuryFlow-VM-Installed'
83 $apps=@(Get-ChildItem -LiteralPath $root -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue)
84 if($apps.Count -ne 1){throw 'ACTUAL_INSTALLED_ELECTRON_MISSING'}
85 $reports=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
86 node "$env:GITHUB_WORKSPACE/qa/windows/electron-native-gui-smoke.mjs" $apps[0].FullName $reports
87 if($LASTEXITCODE -ne 0){throw 'NATIVE_FINANCIAL_CDP_MATRIX_FAILED'}
88 - name: Real NSIS silent uninstall
89 # Disposal and independent installer verification must run even if GUI fails.
90 # Failure of a prior step still leaves this Job failed.
91 if: ${{ always() && steps.installed_setup.outcome == 'success' }}
92 shell: pwsh
93 run: |
94 & "$env:GITHUB_WORKSPACE/scripts/windows-vm-treasury-uninstall-smoke.ps1" -InstalledFolder (Join-Path $env:RUNNER_TEMP 'TreasuryFlow-VM-Installed')
95 - name: Independently aggregate required acceptance evidence
96 if: always()
97 shell: pwsh
98 run: |
99 $ErrorActionPreference='Stop'
100 $folder=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
101 New-Item -ItemType Directory -Path $folder -Force | Out-Null
102 $matrix=@(
103 @{file='source-provenance.json';status='PINNED_SOURCE_PASS';label='source'},
104 @{file='installed-runtime.json';status='NSIS_INSTALL_AND_INSTALLED_RUNTIME_PASS';label='install'},
105 @{file='treasuryflow-native-gui.json';status='REAL_INSTALLED_ELECTRON_GUI_PASS';label='native_ui'},
106 @{file='uninstall-runtime.json';status='NSIS_REAL_UNINSTALL_PASS';label='uninstall'}
107 )
108 $checks=@()
109 foreach($rule in $matrix){
110 $result='MISSING'
111 $path=Join-Path $folder $rule.file
112 if(Test-Path $path){
113 try{
114 $record=Get-Content $path -Raw | ConvertFrom-Json
115 $result=if($record.outcome -eq $rule.status){'PASS'}else{'INCOMPLETE'}
116 if($result -eq 'PASS' -and $rule.label -eq 'native_ui'){
117 $fields=@('preLaunchPortClear','localEntry','cdp','localOrigin','integrations','queryEditor','copyQuery','copyExactlyEditedSql','syntheticAccount','syntheticBeneficiary','syntheticDraft','appReopened','durableData','auditPersisted','screenshot')
118 foreach($field in $fields){if(-not $record.$field){$result='NATIVE_MATRIX_INCOMPLETE';break}}
119 if(@($record.visitedRoutes).Count -ne 10){$result='NAVIGATION_NOT_VERIFIED'}
120 if(@($record.postRestartRoutes).Count -ne 4){$result='POST_RESTART_DATA_ROUTES_NOT_VERIFIED'}
121 if($record.persistenceEvidenceMethod -ne 'INSTALLED_ELECTRON_HTTP_AFTER_CDP_REOPEN'){$result='PERSISTENCE_METHOD_UNVERIFIED'}
122 }
123 }catch{$result='INVALID_REPORT'}
124 }
125 $checks+=@{name=$rule.label;result=$result;file=$rule.file}
126 }
127 $verified=(@($checks | Where-Object {$_.result -ne 'PASS'}).Count -eq 0)
128 $proof=[ordered]@{schema='treasuryflow-replayed-native-acceptance-v1';runId=$env:GITHUB_RUN_ID;currentSha=$env:GITHUB_SHA;runnerOS=$env:RUNNER_OS;sourceRun=$env:SOURCE_RUN_ID;sourceSha=$env:SOURCE_SHA;windowsAcceptance=if($verified){'PASS'}else{'NOT_VERIFIED'};upgrade='NOT_VERIFIED_NO_PREVIOUS_BASELINE';authenticatedLogin='NOT_TESTED_LOCAL_ENTRY_LINK_ONLY';bankAdapter='disabled';checks=$checks}
129 $proof | ConvertTo-Json -Depth 7 | Set-Content (Join-Path $folder 'native-acceptance-verification.json') -Encoding UTF8
130 "Installed native acceptance: $($proof.windowsAcceptance)" >> $env:GITHUB_STEP_SUMMARY
131 if(!$verified){throw 'INSTALLED_NATIVE_ACCEPTANCE_INCOMPLETE'}
132 - name: Upload synthetic JSON and non-sensitive screenshot evidence only
133 if: always()
134 uses: actions/upload-artifact@v4
135 with:
136 name: treasuryflow-installed-native-acceptance-evidence
137 path: |
138 ${{ runner.temp }}/treasuryflow-vm-evidence/*.json
139 ${{ runner.temp }}/treasuryflow-vm-evidence/*.png
140 retention-days: 7
141 if-no-files-found: warn
142 - name: State bounded scope
143 if: always()
144 shell: pwsh
145 run: |
146 'Actual Windows NSIS + installed Electron CDP tested only against a pinned public-branch build and synthetic data.' >> $env:GITHUB_STEP_SUMMARY
147 'No bank LIVE, customer data, production SQL, private V5 asset, public release, authenticated-login claim or upgrade claim.' >> $env:GITHUB_STEP_SUMMARY