Skip to content

Workbench redesign — Stage 4: Reintroduce Observe (J3) #378

Closed

Description

@nockawa

Execution plan: claude/design/Apps/Workbench/stages/stage-4-observe.md · Inputs: Stages 1–3 (unified bus + context-bar scope + live SSE + gauges canvas + SaveReplayDialog + DS-2/3/1 bases) · depends on #376 (Stage 3).

Goal: Mount the redesigned live-attach surfaces onto the finished shell — the engine-live-health view (consolidated health surface) plus the J3 ergonomic glue: anomaly → time-scope jump (GAP-21), an actionable reconnect / shutdown banner, and a one-gesture Capture & Analyse (freeze → save → reopen as Trace) (GAP-22). Today's live signals are scattered across the status bar, the timeline overload strip, and side panels; the freeze → save → reopen flow is three separate gestures. J3 makes "watch live → notice → freeze → analyse" feel like one continuous motion.

Exit gate: the J3 E2E green end-to-end — watch live (mock-profiler + with-anomalies) → anomaly Jump to time narrows the timeline → Disconnect freezes the stream → Capture & Analyse saves the buffer and reopens it as a Trace session (lands in J2) — within J3's click budget, the UC-OBS-* primary tests green, the engine-live-health surface passing conformance D / E / F / H. Out of the gate: the live → schema pivot (engine API G1 — schema-over-wire) — explicitly deferred (vision); the panel degrades gracefully without it.

Build order (dependency sequence — the J3 flow is the order)

Phase 1 — View shell + connection state (the spine).

  • 1. engine-live-health panel — header (status dot + endpoint + uptime + tick count), placeholder gauges region, placeholder anomaly list, control row with Disconnect. Cold state for non-attach sessions (PC-2 / suite D).
  • 2. Dock / menu / palette wiring — register in DockHost.tsx components map; add to ZONE_D_VIEW_ACTIVE; attach default layout places it beside the Profiler; toggleViewEngineLiveHealth command + palette entry; View → Engine Health menu item.
  • 3. Disconnect wired to POST /api/sessions/{id}/profiler/disconnect (per AttachSessionRuntime.RequestDisconnect()) — session stays alive for inspection + Capture & Analyse.
    → Delivered J3 Phase 2 (Freeze): user can attach + freeze the live stream while the session stays open.

Phase 2 — Live gauges (consolidated health — GAP-21 consolidation).

  • 4. Live gauges + sparklines + engine scalars — five gauge groups (Memory · Page Cache · Transient Store · WAL · Tx + UoW) plus the engine-level scalar tiles (tick rate · jitter · overload · queue · GC pauses · total ticks) wired through globalMetricsUpdated SSE deltas (~1 Hz, rAF-batched). Reused the existing gauges canvas (libs/profiler/canvas/gauges/region.ts + appendGaugeTracks) + the existing collapse / visibility toggles in useProfilerViewStore.
    → Delivered GAP-21 consolidation.

Post-P5 simplification (2026-05-26): the in-panel live-gauges canvas (5 groups) was removed from the Engine Live Health panel — the Profiler TimeArea is the canonical surface for those gauges, and duplicating them in a narrow right-edge panel produced labels-overflow + cramped sparklines without adding signal. The scalar tiles stay (tick rate · p95 · max · GC · total ticks); the panel is now header + tiles + anomaly log + controls. LiveGaugesRegion.tsx deleted; useLiveGaugeData retained because EngineHealthScalars still consumes its windowed-ticks + GC-events derivations. AC4.4 scope updated: gauges-in-panel deliverable supplanted by "gauges live in the timeline (canonical)" — no functional regression.

Phase 3 — Anomaly stream + anomaly → time jump (GAP-21 jump).

  • 5. Anomaly detection — client-side heuristics over the live globalMetrics stream (overload > P95 baseline · GC pause > N ms · jitter > N ms · queue backpressure spike). Anomaly model: { tick, kind, value, magnitude, timestamp }.
  • 6. Anomaly log — sortable list in the panel; per-row "jump" affordance sets the global time scope to the anomaly's tick window (useProfilerViewStore.commitViewRange); "jump to last" button.
  • 7. with-anomalies trace fixture — server-side C# (TraceFixtureBuilder.BuildTraceWithAnomalies + FixturesController wiring); the one non-UI item, parallel to Stage 3's with-queries.
    → Delivered GAP-21 jump.

