فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(a02): repair DPAPI manifest smoke-test insertion and retain one valid PowerShell cleanup block
davoodmehraban89 committed
Oct 30, 2026 at 20:31 UTC
ce373df473942d0cb73e5f754eea9ee87ae89d7c
1 file changed
+2
-36
scripts/a02-synthetic-sql-localdb-restore-smoke.ps1
+2
-36
@@ -133,42 +133,7 @@ try{
133
$privateManifest=Get-Content -LiteralPath $plainManifest -Raw | ConvertFrom-Json
134
Require ($privateManifest.format -eq 'factor-easypro-a02-schema-manifest' -and
135
$privateManifest.formatVersion -eq 1 -and
136
- $privateManifest.schemaFingerprintSha256 -cmatch '^[0-9a-f]{64} $phase='synthetic-reconciliation'
137
- $row=QuerySql $conn ('SELECT COUNT_BIG(*) AS C,SUM(amount) AS T FROM ['+$restored+'].dbo.A02Synthetic;')
138
- Require ($row.Rows.Count -eq 1 -and [long]$row.Rows[0]['C'] -eq 2 -and
139
- [long]$row.Rows[0]['T'] -eq 80235) 'A02_RESTORED_SYNTHETIC_TOTALS_MISMATCH'
140
- [pscustomobject]@{
141
- status='synthetic-localdb-restore-verified';ownerBackupUsed=$false
142
- headerVerified=$true;fileListVerified=$true;verifyOnlyPassed=$true
143
- restoreExecuted=$true;dbccPassed=$true;syntheticRecords=2
144
- syntheticTotal=80235;schemaOnlyInventoryVerified=$true
145
- privateManifestRoundTripVerified=$true
146
- financialMigrationPerformed=$false;canImport=$false
147
- }|ConvertTo-Json -Compress
148
-}catch{
149
- # Only a bounded phase and exception *type* are public; never emit raw SQL,
150
- # paths, backup bytes, identity, or exception messages.
151
- $kind=$_.Exception.GetType().Name
152
- Write-Error ('A02_SYNTHETIC_LOCALDB_RESTORE_FAILED phase='+$phase+' type='+$kind)
153
- exit 2
154
-}finally{
155
- if($null -ne $conn){
156
- try{
157
- foreach($name in @($restored,$source)){
158
- ExecSql $conn ('IF DB_ID('+(Literal $name)+') IS NOT NULL BEGIN '+
159
- 'ALTER DATABASE ['+$name+'] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; '+
160
- 'DROP DATABASE ['+$name+']; END;')
161
- }
162
- }catch{}
163
- $conn.Dispose()
164
- }
165
- if($created){
166
- try{& $localdb stop $instance -k | Out-Null}catch{}
167
- try{& $localdb delete $instance | Out-Null}catch{}
168
- }
169
- if([IO.Directory]::Exists($folder)){try{[IO.Directory]::Delete($folder,$true)}catch{}}
170
-}
171
- -and
136
+ $privateManifest.schemaFingerprintSha256 -cmatch '^[0-9a-f]{64}$' -and
137
$privateManifest.tables.Count -eq 1 -and
138
$privateManifest.tables[0].name -eq 'A02Synthetic' -and
139
$privateManifest.tables[0].columns.Count -eq 2 -and
@@ -201,6 +166,7 @@ try{
166
headerVerified=$true;fileListVerified=$true;verifyOnlyPassed=$true
167
restoreExecuted=$true;dbccPassed=$true;syntheticRecords=2
168
syntheticTotal=80235;schemaOnlyInventoryVerified=$true
169
+ privateManifestRoundTripVerified=$true
170
financialMigrationPerformed=$false;canImport=$false
171
}|ConvertTo-Json -Compress
172
}catch{