Expand description
#855: the wire-contract peek — the model behind “hover a service handler”
and “Show Wire Contract”. Renders bynk_check::wire::WireModel (the
same IR bynk-emit’s codec generation consumes) narrowed to one
handler, plus the facts the IR does not carry: the request envelope
shape, the cross-context contract form + hash (on call only), and the
HTTP response set a route can actually answer with.
Handler resolution mirrors bynk-lsp/src/sequence_request.rs’s
sequence_model_at: re-parse the committed snapshot with
parse_unit_with_recovery, find the Handler whose span contains the
cursor. The re-parsed Handler supplies spans/body; the retained
ContextBoundaryInfo supplies the type table — a single-file re-parse
cannot see a uses target’s types, which is the whole reason that table
is retained project-wide (Phase 3).
Provenance. bynk_check::wire::Provenance distinguishes a type this
module owns from one reached through another unit. ContextBoundaryInfo‘s
types table is combined_types_for(unit, …) — this unit’s own type
namespace, own declarations plus its uses targets’ — the exact table
own_contract_hashes (bynk-emit/src/project.rs) hashes a service’s
contract through. Every name resolvable through it is therefore this
unit’s own view of its boundary: Provenance::Owned throughout. A
genuinely Consumed type (reached through a consumes <other context>,
not a uses <commons>) never appears here — that is a caller’s view of
another unit’s boundary, not this handler’s own, and is out of scope for
a peek that answers “what does this handler send and receive”.
Scope. Service handlers only. An agent’s on call handler crosses a
Durable-Object RPC boundary too, but the issue’s worked examples (an HTTP
route, a cross-context on call) are both service handlers, and
ContextBoundaryInfo does not retain agents’ own handler bodies in a form
this module needs. Left for a later slice if an agent peek is wanted.
Structs§
- Contract
Form - The canonical form + hash of an
on callhandler’s contract — the same projectionbynk-emit/src/project.rs’sown_contract_hashesbuilds, so the hash this peek shows is provably the hash the emittedX-Bynk-Contractconstant stamps. - Http
Response - One reachable HTTP outcome.
- Wire
Contract Model - The wire contract of one handler: its request envelope, its reachable
response set (HTTP handlers only), its cross-context contract form + hash
(
on callonly), and the boundary type shapes both reference.
Enums§
- Boundary
Kind - Which protocol hosts the hovered handler — the header facts
discriminator(bynk-ide/src/sequence.rs) also renders, kept here as their own IDE-shaped type rather than re-exportingHandlerKinddirectly, so a future field this peek needs (thatHandlerKindhas no room for) is a local addition, not an upstream one. - Envelope
- The request shape a handler’s caller sends. Three cases, not two —
bynk-emit/src/emitter/workers_entry.rs’sh.params.len() == 1branch is the only bare-value case; everything else, including zero params, takes the object branch. Rendering onlyBare/Keyedwould misstate a zero-arg service as accepting an (empty) object body it never inspects, when what actually happens is the body is not read at all. - NoCross
Context Reason - Why there is no cross-context contract to show for this handler. Rendered on the panel only — hover stays quiet about an absence (Part 4).
- Response
Origin - Why a response was reachable — so a renderer can tell an author-declared outcome from one the boundary injects on their behalf without their having written a line for it.
Functions§
- real_
context_ count - How many real contexts/adapters a project has — the input
wire_contract_at/wire_contract_for_service’scontext_countwants, decidingNoCrossContextReason::SingleContext. - wire_
contract_ at - Locate the
Handlerenclosingoffsetintextand build its wire contract. Mirrorssequence_request::sequence_model_at’s re-parse convention.infois the owning unit’s retained boundary table (Phase 3);expr_typesis that same file’s checked expression types (empty for a file with errors — theOk-overload disambiguation then falls back to the declared return type, seeResponseWalk::is_http_result_exprbelow). - wire_
contract_ for_ service - Build the wire contract for one already-located handler. The pure half of
wire_contract_at— the part that never touches the offset/re-parse machinery — split out the same waysequence_model_atdelegates tosequence::sequence_model.