Phase 4 — Capture & Analyse + reconnect / shutdown banner (GAP-22).

  • 8. Capture & Analyse command — orchestrates: disconnect (freeze) → SaveReplayDialog → save-replay → open the saved file as a Trace session. One palette command + one button on the engine-live-health controls.
  • 9. Reconnect / shutdown banner — actionable banner when SSE drops ("Engine connection dropped — Reconnect or Capture what we have") and when the shutdown SSE event fires with incompatible-schema status ("Engine restarted with incompatible schema — Reconnect to a fresh session or Capture what we have"). Wired off useProfilerSessionStore.connectionStatus + the latest shutdown payload.
    → Delivered GAP-22.

Phase 5 — J3 E2E + per-view conformance + exit gate.

  • 10. E2E spec — j3-capture-analyse.spec.ts — watch → anomaly jump → freeze → Capture & Analyse → lands in J2 (saved replay opens as Trace), using mock-profiler + with-anomalies.
  • 11. UC-OBS-* tests — anomaly log records (UC-OBS-02), jump sets scope (UC-OBS-03), disconnect freezes (UC-OBS-04), save-replay writes file (UC-OBS-05), reconnect banner appears (UC-OBS-07 / 08).
  • 12. Per-view conformance — engine-live-health enrolled in D + E (conformance.test.tsx) + densityLint covers DOM chrome; F via the View menu / palette entry.
    → Closed the Stage-4 exit gate.

Cross-cutting: the panel reuses the existing gauges canvas (P2 — canvas DS-1-exempt, like the profiler timeline), the existing SSE stream (P1–P4), the existing save-replay dialog (P4), and the shared DS-2 / DS-3 bases from Stage 3.

Integration milestone — the J3 drill (continuous anchor)

  • After P1: attach → engine-live-health mounts with connection-state header + Disconnect; user can freeze the live stream while the session stays open.
  • After P2: + live gauges (five groups + engine metrics) stream and update under the SSE deltas — the consolidated health surface. (= GAP-21 consolidation)
  • After P3: + anomaly log records overload / GC / jitter / queue events; clicking "jump" narrows the global time scope to the anomaly's tick window. (= GAP-21 jump)
  • After P4: + Capture & Analyse is one gesture (palette + button); reconnect / shutdown banners are actionable. (= GAP-22)
  • After P5: + J3 E2E green (the full watch → notice → freeze → Capture & Analyse → lands in J2 journey). (= exit gate)

