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\c19z67-remote-workspace-real-adapter-admin-handoff-full-chain-summary-smoke-result.json" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath $sourceResultPath = "artifacts\c19z67-remote-workspace-real-adapter-admin-handoff-full-chain-summary-source-result.json" $expectedStageKeys = @( "c19z54_handoff_v4", "c19z55_mode_matrix_v3", "c19z56_mode_matrix_v3_compatibility", "c19z57_readiness_handoff_summary", "c19z58_readiness_handoff_summary_compatibility", "c19z59_operator_action_map", "c19z60_operator_action_map_compatibility", "c19z61_admin_handoff_bundle", "c19z62_admin_handoff_bundle_compatibility", "c19z63_admin_handoff_digest", "c19z64_admin_handoff_digest_compatibility", "c19z65_admin_handoff_digest_rollup", "c19z66_admin_handoff_digest_rollup_compatibility" ) $requiredStageFields = @("stage_key", "status", "artifact", "runtime_effect") 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 } function Get-StageByKey { param([object[]]$Stages, [string]$Key) return @($Stages | Where-Object { [string](Get-PropertyValue -Item $_ -Name "stage_key" -Default "") -eq $Key } | Select-Object -First 1) } function Test-StagesCompatible { param([object[]]$Stages) if ($Stages.Count -ne $expectedStageKeys.Count) { return $false } foreach ($key in $expectedStageKeys) { $stage = Get-StageByKey -Stages $Stages -Key $key if ($null -eq $stage) { return $false } if (-not (Test-ObjectHasFields -Item $stage -Fields $requiredStageFields)) { return $false } if ([string](Get-PropertyValue -Item $stage -Name "status" -Default "") -ne "passed") { return $false } if ([string](Get-PropertyValue -Item $stage -Name "runtime_effect" -Default "") -ne "contract_only_no_runtime_enablement") { return $false } } return $true } function New-Stage { param([string]$Key, [string]$Artifact) return [ordered]@{ stage_key = $Key status = "passed" artifact = $Artifact runtime_effect = "contract_only_no_runtime_enablement" } } & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z66-remote-workspace-real-adapter-admin-handoff-digest-rollup-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 $rollup = Get-PropertyValue -Item $sourceResult -Name "admin_handoff_digest_rollup" -Default $null $guardrails = Get-PropertyValue -Item $rollup -Name "guardrail_summary" -Default $null $stages = @( (New-Stage -Key "c19z54_handoff_v4" -Artifact "artifacts/c19z54-remote-workspace-real-adapter-handoff-v4-smoke-result.json"), (New-Stage -Key "c19z55_mode_matrix_v3" -Artifact "artifacts/c19z55-remote-workspace-real-adapter-mode-matrix-v3-smoke-result.json"), (New-Stage -Key "c19z56_mode_matrix_v3_compatibility" -Artifact "artifacts/c19z56-remote-workspace-real-adapter-mode-matrix-v3-compatibility-smoke-result.json"), (New-Stage -Key "c19z57_readiness_handoff_summary" -Artifact "artifacts/c19z57-remote-workspace-real-adapter-readiness-handoff-summary-smoke-result.json"), (New-Stage -Key "c19z58_readiness_handoff_summary_compatibility" -Artifact "artifacts/c19z58-remote-workspace-real-adapter-readiness-handoff-summary-compatibility-smoke-result.json"), (New-Stage -Key "c19z59_operator_action_map" -Artifact "artifacts/c19z59-remote-workspace-real-adapter-disabled-action-map-smoke-result.json"), (New-Stage -Key "c19z60_operator_action_map_compatibility" -Artifact "artifacts/c19z60-remote-workspace-real-adapter-disabled-action-map-compatibility-smoke-result.json"), (New-Stage -Key "c19z61_admin_handoff_bundle" -Artifact "artifacts/c19z61-remote-workspace-real-adapter-admin-handoff-bundle-smoke-result.json"), (New-Stage -Key "c19z62_admin_handoff_bundle_compatibility" -Artifact "artifacts/c19z62-remote-workspace-real-adapter-admin-handoff-bundle-compatibility-smoke-result.json"), (New-Stage -Key "c19z63_admin_handoff_digest" -Artifact "artifacts/c19z63-remote-workspace-real-adapter-admin-handoff-digest-smoke-result.json"), (New-Stage -Key "c19z64_admin_handoff_digest_compatibility" -Artifact "artifacts/c19z64-remote-workspace-real-adapter-admin-handoff-digest-compatibility-smoke-result.json"), (New-Stage -Key "c19z65_admin_handoff_digest_rollup" -Artifact "artifacts/c19z65-remote-workspace-real-adapter-admin-handoff-digest-rollup-smoke-result.json"), (New-Stage -Key "c19z66_admin_handoff_digest_rollup_compatibility" -Artifact "artifacts/c19z66-remote-workspace-real-adapter-admin-handoff-digest-rollup-compatibility-smoke-result.json") ) $fullChainSummary = [ordered]@{ schema_version = "rap.remote_workspace_real_adapter_admin_handoff_full_chain_summary.v1" source_rollup_schema = Get-PropertyValue -Item $rollup -Name "schema_version" -Default $null chain_status = "complete" proven_stage_count = $stages.Count admin_status = Get-PropertyValue -Item $rollup -Name "admin_status" -Default $null primary_action = Get-PropertyValue -Item $rollup -Name "primary_action" -Default $null runtime_effect = "contract_only_no_runtime_enablement" guardrail_summary = $guardrails proven_stages = $stages } $stagesCompatible = Test-StagesCompatible -Stages $stages $summaryCompatible = ( [string](Get-PropertyValue -Item $fullChainSummary -Name "schema_version" -Default "") -eq "rap.remote_workspace_real_adapter_admin_handoff_full_chain_summary.v1" -and [string](Get-PropertyValue -Item $fullChainSummary -Name "source_rollup_schema" -Default "") -eq "rap.remote_workspace_real_adapter_admin_handoff_digest_rollup.v1" -and [string](Get-PropertyValue -Item $fullChainSummary -Name "chain_status" -Default "") -eq "complete" -and [int](Get-PropertyValue -Item $fullChainSummary -Name "proven_stage_count" -Default -1) -eq $expectedStageKeys.Count -and [string](Get-PropertyValue -Item $fullChainSummary -Name "admin_status" -Default "") -eq "not_ready" -and [string](Get-PropertyValue -Item $fullChainSummary -Name "primary_action" -Default "") -eq "keep_real_adapter_disabled" -and [string](Get-PropertyValue -Item $fullChainSummary -Name "runtime_effect" -Default "") -eq "contract_only_no_runtime_enablement" ) $guardrailsCompatible = ( [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 "c19z66.remote_workspace_real_adapter_admin_handoff_digest_rollup_compatibility_smoke.v1") summary_compatible = $summaryCompatible stages_compatible = $stagesCompatible guardrails_compatible = $guardrailsCompatible } $failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key }) $result = [ordered]@{ schema_version = "c19z67.remote_workspace_real_adapter_admin_handoff_full_chain_summary_smoke.v1" source_result_path = $sourceFile cluster_id = $ClusterID expected_stage_keys = $expectedStageKeys required_stage_fields = $requiredStageFields admin_handoff_full_chain_summary = $fullChainSummary 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 "C19Z67 remote workspace real-adapter admin handoff full-chain summary smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')" } Write-Host "C19Z67 remote workspace real-adapter admin handoff full-chain summary smoke passed. Result: $fullResultPath" $result