Files
isphere-ai-bridge/scripts/test-validate-returned-send-sandbox-package.ps1
2026-07-10 20:51:50 +08:00

71 lines
2.5 KiB
PowerShell

param(
[string]$FixtureZip = "C:\Users\zhaoy\Downloads\1631.zip"
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$repo = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")).Path
$validator = Join-Path $repo "scripts\validate-returned-send-sandbox-package.ps1"
if (-not (Test-Path -LiteralPath $validator)) {
throw "missing validator script: $validator"
}
if (-not (Test-Path -LiteralPath $FixtureZip)) {
throw "missing fixture zip: $FixtureZip"
}
$output = & powershell -NoProfile -ExecutionPolicy Bypass -File $validator -PackagePath $FixtureZip
if ($LASTEXITCODE -ne 0) {
throw "validator failed with exit code $LASTEXITCODE"
}
$output | ForEach-Object { Write-Host $_ }
$lastLine = @($output | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }) | Select-Object -Last 1
$result = $lastLine | ConvertFrom-Json
if ($result.ok -ne $true) {
throw "validator ok mismatch: $($result.ok)"
}
if ($result.partial_evidence_usable -ne $true) {
throw "partial_evidence_usable mismatch: $($result.partial_evidence_usable)"
}
if ($result.r6d_gate_pass -ne $false) {
throw "r6d_gate_pass mismatch: $($result.r6d_gate_pass)"
}
if ($result.capability_test_ok -ne $true) {
throw "capability_test_ok mismatch: $($result.capability_test_ok)"
}
if ($result.capability_tool_count -ne 9) {
throw "capability_tool_count mismatch: $($result.capability_tool_count)"
}
if ($result.content_hash_matches -ne $true) {
throw "content_hash_matches mismatch: $($result.content_hash_matches)"
}
if ($result.operator_observed_success -ne $true) {
throw "operator_observed_success mismatch: $($result.operator_observed_success)"
}
if ($result.has_after_probe -ne $false) {
throw "has_after_probe mismatch: $($result.has_after_probe)"
}
if ($result.production_send_enabled -ne $false) {
throw "production_send_enabled mismatch: $($result.production_send_enabled)"
}
if ($result.strict_v2_pass -ne $false) {
throw "strict_v2_pass mismatch: $($result.strict_v2_pass)"
}
$strictOutput = & powershell -NoProfile -ExecutionPolicy Bypass -File $validator -ZipPath $FixtureZip -StrictV2
if ($LASTEXITCODE -eq 0) {
throw "StrictV2 unexpectedly passed for partial fixture: $strictOutput"
}
[ordered]@{
ok = $true
fixture = $FixtureZip
partial_evidence_usable = $result.partial_evidence_usable
r6d_gate_pass = $result.r6d_gate_pass
strict_v2_pass = $result.strict_v2_pass
capability_tool_count = $result.capability_tool_count
production_send_enabled = $result.production_send_enabled
} | ConvertTo-Json -Depth 4 -Compress