mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
fix(e2e): fabricate runtime-host health through the snapshot that owns it (#20762)
* 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. * fix(e2e): fabricate paired-web host health through the snapshot that owns it Companion to the onboarding seed fix. Since #20003 the published snapshot owns runtime-host health, so writing `status: null` alone leaves the paired-web client's verified/ready snapshot in place: addRuntimeHost reads snapshot.transport 'ready' before it ever consults status, and the host still renders Connected while the test waits for Disconnected. Rewrite the snapshot coherently instead, pinned at the top sequence so the live status owner cannot restore the host mid-assertion. The disconnected leg uses transport 'unknown' rather than 'disconnected', because a dropped transport is unverifiable and renders as Connecting; only a never-reached host renders Disconnected. remoteControl is nulled because runtimeControlHealth answers 'available' on a ready control socket even with a null status. Ablated with ORCA_E2E_WEB_CLIENT=1 (the whole file is test.skip'd without it, so a run without that flag reports a passing skip): fails without the change, passes with it. * test(e2e): preserve paired runtime status metadata
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -35,20 +35,43 @@ async function setOnlyRuntimeHostHealth(page: Page, health: HostHealth): Promise
|
||||
if (nextHealth === 'blocked' && !current?.status) {
|
||||
throw new Error('Paired web runtime status unavailable for compatibility fault')
|
||||
}
|
||||
// Why rewrite the snapshot and not just the status: since #20003 the published snapshot owns
|
||||
// host health. A bare `status: null` leaves the paired-web client's verified/ready snapshot in
|
||||
// place, addRuntimeHost reads transport 'ready' before it ever looks at status, and the host
|
||||
// still renders Connected. Pinning at the top sequence also stops the live status owner
|
||||
// restoring the host mid-assertion.
|
||||
const verified = current?.status ?? current?.snapshot?.status ?? null
|
||||
const snapshot = {
|
||||
environmentId: environment.id,
|
||||
pairingRevision: environment.pairingRevision ?? environment.createdAt,
|
||||
sequence: Number.MAX_SAFE_INTEGER,
|
||||
checkedAt: Date.now(),
|
||||
...(nextHealth === 'blocked'
|
||||
? {
|
||||
status: { ...verified!, protocolVersion: 0, runtimeProtocolVersion: 0 },
|
||||
verification: 'verified' as const,
|
||||
transport: 'ready' as const
|
||||
}
|
||||
: {
|
||||
status: null,
|
||||
verification: 'unavailable' as const,
|
||||
// Why 'unknown' and not 'disconnected': an unavailable/unknown snapshot falls
|
||||
// through to disconnected health; explicit disconnected transport is treated as
|
||||
// reconnecting and renders Connecting.
|
||||
transport: 'unknown' as const
|
||||
})
|
||||
}
|
||||
store.setState({
|
||||
runtimeStatusByEnvironmentId: new Map(state.runtimeStatusByEnvironmentId).set(
|
||||
environment.id,
|
||||
nextHealth === 'blocked'
|
||||
? {
|
||||
...current,
|
||||
checkedAt: Date.now(),
|
||||
status: {
|
||||
...current!.status!,
|
||||
protocolVersion: 0,
|
||||
runtimeProtocolVersion: 0
|
||||
}
|
||||
}
|
||||
: { ...current, checkedAt: Date.now(), status: null }
|
||||
{
|
||||
...current,
|
||||
snapshot,
|
||||
checkedAt: snapshot.checkedAt,
|
||||
status: snapshot.verification === 'verified' ? snapshot.status : null,
|
||||
// Why: runtimeHealth answers 'available' on a ready remoteControl even with a null status.
|
||||
remoteControl: null
|
||||
}
|
||||
)
|
||||
})
|
||||
return environment.name
|
||||
|
||||
Reference in New Issue
Block a user