param( [string]$ApiBaseUrl = "http://192.168.200.61:18121/api/v1", [string]$ClusterID = "cfc0743d-d960-49fb-9de8-96e063d5e4aa", [string]$ActorUserID = "f67d943f-5397-4b3a-a229-695fe67ad700", [string]$RequestedNodeName = "test-1", [string]$DefaultNodeName = "test-2", [string]$MatrixNodeName = "test-1", [string]$ResultPath = "artifacts\c19z71-remote-workspace-real-adapter-admin-handoff-package-index-smoke-result.json" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath $sourceResultPath = "artifacts\c19z71-remote-workspace-real-adapter-admin-handoff-package-index-source-result.json" $requiredPackageFields = @( "schema_version", "source_release_marker_schema", "package_status", "package_marker", "covered_stage_range", "covered_stage_count", "proven_full_chain_stage_count", "latest_compatibility_stage", "real_runtime_stage", "runtime_effect", "admin_status", "primary_action", "guardrail_summary", "closeout_notes" ) $requiredGuardrailFields = @("activation_blocked", "process_start_allowed", "health_probe_enabled", "payload_traffic", "allows_process_start", "allows_payload_traffic") function Get-PropertyValue { param([object]$Item, [string]$Name, [object]$Default = $null) if ($null -eq $Item) { return $Default } if ($Item -is [System.Collections.IDictionary]) { if ($Item.Contains($Name)) { return $Item[$Name] } return $Default } $property = $Item.PSObject.Properties[$Name] if ($null -eq $property) { return $Default } return $property.Value } function Test-ObjectHasFields { param([object]$Item, [string[]]$Fields) if ($null -eq $Item) { return $false } foreach ($field in $Fields) { if ($Item -is [System.Collections.IDictionary]) { if (-not $Item.Contains($field)) { return $false } continue } if ($null -eq $Item.PSObject.Properties[$field]) { return $false } } return $true } & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z70-remote-workspace-real-adapter-admin-handoff-release-marker-compatibility-smoke.ps1") ` -ApiBaseUrl $ApiBaseUrl ` -ClusterID $ClusterID ` -ActorUserID $ActorUserID ` -RequestedNodeName $RequestedNodeName ` -DefaultNodeName $DefaultNodeName ` -MatrixNodeName $MatrixNodeName ` -ResultPath $sourceResultPath | Out-Null $sourceFile = Join-Path $repoRoot $sourceResultPath $sourceResult = Get-Content -Raw -Path $sourceFile | ConvertFrom-Json $marker = Get-PropertyValue -Item $sourceResult -Name "admin_handoff_release_marker" -Default $null $guardrails = Get-PropertyValue -Item $marker -Name "guardrail_summary" -Default $null $packageIndex = [ordered]@{ schema_version = "rap.remote_workspace_real_adapter_admin_handoff_package_index.v1" source_release_marker_schema = Get-PropertyValue -Item $marker -Name "schema_version" -Default $null package_status = "closed_contract_only" package_marker = "c19z71_disabled_real_adapter_admin_handoff_package_closed_contract_only" covered_stage_range = "C19Z54-C19Z70" covered_stage_count = 17 proven_full_chain_stage_count = Get-PropertyValue -Item $marker -Name "proven_stage_count" -Default $null latest_compatibility_stage = "C19Z70" real_runtime_stage = Get-PropertyValue -Item $marker -Name "real_runtime_stage" -Default $null runtime_effect = Get-PropertyValue -Item $marker -Name "runtime_effect" -Default $null admin_status = Get-PropertyValue -Item $marker -Name "admin_status" -Default $null primary_action = Get-PropertyValue -Item $marker -Name "primary_action" -Default $null guardrail_summary = $guardrails closeout_notes = @( "admin_handoff_contract_only_package_indexed", "real_runtime_gate_not_enabled", "process_start_disabled", "payload_forwarding_disabled" ) } $packageFieldsCompatible = Test-ObjectHasFields -Item $packageIndex -Fields $requiredPackageFields $packageValuesCompatible = ( [string](Get-PropertyValue -Item $packageIndex -Name "schema_version" -Default "") -eq "rap.remote_workspace_real_adapter_admin_handoff_package_index.v1" -and [string](Get-PropertyValue -Item $packageIndex -Name "source_release_marker_schema" -Default "") -eq "rap.remote_workspace_real_adapter_admin_handoff_release_marker.v1" -and [string](Get-PropertyValue -Item $packageIndex -Name "package_status" -Default "") -eq "closed_contract_only" -and [string](Get-PropertyValue -Item $packageIndex -Name "package_marker" -Default "") -eq "c19z71_disabled_real_adapter_admin_handoff_package_closed_contract_only" -and [string](Get-PropertyValue -Item $packageIndex -Name "covered_stage_range" -Default "") -eq "C19Z54-C19Z70" -and [int](Get-PropertyValue -Item $packageIndex -Name "covered_stage_count" -Default -1) -eq 17 -and [int](Get-PropertyValue -Item $packageIndex -Name "proven_full_chain_stage_count" -Default -1) -eq 13 -and [string](Get-PropertyValue -Item $packageIndex -Name "latest_compatibility_stage" -Default "") -eq "C19Z70" -and [string](Get-PropertyValue -Item $packageIndex -Name "real_runtime_stage" -Default "") -eq "blocked" -and [string](Get-PropertyValue -Item $packageIndex -Name "runtime_effect" -Default "") -eq "contract_only_no_runtime_enablement" -and [string](Get-PropertyValue -Item $packageIndex -Name "admin_status" -Default "") -eq "not_ready" -and [string](Get-PropertyValue -Item $packageIndex -Name "primary_action" -Default "") -eq "keep_real_adapter_disabled" ) $guardrailsCompatible = ( (Test-ObjectHasFields -Item $guardrails -Fields $requiredGuardrailFields) -and [bool](Get-PropertyValue -Item $guardrails -Name "activation_blocked" -Default $false) -and -not [bool](Get-PropertyValue -Item $guardrails -Name "process_start_allowed" -Default $true) -and -not [bool](Get-PropertyValue -Item $guardrails -Name "health_probe_enabled" -Default $true) -and [string](Get-PropertyValue -Item $guardrails -Name "payload_traffic" -Default "") -eq "none" -and -not [bool](Get-PropertyValue -Item $guardrails -Name "allows_process_start" -Default $true) -and -not [bool](Get-PropertyValue -Item $guardrails -Name "allows_payload_traffic" -Default $true) ) $checks = [ordered]@{ source_smoke_passed = ([bool]$sourceResult.passed) source_schema_expected = ([string]$sourceResult.schema_version -eq "c19z70.remote_workspace_real_adapter_admin_handoff_release_marker_compatibility_smoke.v1") release_marker_present = ($null -ne $marker) package_fields_compatible = $packageFieldsCompatible package_values_compatible = $packageValuesCompatible guardrails_compatible = $guardrailsCompatible } $failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key }) $result = [ordered]@{ schema_version = "c19z71.remote_workspace_real_adapter_admin_handoff_package_index_smoke.v1" source_result_path = $sourceFile cluster_id = $ClusterID required_package_fields = $requiredPackageFields required_guardrail_fields = $requiredGuardrailFields admin_handoff_package_index = $packageIndex checks = $checks failed_checks = $failed passed = ($failed.Count -eq 0) } $fullResultPath = Join-Path $repoRoot $ResultPath $resultDir = Split-Path -Parent $fullResultPath if ($resultDir) { New-Item -ItemType Directory -Force -Path $resultDir | Out-Null } $result | ConvertTo-Json -Depth 100 | Set-Content -Encoding UTF8 -Path $fullResultPath if (-not $result.passed) { throw "C19Z71 remote workspace real-adapter admin handoff package index smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')" } Write-Host "C19Z71 remote workspace real-adapter admin handoff package index smoke passed. Result: $fullResultPath" $result