فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix/a03-deny-direct-audit-write-20261019
a02/strict-export-preflight-20261018
audit/a01-readonly-invoice-metadata-20261101
ci/a06-require-trusted-issuer-for-release
ci/main-postmerge-phase-a-validation-20261020
ci/phase-a-controlled-public-release
design/issue-5-commercial-corrections-adr
docs/a01-a02-a05-oct23-verified-evidence
docs/a01-cheque-endorsement-evidence-20261022
docs/a01-cheque-event-date-evidence-20261021
docs/a01-explicit-refund-reason-evidence-20261021
docs/a01-refund-auth-status-20261020
docs/a01-refund-trace-evidence-20261020
docs/a02-102-evidence-20261018
docs/a02-pr104-evidence-20261018
docs/a02-pr106-evidence-20261019
docs/a02-pr108-ten-tests-20261019
docs/a02-private-sql-backup-evidence-20261111
docs/a03-merge-status-sync-20261020
docs/a04-software-gate-acceptance-20261020
docs/feature-matrix-20261014
docs/finora-master-execution-playbook
docs/four-phase-execution-20261014
docs/four-phase-roadmap-20261014
docs/holoo-lab-stabilization-phase1-20261111
docs/holoo-runtime-schema-audit-20261111
docs/ops-142-governance-5-1-3-20261030
docs/phase-a-a01-a02-a06-a08-verified-evidence-20261023
docs/phase-a-a01-a05-a06-evidence-20261023
docs/phase-a-independent-acceptance-evidence
docs/phase-a-pr110-evidence-20261019
docs/project-status-phase-a-20261014
feat/a01-referenced-return-corrections
feat/a01-referenced-returns-on-main
feat/a02-atomic-opening-ledger-preflight
feat/a02-holoo-compatibility-preflight
feat/a02-holoo-declared-control-totals
feat/a02-holoo-explicit-csv-gate
feat/a02-holoo-safe-zip-intake-offline-webview2-20261030
feat/a02-offline-sql-server-provisioning-20261030
feat/a02-opening-balance-dry-run
feat/a02-opening-ledger-admin-ui
feat/a02-opt-in-isolated-sql-restore-executor-20261030
feat/a02-private-holoo-zip-staging-20261030
feat/a02-safe-isolated-restore-plan-20261030
feat/a02-sql-backup-header-verifyonly-20261030
feat/a03-audit-schema-atomic-events
feat/a03-complete-manual-journal-audit
feat/a05-cheque-treasury-reconciliation
feat/a06-signed-offline-license-activation
feat/a08-synthetic-performance-baseline
feat/phase-a-accounting-benchmark-return-preview
feat/phase-a-ledger-settlement-diagnostics
feature/v2-reconciliation-20261013
fix/a01-atomic-confirm-ui-one-shot-20261031
fix/a01-cheque-clearance-explicit-account-20261023
fix/a01-cheque-contractual-due-date-validity-20261023
fix/a01-cheque-endorsement-counterparty-20261022
fix/a01-cheque-event-date-open-period-20261021
fix/a01-cumulative-return-amount-cap
fix/a01-explicit-refund-reason-approval-20261021
fix/a01-manager-authorized-customer-refunds-20261020
fix/a01-no-implicit-refund
fix/a01-one-shot-confirm-on-atomic-import-20261031
fix/a01-refund-and-overcollection-net-cash
fix/a01-refund-correction-trace-20261020
fix/a02-atomic-excel-master-merge-20261031
fix/a02-canonical-mapping-contract-20261018
fix/a02-disable-destructive-excel-replace-20261031
fix/a02-holoo-invoice-line-coverage-20261023
fix/a02-holoo-preflight-required-invoice-lines-20261023
fix/a02-mapping-contract-20261018
fix/a02-opening-preflight-unbalanced-report
fix/a02-orphan-mapping-20261018
fix/a02-private-excel-import-session-20261031
fix/a02-strict-export-input-20261019
fix/a03-append-only-full-backup-import
fix/a03-append-only-write-guard
fix/a03-block-transaction-clear-append-only-20261016
fix/a03-chain-validation-20261020
fix/a03-company-scoped-audit-data-access
fix/a03-deny-direct-audit-write-20261019
fix/a03-escaped-expense-list-20261031
fix/a03-escaped-financial-record-ids-20261031
fix/a03-financial-ledger-actions-and-print-20261031
fix/a04-backup-checksum-preflight
fix/a04-company-audit-replay-stable-compare
fix/a04-company-backup-source-isolation-20261020
fix/a04-full-restore-posted-financial-integrity
fix/a04-reject-mixed-company-backup-20261019
fix/a04-replace-immutable-posted-ledger
fix/a04-restore-financial-journal-references
fix/a04-service-source-company-boundary-20261020
fix/a05-block-inactive-treasury-settlements
fix/a05-cheque-cash-evidence-reconciliation-20261023
fix/a05-cheque-ledger-and-bank-reconciliation-20261023
fix/a05-fiscal-close-invariant-gates
fix/a06-backup-restore-user-privileges
fix/a06-license-user-company-quota-20261023
fix/a06-malformed-trial-state-fail-closed
fix/a06-offline-clock-fail-closed-20261019
fix/a07-indexeddb-blocked-startup
fix/a07-offline-bundled-assets
fix/a07-version-and-startup-banner
fix/issue-7-company-backup-isolation
fix/p0-deterministic-fractional-invoice-money-20261031
fix/p0-fractional-quantity-input-20261031
fix/p0-fractional-quantity-integrated-20261031
fix/p0-invoice-posting-invariants-20261031
fix/p0-legacy-stock-and-product-inputs-20261031
fix/p0-reports-immutable-cogs-20261101
fix/p0-verified-financial-percent-20261031
fix/p0-zero-discount-report-revenue-20261101
fix/phase-a-backup-app-version
fix/phase-a-backup-integrity-checksum
fix/phase-a-backup-record-id-validation-20261014
fix/phase-a-backup-version-validation-20261014
fix/phase-a-closure-pack3-20261101
fix/phase-a-entitlement-payload-validation
fix/phase-a-gate-exact-evidence-20261019
fix/phase-a-pack4-stock-scope-20261101
fix/phase-a-pack5-integrated-evidence-20261101
fix/phase-a-pack6-atomic-legacy-20261101
fix/phase-a-restore-envelope-and-rollback
fix/phase-a-settings-admin-gate
fix/print-browser-header-footer-20261014
fix/q01-expense-security-probe-exact-option-20261031
fix/q01-financial-grid-labels-20261031
fix/q01-form-label-association-20261031
fix/q01-native-evidence-integrity-20261030
fix/q01-number-input-persian-decimal-20261031
fix/q01-responsive-dashboard-and-cheque-table-20261031
fix/q01-safe-ui-action-audit-coverage-20261031
fix/q01-visible-desktop-sidebar-and-safe-confirm-20261030
fix/roadmap-metadata-sync-20261014
gate/a03-audit-metadata-validation-20261019
integration/a02-windows-holoo-setup-candidate-20261030
license-server
main
perf/a07-lazy-load-excel
perf/a08-cheque-reconciliation-account-index-20261023
perf/a08-paginated-reports-20261101
phase1-restore-hardening
planning/holoo-execution-20261013
planning/roadmap-project-management-20261014
qa/native-click-coverage-audit-20261030
release/v2.0.0
test/a01-native-endorsement-mandatory-20261023
test/a01-native-purchase-return-guardrails
test/a01-native-sale-return-financial-guardrails
test/a01-safe-integer-boundary-20261019
test/a02-native-opening-dry-run-rejections
test/a02-native-positive-opening-ledger
test/a04-native-corrupt-fbackup-20261016
test/a04-native-encrypted-company-backup
test/a04-native-encrypted-company-backup-main
test/a04-native-late-transaction-rollback
test/a04-native-windows-backup-recovery
test/a04-real-edge-v6-v7-migration
test/a04-real-native-interrupted-restore
test/a05-native-draft-ledger-and-repeat-close-20261016
test/a05-native-fiscal-close-guardrails
test/a07-native-multipage-print-engine
test/a07-native-origin-provenance
test/a07-native-webview2-offline-routes
test/a07-windows-offline-startup-smoke
test/a08-installed-webview2-60k-baseline
test/a08-native-webview2-heap-metrics
test/a08-windows-synthetic-performance-baseline
test/github-write-access-20261009
test/native-win-ui-routes-after-finance-backup
test/phase-a-combined-a01-a05-a08-final-evidence
test/phase-a-combined-native-acceptance-matrix
test/phase-a-ledger-invariants-20261014
test/phase-a-native-all-routes-on-merged-lab
test/phase-a-native-encrypted-backup
test/phase-a-native-finance-backup-matrix
test/phase-a-native-ui-and-backup-smoke
test/phase-a-windows-native-installer-lab
work/a08-dispatch-activation-20261123
work/a08-memory-stability-20261123
work/finance-curated-20261123
| 1 | # PowerShell 7. Disposable Windows GitHub Actions laboratory. |
| 2 | # Exercises REAL NSIS binaries: released v2.0.3 -> locally built candidate, |
| 3 | # and fresh candidate. No installed user data or public publishing. |
| 4 | [CmdletBinding()] |
| 5 | param( |
| 6 | [Parameter(Mandatory=$true)][string]$CandidateInstaller, |
| 7 | [Parameter(Mandatory=$true)][string]$CandidateVersion, |
| 8 | [string]$OldVersion = '2.0.3' |
| 9 | ) |
| 10 | $ErrorActionPreference = 'Stop' |
| 11 | $ProgressPreference = 'SilentlyContinue' |
| 12 | if (-not $env:GITHUB_ACTIONS -or $env:RUNNER_OS -ne 'Windows') { |
| 13 | throw 'This test must run only on a disposable Windows GitHub Actions runner' |
| 14 | } |
| 15 | $lab = Join-Path $env:RUNNER_TEMP 'factor-easypro-native-vm-lab' |
| 16 | $reportDir = Join-Path $lab 'reports' |
| 17 | New-Item -ItemType Directory -Force -Path $reportDir | Out-Null |
| 18 | $summary = [ordered]@{ |
| 19 | lab='real-Windows-NSIS-WebView2' |
| 20 | oldVersion=$OldVersion |
| 21 | candidateVersion=$CandidateVersion |
| 22 | install='not-run' |
| 23 | upgrade='not-run' |
| 24 | freshInstall='not-run' |
| 25 | nativeGUI='not-run' |
| 26 | status='FAILED' |
| 27 | } |
| 28 | function Verify-Installer([string]$file) { |
| 29 | if (!(Test-Path -LiteralPath $file)) { throw "Installer does not exist: $file" } |
| 30 | $size = (Get-Item -LiteralPath $file).Length |
| 31 | if ($size -lt 500000) { throw "Installer size suspicious: $size" } |
| 32 | return (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash |
| 33 | } |
| 34 | function Install-NSIS([string]$installer,[string]$directory) { |
| 35 | # NSIS /D=path MUST be the final argument. The VM path has no spaces. |
| 36 | if ($directory.Contains(' ')) { throw 'Use a disposable NSIS test path without spaces' } |
| 37 | New-Item -ItemType Directory -Force -Path $directory | Out-Null |
| 38 | $args = @('/S',("/D=" + $directory)) |
| 39 | Write-Host ("Installing " + (Split-Path $installer -Leaf) + ' to ' + $directory) |
| 40 | $process = Start-Process -FilePath $installer -ArgumentList $args -PassThru |
| 41 | try { |
| 42 | if (-not $process.WaitForExit(150000)) { |
| 43 | $process.Kill() |
| 44 | throw 'NSIS silent installation timed out' |
| 45 | } |
| 46 | if ($process.ExitCode -ne 0) { throw "NSIS installer exited $($process.ExitCode)" } |
| 47 | } finally { $process.Dispose() } |
| 48 | # The current Rust binary target is "app.exe" even though the product |
| 49 | # and NSIS installer are called Factor-easyPro. Check both explicitly. |
| 50 | $candidate = Get-ChildItem -LiteralPath $directory -Recurse -File -ErrorAction SilentlyContinue | |
| 51 | Where-Object { $_.Name -in @('app.exe', 'Factor-easyPro.exe') } | Select-Object -First 1 |
| 52 | if (-not $candidate) { |
| 53 | $discovered = @(Get-ChildItem -LiteralPath $directory -Recurse -File -ErrorAction SilentlyContinue | |
| 54 | Select-Object -First 15 -ExpandProperty FullName) |
| 55 | Write-Host ("NSIS installation contents: " + ($discovered -join '; ')) |
| 56 | $uninstallRoots = @( |
| 57 | 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall', |
| 58 | 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall', |
| 59 | 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' |
| 60 | ) |
| 61 | foreach ($registry in $uninstallRoots) { |
| 62 | if (!(Test-Path $registry)) { continue } |
| 63 | $entries = @(Get-ChildItem $registry -ErrorAction SilentlyContinue | |
| 64 | Get-ItemProperty -ErrorAction SilentlyContinue | |
| 65 | Where-Object { $_.DisplayName -like 'Factor-easyPro*' }) |
| 66 | foreach ($entry in $entries) { |
| 67 | $place = $entry.InstallLocation |
| 68 | if (!$place -or !(Test-Path $place)) { continue } |
| 69 | $candidate = Get-ChildItem -LiteralPath $place -Recurse -File -ErrorAction SilentlyContinue | |
| 70 | Where-Object { $_.Name -in @('app.exe', 'Factor-easyPro.exe') } | |
| 71 | Select-Object -First 1 |
| 72 | if ($candidate) { break } |
| 73 | } |
| 74 | if ($candidate) { break } |
| 75 | } |
| 76 | } |
| 77 | if (-not $candidate) { throw "Installed native app executable not found in $directory or uninstall registry" } |
| 78 | if ($candidate.Length -lt 300000) { throw 'Installed executable suspiciously small' } |
| 79 | return $candidate.FullName |
| 80 | } |
| 81 | function Run-Native([string]$exe,[string]$profile,[string]$mode,[string]$version) { |
| 82 | $report = Join-Path $reportDir ($mode + '-native-result.json') |
| 83 | & node 'tests/windows-vm-installed-tauri-cdp.cjs' $exe $profile $mode $version $report | Out-Host |
| 84 | if ($LASTEXITCODE -ne 0) { throw "Installed native application $mode test failed (exit $LASTEXITCODE)" } |
| 85 | $result = Get-Content $report -Raw | ConvertFrom-Json |
| 86 | if ($result.status -ne 'PASSED' -or $result.installedNativeTauri -ne $true) { |
| 87 | throw "Native $mode test did not verify real Tauri WebView2" |
| 88 | } |
| 89 | return $result |
| 90 | } |
| 91 | function Cleanup-Installed([string]$folder) { |
| 92 | $uninstaller = Get-ChildItem -LiteralPath $folder -Recurse -File -ErrorAction SilentlyContinue | |
| 93 | Where-Object { $_.Name -match 'uninstall.*\.exe$' } | Select-Object -First 1 |
| 94 | if (-not $uninstaller) { |
| 95 | Write-Warning "NSIS uninstaller not found in disposable folder $folder" |
| 96 | return |
| 97 | } |
| 98 | $proc = Start-Process -FilePath $uninstaller.FullName -ArgumentList '/S' -PassThru |
| 99 | try { |
| 100 | if (!$proc.WaitForExit(90000)) { $proc.Kill(); throw 'Uninstaller timed out' } |
| 101 | if ($proc.ExitCode -ne 0) { throw "Uninstaller failed with $($proc.ExitCode)" } |
| 102 | } finally { $proc.Dispose() } |
| 103 | } |
| 104 | try { |
| 105 | $newSha = Verify-Installer $CandidateInstaller |
| 106 | $previous = Join-Path $lab ('Factor-easyPro_' + $OldVersion + '_x64-setup.exe') |
| 107 | $checksum = Join-Path $lab 'v2.0.3-SHA256SUMS.txt' |
| 108 | $releaseBase = 'https://github.com/davoodmehraban89/Factor-easyPro/releases/download/v' + $OldVersion + '/' |
| 109 | Invoke-WebRequest -Uri ($releaseBase + (Split-Path $previous -Leaf)) -OutFile $previous |
| 110 | Invoke-WebRequest -Uri ($releaseBase + 'SHA256SUMS.txt') -OutFile $checksum |
| 111 | $checksumText = Get-Content $checksum -Raw |
| 112 | $found = [regex]::Match($checksumText,'(?i)([0-9a-f]{64})\s+\*?Factor-easyPro_' + |
| 113 | [regex]::Escape($OldVersion) + '_x64-setup.exe') |
| 114 | if (-not $found.Success) { throw 'Previous public installer checksum not found' } |
| 115 | $oldSha = Verify-Installer $previous |
| 116 | if ($found.Groups[1].Value.ToUpperInvariant() -ne $oldSha.ToUpperInvariant()) { |
| 117 | throw 'Previous public installer SHA256 verification FAILED' |
| 118 | } |
| 119 | if ($oldSha -eq $newSha) { throw 'Previous and candidate installers are byte-identical' } |
| 120 | Write-Output "Verified signed-by-checksum public release artifact v$OldVersion" |
| 121 | |
| 122 | $upgradeDir = Join-Path $lab 'installed-upgrade' |
| 123 | $upgradeData = Join-Path $lab 'webview2-upgrade-profile' |
| 124 | $oldExe = Install-NSIS $previous $upgradeDir |
| 125 | $summary.install = 'public-v' + $OldVersion + '-nsis-installed' |
| 126 | $seed = Run-Native $oldExe $upgradeData 'seed' $OldVersion |
| 127 | $summary.nativeGUI = 'old-native-CDP-connected' |
| 128 | |
| 129 | $newExe = Install-NSIS $CandidateInstaller $upgradeDir |
| 130 | $summary.upgrade = 'nsis-in-place-upgrade-installed' |
| 131 | $verified = Run-Native $newExe $upgradeData 'upgrade' $CandidateVersion |
| 132 | $summary.upgrade = $verified.persistence |
| 133 | $summary.nativeGUI = 'real-native-WebView2-validated' |
| 134 | $summary.backupRecovery = $verified.backupRecovery |
| 135 | $summary.atomicTamperRollback = $verified.immutableRestoreRollback |
| 136 | # Reopen the real installed executable with the SAME Windows WebView2 |
| 137 | # profile after the restore and rollback tests. This proves disk durability. |
| 138 | $reopened = Run-Native $newExe $upgradeData 'reopen' $CandidateVersion |
| 139 | $summary.restartPersistence = $reopened.persistence |
| 140 | |
| 141 | $freshDir = Join-Path $lab 'installed-fresh' |
| 142 | $freshData = Join-Path $lab 'webview2-fresh-profile' |
| 143 | $freshExe = Install-NSIS $CandidateInstaller $freshDir |
| 144 | $freshResult = Run-Native $freshExe $freshData 'fresh' $CandidateVersion |
| 145 | $summary.freshInstall = $freshResult.indexedDb |
| 146 | |
| 147 | # A08: after all functional checks, measure the real installed candidate |
| 148 | # using a separate disposable WebView2/IndexedDB profile. Never mix with |
| 149 | # data-preservation or first-run validation profiles. |
| 150 | $performanceData = Join-Path $lab 'webview2-native-performance-profile' |
| 151 | $nativePerformance = Run-Native $freshExe $performanceData 'benchmark' $CandidateVersion |
| 152 | $summary.nativePerformance = $nativePerformance.nativePerformance |
| 153 | |
| 154 | # A04 destructive fault injection is strictly confined to a disposable |
| 155 | # Windows VM profile. Abruptly kill the native app during genuine importAll, |
| 156 | # reopen SAME persistent profile and check not one staged row committed. |
| 157 | $crashData = Join-Path $lab 'webview2-crash-restore-profile' |
| 158 | $armed = Run-Native $freshExe $crashData 'crash-arm' $CandidateVersion |
| 159 | if (!$armed.crashInjected.realWindowsProcessKilled) { |
| 160 | throw 'Native restore process was not genuinely force-terminated' |
| 161 | } |
| 162 | $crashVerified = Run-Native $freshExe $crashData 'crash-verify' $CandidateVersion |
| 163 | $summary.crashRestoreRollback = $crashVerified.crashRollback |
| 164 | |
| 165 | # Full Phase A integration contract: a green partial job is not enough. |
| 166 | # Validate all essential paths on the SAME installed candidate before |
| 167 | # declaring the disposable VM laboratory successful. |
| 168 | $mandatory = @( |
| 169 | 'activate-accounting-and-inventory', |
| 170 | 'positive-opening-ledger-and-idempotency', |
| 171 | 'purchase-and-post-ledger', |
| 172 | 'partial-sale-and-inventory', |
| 173 | 'inactive-treasury-cheque-settlement', |
| 174 | 'treasury-cheque-reconciliation-readonly', |
| 175 | 'sale-return-immutable-stock-and-ledger', |
| 176 | 'purchase-return-and-stock-guardrails', |
| 177 | 'return-cash-settlement-net-credit', |
| 178 | 'append-only-history-bulk-clear-protection', |
| 179 | 'backup-and-atomic-rejection', |
| 180 | 'rtl-invoice-print-settings', |
| 181 | 'fiscal-close-atomic-guardrails', |
| 182 | 'opening-dry-run-rejects-existing-postings' |
| 183 | ) |
| 184 | if (!$freshResult.nativeFunctional) { |
| 185 | throw 'Native installed financial matrix was not reported' |
| 186 | } |
| 187 | foreach ($scenario in $mandatory) { |
| 188 | if (!$freshResult.nativeFunctional.PSObject.Properties[$scenario]) { |
| 189 | throw "Required installed native scenario missing: $scenario" |
| 190 | } |
| 191 | } |
| 192 | if (!$freshResult.nativeOffline.simulatedOffline -or |
| 193 | $freshResult.nativeOffline.routesChecked -ne 10) { |
| 194 | throw 'All ten native offline routes were not verified' |
| 195 | } |
| 196 | if ($freshResult.nativePrint.pages -lt 2 -or |
| 197 | $freshResult.nativePrint.itemRows -ne 110 -or |
| 198 | $freshResult.nativePrint.physicalPrinter -ne 'not-tested') { |
| 199 | throw 'WebView2 multi-page RTL PDF evidence is missing or misrepresented' |
| 200 | } |
| 201 | if ($nativePerformance.nativePerformance.products -ne 10000 -or |
| 202 | $nativePerformance.nativePerformance.invoices -ne 50000 -or |
| 203 | $nativePerformance.nativePerformance.companyInvoices -ne 50000) { |
| 204 | throw 'Native 10k/50k actual IndexedDB performance coverage is incomplete' |
| 205 | } |
| 206 | if ($crashVerified.crashRollback -ne |
| 207 | 'killed-real-installed-Windows-WebView2-during-importAll-no-partial-rows-on-restart') { |
| 208 | throw 'A04 actual process-crash restore rollback evidence is missing' |
| 209 | } |
| 210 | # New A08 criterion: this is *renderer JavaScript heap*, never total Windows |
| 211 | # RAM/RSS. Require the real installed candidate's CDP memory measurements. |
| 212 | $heap = $nativePerformance.nativePerformance.jsHeapBytes |
| 213 | if (!$heap -or $nativePerformance.nativePerformance.jsHeapScope -ne |
| 214 | 'renderer-js-heap-not-total-Windows-process-memory' -or |
| 215 | [long]$heap.beforeUsed -le 0 -or |
| 216 | [long]$heap.afterUsed -le 0 -or |
| 217 | [long]$heap.afterAllocated -lt [long]$heap.afterUsed) { |
| 218 | throw 'Installed native WebView2 60k workload has no valid JS heap evidence' |
| 219 | } |
| 220 | $summary.integratedCoverage = [ordered]@{ |
| 221 | installedFinancialScenarios = $mandatory.Count |
| 222 | offlineRoutes = 10 |
| 223 | printPdfPages = [int]$freshResult.nativePrint.pages |
| 224 | benchmarkProducts = 10000 |
| 225 | benchmarkInvoices = 50000 |
| 226 | nativeJsHeapAfterUsedBytes = [long]$heap.afterUsed |
| 227 | nativeJsHeapScope = 'renderer-only' |
| 228 | crashRestoreRowsRemaining = 0 |
| 229 | independentHumanQA = 'not-covered' |
| 230 | customerBackup = 'not-covered' |
| 231 | physicalPrinter = 'not-covered' |
| 232 | } |
| 233 | $summary.status = 'PASSED' |
| 234 | Write-Output 'Verified fresh installation, NSIS in-place upgrade, retained v6 records, native login and Windows DPAPI' |
| 235 | Cleanup-Installed $freshDir |
| 236 | Cleanup-Installed $upgradeDir |
| 237 | } catch { |
| 238 | $summary.failure = $_.Exception.Message |
| 239 | Write-Error $_.Exception.Message |
| 240 | throw |
| 241 | } finally { |
| 242 | New-Item -ItemType Directory -Force -Path $reportDir | Out-Null |
| 243 | $summary | ConvertTo-Json -Depth 5 | Set-Content -Path (Join-Path $reportDir 'lab-summary.json') -Encoding utf8 |
| 244 | $summary | ConvertTo-Json -Depth 5 | Write-Output |
| 245 | } |