Acceptance criteria (each ↔ a conformance suite / UC-OBS / J3 E2E; all must be green)

  • AC4.1 — engine-live-health panel (the shell). Mounts on the attach default layout; non-attach sessions render an explained cold state ("Engine Health is available in Attach sessions only"). (UC-OBS-01; suite D)
  • AC4.2 — connection-state header. Reads connectionStatus + latestTickNumber from useProfilerSessionStore; the dot reflects the four states (connecting / connected / reconnecting / disconnected); uptime + tick count refresh as deltas arrive. (component unit + D, E)
  • AC4.3 — Disconnect. Disconnect button calls POST .../profiler/disconnect; the session stays alive (bus / nav history / Profiler timeline unaffected — RequestDisconnect() freezes ingestion only). (UC-OBS-04; E)
  • AC4.4 — live gauges (GAP-21 consolidation). Scalar tiles (tick rate · p95 · max · GC · total ticks) + the timeline gauges canvas render under the globalMetricsUpdated SSE stream; per-gauge collapse + visibility toggles work. Post-P5 update: the canonical surface for the 5 gauge groups is the Profiler TimeArea (the in-panel gauges canvas was removed — no functional regression). (UC-OBS-01 / 02; D, G)
  • AC4.5 — anomaly detection. Heuristic detector records { tick, kind, value, magnitude } for overload spikes, GC pauses, and jitter / queue spikes against the live metric stream. (unit against the with-anomalies fixture)
  • AC4.6 — anomaly → time jump (GAP-21 jump). Clicking an anomaly row or "jump to last" sets useProfilerViewStore.commitViewRange to the anomaly's tick window; the Profiler timeline narrows; the context-bar scope display reflects it. (UC-OBS-03, UC-XV-12; E) · Honest scope: the live-anomaly-jump half is unit-tested — mock-profiler doesn't emit anomalies live (P3-deferred); trace-mode kind-aware refactor of EngineLiveHealth is a follow-up.
  • AC4.7 — Capture & Analyse (GAP-22, one gesture). One palette command + a button on the engine-live-health controls performs disconnect → save-replay → reopen-as-Trace; the user lands in J2 (Profiler) on the saved replay. (UC-OBS-05 / 06; J3 E2E)
  • AC4.8 — reconnect / shutdown banner (GAP-22). SSE-drop and shutdown events surface as actionable banners ("Reconnect" / "Capture what we have"); incompatible-schema shutdown is explicitly distinguished from a generic drop. (UC-OBS-07 / 08; E)
  • AC4.9 — J3 E2E (headline). j3-capture-analyse.spec.ts green — watch live (mock-profiler + with-anomalies) → anomaly jump → freeze → Capture & Analyse → lands in J2 — within the click budget. (exit gate)
  • AC4.10 — per-view conformance. engine-live-health passes D (PC-2 cold state) / E (PC-6 no broken affordances); H (densityLint text-fs-*) covers DOM chrome; F via panel focus + the View / palette entries.
  • AC4.11 — with-anomalies fixture. Server-side TraceFixtureBuilder.BuildTraceWithAnomalies populates a deterministic trace with overload + GC + jitter + queue spikes in known ticks; FixturesController exposes it via the same pattern as with-queries. (test infra)

Scope of "done" (excluded by ID — must degrade, not stub): the live → schema pivot (engine API G1 — schema-over-wire) is out of the Stage-4 done-bar. A "what is this component?" click from a live span renders an explained degraded state ("Schema is not available on a live attach session — open the captured replay to inspect").

Risks / out of scope

  • API G1 (no schema-over-wire on attach) — the panel is perf-only; live → schema pivot stays graceful-degraded. Full live-schema is engine-protocol work, deferred to vision.
  • with-anomalies fixture is the one non-UI item (parallel to Stage 3's with-queries). Without it, anomaly + J3 E2E can't run deterministically; shipped server-side in P3.
  • Reconnect semantics are subtle. Silent TCP retry is by-design for transient drops; the banner only fires for unrecoverable drops (Init signature mismatch / explicit shutdown SSE) and for the user-initiated freeze. Avoid noisy banners on every blip.
  • Anomaly thresholds are heuristic — defaults derived from P95 baselines (overload multiplier > 2× baseline; GC pause > 16 ms; jitter > 33 % of tick budget). Expose tuning later — open question §6 of the view spec.
  • Reintroduction gating — flipped EngineLiveHealth in ZONE_D_VIEW_ACTIVE only when D / E green; pre-P2 / P3 phases shipped meaningful skeletons rather than blank space.
  • Default layout-by-kind — attach session's default DockHost layout accepts the new panel additively (no Trace / Open impact).
  • Additive API only — Stage 4 needs no new engine API (live stream, disconnect, save-replay all exist); GAP-21 / 22 are pure UI consolidation.
  • Out of scope: live → schema pivot (API G1 — engine-protocol work, vision) · Component go-to-source from live span (engine GAP-14 / G4 — degrades) · multi-session compare from live + frozen (GAP-18 — vision) · anomaly threshold tuning UI (P5 follow-up; documented heuristic defaults shipped in P3) · Live → call-tree (call tree is Trace-only by design; Capture & Analyse is the path).

Activity

  1. self-assigned this
    on May 26, 2026
  2. moved this to In Progress in Typhon devon May 26, 2026
  3. moved this from In Progress to Done in Typhon devon May 28, 2026
  4. nockawa commented on Jun 29, 2026

    @nockawa
    CollaboratorAuthor

    Closing as done. Workbench redesign Stage 4 (Observe) shipped via #379 — all 11 acceptance criteria ticked; stage-4-observe.md records the J3 exit gate green and the EngineLiveHealth/ panel is in main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions