feat(truapi-server): host-side wire debug tap and debugger - #295
Open
decrypto21 wants to merge 11 commits into
Open
feat(truapi-server): host-side wire debug tap and debugger#295decrypto21 wants to merge 11 commits into
decrypto21 wants to merge 11 commits into
Conversation
decrypto21
force-pushed
the
nidish/debug-host-port
branch
from
July 25, 2026 06:30
f752ca3 to
70c230f
Compare
decrypto21
force-pushed
the
nidish/debug-host-port
branch
2 times, most recently
from
July 25, 2026 09:42
6869ac4 to
0ac06b0
Compare
decrypto21
marked this pull request as ready for review
July 25, 2026 09:43
Imod7
reviewed
Jul 27, 2026
decrypto21
force-pushed
the
nidish/debug-host-port
branch
from
July 28, 2026 09:03
0ac06b0 to
65ac1ff
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
decrypto21
force-pushed
the
nidish/debug-host-port
branch
3 times, most recently
from
July 28, 2026 20:04
9ef0a44 to
6a6060f
Compare
…er wire-decode surface
decrypto21
force-pushed
the
nidish/debug-host-port
branch
from
August 2, 2026 19:51
6a6060f to
79d24d4
Compare
Imod7
reviewed
Aug 3, 2026
decrypto21
force-pushed
the
nidish/debug-host-port
branch
from
August 5, 2026 11:35
9498dbb to
6835784
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the wire observability layer for TrUAPI: a payload-blind debug tap in the Rust host (
truapi-server), correlated by the wirerequestId. The host streams every product↔host frame, opaque, to a debugger it dials out to over loopback, which groups the frames into per-operation traces and renders them in a web inspector (op list, drill-down, aggregate strip). The tap carries the frame bytes untouched - the core never decodes them - so@parity/truapi(the product package) is left completely alone. Strictly dev-only: the tap is inert unless a host installs a sink, and the whole decode path is compiled out of production (the web host's dial readsimport.meta.env.DEV), so no production bundle can ever enable it. Design doc:docs/design/wire-observability-debug-host.md(#315).What's in it
truapi-server) - theDebugSinktrait +DebugEventat the two frame choke points (receive_frameinbound,emit_frameoutbound). Outbound forwards to the product before it emits; inbound emits before dispatch so a corrupt frame is still observed; every emit is wrapped incatch_unwindand is inert when no sink is installed (a lock-freehas_debugfast path). Direction is product-vantage (out= left the product), pinned by a guard test;DebugEventis#[non_exhaustive]. Ships a nativeWsDebugSink(loopback-only, gated behind thews-bridgeCargo feature) with a byte- and count-bounded queue and counted drops, plus the wasmWasmDebugSink.truapi-codegen) - codegen emits oneTRUAPI_WIRE_SCHEMA_HASH(a fingerprint over frame ids + method legs) into both the TS client and the Rust dispatcher, so a host built against a drifted frame table is caught rather than silently mis-decoded.@parity/truapi-debugger, private, in-repo) -createWireDebuggergroups frames into per-(channelId, requestId)WireTraces, segments recycled request ids into distinct generations, resolves lifecycle roles at ingest, detects retry storms, and bounds retention (LRU trace cap, per-trace frame + byte caps, surfaced eviction/drop counters)./op-list·/op·/stats·/channels: aggregate strip, op list with filter/sort/channel switch, per-frame drill-down that decodes to the SCALE-typed value inline. Decode is refused for a channel whose wire schema hash did not match (codec drift), matching the gated/frameJSON endpoint.createInAppDebugger) - feed frames in-process and mount the same inspector; the surface a host embeds directly (see the companion dotli PR).Verification
cargo test -p truapi-server --features ws-bridge(the tap covered in both directions, product-vantage convention pinned) and-p truapi-codegen(incl. golden) green;make wasmconfirms the nativews-bridgedeps stay out of the wasm graph; clippy + fmt clean.bun testgreen for the debugger andtsc -bclean.Notes
import.meta.env.DEV), so there is nothing to arm in a shipped build.catch_unwind) - a slow, absent, or crashed debugger loses a trace, never a session.Origingate and the HTTP routes aHost-header allowlist (blocks DNS-rebinding reads of decoded frames). WSmaxPayloadLength+ a true per-trace byte cap bound RSS now that decode retains bytes./op,/view,/frame) decodes only for a channel whose wire schema hash affirmatively matched; a drifted/foreign host groups but shows no value, rather than decoding its frames against the wrong table.