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\c19z4-remote-workspace-mailbox-preflight-action-hints-smoke-result.json" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath $sourceResultPath = "artifacts\c19z4-remote-workspace-mailbox-preflight-action-hints-source-result.json" 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 } $source = & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "c19z3-remote-workspace-mailbox-stale-preflight-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 $preflight = Get-PropertyValue -Item $sourceResult -Name "preflight" -Default $null $preflightJson = Get-PropertyValue -Item $preflight -Name "json" -Default $null $hints = @((Get-PropertyValue -Item $preflightJson -Name "action_hints" -Default @())) $checks = [ordered]@{ source_smoke_passed = ([bool]$sourceResult.passed) stale_preflight_detected = ([bool](Get-PropertyValue -Item $preflightJson -Name "stale_cursor" -Default $false) -and [string](Get-PropertyValue -Item $preflightJson -Name "diagnostic_state" -Default "") -eq "stale_cursor_gap") recommended_action_visible = ([string](Get-PropertyValue -Item $preflightJson -Name "recommended_action" -Default "") -eq "reset_consumer_and_resync") reset_hint_visible = $hints.Contains("reset_consumer_cursor") resync_hint_visible = $hints.Contains("request_full_adapter_resync") checkpoint_hint_visible = $hints.Contains("resume_from_checkpoint_after_resync") } $failed = @($checks.GetEnumerator() | Where-Object { -not $_.Value } | ForEach-Object { $_.Key }) $result = [ordered]@{ schema_version = "c19z4.remote_workspace_mailbox_preflight_action_hints_smoke.v1" source_result_path = $sourceFile cluster_id = $ClusterID adapter_session_id = [string](Get-PropertyValue -Item $sourceResult -Name "adapter_session_id" -Default "") preflight = $preflight 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 "C19Z4 remote workspace mailbox preflight action hints smoke failed. Result: $fullResultPath Failed: $($failed -join ', ')" } Write-Host "C19Z4 remote workspace mailbox preflight action hints smoke passed. Result: $fullResultPath" $result