control-panel observability child spec: logs surface (P10) — one shared kit screen, streaming in place #836

Closed
opened 2026-08-25 16:17:20 +00:00 by ben · 1 comment
Owner

Parent

Program map: #7 — Wayfinder map: OurCloud v1 program scope (Phase 0).
Design ticket: #760 — control-panel observability: logs surface in the dashboard (wire the dropped open-logs intents) (the arc was filed from the 2026-08-24 matou-distributed-servers comparison rather than charted on the map; the map's v1 scope is what it lands inside).

Design tier this spec is written against (all present, all accepted):

  • DDR docs/adr/0203-design-the-dashboard-logs-surface-streams-in-place.md — the ruling DDR: one kit logs screen with two mounts and an embeddable scoped-tail face, SSE ruled in scoped to logs, the --oc-term-* vocabulary, in-place mounting with no standing entry, the followable-targets catalogue, the operator-only door, the honest level-chip split.
  • Flow docs/ux/flows/p10-logs.mermaid (+ the one new p5-monitoring.mermaid edge S3 → P10-S1; the other emitters' flows already carry ADR 0027's standing affordance and are not re-drawn).
  • Wireframes docs/ux/wireframes/p10-logs/ — p10-e1-entry-points, p10-s1-logs-streaming, p10-s1x-stream-lost, p10-s2-paused-still-watching, p10-s0x-nothing-followable. Their data-field / data-action / data-status attributes are the stable element-ID contract every acceptance criterion below is written against. (E1 depicts existing emitting screens to show the edge — design-verify matches those elements against their own wireframes, not E1.)
  • Vocabulary CONTEXT.md — Log target, Log scope, Follow (Language) and Logs surface (P10) object-states (Design nouns), merged with the arc.

Siblings in the same observability arc (each specs separately, then all fan in at one /slice-map): #759 device telemetry (specced as #769 — its kit primitives are this spec's status-dot dependency), #761 network, #762 replication matrix, #763 activity feed (its P12-S5 consumes this spec's scoped-tail face), #764 topology map (deferred).

Problem Statement

The panel has been promising logs it cannot show. ADR 0027 rules Open / Download logs onto every deploy, update, rescue and monitoring surface — and the dashboard's screens duly offer them: monitoring's service drill-in, provisioning's deploy and rescue screens, the updates rollout screens, the mail readiness pair all emit open-logs / download-logs. But DashboardComposition binds only @route, so every one of those emits is silently dropped (FleetSurface parks its own as a PendingRoute translation that nothing answers). An operator watching a deploy hang, or standing on "chat is down 4 min", clicks Open logs and nothing happens.

The logs viewer that does exist (A5) lives only in the Electron operator app, over the bounded operation log. The served dashboard — the surface an operator actually has open when a service misbehaves — has no logs surface at all, and no way to watch a live line arrive. For the low-skill, low-time operator this product is built for, the honest workaround is "SSH in", which is exactly what they cannot do. Logs are the escalation path that makes every plain-language diagnosis recoverable (download and hand the evidence to a helper); a promise-shaped button that does nothing is worse than no button.

Solution

The shell answers every emitter, in place, with one shared screen. Three things land:

  1. The dropped intents are wired. DashboardComposition binds open-logs / download-logs beside @route; every emitter converges on one intent-with-scope shape. open-logs mounts the logs surface in place over whichever tab's screen emitted it (the SetupSurface-on-Fleet drill-in pattern) — no seventh tab (ADR 0094), no navigation the operator didn't ask for, and no standing entry anywhere (the rescue tabless posture): an operator is led to logs by an emitting surface, never left to find them. download-logs mounts nothing — it fetches the bounded log artifact for the same scope as a direct browser download.

  2. One kit logs screen, two mounts, one embeddable face (the codes-ledger precedent). The kit gains LogsScreen: the screen owns the controls (scope, search, level chips, pause, download) and the terminal panel; the feed is a seam-injected source with two faces. The app mounts it over A5's bounded operation-log read (contract preserved — a static feed is always "complete", so the stream-lifecycle chrome never appears there); the dashboard mounts it over the live stream source, which alone renders the stream's object-states — streaming / stream lost / paused / nothing followable, each a rendered frame (P10-S1 / S1x / S2 / S0x). The same component also exposes a scoped-tail face — the terminal panel with its live/paused/lost states, without the controls chrome — which the activity feed's select-event pairing embeds (DDR 0206, P12-S5). No second log reader exists anywhere.

  3. SSE is ruled in, scoped to logs. The control plane gains a log-stream hub (the prototype's logstream mechanics ported: ref-counted follows, tail 200 on subscribe, 200 lines/s per-target cap, 2000-line ring for instant backlog, drop-oldest; slow subscribers drop lines rather than block) behind one SSE endpoint — EventSource, one-directional plain HTTP through the front door's gate, auto-reconnecting, no WebSocket machinery. Client guards ride with it: 2000-line client ring, 120 ms batched flush, 400-line render cap, 5-minute idle auto-pause with the "Still watching?" resume, pause on document.hidden with auto-resume. Every other dashboard read keeps its re-read cadence; live logs are the one surface where polling is genuinely wrong.

What is followable is a server-side truth: a log scope (an operation log, a service, a node, or a subject reference) resolves through the control plane's followable-targets catalogue to log targets — bounded, replayable operation logs (the LogRef ids today's emitters carry, unchanged) and live service units. The whole surface, stream endpoint included, sits behind the community door, operators only (DDR 0172); no public tier exists, so no redaction tier is needed, and A5's secrets-never-enter-logs-by-construction rule stands. Level filtering is honest: operation logs carry structured levels, so there the chips filter authoritatively; raw service lines carry none, so there the chips are a named text-match heuristic — never presented as monitoring's classification.

User Stories

A — The shell answers every emitter (E1; the dropped intents wired)

  1. As an operator, I want Open logs to actually open logs from every surface that offers it, so that ADR 0027's promise is kept instead of silently dropped.

    • Given any mounted dashboard screen that carries the standing affordance (monitoring P5-S3/S4x, provisioning P4-S4/S5/S5x, updates P4b-U1/U3/U4/U4x, mail MAIL-S1/S1x), When the operator activates its data-action="open-logs" control, Then the logs surface mounts, scoped to the emitting subject's log targets — the emit is bound in the one composition and no emitter's intent is dropped or parked.
    • Given the same screens' data-action="download-logs", Then that intent is likewise bound (stories 19–20).
  2. As an operator, I want the logs surface to land in place, so that opening logs never costs me my place in the panel.

    • Given open-logs emitted from a screen on tab T, When the surface mounts, Then P10-S1 renders in place over T (the SetupSurface-on-Fleet drill-in pattern), the browser URL is unchanged, no seventh tab appears (ADR 0094), and no modal is used.
    • Given the mount, Then it is the shell's: one binding in the composition answers every emitter, and no feature grows a private logs panel (ADR 0097 — shell giving a cross-cutting surface its home is not shell running a feature journey; the A5 parallel).
  3. As an operator, I want Back to return me exactly where I was, so that the logs surface reads as a look, not a move.

    • Given any P10 frame, When the operator activates data-action="back-to-emitter", Then the emitting screen resumes with its place held — no tab change ever happened.
  4. As an operator, I want no standing Logs entry anywhere, so that I am led to logs by the thing that needs them, never left to browse them.

    • Given the whole dashboard, Then logs have no tab, no menu row and no route of their own (the rescue tabless posture, DDR 0101 §3) — the surface is reached only through an emitter's intent.
  5. As a maintainer, I want every emitter converging on one intent-with-scope shape, so that a new surface gains logs by emitting, never by wiring.

    • Given all current emitters, Then each emits open-logs carrying a log scope (an operation log reference, a service, a node, or a subject reference); FleetSurface's open-log-<id> PendingRoute translation converges on the same shape.
    • Given the arc's siblings, Then the activity feed (#763) opens this surface through the same intent contract — two doors in (mount or embedded face), one contract.
  6. As an operator, I want opening logs on a subject with nothing to follow to land somewhere honest, so that an empty scope is never a dead click.

    • Given open-logs whose scope resolves to at least one log target, Then P10-S1 mounts streaming; Given a scope that resolves to none (service not deployed yet, operation log gone), Then P10-S0x mounts (stories 30–32) — never a blank terminal and never a toast.

