Skip to content

feat(truapi-debugger): wire trace engine, standalone inspector, and in-app panel - #536

Open
decrypto21 wants to merge 8 commits into
mainfrom
nidish/debugger-2-engine
Open

feat(truapi-debugger): wire trace engine, standalone inspector, and in-app panel#536
decrypto21 wants to merge 8 commits into
mainfrom
nidish/debugger-2-engine

Conversation

@decrypto21

@decrypto21 decrypto21 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Adds the TrUAPI wire debugger: the trace engine, a standalone loopback inspector, an in-app panel a host can mount, the dev-gated worker dial that feeds them, and the release plumbing for @parity/truapi-debugger. Stacked on #295, which emits the opaque frames this correlates and decodes.

Why: the tap in #295 has no consumer. This is the consumer, and the first thing in the stack that turns frames into something readable.

How: js/packages/truapi-debugger holds the engine and both surfaces; the dial is in create-worker-host-runtime.ts.

Engine:

  • Correlates frames into per-operation traces keyed on (channelId, requestId), resolving each frame's lifecycle role at ingest from the generated wire table.
  • Locates the opener by role rather than by position. frames[0] is the opener only if the opener was the first frame observed, and a tap attaching mid-session usually sees a closer first, so retention spares the opener by role. Keying on index 0 evicts the frame that pairing and storm detection depend on.
  • Keeps the two pairing verdicts distinct. An opener with no close is a claim about the host; a close with no opener is usually a claim about the debugger, because the operation predates the tap or retention dropped the opener. One shared badge made the tool report its own retention as a protocol defect.
  • Rotates generations when a product recycles a request id.
  • Surfaces undecodable frames as a malformed sentinel rather than dropping them.
  • Bounds retention on traces, frames per trace, and bytes per trace, counting evictions and marking truncation.

Surfaces:

  • The standalone inspector is a loopback WS + HTTP server the host dials. Every HTTP route is fed by the same view model the page renders, so curl and the UI cannot disagree about operations, badges, or payloads.
  • The in-app panel mounts the same engine and renderers inside a host: no server, no dial-out, frames never leave the app.
  • Both strips render from one shared aggregate. A second bespoke roll-up is how the two once disagreed, the standalone reporting malformed 1 / truncated 1 on a stream the panel showed as clean.

Confinement and decode:

  • The debugger is the server; the host always dials outward. The URL must be ws:// on a loopback host, with origin, target, and bind checked as three distinct loopback classifications.
  • Host must match a loopback name exactly rather than by substring, and inbound payload size is capped.
  • No denylist and no reveal toggle: the decoder is absent from a production bundle, behind a build-time flag.
  • Decode is gated on an affirmative schema-hash match per channel and per frame. A host running a stale WASM bundle declares a stale hash, and the debugger refuses payloads and flags its method names as unreliable rather than rendering nonsense.
  • sync-release-versions gains the debugger's @parity/truapi range, so a protocol release that leaves the debugger pinned to an older version fails at release time rather than at decode time.

Driven end to end against dot.li on paseo-next-v2 with the playground as the product: 172 operations, 351 frames, decoded payloads, and codecOk/schemaOk true on the channel.

@socket-security

socket-security Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​happy-dom@​20.11.2661008896100

View full report

@decrypto21
decrypto21 force-pushed the nidish/debugger-2-engine branch from eebee61 to e8d9625 Compare August 28, 2026 06:53
@decrypto21
decrypto21 force-pushed the nidish/debug-host-port branch 3 times, most recently from 715bfec to af7b25a Compare August 31, 2026 10:25
@decrypto21
decrypto21 force-pushed the nidish/debug-host-port branch from af7b25a to b3d0095 Compare September 3, 2026 09:29
@decrypto21
decrypto21 force-pushed the nidish/debugger-2-engine branch from e8d9625 to 60a5960 Compare September 3, 2026 09:39
@decrypto21 decrypto21 changed the title feat(truapi-debugger): wire trace, decode, and render engine feat(truapi-debugger): wire trace engine, standalone inspector, and in-app panel Sep 3, 2026
@decrypto21
decrypto21 force-pushed the nidish/debugger-2-engine branch from 60a5960 to 30fbec3 Compare September 3, 2026 11:19
@decrypto21
decrypto21 marked this pull request as ready for review September 3, 2026 11:39
Base automatically changed from nidish/debug-host-port to main September 3, 2026 16:08
@decrypto21
decrypto21 requested a review from a team September 3, 2026 16:08
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