فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(a02): repair PowerShell syntax in synthetic schema-after-restore gate and enforce fingerprint format

davoodmehraban89 committed Oct 30, 2026 at 20:04 UTC f724656b1b6896b89a443369f292c0f81cfa0db2
1 file changed +8 -4
scripts/a02-synthetic-sql-localdb-restore-smoke.ps1
+8 -4
@@ -97,15 +97,19 @@ try{
97 $phase='dbcc-checkdb'
98 ExecSql $conn ('DBCC CHECKDB(['+$restored+']) WITH NO_INFOMSGS;')
99 $phase='isolated-schema-inventory'
100 - # Execute the schema-only command against the real restored synthetic DB.
101 - # No table names/column names or private data are logged.
100 + # Test exact read-only fingerprint tool after a genuine synthetic restore.
101 $inventoryScript=Join-Path $PSScriptRoot 'a02-isolated-schema-inventory.ps1'
102 $inventoryLines=@(& powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File $inventoryScript -Mode Inspect -InstanceName $instance -DatabaseName $restored)
103 Require ($LASTEXITCODE -eq 0) 'A02_SCHEMA_INVENTORY_INTEGRATION_FAILED'
104 $inventory=($inventoryLines | Out-String | ConvertFrom-Json)
106 - Require ($inventory.status -eq 'isolated-schema-inventoried' -and
105 + $validFingerprint=([string]$inventory.fingerprintSha256 -cmatch '^[0-9a-f]{64}$')
106 + $accepted=($inventory.status -eq 'isolated-schema-inventoried' -and
107 $inventory.tableCount -eq 1 -and $inventory.columnCount -eq 2 -and
108 - $inventory.fingerprintSha256 -cmatch '^[0-9a-f]{64} $row=QuerySql $conn ('SELECT COUNT_BIG(*) AS C,SUM(amount) AS T FROM ['+$restored+'].dbo.A02Synthetic;')
108 + $validFingerprint -and $inventory.userRowsRead -eq $false -and
109 + $inventory.databaseModified -eq $false -and $inventory.canImport -eq $false)
110 + Require $accepted 'A02_SCHEMA_INVENTORY_CONTRACT_FAILED'
111 + $phase='synthetic-reconciliation'
112 + $row=QuerySql $conn ('SELECT COUNT_BIG(*) AS C,SUM(amount) AS T FROM ['+$restored+'].dbo.A02Synthetic;')
113 Require ($row.Rows.Count -eq 1 -and [long]$row.Rows[0]['C'] -eq 2 -and
114 [long]$row.Rows[0]['T'] -eq 80235) 'A02_RESTORED_SYNTHETIC_TOTALS_MISMATCH'
115 [pscustomobject]@{