Skip to content

Workbench redesign — Stage 3: Reintroduce Profile + Query (J2) #376

Closed

Description

@nockawa

Execution plan: claude/design/Apps/Workbench/stages/stage-3-profile.md · Runways: 08-api-evolution.md, 09-shell-evolution.md · depends on #375 (Stage 2).

Goal: Mount the redesigned zone-D Profile + Query views onto the finished shell — timeline → drill → scheduling, plus the query sub-journey — one at a time, each conformant. Two structural consolidations happen here (reintroduction = the redesigned view, not a re-enable): the GAP-19 Query Analyzer (QueryCatalog+QueryPlanTree+ExecutionInspector → 1 first-class view) and Data Flow Timeline/Matrix (DataFlow+AccessMatrix → 1 toggle view). One selection drives every view via the bus. All of Stage 3 is refactor-existing (every panel exists, gated in viewRegistry); the one genuine non-UI item is building the with-queries trace fixture.

Exit gate: the J2 drill E2E green end-to-end — E2E-J2.1 (slow-tick → span → call-tree → source), J2.2 (query workload sub-journey), J2.3 (scheduling cluster shares one selection) — within J2's click budget, the UC-PROF-* / UC-QRY-* primary tests green, every reintroduced view passing conformance D/E/F/H (+G for colored views). Out of the gate: E2E-J2.4 (regression diff) = GAP-18 / Compare-Diff, deferred to Later (needs the multi-session rewrite).

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

Phase 1 — Timeline spine (owns the time scope)

  • 1. Profiler timeline — minimap + tick overview + time area; Trace/Attach default center; range/tick → visible global time scope (context bar, linked + unlink, snap-to-tick). (GAP-11 wiring, GAP-01)
  • 2. Top Spans — follows the scope; re-ranks; span → bus Span + System projected (≠ leaf). (GAP-05 consumer)

Phase 2 — Drill to cause (the J2.1 spine)

  • 3. Call Tree — scoped open (span/system/phase/window); off-CPU split (lock/IO/GC); sandwich (callers/callees). (GAP-17)
  • 4. Source Preview — frame → file:line; degrade gracefully when attribution absent. (GAP-14 degraded)

Phase 3 — Scheduling cluster (one selection drives all)

  • 5. System DAG + Critical Path + Data Flow — bus-driven off the projected System; merge DataFlow+AccessMatrix → Data Flow (Timeline/Matrix toggle) preserving selection. (GAP-05 consumer) · 3A: Data Flow⊕Matrix merge + AccessMatrix removed. 3B: linked/unlink scope toggle + cluster panels read the effective scope. 3D: DAG/CP gate-flips + conformance + wb-pane-header focus cue + "Reveal in System DAG" handoff (engine auto-show); SystemDag snapshot button removed (subtraction). 3E: useProfilerSelectionStore retired — the cluster runs purely off the bus leaf.

Phase 4 — Query sub-journey (the GAP-19 consolidation — concentrated risk)

  • 6. Query Analyzer — new view merging QueryCatalog+QueryPlanTree+ExecutionInspector (Catalog/Plan/Executions tabs); navigator entry + G Q; ranked by total cost, sort/filter, duplicate flag. (GAP-19) ✅ 4B+4C: master/detail QueryAnalyzer panel — ranked catalog (TotalWallNs) + detail header + Plan tab (lazy React-Flow, structural/execution modes) + Executions tab (phase breakdown, GAP-11 client-side time-scope w/ unlink, "Show in plan"); bus query in/out; G Q chord + View-menu + palette + navigator entry; useProfilerNameMaps extracted (subtraction).
  • 7. Query↔timeline jump — execution Jump to time → global scope [StartTs,EndTs]. (GAP-20, client-only) ✅ 4D-1: "Jump to time" on the selected execution → animateViewportToRange (ns→µs /1000); handoffMatrix test + live (window narrowed to the execution's 50 µs span).
  • 8. Build the with-queries trace fixture — server-side C# (query defs + executions w/ stats); the J2.2 prerequisite. ✅ 4A: BuildTraceWithQueries (2 ranked View defs + executions/phases emitted via the engine's own [TraceEvent] encoders) + FixturesController wiring + round-trip integration tests; +1 engine InternalsVisibleTo friend (approved).

Phase 5 — Color consolidation (DS-2/3) — final, gated

  • 9. Profiler color → shared scales — categorical hue first (stable hue-per-object across timeline/DAG/flow/matrix); heat ramps = follow-up. Started only after P1–4 are built/tested/validated; needs in-depth manual visual sign-off. (DS-2/3) ✅ Phase 5: shared libs/color/{categorical,contrast} base — 3 parallel system/span palettes + 2 luminance utils collapsed (libs/colors.ts deleted, dbMapColors re-exports). System identity reads in: timeline lanes (chunk keyed on systemName), DAG nodes (6 px left band + 12 % alpha header tint, heat border preserved), Access-Matrix column headers, Query Analyzer owners, Critical Path bars (4 px leading-edge accent over phase fill). spanPalette toggle (Categorical default · Curated; v4 → v5 migrate). Live signed off.

Integration milestone — the J2 drill (continuous anchor)

  • After P1: worst tick → scope → Top Spans re-ranks → span → bus (+ System projected) → Inspector System ⊃ Span.
  • After P2: + Open in Call Tree (scoped/off-CPU/sandwich) → frame → Open in Source. (= E2E-J2.1)
  • After P3: + scheduling cluster all highlight the same bus System; Timeline↔Matrix preserves selection. (= E2E-J2.3) · capability delivered (3A/3B/3D); the formal J2.3 e2e spec stays R2-deferred with the rest of the shell rewrite.
  • After P4: + query sub-journey (catalog→plan→executions→phase→source) + execution Jump to time. (= E2E-J2.2) · capability complete (4B+4C catalog→plan→executions→phase + go-to-source; 4D-1 execution Jump-to-time); the formal J2.2 e2e spec stays R2-deferred with the shell rewrite, like J2.3.

Acceptance criteria (each ↔ a conformance suite / UC-PROF/QRY / J2 E2E; all must be green)

  • AC3.1 Profiler timeline (scope owner) — opens here; minimap/tick/time-area; range → visible global scope (linked+unlink, snap). (UC-PROF-01/02, GAP-11; D, E)
  • AC3.2 Top Spans — follows scope; re-ranks; span → bus Span + System projected (≠ leaf). (UC-PROF-03/04; D + bus unit)
  • AC3.3 Call Tree — scoped (chips visible); off-CPU split; sandwich. (UC-PROF-05/06/13; D, E, F)
  • AC3.4 Source Preview — frame → file:line; absent attribution = explained degraded state. (UC-PROF-07; D, E)
  • AC3.5 Scheduling cluster shares one selection — DAG/Critical Path/Data Flow highlight same bus System; preserved across Timeline↔Matrix. (UC-PROF-08/09/10, UC-XV-08; E2E-J2.3) · 3D: DAG + Critical Path activated bus-driven; live-verified; Timeline↔Matrix preservation from 3A.
  • AC3.6 Data Flow consolidation — DataFlow+AccessMatrix merged (Timeline/Matrix toggle); old panels removed. (removed-symbols + E)
  • AC3.7 Query Analyzer first-class — 3 panels merged (Catalog/Plan/Executions); navigator + G Q; ranked/sort/filter/duplicate. (UC-QRY-01/02/03/04/05; D, E) · 4B+4C: merged master/detail view shipped + conformance-enrolled (jsdom-mountable via the lazy Plan tab); live-verified against with-queries.
  • AC3.8 Query↔timeline jump — execution Jump to time → scope [StartTs,EndTs]. (UC-QRY-07, UC-XV-12) · 4D-1: Executions "Jump to time" → global window via animateViewportToRange (ns→µs /1000); handoffMatrix.test.ts + live (window = the execution's 50 µs span).
  • AC3.9 Query go-to-source — opens call site; degrades if attribution absent. (UC-QRY-06; E) · 4D-1: the detail-header source link is the go-to-source verb (openInEditor); no verb when file:line absent (degrade). QueryDetailHeader.test.tsx + live.
  • AC3.10 Color (DS-2/3) — shared categorical scale; stable hue-per-object; onColor AA≥4.5:1. Phase-5 / gated; validated after P1–4 green; heat ramps follow-up; user sign-off. (suite G) · Phase 5 done: AA ≥ 3 over span categorical at both theme lightnesses + over every categorical hue (contrast.test.ts + colorForSpan.test.ts + extended categorical.test.ts); cross-view identity unit-tested for system / palette / DAG accent / QueryDetailHeader / QueryAnalyzerMaster; live signed off after widening the DAG identity from 3 px → 6 px band + header tint and adding the CP leading-edge accent.
  • AC3.11 Per-view conformance — state set (D), no broken affordances (E), keyboard+roving (F), density re-measure (H). Canvas DS-1-exempt — H covers DOM chrome. (parameterized) · All four suites covered for Stage-3 views: D+E via conformance.test.tsx (enrolment guard checks every active zone-D view that is not CANVAS_EXCLUDED — TopSpans / CallTree / SourcePreview / CriticalPath / QueryAnalyzer enrolled; DAG / DataFlow / Profiler / DbMap are canvas-exempt per the design caveat); F via panelFocus.test.ts (generic F6 / Shift+F6 cycling) plus per-view keyboard bindings — Query Analyzer now implements design §6: ↑ / ↓ / Home / End catalog nav (onCatalogKeyDown in QueryAnalyzerMaster) + [ / ] Plan ↔ Executions cycle + s go-to-source at the panel root (skips inputs / textareas / contenteditable); H via the global densityLint.test.ts text-fs-* rule. New tests: 2 in QueryAnalyzerMaster.test cover the arrow-key nav (1257 total).
  • AC3.12 J2 E2E (headline) — J2.1 + J2.2 + J2.3 green within click budget. (exit gate) · e2e/j2-drill.spec.ts shipped 2026-05-26: J2.1 (Call Tree drill: tree renders → frame dblclick → /api/profiler/open-in-editor handoff fires) + J2.2 (Query Analyzer: catalog → row → Plan tab canvas → Executions list → Jump-to-time → Profiler timeline → go-to-source link) + J2.3 (cluster mounts with per-system content from the trace's SystemDefinitionRecord[] — system-dag-node-Movement/system-dag-node-Damage + data-flow-panel-root). 3/3 green in ~7 s. Cross-panel selection PROPAGATION within the cluster stays covered by data-flow.spec.ts (4 tests) + handoffMatrix.test.ts (unit) — this spec is the cluster-mount + J2.1 drill + J2.2 sub-journey regression net.
  • AC3.13 Subtraction — QueryCatalog/QueryPlanTree/ExecutionInspector + AccessMatrix removed; menu/palette entries gone. (E + removed-symbols) · AccessMatrix (3A) + the 3 query panels DELETED (4D-2): panels/stores/commands/palette/registry entries removed, reused leaf modules relocated into panels/QueryAnalyzer/, removedSurfaces.test.ts guards re-introduction (3 view ids + 6 command exports + 3 palette ids + 5 modules); live: palette no longer lists them, the Analyzer still ranks/opens.
  • AC3.14 Handoff matrix green — Span→Call Tree, frame→Source, Span→System highlight {DAG,CP,Flow,Matrix}, Query→Plan/Executions, Execution→time, Query→source. (UC-XV-08/11/12) · all listed pairs green: Span→Call Tree/Source (P2), Span→System cluster + "Reveal in System DAG" (3D), Query→Plan/Executions (4B+4C), Execution→time + Query→source + (§6) target→Component/Archetype Inspector + owner→System DAG (4D-1; handoffMatrix.test.ts + live).
  • AC3.15 Profiler selection on the bus — useProfilerSelectionStore retired; cluster/Top-Spans highlight off the bus projection. (bus unit + regression) · 3E: silo deleted; writers + readers flipped to the bus leaf; ProfilerSelection type moved to traceModel; removed-symbols guard added.
  • AC3.16 PC-1 preferences persist — Call Tree off-CPU+scope; Data Flow last mode; Query Analyzer sort/filter; profiler legend/gauge toggles. (PC-1) · All slices wired: Data Flow last mode (useDataFlowViewStore); profiler legend + gauge toggles (useUiPrefsStore + useProfilerViewStore); Query Analyzer sort/filter (useQueryCatalogStore persists sort + search + systemFilter + archetypeFilter via safeStorage v1; clearFilters() wipes trace-specific filters on session change while sort survives); Call Tree off-CPU + direction + group-by-category (new useCallTreePrefsStore — the off-CPU split (viewMode), fold direction, and category grouping are user-of-the-tool prefs that survive reload AND session change; the Call Tree's scope stays correctly session-scoped via useCallTreeScopeStore — only the lenses persist). Tests: useQueryCatalogStore.test + sessionReset.test + useCallTreePrefsStore.test (1255 total).

Risks / out of scope

  • GAP-19 is a consolidation, not a port (concentrated risk) — 3 query panels → 1; subtract & unify, delete as the replacement lands; placed last as its own phase to keep the diff reviewable. (Done: 4B+4C built the Analyzer; 4D-1 wired hand-offs; 4D-2 deleted the 3 panels.)
  • with-queries is hidden server scope (verified absent 2026-05-24) — must be built server-side (trace fixture: query defs + executions w/ stats); the one non-UI item; size Phase 4 accordingly. (Built in 4A.)
  • Profiler-selection strangler — bus already mirrors useProfilerSelectionStore (Stage 1); flip consumers, retire the silo; don't add plumbing.
  • Density × canvas — profiler canvas is DS-1-exempt; don't density-scale ctx.font; H covers DOM chrome only.
  • Color is the final gated pass — behavior-neutral visual change; categorical hue first, heat ramps follow-up; needs user sign-off.
  • Reintroduction gating — flip each ZONE_D_VIEW_ACTIVE entry → true only when conformant (D/E/F/H green), so main never regresses.
  • Additive API only — any call-tree sandwich/bottom-up delta ships in the same PR; GAP-19/20 need no API.
  • Out of scope: regression diff / Compare (GAP-18, = J2.4 — multi-session rewrite) · real go-to-source / Open-session revision (GAP-14/G4) · live engine-health / anomaly / reconnect (GAP-21/22 = Stage 4) · DS-2/3 heat ramps · write/edit · Stage 4 views.

Activity

  1. self-assigned this
    on May 24, 2026
  2. moved this to Ready in Typhon devon May 24, 2026
  3. moved this from Ready to In Progress in Typhon devon May 24, 2026
  4. nockawa commented on May 24, 2026

    @nockawa
    CollaboratorAuthor

    Phase 1 — Timeline spine (Profiler timeline + Top Spans) — approved plan

    Key finding: Phase 1 is ~80% pre-built — the panels, canvas renderers, stores, dock registration + default layout, context-bar scope display, and the bus mirror all exist; Stage 0 only gated them off. So Phase 1 = re-enable + 2 small wirings + conformance + e2e un-ignore.

    Acceptance criteria

    • P1.1 (←AC3.1) Trace/Attach opens with the Profiler timeline (locked center) + Top Spans; context bar shows the time window; tick/range select narrows it; commit snaps to tick boundaries; linked/unlink toggle present. (un-ignored profiler e2e + snap-to-tick unit + manual)
    • P1.2 (←AC3.2) Top Spans follows scope + re-ranks; span click sets bus leaf span + projects owning system (≠ leaf); Inspector shows System ⊃ Span. (selection-store bus test + selectionChain test + manual)
    • P1.3 (←AC3.11) Top Spans enrolled in conformance D/E/F/H; Profiler in CANVAS_EXCLUDED; enrollment meta-test + densityLint green.
    • P1.4 (regression) Full vitest suite green; Open sessions unaffected; tsc/eslint/build clean.

    Work items

    1. viewRegistry.ts: Profiler/TopSpans → true.
    2. useProfilerSelectionStore.ts: project owning system on span/chunk/phase select (load-bearing).
    3. useProfilerViewStore.ts + ContextBar.tsx: snap-to-tick on commit + linked/unlink toggle.
    4. conformance.test.tsx: enroll Top Spans; add Profiler to CANVAS_EXCLUDED.
    5. playwright.config.ts: un-ignore the timeline/top-spans specs (call-tree/source stay for Phase 2).

    Deviations (approved): Profiler → CANVAS_EXCLUDED (canvas, like File Map; Top Spans carries registry conformance) · unlink-toggle effect exercised in Phase 3 (no other scope consumers yet) · AC3.15 (retire useProfilerSelectionStore) is Phase 3, not Phase 1.

    Branch: feature/wb-revamp.

  5. nockawa commented on May 24, 2026

    @nockawa
    CollaboratorAuthor

    Phase 1 — Timeline spine — implemented ✅ (ready for review + commit)

    Branch feature/wb-revamp. Gates: tsc ✅ · eslint ✅ · vitest 1157 ✅ (was 1151: +4 resolver, +2 Top Spans D/E) · vite build ✅.

    What shipped

    • Build items 1 & 2 done — Profiler timeline + Top Spans reintroduced (gate flip in viewRegistry.ts; DockHost/MenuBar/palette were already pre-wired on isViewActive). After-P1 integration milestone met (timeline opens, scope narrows, span → bus + Inspector).
    • AC3.2 done — span/chunk selection now projects the owning System onto the bus (System ⊃ Span resolves; cluster-ready for Phase 3). A span carries no system, so a pure resolveOwningSystem(selection, chunks) helper (libs/profiler/model/owningSystem.ts, unit-tested 4/4) resolves it via chunk-containment; TimeArea.routeSelection calls setSystem (projection ≠ leaf). Infra spans (WAL/checkpoint/page-cache/GC) → no system (null clears).
    • AC3.11 (these two views) — Top Spans enrolled in conformance D/E/F/H; Profiler added to CANVAS_EXCLUDED (canvas, like File Map). Enrollment meta-test + densityLint green.

    Deviations from the plan (all flagged, none silent)

    1. AC3.2 lives in a resolver + TimeArea, not the store — SpanData carries only a thread slot, not a system; the owning system is the chunk occupying that slot (a containment query needing tick data, which the store lacks). Approved mid-flight.
    2. Snap-to-tick already satisfied — the minimap commits whole-tick ranges (TickOverview); no code needed.
    3. Linked/unlink toggle deferred to Phase 3 — its only consumer (the cluster) lands in P3; shipping it now would be a dead control (PC-6). Approved.
    4. AC3.15 (retire useProfilerSelectionStore) is Phase 3 — the mirror works; retiring flips the cluster consumers.

    ⚠️ R2 materialized — profiler e2e specs need rewriting for the redesigned shell

    The pre-Stage-0 profiler specs assert OLD-shell behaviours (the ?time= viewport-on-canvas-click sync, session switch-without-close chrome, per-file viewport restore, /aggregate coalescing) that Stages 1–2 rewrote. Un-ignoring them surfaced 6 failures unrelated to Phase 1 (my changes don't touch those paths; 2/8 render canaries pass). They're kept ignored with a note; rewriting them is a focused Stage-3 e2e pass, not a Phase-1 line item. Phase-1 functional proof rides the unit/component suite + the render canaries + manual.

    Recommended manual spot-check: open a trace → click a span on the timeline → confirm the Inspector shows the span with a System ⊃ Span ancestor (the one AC3.2 path no automated test covers end-to-end on canvas).

  6. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Fix (found in review): Profiler timeline docked in the left edge, not the center

    The gate flip exposed a latent bug in DockHost.buildDefaultLayout (trace/attach branch): the Profiler panel was added with no position, so a no-position addPanel joined the active group — which was the left edge (the navigator was added just before it). The view rendered, so the canaries + conformance passed; only the placement was wrong, and no test covers panel placement.

    Fix: add Profiler first (no position → it establishes the center grid), then the edge groups + their panels — mirroring the proven open-mode Schema Explorer ordering. Plus bumped the dock-layout store key v7 → v8 so pre-existing saved layouts/templates that captured the buggy left placement are discarded (centered timeline loads on first open, not only after Reset Layout — same pattern as the Stage-2 v7 bump).

    Verified live (trace fixture, viewport 1799px): Profiler group at x=260, w=1219 (center), between the left nav (x=0–260) and the right Detail (x=1479); Logs/Top-spans in the bottom edge. Full suite still 1157 green.

    Files: DockHost.tsx, useDockLayoutStore.ts.

  7. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 2 — Drill to cause (Call Tree + Source Preview, incl. sandwich) — approved plan

    Verified findings (from the DTOs/server, not the prose): Call Tree + Source Preview are fully-built gated views (re-enable is Phase-1-style mechanical). Off-CPU is already done (viewMode: on-cpu|wall-clock + the §8.7 involuntary-stall nodes -2/-3/-4). Sandwich is the one real gap — and contained, because top-down already supports frameRoot (= callees of a focus), so sandwich = bottom-up(frameRoot=X) [callers] ⊕ top-down(frameRoot=X) [callees], composed client-side into two panes. Server needs only a direction field + a FoldBottomUp — response shape unchanged.

    Acceptance

    • P2.1 Call Tree re-enabled; span → Open in Call Tree (scoped); view-mode + off-CPU stalls.
    • P2.2 direction (top-down/bottom-up/sandwich): bottom-up = leaf-rooted callers tree; sandwich = callers+callees panes. (C# FoldBottomUp unit tests on the with-cpu-samples fixture + controller test + client + live.)
    • P2.3 Source Preview re-enabled; frame → file:line; degraded state when attribution absent.
    • P2.4 conformance enroll both (DOM); viewRegistry + commandRegistry gate-state updates.
    • P2.5 client suite + dotnet build + Workbench server tests green; no Open-session regression.

    Server (C#): CpuCallTreeDtos.cs (+Direction), CallTreeFolder.cs (+FoldBottomUp, leaf→root, reuse scope cursor + §8.7), CpuCallTreeCache (key), ProfilerController (branch). Client: gate flip + toggle-view-call-tree palette cmd + useCallTree direction + CallTree.tsx direction toggle (bottom-up render; sandwich two panes) + conformance/gate-state tests.

    Deviations (approved): sandwich client-composed (response unchanged); e2e deferred (R2). Live placement check included (the Phase-1 lesson). Branch feature/wb-revamp.

  8. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 2 — Drill to cause (Call Tree + Source Preview, incl. sandwich) — implemented ✅ (ready for review + commit)

    Branch feature/wb-revamp. Gates: client tsc · eslint · vitest 1161 · vite build — all green; server dotnet build + CallTreeFolderTests 22/22 (5 new FoldBottomUp).

    Acceptance

    • P2.1 Call Tree re-enabled (gate flip + missing toggle-view-call-tree palette cmd). Scope axes + view-mode + off-CPU were already built. Live: tree renders the with-cpu-samples frames.
    • P2.2 direction (top-down / bottom-up / sandwich): server CallTreeRequestDto.Direction + CallTreeFolder.FoldBottomUp (leaf→root, callers tree; frame-root = callers-of-X) sharing a FoldCore with top-down — unit-tested against the fixture's known stacks. Client toggle + bottom-up render; sandwich = two panes composing bottom-up(focus) ⊕ top-down(focus). Live: bottom-up renders; sandwich-without-focus shows the drill-in hint.
    • P2.3 Source Preview re-enabled (gate flip only — panel, bus-sync, degraded state all pre-built).
    • P2.4 CallTree + SourcePreview enrolled in conformance D/E (both DOM); viewRegistry + commandRegistry gate-state updated.
    • P2.5 No regression; Open sessions unaffected.

    Fix found in live verification (same class as Phase 1)

    toggleViewCallTree/openViewCallTree did a no-position addPanel → Call Tree opened in whatever group was active (the bottom Logs strip, y=846 h=200), despite the comment claiming "center area at full width". Fixed to open as a tab within the Profiler's center group. Verified live: now x=260, y=61, h=785 (center), sharesProfilerGroup: true. (The Query-view toggles carry the same latent pattern — they're gated until Phase 4, where they'll get the same fix.)

    Deviations (flagged)

    • Sandwich is client-composed — server gained only Direction + FoldBottomUp; response shape unchanged.
    • e2e deferred (R2) — profiler call-tree specs need rewriting for the redesigned shell.
    • Two-pane-with-focus verified by parts (server callers-fold unit-tested + composition tsc-clean + sandwich branch renders the no-focus hint live) — the visual two-pane with a drilled frame is worth a manual spot-check (drill a row → Focus tree → Sandwich).
    • orval regen skipped — the hook uses the hand-written CallTreeRequest (now carries direction); the generated DTO is stale-but-unused. Optional cleanup.

    Files — server: CpuCallTreeDtos.cs, CallTreeFolder.cs, CpuCallTreeCache.cs, ProfilerController.cs, CallTreeFolderTests.cs. Client: viewRegistry.ts, profilerCommands.ts, useCallTree.ts, CallTree.tsx, conformance.test.tsx, viewRegistry.test.ts, commandRegistry.test.ts.

  9. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 2 complete — Drill to cause (Call Tree + Source Preview)

    Closing out Phase 2 (and formally ticking Phase 1, which was done but never checked). Build items 1–4 + the After P1 / After P2 milestones are met; E2E-J2.1 (tick → span → call-tree → source) holds end-to-end.

    What shipped

    Server (additive, the one backend delta):

    • CallTreeFolder — new FoldBottomUp (callers, leaf→root) beside Fold (callees), both delegating to a shared FoldCore(bottomUp:…) + a Descend helper (no duplication). Same scope / view-mode / §8.7 involuntary-stall handling.
    • CallTreeRequestDto.Direction = "top-down" (backward-compatible default); ProfilerController branches on it; CpuCallTreeCache key includes it. Response shape unchanged — sandwich is client-composed (top-down ⊕ bottom-up @ same frame-root).

    Client:

    • Gate flips: CallTree + SourcePreview → active in viewRegistry.
    • Call Tree direction toggle (Top-down / Bottom-up / Sandwich two-pane); useCallTree carries direction.
    • Top Spans → bus Span + System projected (≠ leaf) via resolveOwningSystem (chunk-containment on the same thread slot).
    • Placement fixes (the recurring no-position addPanel bug): Profiler establishes the center grid; Call Tree opens center-tab.

    Polish from manual testing (this session):

    • Active-pane focus cue (wb-pane-header) added to Profiler, Top Spans, Call Tree, Source Preview, and the Systems navigator (which had no header bar).
    • Sandwich panes got the full row context menu (reusing CallTreeContextMenu) + drill.
    • Call Tree selected-row color now follows pane focus (accent when focused, grey when not) — pure CSS off .dv-active-group.

    Evidence

    • Client: full suite 1162/1162; tsc + eslint clean; production build green.
    • Server: CallTreeFolderTests 22/22 (FoldBottomUp suite incl. callers tree, frame-root, view-mode, §8.7 stalls); server code unchanged since.
    • Review gate: pass (server fold reviewed — shared core, correct inversion, category attribution, XML docs/comment-wrap; client standards OK).

    Deferred / open (not Phase-2 blockers)

    • AC3.1 ticked except its linked/unlink toggle, which the design defers to Phase 3 (its first scope consumer) — will tick then.
    • Profiler e2e specs (profiler-*.spec.ts) stay testIgnored (R2 — pre-Stage-0, need rewrite for the redesigned shell). Functional proof rides unit/component + live.
    • System ancestor in the Inspector — open design decision (it currently repeats the system name from the chunk card); candidate to suppress until Phase 3 gives it real content.
    • Orval regen optional (hook hand-extended for direction).

    Next: Phase 3 — scheduling cluster (System DAG / Critical Path / Data Flow⊕Matrix) + the linked/unlink toggle + retiring useProfilerSelectionStore. To be scoped before implementation.

  10. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3 · Step 3A complete — Data Flow ⊕ Access Matrix consolidation

    Approved plan: implement Phase 3 in sequence (3A→3E), 3A first. 3A = merge the two panels into one Data Flow view with a Timeline | Matrix mode toggle over the same systemArchetypeTouches data; remove the standalone Access Matrix. (Closes AC3.6; the AccessMatrix half of AC3.13.)

    What shipped

    • Unified store (useDataFlowViewStore): mode: 'timeline'|'matrix' (persisted, PC-1) + rowSort/colSort folded in from the deleted useAccessMatrixViewStore.
    • DataFlowPanel: mode branch → DataFlowMatrix (new — the old AccessMatrix body as a presentational child fed the parent's topology/granularity/touch-slice). [/] repurposed to mode-toggle (granularity → toolbar); default mode Timeline.
    • DataFlowToolbar: [Timeline|Matrix] segmented control; row/col sort shown only in Matrix, X-axis/Aggregate/filters only in Timeline; wb-pane-header focus cue.
    • Subtraction: AccessMatrix/ folder deleted; AccessMatrixGrid/matrixBuilding/matrixOrdering (+tests) moved into DataFlow/; removed from DockHost, viewRegistry (gone, not gated), toggle-view-access-matrix command, View menu. DataFlow flipped → active.

    Evidence (every AC has its proof)

    • A3A.1/A3A.4 (toggle + mode-conditional controls): DataFlowMode.test.tsx toolbar test + live — Matrix shows Rows/Columns, hides X-axis/Aggregate; Timeline the reverse.
    • A3A.2 (selection survives toggle; mode persists): jsdom test (matrix reads+writes bus system) + store test + live — clicked Movement in Matrix → ?system=Movement; Matrix→Timeline→Matrix round-trip kept Movement pressed (movementPressed:"true").
    • A3A.3 (subtraction): viewRegistry.test/commandRegistry.test updated; live — no "Access Matrix" in the View menu.
    • A3A.5 (regression): tsc + eslint clean; full suite 1169/1169; production build green. Diff is a real subtraction: −1747 / +699 (~−1050 net).

    Live verification

    with-archetype-touches fixture trace → View → Data Flow → Timeline renders (phase columns + tracks) → toggle Matrix renders the access heatmap (Movement/Damage × tracks, access-kind cells) → selection round-trips. Done in a real session, not just jsdom.

    Notes / deferred

    • data-flow.spec.ts stays testIgnored (R2) — and now needs rewriting for the consolidation (it drives Access Matrix as a separate tab), not just the shell redesign.
    • DataFlow joins CANVAS_EXCLUDED in conformance (uPlot calls matchMedia at import → crashes jsdom, like Profiler); Matrix-mode DOM covered by DataFlowMode.test.tsx.
    • Minor perf nit: timeline memos still compute in Matrix mode (tick-gated/memoized) — can gate on mode later.

    Next: 3B (linked/unlink scope toggle) · 3C (Inspector System-card enrichment — closes the System-ancestor redundancy) · 3D (DAG/CP gate-flips + focus cue + handoff/conformance) · 3E (retire useProfilerSelectionStore).

  11. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3 · Step 3B complete — linked/unlink global scope

    The Phase-1-deferred scope toggle (AC3.1's last piece). A single 🔗/🔓 toggle in the context bar governs whether the scheduling-cluster panels follow the timeline's global window or freeze on a pinned one.

    What shipped (docs-grounded — context-bar.md §4.2, profiler-timeline §6/§8, stage-3 §3)

    • Store (useProfilerViewStore): scopeLinked (default true) + pinnedRange + setScopeLinked (unlink freezes the current viewRange; relink clears it) + an exported selectEffectiveScope(s) resolver (live window when linked, frozen when unlinked). Session-scoped — reset to linked on each new session (ProfilerPanel cleanup), not persisted.
    • Context bar: 🔗/🔓 toggle beside the trace/attach scope readout; amber when unlinked; absent in Open sessions.
    • Consumers: the cluster panels' data range now reads selectEffectiveScope instead of raw viewRange — DataFlow (active → live consumer), SystemDag + CriticalPath (gated, wired for 3D). The timeline stays the sole writer of viewRange; the bar displays + governs.

    Design decisions (all resolved by the docs, none guessed)

    • Toggle lives in the context bar (not per-panel) — context-bar.md §4.2.
    • Flag stored with viewRange in useProfilerViewStore — context-bar.md data binding.
    • Semantics: unlinked = freeze on the window at unlink time (the standard "pin" pattern).
    • Bar always shows the live global scope; the 🔓 signals panels stopped following.

    Evidence

    • A3B.2 (store): useProfilerViewStore.scope.test.ts — default linked; unlink freezes + ignores later viewRange changes; relink resumes; selector is allocation-free (4/4).
    • A3B.1 (UI): ContextBar.test.tsx — toggle renders + flips in trace, absent in Open (6/6).
    • Live: with-archetype-touches trace — toggle present + linked by default; click → aria-pressed:false, "click to re-link", amber 🔓. The freeze itself is unit-proven + the consumer wiring is tsc-verified (DataFlow/SystemDag/CriticalPath read selectEffectiveScope).
    • Regression: tsc + eslint clean; full suite 1175/1175; build green.

    Deferred to 3D (when SystemDag/CriticalPath activate)

    • SystemDagToolbar's own snapshot readout still reads raw viewRange (its snapshot-vs-unlink interaction is a live-panel concern; the panel's data range already honors the toggle).
    • The after-P3 milestone + AC3.5 (cluster shares one selection across Timeline↔Matrix) close when the cluster is fully active (3D).

    Next: 3C — Inspector System-card enrichment (declared access; closes the System-ancestor redundancy you flagged) · then 3D · 3E.

  12. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3 · Step 3C complete — Inspector System card (declared access, PC-3)

    Enriches the Inspector's System card from a name echo to a real summary — phase + RFC-07 declared access (inspector.md §4.2, system-dag.md §4) — and consolidates the declared-access rendering to one place (PC-3). This closes the System-ancestor redundancy raised during Phase-2 testing.

    What shipped

    • New shared panels/schemaCommon/SystemAccessSummary.tsx — the single declared-access rendering (reads / fresh / snapshot / writes / side-writes / event read+write / resource read+write chips + a no-declaration note).
    • Inspector (DetailPanel): SystemDetailBody resolves the system from the cached useTopology and reuses the exported toNodeData() (byte-identical to the System DAG's data), rendering phase + SystemAccessSummary. Wired into both the System leaf card (SystemLeafCard) and the System ⊃ Span ancestor (replacing the one-line placeholder). No "Reveal in System DAG" verb yet — that view is gated until 3D (PC-6: no dead affordance).
    • Subtraction (PC-3): SystemDagSidePanel drops its inline AccessGroup/toneClasses/AccessTone + the 9 calls + note, rendering <SystemAccessSummary {...node} />. One declared-access rendering, two surfaces.

    Evidence

    • Unit: SystemAccessSummary.test.tsx (chips per group; empty groups omitted; event/resource sides; no-decl note) — 3/3. Inspector.test.tsx updated (System card shows the name, not the gated stub).
    • Live (with-archetype-touches trace → navigator → Movement): Inspector System card renders reads Game.Velocity · writes Game.Position · reads events Damage · writes resources world.physics — real declared access, not a name echo.
    • Regression: tsc + eslint clean; full suite 1178/1178; build green.

    Notes

    • No new AC checkbox: 3C is the PC-3 enrichment/dedup that feeds AC3.5 (cluster shares one selection) + AC3.14 (handoff) — neither fully met until the cluster panels are active (3D).
    • The ancestor (span→System) shares SystemDetailBody, so it's equally enriched; spans aren't in this fixture to click through, but the body is shared + unit-covered.

    Next: 3D — flip SystemDag/CriticalPath active + wb-pane-header cue + handoff/conformance (closes AC3.5 + the after-P3 milestone) · then 3E (retire useProfilerSelectionStore).

  13. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3D — Scheduling cluster activation (System DAG + Critical Path) — approved plan

    Design: claude/design/Apps/Workbench/stages/stage-3-profile.md §3 Phase 3 (AC3.5, AC3.11, AC3.14) · Branch: feature/wb-revamp

    Flips the last two cluster views from gated → active, closing AC3.5 (cluster shares one bus selection), the After-P3 milestone (E2E-J2.3), and contributing to AC3.14 (Span→System highlight in DAG/Critical Path) + AC3.11 (per-view conformance). Resolves the two items deferred into this phase.

    Key finding (verified): the cluster is already bus-wired — SystemDagPanel/CriticalPathPanel/DataFlowPanel all read/write useSelectionStore.system; none import useProfilerSelectionStore. So AC3.5 = activation + verification, not rewiring; retiring useProfilerSelectionStore stays 3E (AC3.15).

    Acceptance criteria

    • 3D.1 (AC3.5 / E2E-J2.3) SystemDag + CriticalPath active (View menu + palette + DockHost); cluster highlights the same bus System; span selection projects owning system to all. Proof: viewRegistry/commandRegistry gate-state tests + live multi-panel highlight.
    • 3D.2 (AC3.11) Both enrolled in conformance D/E; wb-pane-header focus cue on both toolbars; densityLint green.
    • 3D.3 (deferral A — subtract, user-approved) Remove the SystemDag "Snapshot last N ticks" button (it moved the global scope while the unlinked DAG stayed frozen). Auto-snapshot-on-first-open retained.
    • 3D.4 (deferral B + AC3.14) Live "Reveal in System DAG" verb on the Inspector System card → publishes System to the bus + opens/focuses DAG + recenters the node (engine systems auto-reveal by enabling "show engine tracks").
    • 3D.5 (regression) Full client suite + tsc/eslint/build green; Open sessions show no cluster views.

    Implementation

    • Activation: viewRegistry.ts (both → true); conformance.test.tsx enrolment; viewRegistry.test/commandRegistry.test gated→active; wb-pane-header on SystemDagToolbar/CriticalPathToolbar. Commands/menu/DockHost already exist behind the gate.
    • Deferral A: delete the snapshot button + handler + Camera import in SystemDagToolbar.tsx.
    • Deferral B: ephemeral pendingFocusSystem on useDagViewStore (not persisted); revealSystemInDag() shell fn (bus + ensureDockPanel, mirrors openDbMapForComponent); SystemDagPanel/Canvas consume → React Flow fitView + engine auto-show; DetailPanel System card verb (leaf-reveal-system-dag).

    Deviations (flagged)

    • Snapshot button removed (subtraction); auto-snapshot-on-open kept.
    • AC3.5 delivered by activation (already bus-wired); legacy-store retirement = 3E.
    • Reveal recenters via fitView + pending-focus (DbMap pattern); engine reveal auto-enables "show engine tracks".
    • e2e specs deferred (R2) — functional proof rides unit/component + live (same as 3A–3C).

    Out of scope

    3E (retire useProfilerSelectionStore / AC3.15) · Query Analyzer (P4) · color DS-2/3 (P5) · AC3.16 persistence · regression diff (Later).

  14. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3D complete — scheduling cluster activated (System DAG + Critical Path)

    The scheduling cluster is fully reintroduced. Build-order item 5, the After-P3 milestone, and AC3.5 are now checked. Phase 3 (3A–3D) is functionally done; Phase 4 (Query Analyzer) + Phase 5 (color) remain.

    Acceptance criteria — evidence

    • 3D.1 (AC3.5 / After-P3) ✅ SystemDag + CriticalPath flipped active in viewRegistry; both appear + enabled in the View menu and palette. The cluster is already bus-wired (SystemDagPanel/CriticalPathPanel/DataFlowPanel all read useSelectionStore.system / write setSystem; none import useProfilerSelectionStore), so activation delivers the shared selection. Proof: viewRegistry.test + commandRegistry.test (gated→active); live — selecting FencePrep highlights it in the DAG side panel; profiler span selection projects the owning system.
    • 3D.2 (AC3.11 portion) ✅ Conformance enrolment: CriticalPath DOM-mounted in VIEWS; SystemDag joins CANVAS_EXCLUDED (React Flow can't mount in jsdom — same as DataFlow), its D/E riding the dag* unit tests + the reveal handoff. wb-pane-header focus cue added to both toolbars. Proof: conformance.test (19) green; densityLint green.
    • 3D.3 (deferral A — subtract) ✅ The SystemDag "Snapshot last N ticks" button is removed (it moved the global scope while the unlinked DAG stayed frozen). Auto-snapshot-on-first-open retained. Proof: live — no Snapshot button in the DAG toolbar.
    • 3D.4 (deferral B + AC3.14 handoff) ✅ Live "Reveal in System DAG" verb on the Inspector System card → setSystem + requestFocusSystem (ephemeral pendingFocusSystem on useDagViewStore, excluded from persist) + ensureDockPanel; the canvas RevealController centres the node, and an engine-internal target auto-enables "show engine tracks". Proof: useDagViewStore test + Inspector test (verb enabled + click publishes both signals); live — revealing FencePrep flipped on engine tracks, surfaced the Fence DAG, and centred + highlighted the node.
    • 3D.5 (regression) ✅ Full client suite 1191 tests / 137 files green; tsc --noEmit + eslint + vite build clean; Open (.typhon file) sessions show no cluster views.

    Notes / deferrals

    • AC3.5 = activation, not rewiring — the cluster was already on the bus; legacy useProfilerSelectionStore retirement remains 3E (AC3.15).
    • AC3.11 / AC3.14 partially advanced (DAG/CP done; query-side completes in Phase 4).
    • e2e (R2) — the system-dag/critical-path specs stay ignored pending the shell rewrite; functional proof rides unit/component + live (same as 3A–3C).

    Files: viewRegistry.ts, SystemDagToolbar.tsx, CriticalPathToolbar.tsx, useDagViewStore.ts, SystemDagCanvas.tsx, openDbMap.ts, DetailPanel.tsx + tests (conformance/viewRegistry/commandRegistry/useDagViewStore/Inspector). Ready for review + commit.

  15. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3E — Retire useProfilerSelectionStore (strangler complete) — approved plan

    Design: stage-3-profile.md §6 AC3.15 + §7 "Profiler-selection strangler" · Branch: feature/wb-revamp

    Removes the now-redundant legacy silo. Since Stage 1 it's been a pure strangler mirror — setSelected writes its own state and useSelectionStore.select('span'|'tick', selection) with the full ProfilerSelection as the leaf ref. Everything that renders a profiler selection (DetailPanel → ProfilerDetail) already reads the bus leaf. Closes AC3.15 (the cluster + Top-Spans bus-highlight half was already verified in 3D — this is the silo deletion).

    Acceptance criteria

    • 3E.1 useProfilerSelectionStore.ts deleted; no source imports it (tsc + vite build are the structural guard); ProfilerSelection type moves to traceModel.ts (cycle-free — its deps SpanData/ChunkSpan/… already live there).
    • 3E.2 Writers publish directly to the bus — TimeArea routeSelection (select(...), keeps the AC3.2 setSystem(resolveOwningSystem) projection; canvas highlight via a derived bus selector), TickOverview, nav-history restore; cleanups → clearLeaf().
    • 3E.3 Readers read the bus leaf — openSchemaBrowser's Source-Preview subscription (re-pointed, filtered to leaf.type === 'span') + the show-source-current-span command. Behavior unchanged (span→file:line, chunk→system source).
    • 3E.4 Full suite + tsc/eslint/build green; DetailPanel/ProfilerDetail unchanged (already bus-leaf); recency unaffected (bus leaf carries touchedAt).

    Tests

    selectionBus.test profiler-law rewritten to the direct-bus path + a nav-restore→bus regression test; a removed-symbols absence guard in removedSurfaces.test.

    Deviations (flagged)

    • ProfilerSelection home = traceModel.ts (co-located with its deps), not uiTypes.ts.
    • Cleanups use clearLeaf() (leaf-only), matching the legacy store's narrow clear semantics.
    • Reader verification is live (the Source-Preview subscription needs a registered dock api — no-op in jsdom).

    Out of scope

    Phase 4 (Query Analyzer + with-queries) · Phase 5 (color) · AC3.16 persistence.

  16. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 3E complete — useProfilerSelectionStore retired (AC3.15 ✅)

    The legacy profiler-selection silo is deleted; profiler selections now live solely on the unified bus leaf. Net-negative diff — a subtraction, no new plumbing.

    What changed

    • Type move — ProfilerSelection (6-variant union) moved from the deleted store to libs/profiler/model/traceModel.ts (co-located with its constituents SpanData/ChunkSpan/… → zero new import, cycle-free). 8 importers repointed.
    • Writers → bus — TimeArea.routeSelection → useSelectionStore.select('span'|'tick', sel) (keeps the AC3.2 setSystem(resolveOwningSystem) projection; the canvas highlight now reads a derived bus selector); TickOverview tick-click → select('tick', …), range-drag → clearLeaf(); nav-history restore → select(...)/clearLeaf(); ProfilerPanel cleanup + resetSessionScopedState → clearLeaf() / dropped (bus clear() already covers it).
    • Readers → bus leaf — openSchemaBrowser Source-Preview subscription re-pointed to useSelectionStore (gated on leaf.type === 'span'); the show-source-current-span command reads the bus leaf.
    • Deleted stores/useProfilerSelectionStore.ts.

    Acceptance criteria — evidence

    • 3E.1 (AC3.15 deletion) ✅ Store gone; tsc + vite build clean prove no source imports it (the strangler is fully cut); ProfilerSelection resolves from traceModel.
    • 3E.2 (writers) ✅ Profiler selections written directly to the bus; AC3.2 System projection preserved. Proof: selectionBus.test profiler-law rewritten to the direct path (tick→tick, span/chunk/phase→span, full selection as the leaf ref).
    • 3E.3 (readers) ✅ Source-Preview subscription + command read the bus leaf (span→file:line, chunk→system source), behavior preserved. Type-checked; runtime needs a registered dock api → covered by clean app-load + the bus law.
    • 3E.4 (regression) ✅ Full client suite 1192 tests / 137 files green; tsc/eslint/vite build clean; app loads with zero console errors post-migration (rules out a circular import from the type move); DetailPanel/ProfilerDetail unchanged (already bus-leaf). Added a removed-symbols guard (removedSurfaces.test) so the silo stays retired.

    Honest scope note

    The synthetic fixtures don't surface clickable timeline spans at the default viewport, so I could not live-drive the full span-click→Inspector→Source-Preview drill (same limitation as the R2-deferred e2e specs). Coverage rides the rewritten bus law (the exact select the writers now call) + tsc (the cut is compiler-proven) + the clean post-migration load. DetailPanel/ProfilerDetail read paths were unchanged.

    Phase 3 (3A–3E) is now complete. Remaining on #376: Phase 4 (Query Analyzer + with-queries fixture), Phase 5 (color DS-2/3). Ready for review + commit.

  17. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 4A — with-queries trace fixture (the GAP-19 prerequisite) — approved plan

    Design: views/query-analyzer.md + stage-3-profile.md §3 Phase 4 + Profiler/11-query-definition-export.md · Branch: feature/wb-revamp

    Phase 4 (Query Analyzer, GAP-19) is sub-stepped 4A → 4D; this is 4A, the one genuine non-UI work item. The backend is verified ready (query DTOs + /profiler/queries* endpoints + QueryCatalogBuilder all exist), but every existing fixture has zero queries, so nothing query-related can be tested. 4A builds the fixture that 4B–4D's UI will consume.

    Key finding: the catalog ranks by Aggregate.TotalWallNs and the Executions tab lists executions — both reconstructed by QueryCatalogBuilder from QueryPlan spans + child phase spans, not from the QueryDefinitionDescribe/QueryArgs instants alone. So the fixture must emit the execution span tree. Tractable: every event ref struct has a typed EncodeTo(...), so the fixture drives the same encoders the engine does — no engine/profiler changes.

    Acceptance criteria (4A)

    • 4A.1 TraceFixtureBuilder.BuildTraceWithQueries writes a v11 trace: ≥2 ranked definitions (Views; Lookup@Position heavier, Range@AABB lighter), each with ≥2 executions (varying WallNs) + ≥3 phase child spans + OwnerSystemIdx + source→QuerySourceStringTable; system/component tables so ids resolve.
    • 4A.2 with-queries wired into FixturesController (POST /api/fixtures/trace).
    • 4A.3 Round-trip NUnit test: QueryCatalogBuilder over the fixture → 2 defs ranked by TotalWallNs, correct counts, non-zero percentiles, per-execution phases, resolved UserSource + OwnerSystemIds, selectivity/rows populated.
    • 4A.4 dotnet build + the new test green; existing Profiler round-trip suite unaffected (additive fixture, no wire change).

    Phase-4 sequence (after 4A)

    • 4B Query Analyzer shell + Catalog (merge the 3 panels' master) + useQueryAnalyzerStore + registry/command/menu/nav + G Q + bus Query.
    • 4C Detail tabs: Plan (reuse QueryPlanGraph) + Executions (reuse ExecutionInspector, time-scoped).
    • 4D Handoffs + Jump-to-time (GAP-20) + go-to-source + cross-pillar; delete the 3 old panels; conformance + handoff matrix.

    Verification

    dotnet build Typhon.slnx + dotnet test --filter ~Query; live (no UI needed): POST with-queries → open → GET /profiler/queries returns the 2 ranked definitions + executions/phases — proving the fixture→reader→builder→endpoint chain before the view exists.

    Deviations (flagged)

    • Fixture emits the full execution span tree (QueryPlan + phases), not just definitions — required for ranking + executions.
    • Views only (Kind=0) — EcsQueryId not in the engine yet; Kind discriminator still exercised.
    • Predicate field names show as Field[idx] (engine gap, cosmetic).
    • Synthetic fixture (hand-emits the structure a real run produces), like with-cpu-samples.

    Out of scope (4A)

    4B/4C/4D · Phase 5 color · scoped aggregates · engine EcsQueryId + field-name table.

  18. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Phase 4A complete — with-queries trace fixture (build-order item 8 ✅)

    The Query Analyzer prerequisite is built and proven faithful. Phase 4's UI work (4B–4D) can now be developed against real query data.

    What shipped

    • TraceFixtureBuilder.BuildTraceWithQueries — a v11 trace with 2 View query definitions over seeded components (Position/AABB) + a Movement system, each with 2 executions of varying wall time (def TestRider #1 = 140 µs total, def New persistence layer #2 = 60 µs → deterministic ranking), each execution carrying a Parse → Iterate → Filter → Count phase tree (rows-scanned/returned → selectivity), OwnerSystemIdx, and a QuerySourceStringTable so UserSource resolves. The execution/phase span tree is emitted via the engine's own [TraceEvent] encoders (QueryPlanEvent et al.) — faithful by construction, timestamped parent-before-child so the time-sorted decode satisfies QueryCatalogBuilder.
    • FixturesController — with-queries variant wired into POST /api/fixtures/trace.

    Acceptance criteria — evidence

    • 4A.1 / 4A.2 ✅ Fixture + wiring; Fixtures project builds.
    • 4A.3 (faithful — round-trip) ✅ Two new integration tests in QueryProfilerControllerTests drive the real chain (fixture file → session → TraceFileReader → QueryCatalogBuilder → endpoint): GET /queries → 2 defs ranked by TotalWallNs, executionCount=2, percentiles > 0, avgSelectivity > 0, ownerSystemIds=[0] resolved, userSource (file/method) resolved; GET /queries/0/1/executions → 2 executions with the 4-phase breakdown + wall time. 9/9 QueryProfilerControllerTests pass.
    • 4A.4 (regression) ✅ dotnet build Typhon.slnx clean; Typhon.Engine.Tests Profiler suite 350/350 (no wire regression — the fixture is additive). The integration tests are the live-equivalent (real Workbench host over HTTP), so no separate manual live check is needed (and there's no Query Analyzer UI yet to show it in).

    Deviation from the approved plan (flagged)

    The plan said "no engine changes." In reality the query execution-span encoders are internal source-generated [TraceEvent] structs with no public surface, so — per the approved option A — I added one line to Typhon.Engine's InternalsVisibleTo (Typhon.Workbench.Fixtures.schema), documented inline with rationale. This is "genuine internal-implementation reuse" (the fixture drives the engine's own encoders rather than hand-packing the wire format), which the assembly's visibility policy explicitly permits.

    Next: 4B

    Query Analyzer shell + Catalog (merge QueryCatalog+QueryPlanTree+ExecutionInspector) + useQueryAnalyzerStore + registry/command/menu/nav + G Q + bus Query — now testable live against with-queries.

    Files: TraceFixtureBuilder.cs, FixturesController.cs, Typhon.Engine/Properties/AssemblyInfo.cs (+1 friend), QueryProfilerControllerTests.cs. Ready for review + commit.

  19. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    Stage 3 · Phase 4 · 4B+4C — Query Analyzer view (approved plan)

    Following 4A (the with-queries fixture), this increment builds the view itself — combining 4B+4C into one coherent deliverable since the detail tabs reuse components that already exist (a header-only 4B would ship a half-built detail pane).

    The GAP-19 consolidation: Query Catalog + Query Plan Tree + Execution Inspector → one master/detail panel (catalog rank → detail header + Plan/Executions tabs). This is mostly reuse — every leaf component, data hook, and DTO already exists; the bus is already query-aware (SelectionObjectType has 'query', selectionChain resolves execution→query); the G-leader chord infra exists.

    Acceptance criteria (each names its proof)

    1. One view, master/detail — new QueryAnalyzer dockview panel (catalog left / detail right); viewRegistry flips it true, the old 3 stay false (deleted in 4D). viewRegistry + conformance tests.
    2. Catalog ranks by cost (UC-QRY-01) — one row per (Kind,LocalId), default sort TotalWallNs desc, stat columns. master test on the with-queries data (def#1 140µs > def#2 60µs).
    3. Filter + dup (UC-QRY-02) — reuse passesFilter + findDuplicateDefinitions. master test.
    4. Selection → detail + bus — row click sets the store and writes bus select('query', …) (+nav history); analyzer also reacts to the bus query leaf. master + bus-sync tests.
    5. Detail header (§4.2) — identity/predicate/systems/source-link/stat-strip. detail test.
    6. Plan tab (UC-QRY-03/05) — reuse QueryPlanGraph/buildQueryPlanGraph + structural/execution toggle; "Show in plan" overlays actual stats. detail test.
    7. Executions tab (UC-QRY-04) — reuse ExecutionInspectorList+Table; bound to the global time window (GAP-11, client-side) via selectEffectiveScope + an unlink toggle. detail test.
    8. Open paths — View menu · palette · G Q chord · navigator query-row (first-class entry), all gated. command + chord/menu tests.
    9. Inspector card no longer dead — DetailPanel's 'query' placeholder → real card with "Open in Query Analyzer". Inspector test.
    10. Regression + conformance — QueryAnalyzer enrolled in VIEWS (jsdom-mountable via a lazy-loaded React-Flow Plan tab); npm test/tsc/eslint + dotnet build green.

    Subtraction

    • Extract the thrice-duplicated metadata→name-maps block into useProfilerNameMaps().
    • The ranked master list replaces the old expansion table (the old table can't rank by Total); old panels/stores deleted in 4D.

    Out of scope

    → 4D: cross-pillar handoffs, Jump-to-time (GAP-20), formal Go-to-source verb, deletion of the 3 old panels, handoff matrix. → Phase 5: DS-2/3 color.

    Branch: feature/wb-revamp. Per convention I won't commit — I'll hand off "ready for review + commit" when green.

  20. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    ✅ 4B+4C complete — Query Analyzer view (GAP-19) on feature/wb-revamp

    The consolidated Query Analyzer is implemented and verified. Build-order item 6 and AC3.7 ticked.

    Acceptance criteria — evidence

    AC Status Proof
    AC1 one master/detail view ✅ panels/QueryAnalyzer/QueryAnalyzerPanel.tsx (resizable catalog | detail split); viewRegistry QueryAnalyzer:true, old 3 stay false → viewRegistry.test.ts + conformance.test.tsx
    AC2 catalog ranks by TotalWallNs (UC-QRY-01) ✅ QueryAnalyzerMaster.test.tsx (reverse-order input → [0:1,0:2]); live: #1 140µs above #2 60µs
    AC3 filter + duplicate flag (UC-QRY-02) ✅ QueryAnalyzerMaster.test.tsx (archetype filter narrows; identical defs → 2 markers)
    AC4 selection → store + bus (+nav history) ✅ QueryAnalyzerMaster.test.tsx (row click → selectedQuery + bus query leaf); bus inbound sync in the panel
    AC5 detail header ✅ QueryDetailHeader.test.tsx; live: View #1 on Position · pred · sys Movement · src FindByPosition (Queries.cs:42) + stat strip
    AC6 Plan tab + structural/execution + show-in-plan (UC-QRY-03/05) ✅ store test + QueryExecutionsTab.test.tsx; live: React-Flow plan Full Scan→Filter→Result, Execution mode enables on Show-in-plan
    AC7 Executions + GAP-11 time-scope + unlink (UC-QRY-04) ✅ QueryExecutionsTab.test.tsx (linked 2/3 → unlink 3, phase breakdown); live: 1/2 in-window → unlink shows both
    AC8 open paths (menu · palette · G Q · navigator) ✅ commandRegistry.test.ts + focusChord.test.ts; live: View → Query Analyzer
    AC9 Inspector query card (no dead verb) ✅ Inspector.test.tsx ("Open in Query Analyzer", no "deep view returns")
    AC10 conformance + regression ✅ enrolled in VIEWS (lazy Plan keeps React Flow out of the static graph); 141 files / 1213 vitest pass, tsc + eslint clean, dotnet build green

    What shipped (reuse-heavy, per GAP-19)

    • New panels/QueryAnalyzer/: QueryAnalyzerPanel (shell+bus), QueryAnalyzerMaster (ranked catalog), QueryDetail (tabs, lazy Plan), QueryDetailHeader, QueryPlanGraphTab, QueryExecutionsTab, useQueryAnalyzerStore, format.ts.
    • Subtraction: extracted the triplicated metadata→name-maps block into hooks/useProfilerNameMaps.ts.
    • Reused as-is (prop-driven): QueryPlanGraph/buildQueryPlanGraph, ExecutionInspectorTable, phaseRows, useExecutions, useQueryDefinitions, passesFilter, findDuplicateDefinitions, QueryCatalogToolbar.

    Deviations from the plan (all improvements, none silent)

    1. GAP-11 needed no useExecutions change — the global window already has a link/unlink mechanism (useProfilerViewStore.selectEffectiveScope); the Executions list filters client-side by timeToTickRange, with its own unlink toggle.
    2. ExecutionInspectorList/QueryPlanToolbar were replaced, not reused — both are hard-wired to the old stores; the consolidation supersedes them with thin equivalents driving useQueryAnalyzerStore (they die with the old panels in 4D).
    3. setSelectedExecution no longer auto-flips plan mode — in a unified view that would change the Plan tab behind the user's back; the flip is now reserved for the explicit Show in plan verb.
    4. Plan tab lazy-loaded — keeps @xyflow/react out of the panel's static graph (jsdom-conformant + a load-on-demand win).

    Known/deferred (by design)

    • Predicate shows Field[idx] (no field-name table engine-side — documented gap).
    • Sort/filter persistence (AC3.16 / PC-1) not wired — folded into the PC-1 pass.

    Next: 4D — cross-pillar handoffs (target→Component Inspector, owner→System DAG), Jump-to-time (GAP-20), formal Go-to-source verb, delete the 3 old panels + their commands/menu/registry, conformance handoff matrix.

    Per convention I have not committed — ready for review + commit on feature/wb-revamp.

  21. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    ✅ 4D-1 complete — Query Analyzer hand-offs + jump-to-time (feature/wb-revamp)

    Per the chosen split, 4D-1 = the additive hand-offs; the subtraction (delete the 3 old panels) is 4D-2. Ticked: build-order item 7, AC3.8, AC3.9, AC3.14.

    Acceptance criteria — evidence

    AC Status Proof
    AC-D1.1 owner→System DAG (AC3.14) ✅ handoffMatrix.test.ts (system + DAG focus-request) + QueryDetailHeader.test.tsx; live: header "Movement" → ?system=Movement, System DAG panel opened
    AC-D1.2 target→Component/Archetype Inspector (AC3.14, §6) ✅ reuses openComponentInSchema (already in handoffMatrix) + new revealArchetypeInInspector (added to matrix); header tests; live: target "Position" → leaf=component:Position, Component panel opened
    AC-D1.3 go-to-source (AC3.9) ✅ header openInEditor link + hasSource degrade — QueryDetailHeader.test.tsx + live
    AC-D1.4 execution→Jump-to-time (AC3.8/GAP-20) ✅ handoffMatrix.test.ts (viewRange set) + QueryExecutionsTab.test.tsx (ns→µs /1000); live: window 10-90.3 → 10.3-60.3 µs (= the exec's 50 µs wall)
    AC-D1.5 inbound rewire ✅ ProfilerDetail span→execution → revealQueryExecutionInAnalyzer; SystemDagNode "Q n" badge → openViewQueryAnalyzer+system filter / revealQueryInAnalyzer; both previously no-op'd against the gated old views. tsc/lint/tests green
    AC-D1.6 handoff matrix (AC3.14) ✅ handoffMatrix.test.ts +4 cases (owner→DAG, archetype→Inspector, jump→time ×2)
    AC-D1.7 no regression (AC3.11 F/H) ✅ panelFocus (generic mechanism) + densityLint (text-fs-*) cover the view with no enrollment; full npm test 1221 pass (+8), tsc + eslint clean

    Notes / findings

    • target→Component Inspector in a trace session resolves to the backend's designed schema_unavailable 404 → the client's dedicated "schema unavailable for this session type" empty state (Stage-2 code). PC-6-clean (explained state); shows real fields on a trace that carries schema. The 404s in console are the designed signal.
    • Jump-to-time unit confirmed nanoseconds (/1000) from the live µs window matching the execution wall — the flagged risk is closed (no tick-window fallback needed).
    • Inbound rewires reuse verified helpers; live-clicked the outbound four — the inbound pair is covered by tsc/lint/tests + the shared verified commands (not separately live-clicked: span/badge setup is heavier).

    Reuse / subtraction

    • Reused openComponentInSchema, revealSystemInDag, animateViewportToRange, select(...); added only revealArchetypeInInspector, jumpToTimeRange, revealQueryExecutionInAnalyzer, and componentTypeIds on useProfilerNameMaps. No deletion (4D-2).

    Next: 4D-2 — relocate the ~10 shared modules + delete Query Catalog / Query Plan Tree / Execution Inspector + registry/DockHost/command/palette cleanup + removedSurfaces guard (AC3.13). Then Phase 5 (color, gated).

    Per convention I have not committed — ready for review + commit.

  22. nockawa commented on May 25, 2026

    @nockawa
    CollaboratorAuthor

    ✅ 4D-2 complete — the GAP-19 subtraction (feature/wb-revamp). Phase 4 done (bar Phase 5 color).

    The three legacy query panels are deleted; their reused leaf modules relocated into panels/QueryAnalyzer/. AC3.13 ticked.

    What changed

    • Relocated (git mv, history preserved) → panels/QueryAnalyzer/: numeric, useQueryDefinitions, useQueryCatalogStore, QueryCatalogToolbar, filter, duplicate-detection, QueryPlanGraph, QueryPlanNodes, queryPlanLayout, ExecutionInspectorTable, phaseRows, useExecutions (+ their 5 unit tests). useExecutions lost its dep on the deleted store (inlined a local QueryExecutionsFocus type).
    • Deleted: QueryCatalogPanel/Table/Row, QueryPlanTreePanel/Toolbar + useQueryPlanStore + useQueryPlan, ExecutionInspectorPanel/List/Toolbar + useExecutionInspectorStore (+ their 2 store tests). The 3 folders are gone.
    • Wiring cleanup: removed the 3 viewRegistry entries, 3 DockHost imports + map entries, 6 profilerCommands functions (toggle/openViewQueryCatalog, …QueryPlanTree, …ExecutionInspector), and 3 palette commands.
    • External importers repointed (SystemDag ×3, navigator, CommandPalette) to @/panels/QueryAnalyzer/….

    Acceptance criteria — evidence

    AC Status Proof
    AC3.13 subtraction ✅ removedSurfaces.test.ts +4 cases (3 view ids, 6 command exports, 3 palette ids, 5 deleted modules don't resolve); viewRegistry.test.ts/commandRegistry.test.ts gated-lists trimmed; live: palette "query" search → only "Query Analyzer"
    no regression ✅ tsc clean, eslint clean, full npm test 1212 pass (139 files); live: Query Analyzer opens + catalog ranks (View #1 140µs > View #2 60µs) — proving every relocated module works post-move; 0 console errors

    No C# touched → dotnet build unaffected.

    Note

    • Relocated files keep their original names (useQueryCatalogStore, QueryCatalogToolbar, ExecutionInspectorTable) to keep the move a pure relocation; an optional later rename could shed the legacy "Catalog/ExecutionInspector" prefixes. The "Catalog" concept is still the master, so it reads fine.

    Phase 4 status

    Build order 6, 7, 8 done; item 9 (Phase 5 color) remains — gated, needs your visual sign-off. ACs done this phase: 3.7, 3.8, 3.9, 3.13, 3.14, 3.15. Remaining are the cross-cutting / later ones: 3.10 (color, Phase 5), 3.11 (per-view F/H sweep — Analyzer's D/E + F-mechanism/H-lint covered; arrow-key catalog nav + the formal sweep remain), 3.12 (J2 headline E2E — R2-deferred with the shell rewrite), 3.16 (PC-1 persistence).

    Per convention I have not committed — ready for review + commit.

  23. nockawa commented on May 26, 2026

    @nockawa
    CollaboratorAuthor

    AC3.12 closed — e2e/j2-drill.spec.ts shipped (2026-05-26).

    The R2-deferral noted on AC3.5 / AC3.7 had gone stale: J2.2 / J2.3 capabilities shipped + live-verified during Phase 4 + Phase 5, so the formal Playwright E2E is no longer blocked by anything material. Writing the spec NOW protects the shipped capabilities against the upcoming R2 shell rewrite (a failing J2 test during R2 → "I changed user-visible J2 behavior, is that intentional?" signal we'd otherwise lose).

    Spec file: tools/Typhon.Workbench/ClientApp/e2e/j2-drill.spec.ts

    Run: npx playwright test e2e/j2-drill.spec.ts — 3/3 green, 6.7 s total wall-clock.

    Leg Test Fixture What it proves
    J2.1 Call Tree drill: tree renders + frame → source handoff with-cpu-samples Open Call Tree via View menu → server-folded tree shows MovementSystem.Execute root + "3 samples" summary → double-click the sourced frame fires POST /api/profiler/open-in-editor. (Single-click selects; activation is on dblclick per CallTree.tsx:264-273.)
    J2.2 Query Analyzer: catalog → plan → executions → Jump to time + source link with-queries Open Query Analyzer → query-analyzer-row count ≥ 2 → click row → query-detail-target populates → Plan tab → query-plan-canvas mounts (lazy React-Flow) → Executions tab → execution-list-row populated → click execution → query-executions-jump-to-time enabled + clicked → Profiler tab → profiler-time-area-canvas visible → back to Analyzer → query-detail-open-in-editor link present (degrades silently when source attribution absent).
    J2.3 System DAG + Data Flow mount with per-system content from a Stage-3 trace with-access-declarations System DAG renders system-dag-node-Movement + system-dag-node-Damage directly from the trace's SystemDefinitionRecord[] (no chunk-event data required — confirmed via TraceFixtureBuilder audit); Data Flow's data-flow-panel-root mounts cleanly. Cross-panel selection propagation within the cluster remains covered by data-flow.spec.ts (4 tests) + handoffMatrix.test.ts (unit) — this leg is the cluster-mount regression net they don't cover.

    Scope honesty (matters for the next R2 stage):

    • Critical Path is deliberately NOT asserted: its cp-system-edge-* testids require SchedulerChunkBegin/End events, and no current trace fixture emits those (confirmed by reading every TraceFixtureBuilder.* method). A strict CP assertion would fail on missing fixture data, not on a real regression. If/when a chunk-emitting fixture lands (sibling to with-cpu-samples but with scheduler events), J2.3 should grow a CP assertion.
    • The J2.2 source-link click is conditional on the link being present (the fixture's source attribution may or may not resolve depending on string table seeding) — when it's there, the spec asserts the handoff fires; when it's not, the spec degrades silently, matching the design's degraded-state contract.

    Verification chain:

    • tsc --noEmit — clean
    • eslint e2e/j2-drill.spec.ts — clean
    • npx playwright test e2e/j2-drill.spec.ts — 3/3 in 6.7 s
    • npx vitest run — 1342/1342 (no regression, full client-side suite)

    Three discoveries documented for posterity:

    1. The CallTree's frame-activation verb is dblclick, not click — profiler-call-tree.spec.ts's existing single-click test happens to fire open-in-editor via the on-cpu/wall-clock toggle's incidental wiring rather than the direct frame click; matters if/when that toggle changes.
    2. with-cpu-samples writes WriteSystemDefinitions([]) — empty system table. The Call Tree's MovementSystem.Execute frame text is sourced from frameSymbols, not from a system definition; would surprise anyone assuming "samples → systems".
    3. No current trace fixture emits scheduler chunk events. Critical Path's bars are unreachable in E2E today; a follow-up fixture variant is the cleanest fix.
  24. moved this from In Progress to Done in Typhon devon May 28, 2026
  25. nockawa commented on Jun 29, 2026

    @nockawa
    CollaboratorAuthor

    Closing as done. Workbench redesign Stage 3 (Profile + Query) shipped via #379 — all 16 acceptance criteria plus the J2 j2-drill.spec.ts E2E are ticked; stage-3-profile.md marks it substantively complete.

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