Skip to content

Workbench Profiler Port — Phases 1a/1b/2 + comprehensive test coverage - #268

Merged
nockawa merged 2 commits into
mainfrom
feature/267-profiler-port
Apr 24, 2026
Merged

nockawa merged 2 commits into
mainfrom
feature/267-profiler-port

Conversation

@nockawa

@nockawa nockawa commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Umbrella #267 Phases 1a (Trace mode), 1b (Attach mode), and 2 (canvas renderer port) with detail-panel integration, shortcuts, nav history, and a multi-tier regression test suite. Closes the critical path to profiler parity with Typhon.Profiler.Server.

116 files changed, +20 350 / −112.

What shipped

Backend

  • TraceSessionRuntime / AttachSessionRuntime — per-session (not singleton) runtimes with fingerprint-cached sidecar builds, LZ4 chunk reads, bounded-channel SSE broadcast.
  • ProfilerController — session-scoped binary chunk endpoint with documented X-Chunk-* headers + ACL expose.
  • ProfilerBuildProgressStream / ProfilerLiveStream — SSE for trace-build progress and live tick broadcast; subscribe-before-terminal-check race fixed.
  • Session-kind discriminants on all /profiler/* routes; bootstrap + session-token gating; sidecar magic validation with human-readable hints.

Frontend

  • ProfilerPanel with tick overview + time area + gauge region + per-system lanes.
  • Chunk cache with LRU + OPFS persistence, memoised assembly, pending-range coalescing.
  • DetailPanel branch for profiler selection (4-way arbitration).
  • Greedy row-packing for overlapping spans, cross-tick span attribution, async-completion fold, depth walk with 16-zero sentinel handling.
  • Nav history with viewport-based triggers + Mouse 3/4 bindings.
  • Keyboard shortcuts gated on active panel / typing-in-text.

Test infrastructure (new)

  • Typhon.Workbench.Fixtures/TraceFixtureBuilder + MockTcpProfilerServer — programmatic trace + live-profiler fixtures so no binary blobs land in git.
  • test/Typhon.Workbench.Tests/Fixtures/RecordStreamBuilder — in-memory v3-record streams for decoder tests.
  • ClientApp/src/libs/profiler/model/__tests__/spanBuilder — TS fixture helper for span/tick construction.
  • DEBUG-only POST /api/fixtures/trace + POST /api/fixtures/mock-profiler endpoints so Playwright can set up scenarios without committing blobs.

Test coverage added in this PR (~137 new tests, everything green)

Tier Focus Counts
0 E2E canaries — trace open, attach connect 4 Playwright
1 Core correctness — RecordDecoder, fingerprint cache, chunk endpoint, auth gating, AttachSessionRuntime init/block/isolation, SSE race 27 NUnit
1 processTickEvents, chunkCache memo/pending, binaryReader+lz4Block, persist migration 44 Vitest
1 Session cleanup, kind switch 3 Playwright
2 mergeTickData, aggregateGaugeData, viewRangeToTickRange 18 Vitest
2 Trace-magic validation, LiveStream SSE shape, reconnect signal 9 NUnit
3 useNavHistoryStore patch paths, useProfilerSessionStore reset 12 Vitest
3 SchemaConvention edge cases, theme DOM smoke 2 NUnit + 2 Playwright
4 FS auth gate; repaired 2 stale Phase-4/6 tests 4 NUnit + 2 Playwright

Totals: 110 NUnit / 194 Vitest / 28 Playwright — all green.

Out of scope

Known flagged items (for follow-up, not blockers)

  • aggregateGaugeData thread-name fold: docstring says "first observation wins"; code does last-wins. Test pins shipped behaviour.
  • RecordDecoder.DecodeGenericSpan crashes on unknown kind bytes ≥ 10 that arrive with only a 12-byte record (the generic span decoder reads past the record). Deferred — no prod path hits this.
  • WelcomeScreen.tsx: "Open .typhon-trace" button routes the dialog to the cached tab instead of trace. E2E specs click the Open Trace tab explicitly; might be intentional UX, flagging.

Test plan

  • dotnet test — 110 pass
  • npx vitest run — 194 pass
  • npx playwright test — 28 pass (including 2 previously-stale Phase-4/6 repairs)
  • Manual smoke: open fixture trace, attach to mock, switch between sessions, theme toggle, nav back/forward

🤖 Generated with Claude Code

@nockawa
nockawa merged commit b1a2d85 into main Apr 24, 2026
1 check passed
@nockawa
nockawa deleted the feature/267-profiler-port branch April 24, 2026 21:16
@nockawa nockawa self-assigned this Apr 24, 2026
@nockawa nockawa moved this to Done in Typhon dev Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant