From 1add8cb545b77703e381ff8c4e698573acbc69e2 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 14 Sep 2026 18:37:03 -0700 Subject: [PATCH] fix(e2e): seed the runtime host with a snapshot the host cannot overwrite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since #20003 the published snapshot owns runtime-host health, so a bare status seed no longer survives: main's status owner publishes `checking` for this unreachable synthetic host as soon as any runtime RPC touches it, the host reads `connecting`, and the Add Project dialog falls back to Local — so the host-scoped copy the test asserts never renders. Seed a snapshot pinned at the top sequence instead. applyRuntimeHostStatusSnapshot drops any later publication whose sequence is not higher, and setRuntimeEnvironmentStatus no-ops a snapshot-less write once a snapshot exists, so the bare seed could not have worked either way. Ablated: passes with the pinned snapshot, fails without it. --- tests/e2e/onboarding.spec.ts | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/tests/e2e/onboarding.spec.ts b/tests/e2e/onboarding.spec.ts index a4fcaa8dc1d..4836e08265c 100644 --- a/tests/e2e/onboarding.spec.ts +++ b/tests/e2e/onboarding.spec.ts @@ -452,17 +452,32 @@ test.describe('Onboarding flow', () => { // has a live, protocol-compatible status; without one it reads // 'disconnected' and the Add Project dialog falls back to Local Mac. // runtimeProtocolVersion 3 clears MIN_COMPATIBLE_RUNTIME_SERVER_VERSION. + const seededStatus = { + runtimeId: `${environment.id}-runtime`, + rendererGraphEpoch: 0, + graphStatus: 'ready' as const, + authoritativeWindowId: null, + liveTabCount: 0, + liveLeafCount: 0, + runtimeProtocolVersion: 3, + minCompatibleRuntimeClientVersion: 1 + } + // Why a snapshot and not a bare status: since #20003 the published snapshot owns host health, + // and main's status owner publishes `checking` for this unreachable host as soon as any + // runtime RPC touches it — which flips the Add Project host to Local mid-test. Pinning the + // seed at the top sequence makes applyRuntimeHostStatusSnapshot's monotonic guard drop those + // publications. A snapshot-less write would also no-op once any snapshot exists. store.getState().setRuntimeEnvironmentStatus(environment.id, { - status: { - runtimeId: `${environment.id}-runtime`, - rendererGraphEpoch: 0, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0, - runtimeProtocolVersion: 3, - minCompatibleRuntimeClientVersion: 1 + snapshot: { + environmentId: environment.id, + pairingRevision: environment.pairingRevision ?? environment.createdAt, + sequence: Number.MAX_SAFE_INTEGER, + checkedAt: Date.now(), + status: seededStatus, + verification: 'verified', + transport: 'ready' }, + status: seededStatus, checkedAt: Date.now() }) // Why: the store's switchRuntimeEnvironment probes reachability, which a