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

ci: add pinned real NSIS installed Windows VM acceptance without rebuilding binaries

davoodmehraban89 committed Oct 17, 2026 at 00:39 UTC ec83e185c59a6e4a3ec4e6e0649f416ca5f8bed6
1 file changed +142
.github/workflows/windows-vm-installed-acceptance.yml new
+142
@@ -0,0 +1,142 @@
1 +name: TreasuryFlow Windows Installed Native Artifact Acceptance
2 +
3 +on:
4 + # Temporary single-branch trigger for the first pinned artifact validation.
5 + push:
6 + branches:
7 + - ci/windows-dual-app-lab-20261016
8 + paths:
9 + - .github/workflows/windows-vm-installed-acceptance.yml
10 + workflow_dispatch:
11 +
12 +permissions:
13 + contents: read
14 + actions: read
15 +
16 +concurrency:
17 + group: treasury-native-installed-artifact
18 + cancel-in-progress: false
19 +
20 +jobs:
21 + installed-native-artifact:
22 + runs-on: windows-latest
23 + timeout-minutes: 35
24 + env:
25 + SOURCE_RUN_ID: '38965182060'
26 + SOURCE_SHA: '0b8e85fb3765fce84e407e0e9c59f70ad901fd8a'
27 + SOURCE_ARTIFACT_ID: '12075720690'
28 + SOURCE_DIGEST: 'sha256:70fc35413677ee7a6eaa8698ddd3dfe7f828ce2a5af90a4a24a1364467d2401b'
29 + BANK_ADAPTER_MODE: disabled
30 + TREASURYFLOW_DESKTOP_LOCAL: '1'
31 + LAB_VERSION: REPO_BRANCH_NOT_V5
32 + NEXT_TELEMETRY_DISABLED: '1'
33 + steps:
34 + - name: Checkout exact native acceptance harness
35 + uses: actions/checkout@v4
36 + with:
37 + persist-credentials: false
38 + - name: Install Node 22 for native CDP harness
39 + uses: actions/setup-node@v4
40 + with:
41 + node-version: '22'
42 + - name: Download and pin genuine installer from previous Windows VM run
43 + shell: pwsh
44 + env:
45 + GH_TOKEN: ${{ github.token }}
46 + run: |
47 + $ErrorActionPreference='Stop'
48 + $source=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN_ID" | ConvertFrom-Json
49 + if($LASTEXITCODE -ne 0){throw 'SOURCE_RUN_UNAVAILABLE'}
50 + if($source.head_sha -ne $env:SOURCE_SHA){throw 'SOURCE_COMMIT_MISMATCH'}
51 + if($source.repository.id -ne $source.head_repository.id){throw 'SOURCE_REPOSITORY_IDENTITY_MISMATCH'}
52 + $artifact=gh api "repos/$env:GITHUB_REPOSITORY/actions/artifacts/$env:SOURCE_ARTIFACT_ID" | ConvertFrom-Json
53 + if($LASTEXITCODE -ne 0){throw 'SOURCE_ARTIFACT_UNAVAILABLE'}
54 + if($artifact.name -ne 'treasuryflow-windows-build-and-evidence' -or $artifact.expired){throw 'UNEXPECTED_OR_EXPIRED_ARTIFACT'}
55 + 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'}
56 + if($artifact.digest -ne $env:SOURCE_DIGEST){throw 'ARTIFACT_ZIP_DIGEST_MISMATCH'}
57 + $folder=Join-Path $env:RUNNER_TEMP 'treasuryflow-pinned-source-artifact'
58 + New-Item -ItemType Directory -Path $folder -Force | Out-Null
59 + gh run download $env:SOURCE_RUN_ID --repo $env:GITHUB_REPOSITORY --name treasuryflow-windows-build-and-evidence --dir $folder
60 + if($LASTEXITCODE -ne 0){throw 'ARTIFACT_DOWNLOAD_FAILED'}
61 + $setup=@(Get-ChildItem -LiteralPath $folder -Recurse -File -Filter 'TreasuryFlow-Setup-*-Windows-x64.exe')
62 + if($setup.Count -ne 1 -or $setup[0].Length -lt 1000000){throw 'REAL_NSIS_SETUP_MISSING'}
63 + $original=@(Get-ChildItem -LiteralPath $folder -Recurse -File -Filter 'installed-runtime.json')
64 + if($original.Count -ne 1){throw 'ORIGINAL_INSTALL_TEST_REPORT_MISSING'}
65 + $prior=Get-Content $original[0].FullName -Raw | ConvertFrom-Json
66 + $actualHash=(Get-FileHash $setup[0].FullName -Algorithm SHA256).Hash
67 + if(!$prior.installerSha256 -or $actualHash -ne $prior.installerSha256){throw 'SETUP_SHA256_MISMATCH'}
68 + $release=Join-Path $env:GITHUB_WORKSPACE 'release'
69 + New-Item -ItemType Directory -Path $release -Force | Out-Null
70 + Copy-Item -LiteralPath $setup[0].FullName -Destination $release -Force
71 + $reportDir=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
72 + New-Item -ItemType Directory -Path $reportDir -Force | Out-Null
73 + [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
74 + "Pinned verified setup from run $env:SOURCE_RUN_ID SHA $env:SOURCE_SHA" >> $env:GITHUB_STEP_SUMMARY
75 + - name: Install actual NSIS Setup and verify installed HTTP readiness
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 + shell: pwsh
90 + run: |
91 + & "$env:GITHUB_WORKSPACE/scripts/windows-vm-treasury-uninstall-smoke.ps1" -InstalledFolder (Join-Path $env:RUNNER_TEMP 'TreasuryFlow-VM-Installed')
92 + - name: Independently aggregate required acceptance evidence
93 + if: always()
94 + shell: pwsh
95 + run: |
96 + $ErrorActionPreference='Stop'
97 + $folder=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
98 + New-Item -ItemType Directory -Path $folder -Force | Out-Null
99 + $matrix=@(
100 + @{file='source-provenance.json';status='PINNED_SOURCE_PASS';label='source'},
101 + @{file='installed-runtime.json';status='NSIS_INSTALL_AND_INSTALLED_RUNTIME_PASS';label='install'},
102 + @{file='treasuryflow-native-gui.json';status='REAL_INSTALLED_ELECTRON_GUI_PASS';label='native_ui'},
103 + @{file='uninstall-runtime.json';status='NSIS_REAL_UNINSTALL_PASS';label='uninstall'}
104 + )
105 + $checks=@()
106 + foreach($rule in $matrix){
107 + $result='MISSING'
108 + $path=Join-Path $folder $rule.file
109 + if(Test-Path $path){
110 + try{
111 + $record=Get-Content $path -Raw | ConvertFrom-Json
112 + $result=if($record.outcome -eq $rule.status){'PASS'}else{'INCOMPLETE'}
113 + if($result -eq 'PASS' -and $rule.label -eq 'native_ui'){
114 + $fields=@('localEntry','cdp','localOrigin','integrations','queryEditor','copyQuery','copyExactlyEditedSql','syntheticAccount','syntheticBeneficiary','syntheticDraft','appReopened','durableData','auditPersisted','screenshot')
115 + foreach($field in $fields){if(-not $record.$field){$result='NATIVE_MATRIX_INCOMPLETE';break}}
116 + if(@($record.visitedRoutes).Count -ne 10){$result='NAVIGATION_NOT_VERIFIED'}
117 + }
118 + }catch{$result='INVALID_REPORT'}
119 + }
120 + $checks+=@{name=$rule.label;result=$result;file=$rule.file}
121 + }
122 + $verified=(@($checks | Where-Object {$_.result -ne 'PASS'}).Count -eq 0)
123 + $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}
124 + $proof | ConvertTo-Json -Depth 7 | Set-Content (Join-Path $folder 'native-acceptance-verification.json') -Encoding UTF8
125 + "Installed native acceptance: $($proof.windowsAcceptance)" >> $env:GITHUB_STEP_SUMMARY
126 + if(!$verified){throw 'INSTALLED_NATIVE_ACCEPTANCE_INCOMPLETE'}
127 + - name: Upload synthetic JSON and non-sensitive screenshot evidence only
128 + if: always()
129 + uses: actions/upload-artifact@v4
130 + with:
131 + name: treasuryflow-installed-native-acceptance-evidence
132 + path: |
133 + ${{ runner.temp }}/treasuryflow-vm-evidence/*.json
134 + ${{ runner.temp }}/treasuryflow-vm-evidence/*.png
135 + retention-days: 7
136 + if-no-files-found: warn
137 + - name: State bounded scope
138 + if: always()
139 + shell: pwsh
140 + run: |
141 + 'Actual Windows NSIS + installed Electron CDP tested only against a pinned public-branch build and synthetic data.' >> $env:GITHUB_STEP_SUMMARY
142 + 'No bank LIVE, customer data, production SQL, private V5 asset, public release, authenticated-login claim or upgrade claim.' >> $env:GITHUB_STEP_SUMMARY