B — One kit screen, two mounts, one face (DDR 0203 ruling 1)

  1. As a maintainer, I want one shared logs screen in the kit, so that the panel has one idiom for its one cross-cutting promise.

    • Given the kit's LogsScreen, Then it owns the controls (scope, search, level chips, pause, download) and the terminal panel, and its feed is a seam-injected source — the screen renders what the source declares and computes no truth of its own.
    • Given the whole product, Then no second bespoke log viewer exists in either surface (the exact drift ADR 0027 exists to prevent).
  2. As an operator in the app, I want A5 unchanged in behaviour, so that the share is invisible to me.

    • Given the app's A5 mount over its bounded operation-log read, Then its existing contract is preserved: the operation filter, search, level chips filtering authoritatively on the entry's structured level, and the shareable Download bundle — and the secrets-never-enter-logs-by-construction rule stands (a log entry has no field a secret could ride in on).
    • Given a static (bounded) feed, Then it is always "complete": the stream-lifecycle chrome — the standing line's live/lost/paused states — never appears on A5.
  3. As an operator in the dashboard, I want the live mount to tell me the stream's own truth, so that liveness is a stated fact, not an assumption.

    • Given the dashboard mount over the stream source, Then that source alone drives the lifecycle states, and every state is a rendered frame: streaming (P10-S1), stream lost (P10-S1x), paused (P10-S2), nothing followable (P10-S0x).
  4. As a sibling surface, I want an embeddable scoped tail, so that I can show live lines without leaving my own frame.

    • Given the kit screen's scoped-tail face, Then it renders the terminal panel with its streaming/paused/lost states and without the full surface's controls chrome, and it is the same kit component the mount uses — the activity feed's P12-S5 (DDR 0206) embeds it; no second log reader exists either way.
  5. As a maintainer, I want the stream indicator to be the arc's own primitive, so that the observability surfaces stay one visual language.

    • Given the standing line's streaming/paused/lost dot, Then it wears DDR 0202's status-dot primitive (#759's OcStatusDot) — referenced, never re-minted here.

C — Streaming (P10-S1)

  1. As an operator, I want a standing line that states what I'm following and how live it is, so that the stream's truth is always one glance away.

    • Given the surface streaming, Then data-field="stream-standing" (data-status="streaming") renders the live dot and the scope's name, and data-field="stream-meta" states the honest bounds in plain terms — live, the follow count, how much tail is kept and how many newest lines are shown.
  2. As an operator, I want the log lines readable and graded, so that a scan finds the error without reading every word.

    • Given the terminal panel, Then data-field="log-stream" (data-status="streaming") renders each line with its timestamp and source in the dim ink and its message in the terminal ink, success lines in the ok ink and error lines in the err ink — every colour an --oc-term-* token (story 39).
    • Given the product mount, Then log lines render at the mono secondary size (0.85rem / 0.9em, line-height ~1.65, the ADR 0122 type-scale amendment) — never the prototype's 11.5px or the artboard's micro sizes.
  3. As an operator, I want to see and change what is being followed, so that I can walk from the emitting subject to a neighbouring target without starting over.

    • Given P10-S1, Then data-field="log-scope" names the resolved scope (e.g. the service and its unit count); When the operator picks another log target from it (a service unit, a node, an operation log — the catalogue's rows, story 32), Then the surface re-follows in place (the S1 → S1 re-scope edge) with the standing line and meta updated.
  4. As an operator, I want search to narrow lines within my scope, so that filtering and following stay different ideas.

    • Given text in data-field="log-search", Then only matching lines render; the scope, the follow and the hub subscription are unchanged (a filter narrows lines within a scope — CONTEXT.md's distinction).
  5. As an operator, I want the level chips to be honest about what they can know, so that a chip never impersonates monitoring's judgement.

    • Given a followed operation log (structured entries), When a chip (data-action="filter-info" / "filter-warn" / "filter-error") is active, Then it filters authoritatively on the entry's level.
    • Given followed raw service lines (no structured level), Then the chips filter by a named text-match heuristic and the surface says so — the match is never presented as monitoring's classification (severity stays monitoring's word).
  6. As an operator, I want to pause on purpose, so that I can freeze the tail to read it.

    • Given streaming, When the operator activates data-action="pause-stream", Then the surface rests on the P10-S2 frame with its copy reading that the operator paused the stream (story 28), and the follow is released.
  7. As a maintainer, I want the client to guard itself, so that a busy stream cannot degrade the browser.

    • Given the stream source, Then it keeps a 2000-line client ring, flushes to the screen in 120 ms batches, and renders at most the newest 400 lines — and the meta line states the bounds rather than the client pretending to totality (dropped-line detection is out of scope; the bounds are the honesty).

D — Download logs (no screen)

  1. As an operator, I want Download logs to hand me the evidence directly, so that escalating to a helper is one act.

    • Given any state of the surface, When the operator activates data-action="download-logs", Then the bounded log artifact for the current scope downloads as a direct browser download — nothing mounts, no screen appears, and a running stream keeps running (the S1 self-edge).
    • Given an emitting screen's own data-action="download-logs", Then the same fetch happens for the emitter's scope without the surface ever mounting.
  2. As an operator in the app, I want A5's bundle untouched, so that the remote-helper path I know keeps working.

    • Given the app face, Then its Download bundle keeps producing the shareable bundle exactly as today — the dashboard's artifact download is the same idea for the dashboard's scopes, not a replacement of the app's.

E — Stream lost (P10-S1x)

  1. As an operator, I want a lost stream to be named the moment it is lost, so that I am never reassured by a frozen scroll.

    • Given the follow drops mid-stream (gateway or hub stopped answering), Then the surface renders P10-S1x: data-field="stream-standing" flips to data-status="stream-lost" with data-field="stream-meta" stating that nothing shown below is current, and the tail freezes visibly dimmed and end-marked (data-field="log-stream" data-status="stale") — never a stale scroll under a live dot (DDR 0096).
  2. As an operator, I want the loss explained as a rendered state, so that failure is never a toast or a silent spinner.

    • Given P10-S1x, Then data-field="stream-lost-banner" (data-status="reconnecting") names the wall-clock moment the stream was lost, states that the lines below stop there — they are what arrived, not what is happening now — and states that reconnection is automatic.
    • Given the kept tail, Then it stays readable (it is evidence), dimmed, with the loss end-marked in the terminal itself.
  3. As an operator, I want recovery to need nothing from me, so that a blip heals itself.

    • Given stream lost, When the stream reconnects, Then it backfills from the hub's ring, the stale mark clears, and the surface returns to P10-S1 (data-status="streaming") with no operator act required.
  4. As an operator, I want the loss boundaries kept straight, so that one failure never wears another's face.

    • Given the whole panel loses the community, Then the dashboard's existing unreachable state takes over — S1x is the stream's loss, not the panel's.
    • Given P10-S1x, Then data-action="back-to-emitter" remains offered — the operator can leave a lost stream for the emitting screen.

F — Paused (P10-S2)

  1. As a community, I want a forgotten logs tab to cost the fleet nothing, so that observability never becomes load.

    • Given 5 minutes pass without an operator act on the streaming surface, Then it rests on P10-S2: data-field="stream-standing" reads data-status="paused-idle" with the meta stating no lines are being followed, data-field="idle-prompt" (data-status="paused-idle") asks "Still watching?" and names why streaming paused, and the hub follow is released (the ref-count decrements; at zero the upstream follow ends).
  2. As an operator, I want resume to be one act, so that answering "still watching?" costs nothing.

    • Given P10-S2, When the operator activates data-action="resume-stream", Then the stream reconnects, backfills from the hub's ring, and the surface returns to P10-S1.
  3. As an operator, I want a hidden tab to pause and resume by itself, so that I never manage the stream's lifecycle for the browser.

    • Given the browser tab goes hidden while streaming, Then the follow pauses; When the tab becomes visible again, Then it resumes by itself — this pause has no resting frame, and the operator never sees P10-S2 for it.
  4. As an operator, I want paused, lost and live kept as three different truths, so that a deliberate rest never reads as a failure.

    • Given any pause (idle or the operator's own), Then the terminal renders data-field="log-stream" data-status="paused" with the tail end-marked as paused and an invitation to resume; the operator's own pause rests on the same frame with its copy naming that the operator paused it; and nothing on the frame is dressed as lost (nothing failed) or as live.
  5. As an operator, I want to be able to leave a paused surface, so that pausing is never a trap.

    • Given P10-S2, When data-action="back-to-emitter" is activated, Then the emitting screen resumes, place held.

G — Nothing followable (P10-S0x)

  1. As an operator, I want an empty scope named, so that "nothing here" is designed, not defaulted.

    • Given an open-logs scope that resolves to no log target, Then P10-S0x renders with data-field="no-targets-reason" stating in plain language why this subject has nothing to follow (e.g. no running unit on any node yet; no deploy has run so no operation log exists) — never a blank terminal (the never-empty spirit).
  2. As an operator, I want to be offered what the fleet can follow, so that the empty state is a door, not a wall.

    • Given P10-S0x, Then data-field="followable-targets" lists the control plane's real catalogue — each row naming the target and its class (a live service unit, a finished replayable operation log) with data-action="follow-target" — and When the operator picks a row, Then P10-S1 opens streaming that target (the S0x → S1 edge).
  3. As a maintainer, I want one catalogue read behind both offers, so that two controls can never disagree about what is followable.

    • Given the control plane's followable-targets catalogue read, Then S1's scope control (story 14) and S0x's offer list both render it verbatim — the catalogue is the one answer to "what can be followed right now".

H — The hub, the catalogue and the stream transport (DDR 0203 rulings 2 and 5)

  1. As a maintainer, I want the hub to protect the fleet from its watchers, so that a log stream can never become a load problem.

    • Given the control plane's log-stream hub, Then follows are ref-counted (many subscribers to one target share one upstream follow; the last unsubscribe releases it), a new subscriber receives the last 200 lines as instant backlog, each target is capped at 200 lines/s, and each target keeps a 2000-line ring with drop-oldest.
    • Given a slow subscriber, Then it drops lines rather than blocking the hub or its peers.
  2. As a maintainer, I want one boring stream transport, so that live logs ride the front door like everything else.

    • Given the stream, Then it is one SSE endpoint consumed by EventSource — one-directional, plain HTTP through the front door's gate, auto-reconnecting — with no WebSocket upgrade machinery.
    • Given the rest of the dashboard, Then SSE stays scoped to logs: every other read keeps its re-read cadence, and no other surface gains a stream by riding this one.
  3. As an operator, I want both kinds of logs under one contract, so that "follow it" means the same act everywhere.

    • Given the followable classes, Then an operation log (deploy runs, rescue actions, update rollouts — the LogRef ids today's emitters carry, unchanged) is bounded and replayable start-to-now, live-tailing while the operation runs; and a service unit is a live tail plus the hub ring's backlog, with no history beyond the ring.
  4. As a maintainer, I want scope resolution server-side, so that no browser ever guesses what a service runs on.

    • Given a log scope (an operation log, a service, a node, or a subject reference), Then the control plane resolves it to log targets (a service resolves to its units); the activity feed's subject-kind scope (#763, DDR 0206) rides the same resolution — two doors in, one contract.
  5. As a maintainer, I want the contract in the spec, so that the transport stays generated, not hand-rolled.

    • Given the OpenAPI spec, Then it grows the followable-targets catalogue read, the SSE stream route and the bounded log-artifact fetch; wire stays snake_case, camelised at the client boundary; the catalogue and artifact reads ride the generated client (ADR 0037) — the stream alone rides EventSource, a declared exception, never a hand-rolled fetch elsewhere.
  6. As a community, I want the whole surface behind the community door, so that logs are the operator's evidence and nobody else's.

    • Given every route this spec adds — catalogue, artifact and the SSE stream included — Then it sits behind the community door, operators only (DDR 0172): EventSource rides the same community session cookie, the gate's forward_auth covers the SSE route like any admin route, and an unauthenticated caller is refused with nothing streamed.
    • Given no public tier exists, Then no redaction tier is built, and the secrets-never-enter-logs-by-construction rule (A5) stands unchanged.

I — The terminal vocabulary (DDR 0203 ruling 3)

  1. As a maintainer, I want the terminal's colours to be kit tokens, so that every log line in the product is painted from one place.

    • Given the kit's base layer, Then its :root declares the six terminal tokens — --oc-term-bg, --oc-term-ink, --oc-term-dim, --oc-term-ok, --oc-term-warn, --oc-term-err — at DDR 0203's values, as product language on the ADR 0122 token split (the community palette seam is untouched).
    • Given the components, Then zero raw hex: every terminal colour is worn as its token.
  2. As an operator, I want the terminal deliberately dark in both themes, so that logs read as logs everywhere.

    • Given either theme, Then the terminal panel grounds on --oc-term-bg (only that token ever varies per theme; its dark-mode re-point rides the dark-mode slice — out of scope here), timestamps, sources and end-marks wear the dim ink, and success/warning/error lines wear their inks — one vocabulary across the dashboard mount, the app mount and the embedded face.

Implementation Decisions

Seams — one new control-plane seam at its highest point; everything else grows existing ones

  • The one new seam class is the hub's follow seam (the prototype's FollowFunc shape): the hub asks "give me this log target's line stream" through an injected function, and everything above it — ref-counting, tail, rate cap, ring, SSE framing — is testable without a fleet. This is the highest point the new machinery can be cut at, and it is the only new seam class the spec mints.
  • The shared screen's seam is the injected feed source, with two faces. The static face is A5's existing bounded entries contract (unchanged); the stream face wraps EventSource behind a thin transport boundary so a fake EventSource can drive every lifecycle state in tests. The client guards (ring, flush, render cap, idle timer, visibility pause) live in the stream source, never in the component. Rejected: a second bespoke dashboard viewer — two idioms for one cross-cutting promise, the drift ADR 0027 exists to prevent.
  • The intent is the wiring contract. open-logs carries a log scope (operation log reference | service | node | subject reference); DashboardComposition binds the emits and hosts the overlay at the current mount — one binding answers every emitter, present and future (#763 included), and FleetSurface's open-log-<id> PendingRoute translation converges on the same shape. Shell composes and computes nothing (ADR 0097): the surface is shell's on both sides, as A5 already is.
  • Resolution and cataloguing are server-side. The control plane owns "what is followable right now" as one catalogue read and owns scope → target resolution; the dashboard renders the answer verbatim. This is what makes stories 6, 31, 32 and 36 checkable rather than front-end discipline.
  • The chips' honesty is structural, not copy-deep. The feed source declares whether its lines carry structured levels; the screen derives chip mode (authoritative filter vs named text-match) from that declaration — no surface ever decides for itself to present a heuristic as a classification.
  • Transport per ADR 0037: the OpenAPI spec is the contract; the catalogue and bounded-artifact reads ride the generated client; wire snake_case camelised at the boundary. The SSE route is in the spec but consumed by EventSource — the one declared exception, scoped to logs.
  • Not adopted from the prototype: raw hex and micro type (everything re-encodes as --oc-* tokens at the ADR 0122 type floor), containers as the target model (log targets are the domain word), Pinia, an unauthenticated stream, dropped-line counters (the meta line states the bounds instead), and hand-fed topology (the catalogue is the control plane's own truth).

Surface

  • In place, no standing entry. P10 mounts over the emitting tab's screen with ← back returning place-held — the SetupSurface-on-Fleet / P8-S7-on-Backups drill-in pattern; the six-tab set stays closed (ADR 0094); the rescue tabless posture (DDR 0101 §3) carries over whole.
  • Every P10 frame's data-field / data-action / data-status attributes are the built contract, carried verbatim from the wireframes so design-verify can check the shipped UI against them.
  • The stream's object-states are the frames: streaming / stream lost / paused / nothing followable, exactly CONTEXT.md's P10 nouns; hidden-tab pause is the one state with no resting frame (auto-resumes on visible).
  • The kit gains LogsScreen (controls + terminal + lifecycle states + the scoped-tail face) and the six --oc-term-* tokens; the app's A5 becomes a mount of it (contract preserved — gate D4); the dashboard's mount is new. The streaming/paused/lost dot wears #759's status-dot primitive.

Collection and streaming

  • The hub lands with this feature, not before (the ticket's sequencing): the logstream port (ref-counted follows, tail 200, 200 lines/s cap, 2000-line ring, drop-oldest, slow-subscriber drop), the catalogue read, the SSE route and the bounded-artifact fetch.
  • Idle pause is a resource posture, not UX polish: a forgotten tab must not hold hub follows open against the fleet — 5 minutes (gate 3's default), resume is one act, and the release is real (the ref-count decrements).
  • LogRef is unchanged. Operation logs remain the bounded, replayable class they are today; the hub adds live service units beside them, not instead of them.

Testing Decisions

A good test states externally-observable behaviour at a seam and never reaches into implementation detail. One new seam class (the hub's follow seam); everything else rides existing patterns:

  1. The shared-screen seam (kit). LogsScreen driven against hand-written fakes of both feed faces, asserting on the wireframes' data-field / data-action / data-status contract: the static face never shows lifecycle chrome; the stream face renders all four object-states; chips filter authoritatively vs by named heuristic per the source's declaration; search narrows without re-following; the scoped-tail face renders the terminal + states without controls. Prior art: the shared codes-ledger tests (enrollmentCodes.test.ts), calloutVocabulary.test.ts, the kit theming tests.
  2. The dashboard mount seam. The composition binding and the overlay driven with a fake stream source and a fake EventSource: every emitter's open-logs mounts in place scoped to its subject (none dropped), back resumes the emitter place-held, no standing entry exists, S1 vs S0x on catalogue resolution, stream-lost freeze/end-mark/auto-backfill, idle pause releases the follow and resume reconnects, hidden-tab pause/resume, download fetches without mounting. Prior art: dashboardShell.test.ts, fleet.test.ts, monitoringDrillIn.test.ts, surfaceFaultFrame.test.ts.
  3. The hub seam (control plane). The hub at its follow seam, the prototype's hub_test / demux_test / follow_test ported as prior art: one upstream follow per target however many subscribers, release at zero, tail-200 on subscribe, the 200 lines/s cap, ring drop-oldest at 2000, a slow subscriber drops lines while its peers keep streaming.
  4. The transport seam. Integration tests for the new routes: the catalogue read returns the real followable answer (a service resolves to its units; a subject with nothing resolves to an empty, reasoned answer), the SSE route streams framed events and refuses an unauthenticated caller with nothing streamed, the artifact fetch returns the bounded log for a scope, faults map to the shared Problem body, and the generated client camelises the catalogue. Prior art: the existing Go route integration tests and the dashboard's live-client tests (provisionLive.test.ts, membersLive.test.ts).

Cross-cutting checks ride existing harnesses: the theming contract tests (the six new tokens exist at :root, zero raw hex in components, ADR 0122) and the client-guard unit tests at the stream-source module (ring 2000, 120 ms flush batching, 400-line render cap, the idle timer, the visibility handlers — all against fakes and fake timers, no real stream).

Out of Scope

  • Log retention and history search. Beyond the hub's ring and the bounded operation logs there is no history; indexing, retention windows and search-over-time are a later arc.
  • Log-based alerting. Watching a line and raising on it is monitoring's world; this surface renders, never judges.
  • Custom multi-target follow sets. Scope resolution plus the catalogue's single picks is v1; composing arbitrary target sets is not offered.
  • Dropped-line detection for slow clients. The bounds are stated in the meta line instead (DDR 0203's ruling); counters and gap markers are not built.
  • The dark-mode terminal re-point. --oc-term-bg's dark value rides the dark-mode slice (ADR 0122); this spec declares the tokens light-theme-complete with the terminal dark in both themes.
  • A member-facing tier. Operators only behind the community door (DDR 0172); with no public tier there is no redaction tier.
  • The emitting surfaces themselves. Every emitter exists; this spec binds their intents and changes none of their screens (E1 depicts them; their own wireframes stay canonical).
  • The activity feed's surface (#763). Its P12-S5 embeds this spec's scoped-tail face and its select-event pairing rides the same scope contract; the feed itself is its own spec.
  • New log content. What services and operations log is untouched; A5's secrets-never-enter-logs construction is inherited, not re-engineered.
  • A5 feature growth. The rewire preserves the app viewer's contract exactly; it adds nothing to it.

Further Notes

Vertical slices (named for the fan-in /slice-map)

  1. ui-kit:logs-screen — LogsScreen (controls + terminal + lifecycle states + the scoped-tail face) and the six --oc-term-* tokens. Depends cross-arc on ui-kit:telemetry-primitives (#769 slice 1) for the status-dot; #763's P12-S5 depends on this slice's face.
  2. control-plane:logstream-hub — the hub at its follow seam: ref-counted follows, tail 200, rate cap, ring, drop-oldest. Depends on nothing new.
  3. transport:logs-catalogue-and-stream — the OpenAPI catalogue read, the SSE stream route behind the community door, and the bounded-artifact fetch. Depends on 2.
  4. shell:logs-mount — the composition binding (every emitter, one intent shape), the in-place overlay, the stream source with its client guards, and the four frames S1 / S1x / S2 / S0x. Depends on 1 and 3.
  5. app:a5-rewire — A5 becomes a mount of the kit screen, contract preserved (gate D4's subject). Depends on 1.

Cross-arc note for the fan-in: slice 1 is a consumer of #759's primitives root and a provider to #763; slice 3's scope resolution is what #763's subject-kind pairing rides. Slice 5 is deliberately last and severable (see D4).

The DDR's open gates (ADR 0174 — async veto, proposed defaults applied)

DDR 0203 is accepted with three decisions held open for Ben; per the #769 ruling-1 precedent this spec proceeds on the DDR's defaults, and each gate maps to exactly the stories its veto would retire. (This feature's placement is not D1-dependent — the surface has no standing entry anywhere, story 4, so the arc's placement question never touches it.)

  • D4 — the kit share rewires A5 (DDR 0203 gate 1; default applied: share — one idiom for one promise, the ticket's preferred position). A veto retires story 8 and slice 5 (app:a5-rewire): A5 keeps its current implementation and the accepted cost is two idioms for one promise. Stories 7, 9–11 re-scope to the dashboard side only — the kit LogsScreen still ships, because the dashboard mount and #763's embedded face need it regardless.
  • D5 — the SSE hub (DDR 0203 gate 2; default applied: SSE in, scoped to logs). A veto swaps the transport for its named fallback: bounded-tail polling on the same catalogue/scope contract at the house re-read cadence (the injected-client + cadence pattern every other surface uses). That retires stories 33–34 (the hub and the SSE endpoint) and rewrites stories 21–24 (stream lost becomes the shared async-guard fault frame — a failed read with retry, no auto-backfill) and the backfill clauses of 23 and 26; story 18's guards shrink to the render cap; story 12's meta line states the poll cadence instead of the follow count. Stories 1–17, 19–20, 25–32 and 35–40 stand — the intent wiring, the shared screen, paused, S0x, the catalogue, the download, the door and the tokens are all transport-independent. The fallback knowingly misses lines between polls on raw service units; that dishonesty is why the DDR ruled SSE in.
  • Gate 3 — the idle-pause budget (default applied: 5 minutes, the prototype's). Pure taste: a different budget changes one constant and S2's copy; no story retires (story 25's value updates).

Implementation-time notes

  • docs/ux/flows/p5-monitoring.mermaid already carries its S3 → P10-S1 edge (landed with the DDR); the other emitters' flows are not re-drawn — their Open/Download affordances carry ADR 0027's standing rule.
  • The E1 wireframe depicts existing screens (P5-S3, P4-S4) to show the edge; design-verify must match those elements against their own canonical wireframes, not E1.
  • The prototype (matou-distributed-servers, LogsConsole.vue + Go internal/logstream/) is a reference for mechanics only — the hub/ring/guard engineering transfers; nothing visual does.
  • CONTEXT.md rules the copy: say follow, log target, log scope, streaming / stream lost / paused / nothing followable; never tail (jargon), console (say logs surface), disconnected (say stream lost), offline (that's nodes), or live view (say streaming). Paused is deliberate — its copy never apologises and never implies failure.

Produced by /to-spec in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #760.

## Parent Program map: [#7 — Wayfinder map: OurCloud v1 program scope (Phase 0)](https://git.matou.nz/Matou/idss/issues/7). Design ticket: [#760 — control-panel observability: logs surface in the dashboard (wire the dropped open-logs intents)](https://git.matou.nz/Matou/idss/issues/760) (the arc was filed from the 2026-08-24 `matou-distributed-servers` comparison rather than charted on the map; the map's v1 scope is what it lands inside). Design tier this spec is written against (all present, all `accepted`): - **DDR** [`docs/adr/0203-design-the-dashboard-logs-surface-streams-in-place.md`](https://git.matou.nz/Matou/idss/src/branch/main/docs/adr/0203-design-the-dashboard-logs-surface-streams-in-place.md) — the ruling DDR: one kit logs screen with two mounts and an embeddable scoped-tail face, SSE ruled in scoped to logs, the `--oc-term-*` vocabulary, in-place mounting with no standing entry, the followable-targets catalogue, the operator-only door, the honest level-chip split. - **Flow** `docs/ux/flows/p10-logs.mermaid` (+ the one new `p5-monitoring.mermaid` edge S3 → P10-S1; the other emitters' flows already carry ADR 0027's standing affordance and are not re-drawn). - **Wireframes** `docs/ux/wireframes/p10-logs/` — `p10-e1-entry-points`, `p10-s1-logs-streaming`, `p10-s1x-stream-lost`, `p10-s2-paused-still-watching`, `p10-s0x-nothing-followable`. Their `data-field` / `data-action` / `data-status` attributes are the stable element-ID contract every acceptance criterion below is written against. (E1 *depicts* existing emitting screens to show the edge — `design-verify` matches those elements against their own wireframes, not E1.) - **Vocabulary** `CONTEXT.md` — *Log target*, *Log scope*, *Follow* (Language) and *Logs surface (P10) object-states* (Design nouns), merged with the arc. Siblings in the same observability arc (each specs separately, then all fan in at one `/slice-map`): #759 device telemetry (specced as #769 — its kit primitives are this spec's status-dot dependency), #761 network, #762 replication matrix, #763 activity feed (its P12-S5 consumes this spec's scoped-tail face), #764 topology map (deferred). ## Problem Statement The panel has been promising logs it cannot show. ADR 0027 rules Open / Download logs onto every deploy, update, rescue and monitoring surface — and the dashboard's screens duly offer them: monitoring's service drill-in, provisioning's deploy and rescue screens, the updates rollout screens, the mail readiness pair all emit `open-logs` / `download-logs`. But `DashboardComposition` binds only `@route`, so **every one of those emits is silently dropped** (`FleetSurface` parks its own as a `PendingRoute` translation that nothing answers). An operator watching a deploy hang, or standing on "chat is down 4 min", clicks *Open logs* and nothing happens. The logs viewer that does exist (A5) lives only in the Electron operator app, over the bounded operation log. The served dashboard — the surface an operator actually has open when a service misbehaves — has no logs surface at all, and no way to watch a live line arrive. For the low-skill, low-time operator this product is built for, the honest workaround is "SSH in", which is exactly what they cannot do. Logs are the escalation path that makes every plain-language diagnosis recoverable (download and hand the evidence to a helper); a promise-shaped button that does nothing is worse than no button. ## Solution **The shell answers every emitter, in place, with one shared screen.** Three things land: 1. **The dropped intents are wired.** `DashboardComposition` binds `open-logs` / `download-logs` beside `@route`; every emitter converges on one intent-with-scope shape. `open-logs` mounts the logs surface **in place over whichever tab's screen emitted it** (the SetupSurface-on-Fleet drill-in pattern) — no seventh tab (ADR 0094), no navigation the operator didn't ask for, and **no standing entry anywhere** (the rescue tabless posture): an operator is led to logs by an emitting surface, never left to find them. `download-logs` mounts nothing — it fetches the bounded log artifact for the same scope as a direct browser download. 2. **One kit logs screen, two mounts, one embeddable face** (the codes-ledger precedent). The kit gains `LogsScreen`: the screen owns the controls (scope, search, level chips, pause, download) and the terminal panel; **the feed is a seam-injected source with two faces**. The app mounts it over A5's bounded operation-log read (contract preserved — a static feed is always "complete", so the stream-lifecycle chrome never appears there); the dashboard mounts it over the live stream source, which alone renders the stream's object-states — *streaming / stream lost / paused / nothing followable*, each a rendered frame (P10-S1 / S1x / S2 / S0x). The same component also exposes a **scoped-tail face** — the terminal panel with its live/paused/lost states, without the controls chrome — which the activity feed's select-event pairing embeds (DDR 0206, P12-S5). No second log reader exists anywhere. 3. **SSE is ruled in, scoped to logs.** The control plane gains a **log-stream hub** (the prototype's `logstream` mechanics ported: ref-counted follows, tail 200 on subscribe, 200 lines/s per-target cap, 2000-line ring for instant backlog, drop-oldest; slow subscribers drop lines rather than block) behind **one SSE endpoint** — `EventSource`, one-directional plain HTTP through the front door's gate, auto-reconnecting, no WebSocket machinery. Client guards ride with it: 2000-line client ring, 120 ms batched flush, 400-line render cap, 5-minute idle auto-pause with the "Still watching?" resume, pause on `document.hidden` with auto-resume. Every other dashboard read keeps its re-read cadence; live logs are the one surface where polling is genuinely wrong. What is followable is a server-side truth: a **log scope** (an operation log, a service, a node, or a subject reference) resolves through the control plane's **followable-targets catalogue** to **log targets** — bounded, replayable operation logs (the `LogRef` ids today's emitters carry, unchanged) and live service units. The whole surface, stream endpoint included, sits behind the community door, operators only (DDR 0172); no public tier exists, so no redaction tier is needed, and A5's secrets-never-enter-logs-by-construction rule stands. **Level filtering is honest**: operation logs carry structured levels, so there the chips filter authoritatively; raw service lines carry none, so there the chips are a named text-match heuristic — never presented as monitoring's classification. ## User Stories ### A — The shell answers every emitter (E1; the dropped intents wired) 1. As an operator, I want *Open logs* to actually open logs from every surface that offers it, so that ADR 0027's promise is kept instead of silently dropped. - **Given** any mounted dashboard screen that carries the standing affordance (monitoring P5-S3/S4x, provisioning P4-S4/S5/S5x, updates P4b-U1/U3/U4/U4x, mail MAIL-S1/S1x), **When** the operator activates its `data-action="open-logs"` control, **Then** the logs surface mounts, scoped to the emitting subject's log targets — the emit is bound in the one composition and no emitter's intent is dropped or parked. - **Given** the same screens' `data-action="download-logs"`, **Then** that intent is likewise bound (stories 19–20). 2. As an operator, I want the logs surface to land in place, so that opening logs never costs me my place in the panel. - **Given** `open-logs` emitted from a screen on tab T, **When** the surface mounts, **Then** P10-S1 renders in place over T (the SetupSurface-on-Fleet drill-in pattern), the browser URL is unchanged, no seventh tab appears (ADR 0094), and no modal is used. - **Given** the mount, **Then** it is the shell's: one binding in the composition answers every emitter, and no feature grows a private logs panel (ADR 0097 — shell giving a cross-cutting surface its home is not shell running a feature journey; the A5 parallel). 3. As an operator, I want Back to return me exactly where I was, so that the logs surface reads as a look, not a move. - **Given** any P10 frame, **When** the operator activates `data-action="back-to-emitter"`, **Then** the emitting screen resumes with its place held — no tab change ever happened. 4. As an operator, I want no standing Logs entry anywhere, so that I am led to logs by the thing that needs them, never left to browse them. - **Given** the whole dashboard, **Then** logs have no tab, no menu row and no route of their own (the rescue tabless posture, DDR 0101 §3) — the surface is reached only through an emitter's intent. 5. As a maintainer, I want every emitter converging on one intent-with-scope shape, so that a new surface gains logs by emitting, never by wiring. - **Given** all current emitters, **Then** each emits `open-logs` carrying a log scope (an operation log reference, a service, a node, or a subject reference); `FleetSurface`'s `open-log-<id>` `PendingRoute` translation converges on the same shape. - **Given** the arc's siblings, **Then** the activity feed (#763) opens this surface through the same intent contract — two doors in (mount or embedded face), one contract. 6. As an operator, I want opening logs on a subject with nothing to follow to land somewhere honest, so that an empty scope is never a dead click. - **Given** `open-logs` whose scope resolves to at least one log target, **Then** P10-S1 mounts streaming; **Given** a scope that resolves to none (service not deployed yet, operation log gone), **Then** P10-S0x mounts (stories 30–32) — never a blank terminal and never a toast. ### B — One kit screen, two mounts, one face (DDR 0203 ruling 1) 7. As a maintainer, I want one shared logs screen in the kit, so that the panel has one idiom for its one cross-cutting promise. - **Given** the kit's `LogsScreen`, **Then** it owns the controls (scope, search, level chips, pause, download) and the terminal panel, and its feed is a seam-injected source — the screen renders what the source declares and computes no truth of its own. - **Given** the whole product, **Then** no second bespoke log viewer exists in either surface (the exact drift ADR 0027 exists to prevent). 8. As an operator in the app, I want A5 unchanged in behaviour, so that the share is invisible to me. - **Given** the app's A5 mount over its bounded operation-log read, **Then** its existing contract is preserved: the operation filter, search, level chips filtering authoritatively on the entry's structured level, and the shareable *Download bundle* — and the secrets-never-enter-logs-by-construction rule stands (a log entry has no field a secret could ride in on). - **Given** a static (bounded) feed, **Then** it is always "complete": the stream-lifecycle chrome — the standing line's live/lost/paused states — never appears on A5. 9. As an operator in the dashboard, I want the live mount to tell me the stream's own truth, so that liveness is a stated fact, not an assumption. - **Given** the dashboard mount over the stream source, **Then** that source alone drives the lifecycle states, and every state is a rendered frame: *streaming* (P10-S1), *stream lost* (P10-S1x), *paused* (P10-S2), *nothing followable* (P10-S0x). 10. As a sibling surface, I want an embeddable scoped tail, so that I can show live lines without leaving my own frame. - **Given** the kit screen's **scoped-tail face**, **Then** it renders the terminal panel with its streaming/paused/lost states and without the full surface's controls chrome, and it is the same kit component the mount uses — the activity feed's P12-S5 (DDR 0206) embeds it; no second log reader exists either way. 11. As a maintainer, I want the stream indicator to be the arc's own primitive, so that the observability surfaces stay one visual language. - **Given** the standing line's streaming/paused/lost dot, **Then** it wears DDR 0202's status-dot primitive (#759's `OcStatusDot`) — referenced, never re-minted here. ### C — Streaming (P10-S1) 12. As an operator, I want a standing line that states what I'm following and how live it is, so that the stream's truth is always one glance away. - **Given** the surface streaming, **Then** `data-field="stream-standing"` (`data-status="streaming"`) renders the live dot and the scope's name, and `data-field="stream-meta"` states the honest bounds in plain terms — live, the follow count, how much tail is kept and how many newest lines are shown. 13. As an operator, I want the log lines readable and graded, so that a scan finds the error without reading every word. - **Given** the terminal panel, **Then** `data-field="log-stream"` (`data-status="streaming"`) renders each line with its timestamp and source in the dim ink and its message in the terminal ink, success lines in the ok ink and error lines in the err ink — every colour an `--oc-term-*` token (story 39). - **Given** the product mount, **Then** log lines render at the mono secondary size (0.85rem / 0.9em, line-height ~1.65, the ADR 0122 type-scale amendment) — never the prototype's 11.5px or the artboard's micro sizes. 14. As an operator, I want to see and change what is being followed, so that I can walk from the emitting subject to a neighbouring target without starting over. - **Given** P10-S1, **Then** `data-field="log-scope"` names the resolved scope (e.g. the service and its unit count); **When** the operator picks another log target from it (a service unit, a node, an operation log — the catalogue's rows, story 32), **Then** the surface re-follows in place (the S1 → S1 re-scope edge) with the standing line and meta updated. 15. As an operator, I want search to narrow lines within my scope, so that filtering and following stay different ideas. - **Given** text in `data-field="log-search"`, **Then** only matching lines render; the scope, the follow and the hub subscription are unchanged (a filter narrows lines within a scope — CONTEXT.md's distinction). 16. As an operator, I want the level chips to be honest about what they can know, so that a chip never impersonates monitoring's judgement. - **Given** a followed operation log (structured entries), **When** a chip (`data-action="filter-info"` / `"filter-warn"` / `"filter-error"`) is active, **Then** it filters authoritatively on the entry's level. - **Given** followed raw service lines (no structured level), **Then** the chips filter by a named text-match heuristic and the surface says so — the match is never presented as monitoring's classification (severity stays monitoring's word). 17. As an operator, I want to pause on purpose, so that I can freeze the tail to read it. - **Given** streaming, **When** the operator activates `data-action="pause-stream"`, **Then** the surface rests on the P10-S2 frame with its copy reading that the operator paused the stream (story 28), and the follow is released. 18. As a maintainer, I want the client to guard itself, so that a busy stream cannot degrade the browser. - **Given** the stream source, **Then** it keeps a 2000-line client ring, flushes to the screen in 120 ms batches, and renders at most the newest 400 lines — and the meta line states the bounds rather than the client pretending to totality (dropped-line detection is out of scope; the bounds are the honesty). ### D — Download logs (no screen) 19. As an operator, I want *Download logs* to hand me the evidence directly, so that escalating to a helper is one act. - **Given** any state of the surface, **When** the operator activates `data-action="download-logs"`, **Then** the bounded log artifact for the current scope downloads as a direct browser download — nothing mounts, no screen appears, and a running stream keeps running (the S1 self-edge). - **Given** an emitting screen's own `data-action="download-logs"`, **Then** the same fetch happens for the emitter's scope without the surface ever mounting. 20. As an operator in the app, I want A5's bundle untouched, so that the remote-helper path I know keeps working. - **Given** the app face, **Then** its *Download bundle* keeps producing the shareable bundle exactly as today — the dashboard's artifact download is the same idea for the dashboard's scopes, not a replacement of the app's. ### E — Stream lost (P10-S1x) 21. As an operator, I want a lost stream to be named the moment it is lost, so that I am never reassured by a frozen scroll. - **Given** the follow drops mid-stream (gateway or hub stopped answering), **Then** the surface renders P10-S1x: `data-field="stream-standing"` flips to `data-status="stream-lost"` with `data-field="stream-meta"` stating that nothing shown below is current, and the tail freezes visibly dimmed and end-marked (`data-field="log-stream"` `data-status="stale"`) — never a stale scroll under a live dot (DDR 0096). 22. As an operator, I want the loss explained as a rendered state, so that failure is never a toast or a silent spinner. - **Given** P10-S1x, **Then** `data-field="stream-lost-banner"` (`data-status="reconnecting"`) names the wall-clock moment the stream was lost, states that the lines below stop there — they are what arrived, not what is happening now — and states that reconnection is automatic. - **Given** the kept tail, **Then** it stays readable (it is evidence), dimmed, with the loss end-marked in the terminal itself. 23. As an operator, I want recovery to need nothing from me, so that a blip heals itself. - **Given** *stream lost*, **When** the stream reconnects, **Then** it backfills from the hub's ring, the stale mark clears, and the surface returns to P10-S1 (`data-status="streaming"`) with no operator act required. 24. As an operator, I want the loss boundaries kept straight, so that one failure never wears another's face. - **Given** the whole panel loses the community, **Then** the dashboard's existing unreachable state takes over — S1x is the *stream's* loss, not the panel's. - **Given** P10-S1x, **Then** `data-action="back-to-emitter"` remains offered — the operator can leave a lost stream for the emitting screen. ### F — Paused (P10-S2) 25. As a community, I want a forgotten logs tab to cost the fleet nothing, so that observability never becomes load. - **Given** 5 minutes pass without an operator act on the streaming surface, **Then** it rests on P10-S2: `data-field="stream-standing"` reads `data-status="paused-idle"` with the meta stating no lines are being followed, `data-field="idle-prompt"` (`data-status="paused-idle"`) asks "Still watching?" and names why streaming paused, and the hub follow is released (the ref-count decrements; at zero the upstream follow ends). 26. As an operator, I want resume to be one act, so that answering "still watching?" costs nothing. - **Given** P10-S2, **When** the operator activates `data-action="resume-stream"`, **Then** the stream reconnects, backfills from the hub's ring, and the surface returns to P10-S1. 27. As an operator, I want a hidden tab to pause and resume by itself, so that I never manage the stream's lifecycle for the browser. - **Given** the browser tab goes hidden while streaming, **Then** the follow pauses; **When** the tab becomes visible again, **Then** it resumes by itself — this pause has no resting frame, and the operator never sees P10-S2 for it. 28. As an operator, I want paused, lost and live kept as three different truths, so that a deliberate rest never reads as a failure. - **Given** any pause (idle or the operator's own), **Then** the terminal renders `data-field="log-stream"` `data-status="paused"` with the tail end-marked as paused and an invitation to resume; the operator's own pause rests on the same frame with its copy naming that the operator paused it; and nothing on the frame is dressed as lost (nothing failed) or as live. 29. As an operator, I want to be able to leave a paused surface, so that pausing is never a trap. - **Given** P10-S2, **When** `data-action="back-to-emitter"` is activated, **Then** the emitting screen resumes, place held. ### G — Nothing followable (P10-S0x) 30. As an operator, I want an empty scope named, so that "nothing here" is designed, not defaulted. - **Given** an `open-logs` scope that resolves to no log target, **Then** P10-S0x renders with `data-field="no-targets-reason"` stating in plain language *why* this subject has nothing to follow (e.g. no running unit on any node yet; no deploy has run so no operation log exists) — never a blank terminal (the never-empty spirit). 31. As an operator, I want to be offered what the fleet *can* follow, so that the empty state is a door, not a wall. - **Given** P10-S0x, **Then** `data-field="followable-targets"` lists the control plane's real catalogue — each row naming the target and its class (a live service unit, a finished replayable operation log) with `data-action="follow-target"` — and **When** the operator picks a row, **Then** P10-S1 opens streaming that target (the S0x → S1 edge). 32. As a maintainer, I want one catalogue read behind both offers, so that two controls can never disagree about what is followable. - **Given** the control plane's followable-targets catalogue read, **Then** S1's scope control (story 14) and S0x's offer list both render it verbatim — the catalogue is the one answer to "what can be followed right now". ### H — The hub, the catalogue and the stream transport (DDR 0203 rulings 2 and 5) 33. As a maintainer, I want the hub to protect the fleet from its watchers, so that a log stream can never become a load problem. - **Given** the control plane's log-stream hub, **Then** follows are ref-counted (many subscribers to one target share one upstream follow; the last unsubscribe releases it), a new subscriber receives the last 200 lines as instant backlog, each target is capped at 200 lines/s, and each target keeps a 2000-line ring with drop-oldest. - **Given** a slow subscriber, **Then** it drops lines rather than blocking the hub or its peers. 34. As a maintainer, I want one boring stream transport, so that live logs ride the front door like everything else. - **Given** the stream, **Then** it is one SSE endpoint consumed by `EventSource` — one-directional, plain HTTP through the front door's gate, auto-reconnecting — with no WebSocket upgrade machinery. - **Given** the rest of the dashboard, **Then** SSE stays scoped to logs: every other read keeps its re-read cadence, and no other surface gains a stream by riding this one. 35. As an operator, I want both kinds of logs under one contract, so that "follow it" means the same act everywhere. - **Given** the followable classes, **Then** an **operation log** (deploy runs, rescue actions, update rollouts — the `LogRef` ids today's emitters carry, unchanged) is bounded and replayable start-to-now, live-tailing while the operation runs; and a **service unit** is a live tail plus the hub ring's backlog, with no history beyond the ring. 36. As a maintainer, I want scope resolution server-side, so that no browser ever guesses what a service runs on. - **Given** a log scope (an operation log, a service, a node, or a subject reference), **Then** the control plane resolves it to log targets (a service resolves to its units); the activity feed's subject-kind scope (#763, DDR 0206) rides the same resolution — two doors in, one contract. 37. As a maintainer, I want the contract in the spec, so that the transport stays generated, not hand-rolled. - **Given** the OpenAPI spec, **Then** it grows the followable-targets catalogue read, the SSE stream route and the bounded log-artifact fetch; wire stays snake_case, camelised at the client boundary; the catalogue and artifact reads ride the generated client (ADR 0037) — the stream alone rides `EventSource`, a declared exception, never a hand-rolled fetch elsewhere. 38. As a community, I want the whole surface behind the community door, so that logs are the operator's evidence and nobody else's. - **Given** every route this spec adds — catalogue, artifact and the SSE stream included — **Then** it sits behind the community door, operators only (DDR 0172): `EventSource` rides the same community session cookie, the gate's `forward_auth` covers the SSE route like any admin route, and an unauthenticated caller is refused with nothing streamed. - **Given** no public tier exists, **Then** no redaction tier is built, and the secrets-never-enter-logs-by-construction rule (A5) stands unchanged. ### I — The terminal vocabulary (DDR 0203 ruling 3) 39. As a maintainer, I want the terminal's colours to be kit tokens, so that every log line in the product is painted from one place. - **Given** the kit's base layer, **Then** its `:root` declares the six terminal tokens — `--oc-term-bg`, `--oc-term-ink`, `--oc-term-dim`, `--oc-term-ok`, `--oc-term-warn`, `--oc-term-err` — at DDR 0203's values, as product language on the ADR 0122 token split (the community palette seam is untouched). - **Given** the components, **Then** zero raw hex: every terminal colour is worn as its token. 40. As an operator, I want the terminal deliberately dark in both themes, so that logs read as logs everywhere. - **Given** either theme, **Then** the terminal panel grounds on `--oc-term-bg` (only that token ever varies per theme; its dark-mode re-point rides the dark-mode slice — out of scope here), timestamps, sources and end-marks wear the dim ink, and success/warning/error lines wear their inks — one vocabulary across the dashboard mount, the app mount and the embedded face. ## Implementation Decisions ### Seams — one new control-plane seam at its highest point; everything else grows existing ones - **The one new seam class is the hub's follow seam** (the prototype's `FollowFunc` shape): the hub asks "give me this log target's line stream" through an injected function, and everything above it — ref-counting, tail, rate cap, ring, SSE framing — is testable without a fleet. This is the highest point the new machinery can be cut at, and it is the only new seam class the spec mints. - **The shared screen's seam is the injected feed source, with two faces.** The static face is A5's existing bounded entries contract (unchanged); the stream face wraps `EventSource` behind a thin transport boundary so a fake `EventSource` can drive every lifecycle state in tests. The client guards (ring, flush, render cap, idle timer, visibility pause) live in the stream source, never in the component. Rejected: a second bespoke dashboard viewer — two idioms for one cross-cutting promise, the drift ADR 0027 exists to prevent. - **The intent is the wiring contract.** `open-logs` carries a log scope (operation log reference | service | node | subject reference); `DashboardComposition` binds the emits and hosts the overlay at the current mount — one binding answers every emitter, present and future (#763 included), and `FleetSurface`'s `open-log-<id>` `PendingRoute` translation converges on the same shape. Shell composes and computes nothing (ADR 0097): the surface is shell's on both sides, as A5 already is. - **Resolution and cataloguing are server-side.** The control plane owns "what is followable right now" as one catalogue read and owns scope → target resolution; the dashboard renders the answer verbatim. This is what makes stories 6, 31, 32 and 36 checkable rather than front-end discipline. - **The chips' honesty is structural, not copy-deep.** The feed source declares whether its lines carry structured levels; the screen derives chip mode (authoritative filter vs named text-match) from that declaration — no surface ever decides for itself to present a heuristic as a classification. - **Transport per ADR 0037**: the OpenAPI spec is the contract; the catalogue and bounded-artifact reads ride the generated client; wire snake_case camelised at the boundary. The SSE route is in the spec but consumed by `EventSource` — the one declared exception, scoped to logs. - **Not adopted from the prototype:** raw hex and micro type (everything re-encodes as `--oc-*` tokens at the ADR 0122 type floor), containers as the target model (log targets are the domain word), Pinia, an unauthenticated stream, dropped-line counters (the meta line states the bounds instead), and hand-fed topology (the catalogue is the control plane's own truth). ### Surface - **In place, no standing entry.** P10 mounts over the emitting tab's screen with `← back` returning place-held — the SetupSurface-on-Fleet / P8-S7-on-Backups drill-in pattern; the six-tab set stays closed (ADR 0094); the rescue tabless posture (DDR 0101 §3) carries over whole. - **Every P10 frame's `data-field` / `data-action` / `data-status` attributes are the built contract**, carried verbatim from the wireframes so `design-verify` can check the shipped UI against them. - **The stream's object-states are the frames**: streaming / stream lost / paused / nothing followable, exactly CONTEXT.md's P10 nouns; hidden-tab pause is the one state with no resting frame (auto-resumes on visible). - **The kit gains `LogsScreen`** (controls + terminal + lifecycle states + the scoped-tail face) **and the six `--oc-term-*` tokens**; the app's A5 becomes a mount of it (contract preserved — gate D4); the dashboard's mount is new. The streaming/paused/lost dot wears #759's status-dot primitive. ### Collection and streaming - **The hub lands with this feature, not before** (the ticket's sequencing): the `logstream` port (ref-counted follows, tail 200, 200 lines/s cap, 2000-line ring, drop-oldest, slow-subscriber drop), the catalogue read, the SSE route and the bounded-artifact fetch. - **Idle pause is a resource posture, not UX polish**: a forgotten tab must not hold hub follows open against the fleet — 5 minutes (gate 3's default), resume is one act, and the release is real (the ref-count decrements). - **`LogRef` is unchanged.** Operation logs remain the bounded, replayable class they are today; the hub adds live service units beside them, not instead of them. ## Testing Decisions A good test states externally-observable behaviour at a seam and never reaches into implementation detail. One new seam class (the hub's follow seam); everything else rides existing patterns: 1. **The shared-screen seam (kit).** `LogsScreen` driven against hand-written fakes of both feed faces, asserting on the wireframes' `data-field` / `data-action` / `data-status` contract: the static face never shows lifecycle chrome; the stream face renders all four object-states; chips filter authoritatively vs by named heuristic per the source's declaration; search narrows without re-following; the scoped-tail face renders the terminal + states without controls. Prior art: the shared codes-ledger tests (`enrollmentCodes.test.ts`), `calloutVocabulary.test.ts`, the kit theming tests. 2. **The dashboard mount seam.** The composition binding and the overlay driven with a fake stream source and a fake `EventSource`: every emitter's `open-logs` mounts in place scoped to its subject (none dropped), back resumes the emitter place-held, no standing entry exists, S1 vs S0x on catalogue resolution, stream-lost freeze/end-mark/auto-backfill, idle pause releases the follow and resume reconnects, hidden-tab pause/resume, download fetches without mounting. Prior art: `dashboardShell.test.ts`, `fleet.test.ts`, `monitoringDrillIn.test.ts`, `surfaceFaultFrame.test.ts`. 3. **The hub seam (control plane).** The hub at its follow seam, the prototype's `hub_test` / `demux_test` / `follow_test` ported as prior art: one upstream follow per target however many subscribers, release at zero, tail-200 on subscribe, the 200 lines/s cap, ring drop-oldest at 2000, a slow subscriber drops lines while its peers keep streaming. 4. **The transport seam.** Integration tests for the new routes: the catalogue read returns the real followable answer (a service resolves to its units; a subject with nothing resolves to an empty, reasoned answer), the SSE route streams framed events and refuses an unauthenticated caller with nothing streamed, the artifact fetch returns the bounded log for a scope, faults map to the shared Problem body, and the generated client camelises the catalogue. Prior art: the existing Go route integration tests and the dashboard's live-client tests (`provisionLive.test.ts`, `membersLive.test.ts`). Cross-cutting checks ride existing harnesses: the theming contract tests (the six new tokens exist at `:root`, zero raw hex in components, ADR 0122) and the client-guard unit tests at the stream-source module (ring 2000, 120 ms flush batching, 400-line render cap, the idle timer, the visibility handlers — all against fakes and fake timers, no real stream). ## Out of Scope - **Log retention and history search.** Beyond the hub's ring and the bounded operation logs there is no history; indexing, retention windows and search-over-time are a later arc. - **Log-based alerting.** Watching a line and raising on it is monitoring's world; this surface renders, never judges. - **Custom multi-target follow sets.** Scope resolution plus the catalogue's single picks is v1; composing arbitrary target sets is not offered. - **Dropped-line detection for slow clients.** The bounds are stated in the meta line instead (DDR 0203's ruling); counters and gap markers are not built. - **The dark-mode terminal re-point.** `--oc-term-bg`'s dark value rides the dark-mode slice (ADR 0122); this spec declares the tokens light-theme-complete with the terminal dark in both themes. - **A member-facing tier.** Operators only behind the community door (DDR 0172); with no public tier there is no redaction tier. - **The emitting surfaces themselves.** Every emitter exists; this spec binds their intents and changes none of their screens (E1 depicts them; their own wireframes stay canonical). - **The activity feed's surface (#763).** Its P12-S5 embeds this spec's scoped-tail face and its select-event pairing rides the same scope contract; the feed itself is its own spec. - **New log content.** What services and operations log is untouched; A5's secrets-never-enter-logs construction is inherited, not re-engineered. - **A5 feature growth.** The rewire preserves the app viewer's contract exactly; it adds nothing to it. ## Further Notes ### Vertical slices (named for the fan-in `/slice-map`) 1. **`ui-kit:logs-screen`** — `LogsScreen` (controls + terminal + lifecycle states + the scoped-tail face) and the six `--oc-term-*` tokens. Depends cross-arc on `ui-kit:telemetry-primitives` (#769 slice 1) for the status-dot; **#763's P12-S5 depends on this slice's face**. 2. **`control-plane:logstream-hub`** — the hub at its follow seam: ref-counted follows, tail 200, rate cap, ring, drop-oldest. Depends on nothing new. 3. **`transport:logs-catalogue-and-stream`** — the OpenAPI catalogue read, the SSE stream route behind the community door, and the bounded-artifact fetch. Depends on 2. 4. **`shell:logs-mount`** — the composition binding (every emitter, one intent shape), the in-place overlay, the stream source with its client guards, and the four frames S1 / S1x / S2 / S0x. Depends on 1 and 3. 5. **`app:a5-rewire`** — A5 becomes a mount of the kit screen, contract preserved (gate D4's subject). Depends on 1. Cross-arc note for the fan-in: slice 1 is a consumer of #759's primitives root and a **provider to #763**; slice 3's scope resolution is what #763's subject-kind pairing rides. Slice 5 is deliberately last and severable (see D4). ### The DDR's open gates (ADR 0174 — async veto, proposed defaults applied) DDR 0203 is `accepted` with three decisions held open for Ben; per the #769 ruling-1 precedent this spec proceeds on the DDR's defaults, and each gate maps to exactly the stories its veto would retire. (This feature's placement is not D1-dependent — the surface has no standing entry anywhere, story 4, so the arc's placement question never touches it.) - **D4 — the kit share rewires A5** (DDR 0203 gate 1; default applied: **share** — one idiom for one promise, the ticket's preferred position). A veto retires story 8 and slice 5 (`app:a5-rewire`): A5 keeps its current implementation and the accepted cost is two idioms for one promise. Stories 7, 9–11 re-scope to the dashboard side only — the kit `LogsScreen` still ships, because the dashboard mount and #763's embedded face need it regardless. - **D5 — the SSE hub** (DDR 0203 gate 2; default applied: **SSE in**, scoped to logs). A veto swaps the transport for its named fallback: **bounded-tail polling on the same catalogue/scope contract at the house re-read cadence** (the injected-client + cadence pattern every other surface uses). That retires stories 33–34 (the hub and the SSE endpoint) and rewrites stories 21–24 (*stream lost* becomes the shared async-guard fault frame — a failed read with retry, no auto-backfill) and the backfill clauses of 23 and 26; story 18's guards shrink to the render cap; story 12's meta line states the poll cadence instead of the follow count. Stories 1–17, 19–20, 25–32 and 35–40 stand — the intent wiring, the shared screen, paused, S0x, the catalogue, the download, the door and the tokens are all transport-independent. The fallback knowingly misses lines between polls on raw service units; that dishonesty is why the DDR ruled SSE in. - **Gate 3 — the idle-pause budget** (default applied: **5 minutes**, the prototype's). Pure taste: a different budget changes one constant and S2's copy; no story retires (story 25's value updates). ### Implementation-time notes - `docs/ux/flows/p5-monitoring.mermaid` already carries its S3 → P10-S1 edge (landed with the DDR); the other emitters' flows are not re-drawn — their Open/Download affordances carry ADR 0027's standing rule. - The E1 wireframe **depicts** existing screens (P5-S3, P4-S4) to show the edge; `design-verify` must match those elements against their own canonical wireframes, not E1. - The prototype (`matou-distributed-servers`, `LogsConsole.vue` + Go `internal/logstream/`) is a **reference for mechanics only** — the hub/ring/guard engineering transfers; nothing visual does. - `CONTEXT.md` rules the copy: say **follow**, **log target**, **log scope**, **streaming / stream lost / paused / nothing followable**; never *tail* (jargon), *console* (say logs surface), *disconnected* (say stream lost), *offline* (that's nodes), or *live view* (say streaming). Paused is deliberate — its copy never apologises and never implies failure. --- *Produced by `/to-spec` in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #760.*
Author
Owner

Withdrawn — race duplicate. The interactive session drafted this in parallel while asleep mid-claim; the session-runner overrode the stale claim (its 05:33Z comment on #760) and published the canonical spec #791, which the slice-map fan-in (#770, commit 44cd080, docs/slices/observability.yaml) and /to-tickets have already consumed. This duplicate is closed in #791's favour. Any materially unique findings from this draft are being transferred to #791 as comments.

**Withdrawn — race duplicate.** The interactive session drafted this in parallel while asleep mid-claim; the session-runner overrode the stale claim (its 05:33Z comment on #760) and published the canonical spec **#791**, which the slice-map fan-in (#770, commit `44cd080`, `docs/slices/observability.yaml`) and `/to-tickets` have already consumed. This duplicate is closed in #791's favour. Any materially unique findings from this draft are being transferred to #791 as comments.
ben closed this issue 2026-08-25 16:20:37 +00:00
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.

Dependencies

No dependencies set.

Reference
Matou/idss#836
No description provided.