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\c19z57-remote-workspace-real-adapter-readiness-handoff-summary-smoke-result.json" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath $handoffSourcePath = "artifacts\c19z57-remote-workspace-real-adapter-readiness-handoff-summary-handoff-source-result.json" $matrixSourcePath = "artifacts\c19z57-remote-workspace-real-adapter-readiness-handoff-summary-matrix-source-result.json" $requiredChecklistItems = @( "handoff_v4_complete", "mode_matrix_v3_compatible", "requested_and_default_config_shapes_visible", "desired_workload_modes_visible", "activation_blocked", "process_start_disabled", "health_probe_disabled", "payload_traffic_none", "missing_gates_visible", "missing_health_signals_visible" ) $expectedModes = @("probe_only", "real_adapter_only", "probe_and_real_adapter") function Get-PropertyValue { param([object]$Item, [string]$Name, [object]$Default = $null) if ($null -eq $Item) { return $Default } $property = $Item.PSObject.Properties[$Name] if ($null -eq $property) { return $Default } return $property.Value } function Get-RowByName { param([object[]]$Rows, [string]$Name) return @($Rows | Where-Object { [string](Get-PropertyValue -Item $_ -Name "node_name" -Default "") -eq $Name } | Select-Object -First 1) } function Get-RowByMode { param([object[]]$Rows, [string]$Mode) return @($Rows | Where-Object { [string](Get-PropertyValue -Item $_ -Name "mode" -Default "") -eq $Mode } | Select-Object -First 1) } function Test-AllRowsBool { param([object[]]$Rows, [string]$Field, [bool]$Expected) if ($Rows.Count -eq 0) { return $false } return (@($Rows | Where-Object { [bool](Get-PropertyValue -Item $_ -Name $Field -Default (-not $Expected)) -ne $Expected }).Count -eq 0) } function Test-AllRowsString { param([object[]]$Rows, [string]$Field, [string]$Expected) if ($Rows.Count -eq 0) { return $false } return (@($Rows | Where-Object { [string](Get-PropertyValue -Item $_ -Name $Field -Default "") -ne $Expected }).Count -eq 0) } function Test-ModesPresent { param([object[]]$Rows) foreach ($mode in $expectedModes) { if ($null -eq (Get-RowByMode -Rows $Rows -Mode $mode)) { return $false } } return $true } function New-ChecklistItem { param([string]$Name, [bool]$Passed, [string]$Evidence) return [ordered]@{ name = $Name passed = $Passed evidence = $Evidence } } & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z54-remote-workspace-real-adapter-handoff-v4-smoke.ps1") ` -ApiBaseUrl $ApiBaseUrl ` -ClusterID $ClusterID ` -ActorUserID $ActorUserID ` -RequestedNodeName $RequestedNodeName ` -DefaultNodeName $DefaultNodeName ` -ResultPath $handoffSourcePath | Out-Null & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z56-remote-workspace-real-adapter-mode-matrix-v3-compatibility-smoke.ps1") ` -ApiBaseUrl $ApiBaseUrl ` -ClusterID $ClusterID ` -ActorUserID $ActorUserID ` -NodeName $MatrixNodeName ` -ResultPath $matrixSourcePath | Out-Null $handoffSourceFile = Join-Path $repoRoot $handoffSourcePath $matrixSourceFile = Join-Path $repoRoot $matrixSourcePath $handoff = Get-Content -Raw -Path $handoffSourceFile | ConvertFrom-Json $matrix = Get-Content -Raw -Path $matrixSourceFile | ConvertFrom-Json $handoffRows = @($handoff.handoff_rows) $matrixRows = @($matrix.matrix_rows) $requestedRow = Get-RowByName -Rows $handoffRows -Name $RequestedNodeName $defaultRow = Get-RowByName -Rows $handoffRows -Name $DefaultNodeName $handoffComplete = ([bool]$handoff.passed -and [string]$handoff.schema_version -eq "c19z54.remote_workspace_real_adapter_handoff_v4_smoke.v1" -and $handoffRows.Count -eq 2) $matrixCompatible = ([bool]$matrix.passed -and [string]$matrix.schema_version -eq "c19z56.remote_workspace_real_adapter_mode_matrix_v3_compatibility_smoke.v1" -and $matrixRows.Count -eq 3) $configShapesVisible = ( $null -ne $requestedRow -and $null -ne $defaultRow -and [bool](Get-PropertyValue -Item $requestedRow -Name "enabled_requested" -Default $false) -and -not [bool](Get-PropertyValue -Item $defaultRow -Name "enabled_requested" -Default $true) -and [string](Get-PropertyValue -Item $requestedRow -Name "args_json_shape" -Default "") -eq "json_array" -and [string](Get-PropertyValue -Item $defaultRow -Name "args_json_shape" -Default "") -eq "absent" ) $modesVisible = Test-ModesPresent -Rows $matrixRows $activationBlocked = ( (Test-AllRowsString -Rows $handoffRows -Field "activation_decision" -Expected "blocked") -and (Test-AllRowsString -Rows $matrixRows -Field "activation_decision" -Expected "blocked") ) $processStartDisabled = ( (Test-AllRowsBool -Rows $handoffRows -Field "process_start_allowed" -Expected $false) -and (Test-AllRowsBool -Rows $matrixRows -Field "process_start_allowed" -Expected $false) ) $healthProbeDisabled = ( (Test-AllRowsBool -Rows $handoffRows -Field "health_probe_enabled" -Expected $false) -and (Test-AllRowsBool -Rows $matrixRows -Field "health_probe_enabled" -Expected $false) -and (Test-AllRowsBool -Rows $matrixRows -Field "health_probe_visible" -Expected $true) ) $payloadTrafficNone = (Test-AllRowsString -Rows $matrixRows -Field "payload_traffic" -Expected "none") $missingGatesVisible = (Test-AllRowsBool -Rows $handoffRows -Field "decision_compatible" -Expected $true) $missingHealthSignalsVisible = ( (Test-AllRowsBool -Rows $handoffRows -Field "health_probe_compatible" -Expected $true) -and (Test-AllRowsBool -Rows $matrixRows -Field "missing_signals_visible" -Expected $true) ) $checklist = @( (New-ChecklistItem -Name "handoff_v4_complete" -Passed $handoffComplete -Evidence "C19Z54 handoff rows are present and passed"), (New-ChecklistItem -Name "mode_matrix_v3_compatible" -Passed $matrixCompatible -Evidence "C19Z56 matrix rows are present and passed"), (New-ChecklistItem -Name "requested_and_default_config_shapes_visible" -Passed $configShapesVisible -Evidence "requested=json_array enabled, default=absent disabled"), (New-ChecklistItem -Name "desired_workload_modes_visible" -Passed $modesVisible -Evidence "probe_only, real_adapter_only, probe_and_real_adapter"), (New-ChecklistItem -Name "activation_blocked" -Passed $activationBlocked -Evidence "activation_decision=blocked in handoff and matrix rows"), (New-ChecklistItem -Name "process_start_disabled" -Passed $processStartDisabled -Evidence "process_start_allowed=false in handoff and matrix rows"), (New-ChecklistItem -Name "health_probe_disabled" -Passed $healthProbeDisabled -Evidence "health_probe_enabled=false and health_probe_visible=true"), (New-ChecklistItem -Name "payload_traffic_none" -Passed $payloadTrafficNone -Evidence "payload_traffic=none in all matrix rows"), (New-ChecklistItem -Name "missing_gates_visible" -Passed $missingGatesVisible -Evidence "handoff decision compatibility includes missing gate proof"), (New-ChecklistItem -Name "missing_health_signals_visible" -Passed $missingHealthSignalsVisible -Evidence "handoff and matrix expose missing health-signal proof") ) $checks = [ordered]@{ handoff_source_passed = $handoffComplete matrix_source_passed = $matrixCompatible required_checklist_items_declared = ($requiredChecklistItems.Count -eq 10) checklist_count_expected = ($checklist.Count -eq $requiredChecklistItems.Count) all_required_checklist_items_present = (@($requiredChecklistItems | Where-Object { $want = $_ $null -eq (@($checklist | Where-Object { [string]$_.name -eq $want }) | Select-Object -First 1) }).Count -eq 0) all_checklist_items_passed = (@($checklist | Where-Object { -not [bool]$_.passed }).Count -eq 0) activation_blocked = $activationBlocked process_start_disabled = $processStartDisabled health_probe_disabled = $healthProbeDisabled payload_traffic_none = $payloadTrafficNone } $failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key }) $summary = [ordered]@{ schema_version = "rap.remote_workspace_real_adapter_disabled_runtime_readiness_summary.v1" readiness_state = "blocked_until_real_runtime_stage" operator_status = "not_ready" operator_action = "keep_real_adapter_disabled" runtime_stage = "disabled_until_real_runtime_stage" activation_decision = "blocked" process_start_allowed = $false health_probe_enabled = $false payload_traffic = "none" requested_config_visible = ($null -ne $requestedRow) default_config_visible = ($null -ne $defaultRow) mode_matrix_visible = $modesVisible checklist_passed_count = @($checklist | Where-Object { [bool]$_.passed }).Count checklist_total_count = $checklist.Count checklist_status = $(if (@($checklist | Where-Object { -not [bool]$_.passed }).Count -eq 0) { "complete" } else { "incomplete" }) } $result = [ordered]@{ schema_version = "c19z57.remote_workspace_real_adapter_readiness_handoff_summary_smoke.v1" cluster_id = $ClusterID source_results = [ordered]@{ handoff_v4 = $handoffSourceFile mode_matrix_v3_compatibility = $matrixSourceFile } required_checklist_items = $requiredChecklistItems readiness_summary = $summary operator_checklist = $checklist handoff_rows = $handoffRows matrix_rows = $matrixRows 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 "C19Z57 remote workspace real-adapter readiness handoff summary smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')" } Write-Host "C19Z57 remote workspace real-adapter readiness handoff summary smoke passed. Result: $fullResultPath" $result