Skip to content

Workbench evolutions — eight independent buckets from feature/364 branch #365

Closed

Description

@nockawa

Context

The feature/364-off-cpu-sampling branch accumulated a sizeable batch of Workbench-side work that is independent of the off-CPU sampling effort but landed opportunistically alongside it. This issue tracks landing those changes as their own PR train, separate from #364.

The code is already written and largely tested on the branch — this issue is about carving it into reviewable PRs, not green-fielding it.

The eight buckets

1. HTTP 202 "session building" contract (server + client)

A fresh trace's background cache build can take seconds. Today every schema panel mounted during that window logs Query failed: … into the Logs panel. Fix:

  • Sessions expose IsSchemaBuilding (default false; trace sessions report !Runtime.IsBuildComplete)
  • Schema + query-catalog endpoints return 202 Accepted + Retry-After: 1 while building (vs. the old 409 Conflict)
  • Client customFetch envelopes 202 as { data: undefined, status: 202 } instead of throwing on empty body
  • Affected hooks add refetchInterval: q => q.state.data?.data === undefined ? 1_000 : false to poll quietly until ready
  • New SchemaBuildingException distinguishes "transient — still building" from SchemaUnavailableException ("permanent — wrong session kind")

2. Logs-panel noise filter (silenceErrors)

Global query/mutation cache logger gained an opt-out via meta.silenceErrors:

  • true — always silence (e.g. fs/stat on moved/deleted recent files: every 404 is expected)
  • (error) => boolean — predicate (e.g. typeName schema hooks: silence 404s when the URL restored a selection that doesn't exist in the new session, but still log 500s)

Wired into 4 schema hooks (useArchetypesForComponent, useComponentSchema, useIndexesForComponent, useSystemRelationships) and RecentFilesTab. Introduces a new FetchError class carrying the parsed ProblemDetails so predicates can branch on status.

3. Inline Source Preview panel (Roslyn-based)

The existing brace-counting heuristic for cropping the source preview to the enclosing method mis-handles braces inside strings, char literals, comments and interpolations. Replaced with Roslyn (Microsoft.CodeAnalysis.CSharp 5.3.0):

  • FindEnclosingMethodLines walks the syntax tree, picks the smallest enclosing BaseMethodDeclarationSyntax / LocalFunctionStatementSyntax / AccessorDeclarationSyntax / BasePropertyDeclarationSyntax
  • Roslyn never throws on malformed input (best-effort tree) — partially-broken files still resolve what they can
  • New menu entry "Source Preview" + command palette entry (toggle-view-source-preview)
  • surfacePanel helper expands collapsed edge groups before focusing (a panel docked in a collapsed edge group otherwise stays hidden — focus() doesn't expand)
  • updateSourcePreviewIfOpen — keeps an already-open panel in sync without spawning one

New runtime dep: Microsoft.CodeAnalysis.CSharp (Roslyn) — adds ~3 MB to the Workbench server output.

4. "View in Call Tree" with method-drill

Right-click on a span bar or scheduler-chunk bar in TimeArea → new context menu offering:

  • View in Call Tree (merged) — scope to every instance of this span's kind, re-rooted at the span's emitting method
  • View in Call Tree (system) — scope to the chunk's system, re-rooted at the system's method

Plus parallel additions in the Detail panel's "Scope Call Tree to this" actions.

The frame-root is resolved via a new resolveFrameRootForSite(sourceLoc, frameStore) helper that maps a file:line to a frame id from the manifest (best-effort — falls back to no re-root when the method isn't resolvable / wasn't sampled).

Call Tree breadcrumb refactored: now stacks full view state (scope + frameRoot) per entry instead of just frame-drills, so clicking a crumb restores the whole view. Row selection in the tree syncs an already-open Source Preview.

5. Critical Path drag-to-zoom + local nav history

  • Drag-to-zoom gesture along the major axis with an 800 ms ease-out tween (matches the profiler TimeArea's feel)
  • CP-local back/forward history stack (50-entry cap, independent of the global nav-history stack — mouse back/forward over the CP panel walks this stack)
  • Wheel-burst debounced into a single history entry
  • Occupancy-cell inline percentage labels gated on rect size (only printed when the rect is ≥ 26×11 px so the label doesn't get clipped)
  • criticalPathZoom.ts extracted as a pure module (drawn-µs ↔ view-params math + history primitives), unit-tested

6. System DAG fitView readiness gate

react-flow's imperative fitView was called against stale viewport state when the panel mounted inside a dockview hidden tab (display:none → 0×0 container) or before xyflow had measured nodes — producing fits to off-screen targets.

Fix:

  • All fit triggers (Fit button, middle-click, layout switch, topology filter change, engine-tracks toggle, tick change) collapse into a monotonic fitToken
  • A new <FitController/> consumes the token, gates on xyflow's readiness (nodes measured + viewport sized), and only then calls fitView
  • Middle-click on the canvas requests a fit (button=1 via onAuxClick)

7. Dockview theme polish

Default dockview headers use the same shade as the panel body, making the active tab and the header chrome blend in. Fix:

--wb-dv-header:       color-mix(in oklch, var(--background), black 1%);
--wb-dv-selected-tab: color-mix(in oklch, var(--background), black 5%);

Two color-mix shades off --background so the steps hold in light and dark themes alike. Selected tab = darkest, hidden tabs = the header shade, panel body = unchanged.

8. DbMap context-menu portal fix

  • Portal to document.body so dockview chrome (resize sashes, z-index up to 9999) can't paint over the menu and a transformed panel ancestor can't re-anchor its position: fixed box
  • pointerdown instead of mousedown for the outside-dismiss listener — a canvas may preventDefault() the mousedown (suppressing the compatibility event), but pointerdown always fires
  • z-index raised to 10000

Related

Activity

  1. self-assigned this
    on May 20, 2026
  2. added
    refactoring
    on May 20, 2026
  3. moved this to In Progress in Typhon devon May 20, 2026
  4. added a commit that references this issue on May 20, 2026
  5. moved this from In Progress to Done in Typhon devon May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

refactoring

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions