observability: dashboard-log-stream-source — the live-stream feed source — the ONLY EventSource construction site #810

Closed
opened 2026-08-25 10:58:46 +00:00 by matou-build-agent · 2 comments

Parent

Feature spec: #791 — control-panel observability child spec: logs (P10) (DDR 0203).
Design ticket #760; slice-map fan-in #770; wayfinder map #7.
Slice dashboard-log-stream-source of docs/slices/observability.yaml; covers spec #791 stories 8, 14–23, 40.

What to build

The dashboard's live-stream feed source: exactly one place in the tree constructs an
EventSource
, and it is behind this seam. It owns reconnect and backfill, a 2000-line client
ring
(drop-oldest), a 120 ms batched flush, a 400-line render cap, a 5-minute idle
auto-pause
with the "Still watching?" resume, and a document.hidden pause that auto-resumes on
visible.

All timers are injected, which is what makes stories 8 / 16 / 19 / 21 / 22 provable against a
fake EventSource with no browser and no real waiting. Backfill is the hub's ring's job, so a
reconnecting or resuming subscriber gets the gap filled in order while remembering only its last
line — and lines already rendered are not duplicated.

One deliberate exception is stated here: a browser EventSource is not a generated-client call,
so it lives behind this feed-source seam and nowhere else.

Acceptance criteria

  • (story 39) Given the whole tree, then exactly one site constructs an EventSource, and it is inside this feed source — the tests drive a fake of it.
  • (story 8) Given lines arriving faster than the eye, then the client batches renders on a 120 ms flush, holds at most 2000 lines in its ring (drop-oldest) and renders at most the newest 400, staying responsive to scroll, search and every control throughout.
  • (story 14) Given the follow drops, then the source presents the stream lost lifecycle to the screen.
  • (story 16) Given stream lost, when the control plane answers again, then the client reconnects on its own, backfills from the hub's ring so missed lines appear in order, and returns to streaming with no operator act — and lines already rendered are not duplicated.
  • (story 19) Given streaming with 5 minutes and no operator act, then the source pauses and releases the follows; the idle budget is a system-defined 5 minutes and is not an operator setting anywhere in the panel.
  • (story 21) Given paused, when resume is requested, then the follows re-subscribe, the ring backfills the gap, and the idle timer restarts from that act.
  • (story 22) Given document.hidden becoming true, then the follows are released; and becoming visible again resumes and backfills by itself; but given a tab hidden longer than the idle budget, then becoming visible rests on the idle prompt rather than resuming silently.
  • (story 40) Given every other dashboard read, then it is unaffected — this source is the logs surface's alone.
  • Given the tests, then every timer (flush, idle) is injected and cleared on release — no real waiting and no component-invented interval.

Blocked by

  • #808 — observability:transport-log-stream-sse
  • #809 — observability:ui-kit-logs-screen

Task manifest

task: observability:dashboard-log-stream-source
interface: a dashboard live-stream feed source satisfying the `LogsScreen`'s live face — subscribe / lines
  / lifecycle / release — owning the single `EventSource`, reconnect + ring backfill, a 2000-line client
  ring, a 120 ms batched flush, a 400-line render cap, a 5-minute injected idle timer and the visibility
  listener
seam: 'the stream-source seam driven against a **fake `EventSource`** with injected timers: first lines
  render; a drop enters stream lost; reconnect backfills without duplicates; the client ring caps at 2000
  drop-oldest; the flush batches at 120 ms; the render cap holds at 400; idle pauses at 5 minutes releasing
  follows; resume re-subscribes and backfills; `document.hidden` pauses and visible resumes; a hidden
  span longer than the idle budget rests on the prompt'
acceptance:
- given: a fake `EventSource` emitting faster than the flush
  when: lines arrive
  then: renders batch at 120 ms, the ring caps at 2000 drop-oldest and at most 400 lines render
- given: a dropped stream
  when: the control plane answers again
  then: the client reconnects itself, backfills from the ring in order and renders no duplicate line
- given: a streaming source with the injected clock advanced 5 minutes and no operator act
  when: the timer fires
  then: the source pauses and releases its follows
- given: a paused source
  when: resume is requested
  then: the follows re-subscribe, the ring backfills the gap and the idle timer restarts
- given: '`document.hidden` true then false within the idle budget'
  when: visibility changes
  then: follows release then resume and backfill by themselves with no resting frame
- given: a tab hidden longer than the idle budget
  when: it becomes visible
  then: the idle prompt rests rather than resuming silently
depends_on:
- transport-log-stream-sse
- ui-kit-logs-screen
out_of_scope:
- the screen's own rendering and controls (`ui-kit-logs-screen`)
- the SSE route itself (`transport-log-stream-sse`)
- dropped-line detection/counting for slow clients — the bounds are stated in the meta line instead
- converting any other dashboard read to push
- any `EventSource` construction outside this seam
needs_human_decision: []

Emitted by /to-tickets over docs/slices/observability.yaml in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.

## Parent Feature spec: **#791** — control-panel observability child spec: logs (P10) (DDR 0203). Design ticket #760; slice-map fan-in **#770**; wayfinder map #7. Slice `dashboard-log-stream-source` of `docs/slices/observability.yaml`; covers spec #791 stories 8, 14–23, 40. ## What to build The dashboard's live-stream feed source: **exactly one place in the tree constructs an `EventSource`**, and it is behind this seam. It owns reconnect and backfill, a **2000-line client ring** (drop-oldest), a **120 ms batched flush**, a **400-line render cap**, a **5-minute idle auto-pause** with the "Still watching?" resume, and a `document.hidden` pause that auto-resumes on visible. **All timers are injected**, which is what makes stories 8 / 16 / 19 / 21 / 22 provable against a **fake `EventSource`** with no browser and no real waiting. Backfill is the hub's ring's job, so a reconnecting or resuming subscriber gets the gap filled in order while remembering only its last line — and lines already rendered are not duplicated. One deliberate exception is stated here: a browser `EventSource` is not a generated-client call, so it lives behind this feed-source seam and nowhere else. ## Acceptance criteria - [ ] (story 39) Given the whole tree, then exactly one site constructs an `EventSource`, and it is inside this feed source — the tests drive a fake of it. - [ ] (story 8) Given lines arriving faster than the eye, then the client batches renders on a **120 ms** flush, holds at most **2000** lines in its ring (drop-oldest) and renders at most the newest **400**, staying responsive to scroll, search and every control throughout. - [ ] (story 14) Given the follow drops, then the source presents the *stream lost* lifecycle to the screen. - [ ] (story 16) Given *stream lost*, when the control plane answers again, then the client reconnects on its own, **backfills from the hub's ring** so missed lines appear in order, and returns to *streaming* with no operator act — and lines already rendered are **not duplicated**. - [ ] (story 19) Given *streaming* with **5 minutes** and no operator act, then the source pauses and releases the follows; the idle budget is a system-defined 5 minutes and is not an operator setting anywhere in the panel. - [ ] (story 21) Given *paused*, when resume is requested, then the follows re-subscribe, the ring backfills the gap, and the idle timer restarts from that act. - [ ] (story 22) Given `document.hidden` becoming true, then the follows are released; and becoming visible again resumes and backfills **by itself**; but given a tab hidden longer than the idle budget, then becoming visible rests on the idle prompt rather than resuming silently. - [ ] (story 40) Given every other dashboard read, then it is unaffected — this source is the logs surface's alone. - [ ] Given the tests, then every timer (flush, idle) is injected and cleared on release — **no real waiting and no component-invented interval**. ## Blocked by - #808 — `observability:transport-log-stream-sse` - #809 — `observability:ui-kit-logs-screen` ## Task manifest ```yaml task: observability:dashboard-log-stream-source interface: a dashboard live-stream feed source satisfying the `LogsScreen`'s live face — subscribe / lines / lifecycle / release — owning the single `EventSource`, reconnect + ring backfill, a 2000-line client ring, a 120 ms batched flush, a 400-line render cap, a 5-minute injected idle timer and the visibility listener seam: 'the stream-source seam driven against a **fake `EventSource`** with injected timers: first lines render; a drop enters stream lost; reconnect backfills without duplicates; the client ring caps at 2000 drop-oldest; the flush batches at 120 ms; the render cap holds at 400; idle pauses at 5 minutes releasing follows; resume re-subscribes and backfills; `document.hidden` pauses and visible resumes; a hidden span longer than the idle budget rests on the prompt' acceptance: - given: a fake `EventSource` emitting faster than the flush when: lines arrive then: renders batch at 120 ms, the ring caps at 2000 drop-oldest and at most 400 lines render - given: a dropped stream when: the control plane answers again then: the client reconnects itself, backfills from the ring in order and renders no duplicate line - given: a streaming source with the injected clock advanced 5 minutes and no operator act when: the timer fires then: the source pauses and releases its follows - given: a paused source when: resume is requested then: the follows re-subscribe, the ring backfills the gap and the idle timer restarts - given: '`document.hidden` true then false within the idle budget' when: visibility changes then: follows release then resume and backfill by themselves with no resting frame - given: a tab hidden longer than the idle budget when: it becomes visible then: the idle prompt rests rather than resuming silently depends_on: - transport-log-stream-sse - ui-kit-logs-screen out_of_scope: - the screen's own rendering and controls (`ui-kit-logs-screen`) - the SSE route itself (`transport-log-stream-sse`) - dropped-line detection/counting for slow clients — the bounds are stated in the meta line instead - converting any other dashboard read to push - any `EventSource` construction outside this seam needs_human_decision: [] ``` --- *Emitted by `/to-tickets` over `docs/slices/observability.yaml` in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.*
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=10096
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10096 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #810 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 810,
  "status": "success",
  "commits": [
    "9d2fd2c5eaabedc9c719b8f90f93a3f553bdf7fb"
  ],
  "changed_files": [
    "STATUS.md",
    "dashboard/src/lib/logStreamSource.ts",
    "dashboard/tests/unit/logStreamSource.test.ts"
  ],
  "tests": [
    {
      "command": "CI=true npx vitest run tests/unit/logStreamSource.test.ts (in dashboard/)",
      "exit_code": 0
    },
    {
      "command": "CI=true npx vitest run (full dashboard suite, 1159 tests)",
      "exit_code": 0
    },
    {
      "command": "CI=true npx vue-tsc -p tsconfig.json --noEmit (in dashboard/)",
      "exit_code": 0
    },
    {
      "command": "CI=true npx eslint dashboard/src/lib/logStreamSource.ts dashboard/tests/unit/logStreamSource.test.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "story 39 — exactly one EventSource construction site, inside this feed source, tests drive a fake": "grep-proven: the tree's only `new EventSource(` is dashboard/src/lib/logStreamSource.ts:496 (browserEventSourceFactory); tests inject a fake factory — test 'story 39 · exactly one EventSource construction site'",
    "story 8 — 120ms batched flush, 2000 ring drop-oldest, newest 400 rendered, responsive": "logStreamSource.ts scheduleFlush (FLUSH_MS=120), ring push+shift at ringSize=2000, lines()=slice(-renderCap=400); tests 'batches renders on the flush' and 'keeps at most 2000 lines drop-oldest and renders at most the newest 400'",
    "story 14 — the follow drops → stream lost lifecycle": "onDrop() on error/end → state 'stream-lost' + lostAt + closeStream; test 'a dropped follow enters stream lost and releases the follows'",
    "story 16 — reconnect + ring backfill, no duplicated already-rendered lines": "scheduleReconnect (injected RECONNECT_MS timer) → openStream(lastSeq); onMessage dedups seq<=lastSeq; test 'reconnects itself... no duplicate line' asserts messages ['a','b','c','d','e']",
    "story 19 — streaming 5min no operator act pauses + releases follows; idle system-defined not an operator setting": "armIdle (IDLE_MS=5*60*1000 exported const, no options surface exposes it) → pause('idle') → closeStream; test 'pauses on the injected idle budget and releases its follows'",
    "story 21 — resume re-subscribes, ring backfills gap, idle restarts": "resume() → openStream(lastSeq) + armIdle(); test 'resume re-subscribes, backfills the gap, and restarts idle' (resumeAfterSeq=2, idle fires a full budget after resume)",
    "story 22 — document.hidden releases; visible resumes+backfills by itself; hidden past idle budget rests on prompt": "onVisibilityChange: hidden→closeStream (no paused frame), visible→elapsed<idle resume+openStream(lastSeq) else paused('idle'); tests 'releases on hidden and resumes... within the budget' and 'rests on the idle prompt when hidden longer than the idle budget'",
    "story 40 — every other dashboard read unaffected; this source is the logs surface's alone": "only new files added; no other dashboard client touched; no-targets scope opens no EventSource — test 'opens NO stream when the scope resolves to no target'; full suite (1159) green",
    "every timer (flush, idle) injected and cleared on release — no real waiting, no component-invented interval": "all timers run through injected StreamTimers; release() clears flush/idle/reconnect + unsubscribes visibility; test 'release closes the follow, unsubscribes visibility, and stops every timer'"
  },
  "summary": "Built the dashboard's live-stream LiveLogFeed source — the tree's one EventSource construction site — with reconnect+ring backfill, a 2000-line drop-oldest ring, a 400 render cap, a 120ms batched flush, a 5-minute injected idle timeout and a document.hidden pause/resume, every timer injected and provable against a fake EventSource.",
  "reason": "",
  "blockers": []
}
**close-report** for #810 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 810, "status": "success", "commits": [ "9d2fd2c5eaabedc9c719b8f90f93a3f553bdf7fb" ], "changed_files": [ "STATUS.md", "dashboard/src/lib/logStreamSource.ts", "dashboard/tests/unit/logStreamSource.test.ts" ], "tests": [ { "command": "CI=true npx vitest run tests/unit/logStreamSource.test.ts (in dashboard/)", "exit_code": 0 }, { "command": "CI=true npx vitest run (full dashboard suite, 1159 tests)", "exit_code": 0 }, { "command": "CI=true npx vue-tsc -p tsconfig.json --noEmit (in dashboard/)", "exit_code": 0 }, { "command": "CI=true npx eslint dashboard/src/lib/logStreamSource.ts dashboard/tests/unit/logStreamSource.test.ts", "exit_code": 0 } ], "criteria": { "story 39 — exactly one EventSource construction site, inside this feed source, tests drive a fake": "grep-proven: the tree's only `new EventSource(` is dashboard/src/lib/logStreamSource.ts:496 (browserEventSourceFactory); tests inject a fake factory — test 'story 39 · exactly one EventSource construction site'", "story 8 — 120ms batched flush, 2000 ring drop-oldest, newest 400 rendered, responsive": "logStreamSource.ts scheduleFlush (FLUSH_MS=120), ring push+shift at ringSize=2000, lines()=slice(-renderCap=400); tests 'batches renders on the flush' and 'keeps at most 2000 lines drop-oldest and renders at most the newest 400'", "story 14 — the follow drops → stream lost lifecycle": "onDrop() on error/end → state 'stream-lost' + lostAt + closeStream; test 'a dropped follow enters stream lost and releases the follows'", "story 16 — reconnect + ring backfill, no duplicated already-rendered lines": "scheduleReconnect (injected RECONNECT_MS timer) → openStream(lastSeq); onMessage dedups seq<=lastSeq; test 'reconnects itself... no duplicate line' asserts messages ['a','b','c','d','e']", "story 19 — streaming 5min no operator act pauses + releases follows; idle system-defined not an operator setting": "armIdle (IDLE_MS=5*60*1000 exported const, no options surface exposes it) → pause('idle') → closeStream; test 'pauses on the injected idle budget and releases its follows'", "story 21 — resume re-subscribes, ring backfills gap, idle restarts": "resume() → openStream(lastSeq) + armIdle(); test 'resume re-subscribes, backfills the gap, and restarts idle' (resumeAfterSeq=2, idle fires a full budget after resume)", "story 22 — document.hidden releases; visible resumes+backfills by itself; hidden past idle budget rests on prompt": "onVisibilityChange: hidden→closeStream (no paused frame), visible→elapsed<idle resume+openStream(lastSeq) else paused('idle'); tests 'releases on hidden and resumes... within the budget' and 'rests on the idle prompt when hidden longer than the idle budget'", "story 40 — every other dashboard read unaffected; this source is the logs surface's alone": "only new files added; no other dashboard client touched; no-targets scope opens no EventSource — test 'opens NO stream when the scope resolves to no target'; full suite (1159) green", "every timer (flush, idle) injected and cleared on release — no real waiting, no component-invented interval": "all timers run through injected StreamTimers; release() clears flush/idle/reconnect + unsubscribes visibility; test 'release closes the follow, unsubscribes visibility, and stops every timer'" }, "summary": "Built the dashboard's live-stream LiveLogFeed source — the tree's one EventSource construction site — with reconnect+ring backfill, a 2000-line drop-oldest ring, a 400 render cap, a 120ms batched flush, a 5-minute injected idle timeout and a document.hidden pause/resume, every timer injected and provable against a fake EventSource.", "reason": "", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#810
No description provided.