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\c19z133-remote-workspace-real-adapter-not-approved-outcome-stopped-branch-sentinel-smoke-result.json" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath $sourceResultPath = "artifacts\c19z133-remote-workspace-real-adapter-not-approved-outcome-stopped-branch-sentinel-source-result.json" $requiredSentinelFields = @( "schema_version", "source_manifest_schema", "sentinel_status", "sentinel_marker", "branch_state", "continuation_policy", "manifest_status", "archive_status", "package_status", "final_release_status", "covered_stage_range", "covered_stage_count", "latest_compatibility_stage", "release_status", "closeout_status", "boundary_status", "reopen_policy", "enablement_decision", "operator_review_status", "enablement_status", "runtime_gate_state", "runtime_effect", "operator_default_action", "next_required_phase", "allows_process_start", "allows_payload_traffic", "guardrail_summary", "sentinel_notes" ) $requiredGuardrailFields = @("activation_blocked", "process_start_allowed", "health_probe_enabled", "payload_traffic", "allows_process_start", "allows_payload_traffic") $requiredSentinelNotes = @( "not_approved_branch_stopped", "no_further_not_approved_layers_required", "new_explicit_enablement_request_required", "real_runtime_gate_not_enabled", "process_start_disabled", "payload_forwarding_disabled" ) 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 Test-ArrayContainsAll { param([object[]]$Actual, [string[]]$Expected) foreach ($item in $Expected) { if ($Actual -notcontains $item) { return $false } } return $true } & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z132-remote-workspace-real-adapter-not-approved-outcome-archive-closeout-manifest-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 $manifest = Get-PropertyValue -Item $sourceResult -Name "not_approved_outcome_archive_closeout_manifest" -Default $null $guardrails = Get-PropertyValue -Item $manifest -Name "guardrail_summary" -Default $null $sentinel = [ordered]@{ schema_version = "rap.remote_workspace_real_adapter_not_approved_outcome_stopped_branch_sentinel.v1" source_manifest_schema = Get-PropertyValue -Item $manifest -Name "schema_version" -Default $null sentinel_status = "stopped_until_new_explicit_enablement_request" sentinel_marker = "c19z133_real_adapter_not_approved_outcome_stopped_branch_sentinel" branch_state = "not_approved_branch_closed" continuation_policy = "do_not_continue_without_new_explicit_enablement_request" manifest_status = Get-PropertyValue -Item $manifest -Name "manifest_status" -Default $null archive_status = Get-PropertyValue -Item $manifest -Name "archive_status" -Default $null package_status = Get-PropertyValue -Item $manifest -Name "package_status" -Default $null final_release_status = Get-PropertyValue -Item $manifest -Name "final_release_status" -Default $null covered_stage_range = Get-PropertyValue -Item $manifest -Name "covered_stage_range" -Default $null covered_stage_count = Get-PropertyValue -Item $manifest -Name "covered_stage_count" -Default $null latest_compatibility_stage = Get-PropertyValue -Item $manifest -Name "latest_compatibility_stage" -Default $null release_status = Get-PropertyValue -Item $manifest -Name "release_status" -Default $null closeout_status = Get-PropertyValue -Item $manifest -Name "closeout_status" -Default $null boundary_status = Get-PropertyValue -Item $manifest -Name "boundary_status" -Default $null reopen_policy = Get-PropertyValue -Item $manifest -Name "reopen_policy" -Default $null enablement_decision = Get-PropertyValue -Item $manifest -Name "enablement_decision" -Default $null operator_review_status = Get-PropertyValue -Item $manifest -Name "operator_review_status" -Default $null enablement_status = Get-PropertyValue -Item $manifest -Name "enablement_status" -Default $null runtime_gate_state = Get-PropertyValue -Item $manifest -Name "runtime_gate_state" -Default $null runtime_effect = Get-PropertyValue -Item $manifest -Name "runtime_effect" -Default $null operator_default_action = Get-PropertyValue -Item $manifest -Name "operator_default_action" -Default $null next_required_phase = Get-PropertyValue -Item $manifest -Name "next_required_phase" -Default $null allows_process_start = $false allows_payload_traffic = $false guardrail_summary = $guardrails sentinel_notes = $requiredSentinelNotes } $sentinelFieldsCompatible = Test-ObjectHasFields -Item $sentinel -Fields $requiredSentinelFields $sentinelValuesCompatible = ( [string](Get-PropertyValue -Item $sentinel -Name "schema_version" -Default "") -eq "rap.remote_workspace_real_adapter_not_approved_outcome_stopped_branch_sentinel.v1" -and [string](Get-PropertyValue -Item $sentinel -Name "source_manifest_schema" -Default "") -eq "rap.remote_workspace_real_adapter_not_approved_outcome_archive_closeout_manifest.v1" -and [string](Get-PropertyValue -Item $sentinel -Name "sentinel_status" -Default "") -eq "stopped_until_new_explicit_enablement_request" -and [string](Get-PropertyValue -Item $sentinel -Name "sentinel_marker" -Default "") -eq "c19z133_real_adapter_not_approved_outcome_stopped_branch_sentinel" -and [string](Get-PropertyValue -Item $sentinel -Name "branch_state" -Default "") -eq "not_approved_branch_closed" -and [string](Get-PropertyValue -Item $sentinel -Name "continuation_policy" -Default "") -eq "do_not_continue_without_new_explicit_enablement_request" -and [string](Get-PropertyValue -Item $sentinel -Name "manifest_status" -Default "") -eq "closed_not_approved_archive_manifest_complete" -and [string](Get-PropertyValue -Item $sentinel -Name "archive_status" -Default "") -eq "closed_not_approved_archived_contract_only" -and [string](Get-PropertyValue -Item $sentinel -Name "package_status" -Default "") -eq "final_package_indexed_and_archived_contract_only" -and [string](Get-PropertyValue -Item $sentinel -Name "final_release_status" -Default "") -eq "closed_not_approved_final_contract_only" -and [string](Get-PropertyValue -Item $sentinel -Name "covered_stage_range" -Default "") -eq "C19Z117-C19Z122" -and [int](Get-PropertyValue -Item $sentinel -Name "covered_stage_count" -Default -1) -eq 6 -and [string](Get-PropertyValue -Item $sentinel -Name "latest_compatibility_stage" -Default "") -eq "C19Z122" -and [string](Get-PropertyValue -Item $sentinel -Name "release_status" -Default "") -eq "not_approved_outcome_closed_contract_only" -and [string](Get-PropertyValue -Item $sentinel -Name "closeout_status" -Default "") -eq "closed_not_approved_package_complete" -and [string](Get-PropertyValue -Item $sentinel -Name "boundary_status" -Default "") -eq "closed_not_approved_reopen_required" -and [string](Get-PropertyValue -Item $sentinel -Name "reopen_policy" -Default "") -eq "new_explicit_enablement_request_required" -and [string](Get-PropertyValue -Item $sentinel -Name "enablement_decision" -Default "") -eq "not_approved" -and [string](Get-PropertyValue -Item $sentinel -Name "operator_review_status" -Default "") -eq "closed_without_approval" -and [string](Get-PropertyValue -Item $sentinel -Name "enablement_status" -Default "") -eq "not_enabled" -and [string](Get-PropertyValue -Item $sentinel -Name "runtime_gate_state" -Default "") -eq "validated_contract_only_not_enabled" -and [string](Get-PropertyValue -Item $sentinel -Name "runtime_effect" -Default "") -eq "contract_only_no_runtime_enablement" -and [string](Get-PropertyValue -Item $sentinel -Name "operator_default_action" -Default "") -eq "keep_real_adapter_disabled" -and [string](Get-PropertyValue -Item $sentinel -Name "next_required_phase" -Default "") -eq "explicit_new_enablement_request_only" -and -not [bool](Get-PropertyValue -Item $sentinel -Name "allows_process_start" -Default $true) -and -not [bool](Get-PropertyValue -Item $sentinel -Name "allows_payload_traffic" -Default $true) ) $sentinelNotesCompatible = Test-ArrayContainsAll -Actual @($sentinel.sentinel_notes) -Expected $requiredSentinelNotes $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 "c19z132.remote_workspace_real_adapter_not_approved_outcome_archive_closeout_manifest_compatibility_smoke.v1") manifest_present = ($null -ne $manifest) sentinel_fields_compatible = $sentinelFieldsCompatible sentinel_values_compatible = $sentinelValuesCompatible sentinel_notes_compatible = $sentinelNotesCompatible guardrails_compatible = $guardrailsCompatible } $failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key }) $result = [ordered]@{ schema_version = "c19z133.remote_workspace_real_adapter_not_approved_outcome_stopped_branch_sentinel_smoke.v1" source_result_path = $sourceFile cluster_id = $ClusterID required_sentinel_fields = $requiredSentinelFields required_guardrail_fields = $requiredGuardrailFields required_sentinel_notes = $requiredSentinelNotes not_approved_outcome_stopped_branch_sentinel = $sentinel 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 "C19Z133 remote workspace real-adapter not-approved outcome stopped branch sentinel smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')" } Write-Host "C19Z133 remote workspace real-adapter not-approved outcome stopped branch sentinel smoke passed. Result: $fullResultPath" $result