Files
rdp-proxy/scripts/fabric/c19z34-remote-workspace-probe-to-runtime-gate-smoke.ps1
2026-05-14 23:30:34 +03:00

111 lines
5.0 KiB
PowerShell

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]$EntryNodeName = "test-1",
[string]$ExitNodeName = "test-2",
[string]$EntryBaseUrl = "http://192.168.200.61:19131",
[string]$ResultPath = "artifacts\c19z34-remote-workspace-probe-to-runtime-gate-smoke-result.json"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath
$sourceResultPath = "artifacts\c19z34-remote-workspace-probe-to-runtime-gate-source-result.json"
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
}
$source = & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z33-remote-workspace-readiness-state-matrix-smoke.ps1") `
-ApiBaseUrl $ApiBaseUrl `
-ClusterID $ClusterID `
-ActorUserID $ActorUserID `
-EntryNodeName $EntryNodeName `
-ExitNodeName $ExitNodeName `
-EntryBaseUrl $EntryBaseUrl `
-ResultPath $sourceResultPath
$sourceFile = Join-Path $repoRoot $sourceResultPath
$sourceResult = Get-Content -Raw -Path $sourceFile | ConvertFrom-Json
$matrix = @(Get-PropertyValue -Item $sourceResult -Name "matrix" -Default @())
$allProbeOnly = (@($matrix | Where-Object { -not [bool](Get-PropertyValue -Item $_ -Name "probe_only" -Default $false) }).Count -eq 0)
$allPayloadNone = (@($matrix | Where-Object { [string](Get-PropertyValue -Item $_ -Name "payload_traffic" -Default "") -ne "none" }).Count -eq 0)
$hasFresh = (@($matrix | Where-Object { [string](Get-PropertyValue -Item $_ -Name "state" -Default "") -eq "fresh" }).Count -eq 2)
$hasActive = (@($matrix | Where-Object { [string](Get-PropertyValue -Item $_ -Name "state" -Default "") -eq "active" }).Count -eq 2)
$hasTerminal = (@($matrix | Where-Object { [string](Get-PropertyValue -Item $_ -Name "state" -Default "") -eq "terminal" }).Count -eq 2)
$readyContracts = @(
"fabric_service_channel_remote_workspace_lease_probe",
"remote_workspace_entry_ingress_probe",
"remote_workspace_frame_batch_probe",
"remote_workspace_mailbox_cursor_resume",
"remote_workspace_mailbox_preflight_diagnostics",
"remote_workspace_runtime_readiness_state_matrix",
"remote_workspace_terminal_session_summary",
"remote_workspace_no_session_summary"
)
$remainingRuntimeGates = @(
"replace_contract_probe_with_real_adapter_process_supervision",
"carry_real_rdp_display_input_clipboard_file_audio_frames_over_fabric_service_channel",
"add_payload_sized_backpressure_and_drop_policy_for_real_display_audio_channels",
"bind_real_adapter_session_lifecycle_to_backend_resource_session_lifecycle",
"add_client_runtime_handshake_for_remote_workspace_transport_contract",
"prove_no_backend_relay_steady_state_for_remote_workspace_payloads",
"add_real_workload_soak_and_failure_tests_for_entry_exit_route_rebuild",
"add_operator_ui_for_runtime_state_matrix_and_payload_health"
)
$checks = [ordered]@{
source_smoke_passed = ([bool]$sourceResult.passed)
matrix_present = ($matrix.Count -eq 6)
all_rows_probe_only = $allProbeOnly
all_rows_payload_traffic_none = $allPayloadNone
fresh_active_terminal_rows_present = ($hasFresh -and $hasActive -and $hasTerminal)
ready_contracts_present = ($readyContracts.Count -ge 8)
remaining_runtime_gates_present = ($remainingRuntimeGates.Count -ge 8)
}
$failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key })
$result = [ordered]@{
schema_version = "c19z34.remote_workspace_probe_to_runtime_gate_smoke.v1"
source_result_path = $sourceFile
cluster_id = $ClusterID
entry_node = Get-PropertyValue -Item $sourceResult -Name "entry_node" -Default $null
current_runtime = [ordered]@{
execution_mode = "contract_probe"
probe_only = $allProbeOnly
payload_traffic = "none"
node_agent_image = "rap-node-agent:codex-service-supervisor-20260513z29"
}
ready_contracts = $readyContracts
remaining_runtime_gates = $remainingRuntimeGates
readiness_matrix = $matrix
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 30 | Set-Content -Encoding UTF8 -Path $fullResultPath
if (-not $result.passed) {
throw "C19Z34 remote workspace probe-to-runtime gate smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')"
}
Write-Host "C19Z34 remote workspace probe-to-runtime gate smoke passed. Result: $fullResultPath"
$result