web: live run updates over a single app-wide watch (R10)

This commit is contained in:
2026-10-19 14:22:53 +01:00
parent 2fe63012f9
commit 21a6ee3c4d
13 changed files with 1580 additions and 90 deletions
+9 -13
View File
@@ -18,6 +18,7 @@ import {
ForegroundAction,
IDLE_BANNER_TEXT,
RETRYING_SUFFIX,
RunStream,
bannerState,
foregroundAction,
liveBadgeState,
@@ -182,19 +183,14 @@ test("serverBuildLabel tolerates missing fields", () => {
// liveBadgeState — RunStream.kt words
// ---------------------------------------------------------------------------
test("liveBadgeState is live only while executing on a connected socket", () => {
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "connected" }), { tone: "live", label: "live" });
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "disconnected" }), {
tone: "reconnecting",
label: "reconnecting",
});
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "connecting" }), {
tone: "reconnecting",
label: "reconnecting",
});
assert.deepEqual(liveBadgeState({ executing: false }, { kind: "connected" }), { tone: "not-live", label: "not live" });
assert.deepEqual(liveBadgeState(null, { kind: "connected" }), { tone: "not-live", label: "not live" });
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "idle" }), { tone: "not-live", label: "not live" });
test("liveBadgeState maps the explicit stream state to RunStream.kt's words", () => {
// The badge says whether pushes are arriving, independent of any executing run.
assert.deepEqual(liveBadgeState(RunStream.Live), { tone: "live", label: "live" });
assert.deepEqual(liveBadgeState(RunStream.Connecting), { tone: "reconnecting", label: "reconnecting" });
assert.deepEqual(liveBadgeState(RunStream.Offline), { tone: "not-live", label: "not live" });
// An unknown/missing state is honestly not live.
assert.deepEqual(liveBadgeState(undefined), { tone: "not-live", label: "not live" });
assert.deepEqual(liveBadgeState("something-else"), { tone: "not-live", label: "not live" });
});
// ---------------------------------------------------------------------------