Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
ci/windows-dual-app-lab-20261016
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | name: TreasuryFlow Windows Direct Electron Diagnostic |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | |
| 6 | permissions: |
| 7 | contents: read |
| 8 | |
| 9 | jobs: |
| 10 | electron-startup: |
| 11 | runs-on: windows-latest |
| 12 | timeout-minutes: 25 |
| 13 | env: |
| 14 | BANK_ADAPTER_MODE: disabled |
| 15 | TREASURYFLOW_DESKTOP_LOCAL: '1' |
| 16 | NEXT_TELEMETRY_DISABLED: '1' |
| 17 | steps: |
| 18 | - uses: actions/checkout@v4 |
| 19 | with: |
| 20 | persist-credentials: false |
| 21 | - uses: actions/setup-node@v4 |
| 22 | with: |
| 23 | node-version: '22' |
| 24 | cache: npm |
| 25 | - name: Build local-only Next application without packaging |
| 26 | shell: pwsh |
| 27 | run: | |
| 28 | $ErrorActionPreference='Stop' |
| 29 | npm ci --no-audit --no-fund |
| 30 | if($LASTEXITCODE -ne 0){throw 'NPM_CI_FAILED'} |
| 31 | npm run build |
| 32 | if($LASTEXITCODE -ne 0){throw 'NEXT_BUILD_FAILED'} |
| 33 | node scripts/prepare-standalone.mjs |
| 34 | if($LASTEXITCODE -ne 0){throw 'STANDALONE_PREPARATION_FAILED'} |
| 35 | - name: Start direct Electron executable and capture sanitized failure evidence |
| 36 | shell: pwsh |
| 37 | run: | |
| 38 | $ErrorActionPreference='Stop' |
| 39 | $exe=Join-Path $env:GITHUB_WORKSPACE 'node_modules/electron/dist/electron.exe' |
| 40 | $stdout=Join-Path $env:RUNNER_TEMP 'tf-electron-direct.stdout' |
| 41 | $stderr=Join-Path $env:RUNNER_TEMP 'tf-electron-direct.stderr' |
| 42 | $env:TREASURYFLOW_DATA_FILE=Join-Path $env:RUNNER_TEMP 'tf-direct-test.sqlite' |
| 43 | $report=[ordered]@{schema='treasuryflow-electron-direct-v1';os=$env:RUNNER_OS;run=$env:GITHUB_RUN_ID;head=$env:GITHUB_SHA;exeFound=$false;processLaunched=$false;exitCode=$null;readiness=$false;bankDisabled=$false;stdoutSize=0;stderrSize=0;stderrIndicators=@();outcome='NOT_RUN'} |
| 44 | $p=$null |
| 45 | try { |
| 46 | if(!(Test-Path $exe)){throw 'ELECTRON_BINARY_MISSING'} |
| 47 | $report.exeFound=$true |
| 48 | $p=Start-Process -FilePath $exe -ArgumentList @('.') -WorkingDirectory $env:GITHUB_WORKSPACE -PassThru -RedirectStandardOutput $stdout -RedirectStandardError $stderr |
| 49 | $report.processLaunched=$true |
| 50 | $deadline=[DateTime]::UtcNow.AddSeconds(45) |
| 51 | while([DateTime]::UtcNow -lt $deadline) { |
| 52 | Start-Sleep -Milliseconds 700 |
| 53 | $p.Refresh() |
| 54 | if($p.HasExited){$report.exitCode=$p.ExitCode;throw ('DIRECT_ELECTRON_EXIT_'+$p.ExitCode)} |
| 55 | try { |
| 56 | $resp=Invoke-RestMethod 'http://127.0.0.1:3210/api/ready' -TimeoutSec 2 |
| 57 | if($resp.status -eq 'ready' -and $resp.bankAdapter -eq 'disabled'){$report.readiness=$true;$report.bankDisabled=$true;break} |
| 58 | }catch{} |
| 59 | } |
| 60 | if(!$report.readiness){throw 'DIRECT_ELECTRON_READINESS_TIMEOUT'} |
| 61 | $report.outcome='DIRECT_ELECTRON_PROCESS_AND_HTTP_PASS' |
| 62 | }catch{ |
| 63 | $report.outcome='FAILED' |
| 64 | $report.failureCode=$_.Exception.Message |
| 65 | }finally{ |
| 66 | if($p -and !$p.HasExited){try{& taskkill.exe /T /F /PID $p.Id | Out-Null}catch{}} |
| 67 | if(Test-Path $stdout){$report.stdoutSize=(Get-Item $stdout).Length} |
| 68 | if(Test-Path $stderr){ |
| 69 | $report.stderrSize=(Get-Item $stderr).Length |
| 70 | $raw=Get-Content $stderr -Raw -ErrorAction SilentlyContinue |
| 71 | $report.stderrIndicators=@('MODULE_NOT_FOUND','ERR_MODULE_NOT_FOUND','ENOENT','EPERM','EACCES','EADDRINUSE','cannot','failed','error') | Where-Object {$raw -match [regex]::Escape($_)} |
| 72 | $safe=@(Get-Content $stderr -Tail 12 -ErrorAction SilentlyContinue | Where-Object {$_ -match '(?i)(error|module|failed|cannot|ENOENT|electron)'}) |
| 73 | foreach($line in $safe){ |
| 74 | $scrubbed=$line -replace '(?i)(secret|token|password)\s*[:=]\s*\S+','$1=[REDACTED]' |
| 75 | if($scrubbed.Length -gt 250){$scrubbed=$scrubbed.Substring(0,250)} |
| 76 | Write-Host ('Electron diagnostic: '+$scrubbed) |
| 77 | } |
| 78 | } |
| 79 | $report | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $env:GITHUB_WORKSPACE 'treasuryflow-electron-diagnostic.json') -Encoding UTF8 |
| 80 | } |
| 81 | if($report.outcome -ne 'DIRECT_ELECTRON_PROCESS_AND_HTTP_PASS'){throw $report.failureCode} |
| 82 | - name: Upload sanitized startup evidence only |
| 83 | if: always() |
| 84 | uses: actions/upload-artifact@v4 |
| 85 | with: |
| 86 | name: treasuryflow-electron-direct-diagnostic |
| 87 | path: treasuryflow-electron-diagnostic.json |
| 88 | retention-days: 3 |
| 89 | if-no-files-found: warn |