fix(e2e): seed the runtime host with a snapshot the host cannot overwrite

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.
This commit is contained in:
Brennan Benson
2026-09-14 18:37:03 -07:00
parent a1d135e233
commit 1add8cb545
+24 -9
View File
@@ -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