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

Run one-shot sanitized V6 private unit-test diagnosis on public Windows runner (no private artifacts)

davoodmehraban89 committed Oct 17, 2026 at 22:44 UTC ef3336332dea7f36449b136ef2a1714a3786494c
1 file changed +106
.github/workflows/windows-v6-unit-diagnostic-once.yml new
+106
@@ -0,0 +1,106 @@
1 +name: V6 one-shot private unit-test diagnostic (NOT V7)
2 +on:
3 + push:
4 + branches: ['ci/public-windows-bridge-probe-20261017']
5 + paths: ['.github/workflows/windows-v6-unit-diagnostic-once.yml']
6 +
7 +permissions:
8 + contents: read
9 +
10 +concurrency:
11 + group: treasuryflow-v6-private-test-diagnostic-once
12 + cancel-in-progress: false
13 +
14 +jobs:
15 + diagnose:
16 + name: Windows 2022 - sanitized V6 unit diagnostics only
17 + runs-on: windows-2022
18 + timeout-minutes: 35
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 + defaults:
26 + run:
27 + shell: pwsh
28 + steps:
29 + - name: Download and SHA256 verify private staging ZIP without printing its contents
30 + env:
31 + GH_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
32 + run: |
33 + $ErrorActionPreference='Stop'
34 + if ([string]::IsNullOrWhiteSpace($env:GH_TOKEN)) { throw 'PRIVATE_TOKEN_MISSING' }
35 + $download=Join-Path $env:RUNNER_TEMP 'tf-source-private.zip'
36 + $stage=Join-Path $env:RUNNER_TEMP 'tf-stage-private'
37 + New-Item -ItemType Directory -Force -Path $stage | Out-Null
38 + 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
39 + if ($LASTEXITCODE -ne 0) { throw 'PRIVATE_DOWNLOAD_FAILED' }
40 + $source=Join-Path $env:RUNNER_TEMP 'TreasuryFlow_Validation_Staging_20261017.zip'
41 + if (!(Test-Path -LiteralPath $source)) { throw 'PRIVATE_ZIP_MISSING' }
42 + if ((Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash -ine '9ce46ce2d2a437e08cbf28146b2cf2ac0ed078c71f1aeb537764390cdd3c552f') { throw 'PRIVATE_ZIP_HASH_MISMATCH' }
43 + Expand-Archive -LiteralPath $source -DestinationPath $stage -Force
44 + if (!(Test-Path -LiteralPath (Join-Path $stage 'package.json'))) { throw 'PRIVATE_STAGE_PACKAGE_MISSING' }
45 + "TF_STAGE_DIR=$stage" >> $env:GITHUB_ENV
46 + Write-Host 'PRIVATE_INPUT_HASH_PASS'
47 +
48 + - name: Prepare isolated Node 22 after private token is removed
49 + uses: actions/setup-node@v4
50 + with:
51 + node-version: '22'
52 +
53 + - name: Install dependencies without exposing proprietary command output
54 + run: |
55 + $ErrorActionPreference='Stop'
56 + Set-Location -LiteralPath $env:TF_STAGE_DIR
57 + $log=Join-Path $env:RUNNER_TEMP 'private-install-output.txt'
58 + npm ci --no-audit --no-fund *> $log
59 + if ($LASTEXITCODE -ne 0) { throw 'GATE_FAIL_NPM_CI_PRIVATE_LOG_REDACTED' }
60 + Write-Host 'GATE_PASS_NPM_CI'
61 +
62 + - name: Run tests and publish only scrubbed failure names and counts
63 + run: |
64 + $ErrorActionPreference='Continue'
65 + $PSNativeCommandUseErrorActionPreference=$false
66 + Set-Location -LiteralPath $env:TF_STAGE_DIR
67 + $report=Join-Path $env:RUNNER_TEMP 'private-vitest-results.json'
68 + $log=Join-Path $env:RUNNER_TEMP 'private-test-console.txt'
69 + npm test -- --reporter=json "--outputFile=$report" *> $log
70 + $exitCode=$LASTEXITCODE
71 + if (!(Test-Path -LiteralPath $report)) {
72 + Write-Host 'TEST_REPORT_ABSENT - test process failed before producing a JSON result'
73 + if ($exitCode -eq 0) { throw 'TEST_REPORT_MISSING' }
74 + throw 'UNIT_TEST_FAILURE_DETAILS_WITHHELD'
75 + }
76 + try { $r=Get-Content -LiteralPath $report -Raw | ConvertFrom-Json -Depth 80 } catch { throw 'TEST_REPORT_PARSE_ERROR_PRIVATE_OUTPUT_WITHHELD' }
77 + $total=[int]$r.numTotalTests
78 + $passed=[int]$r.numPassedTests
79 + $failed=[int]$r.numFailedTests
80 + Write-Host "UNIT_TEST_COUNTS total=$total passed=$passed failed=$failed"
81 + $index=0
82 + foreach ($suite in @($r.testResults)) {
83 + foreach ($case in @($suite.assertionResults)) {
84 + if ($case.status -ne 'failed') { continue }
85 + $index++
86 + $name=[string]$case.title
87 + $name=$name.Trim()
88 + if ($name.Length -gt 90 -or $name -notmatch '^[A-Za-z0-9 _().,:;!?-]+$' -or $name -match '(?i)(secret|credential|password|token|api.?key|[0-9]{7,})') { $name='[REDACTED_TITLE]' }
89 + $category='OTHER_ERROR'
90 + $details=(@($case.failureMessages) -join ' ')
91 + if ($details -match '(AssertionError|TypeError|ReferenceError|SyntaxError|TimeoutError|RangeError|AggregateError|DatabaseError)') { $category=$Matches[1] }
92 + Write-Host "FAIL_$index title=$name category=$category"
93 + if ($index -ge 20) { break }
94 + }
95 + if ($index -ge 20) { break }
96 + }
97 + if ($failed -eq 0 -and $exitCode -ne 0) { Write-Host 'NON_TEST_PROCESS_FAILURE_OR_SUITE_SETUP_FAILURE' }
98 + if ($exitCode -ne 0 -or $failed -gt 0) { throw 'V6_UNIT_TESTS_FAILED_NO_PRIVATE_LOG_PUBLISHED' }
99 + Write-Host 'V6_UNIT_TESTS_PASS'
100 +
101 + - name: Confirm this diagnostic did not test or publish V7
102 + if: always()
103 + run: |
104 + Write-Host 'SCOPE=V6_UNIT_DIAGNOSTIC_ONLY'
105 + Write-Host 'SQL_SERVER=NOT_TESTED; NATIVE_BRIDGE=NOT_TESTED; V6_GUI=NOT_TESTED; V7=NOT_TESTED'
106 + Write-Host 'PRIVATE_SOURCE_AND_TEST_LOGS=NOT_UPLOADED'