Expand description
#846: the sequence-diagram query.
Classifies a handler body’s calls into runtime-participant lifelines —
consumed capabilities, calls into consumed contexts, and agents (including
same-context agents) — for the “Show Sequence Diagram” VS Code feature.
Everything else (commons fns, context-local fns, methods, constructors)
folds into the entry participant’s own activation: no message is emitted
for the call, and — because this repo’s resolver does not inline call
bodies either — a lifeline call written inside a commons fn’s own body is
invisible to this walk. That is a stated Tier-1 limitation, not a bug: see
design/pending/sequence-diagram-846.md.
A pure, read-only IDE query: it never touches the checker’s hot path
(bynk_check::checker::check_handler_body) and is built on the exhaustive
expr_children/statement_exprs walkers only insofar as this module’s own
statement dispatch mirrors their coverage of Statement — a new
Statement variant is a compile error here, in Builder::walk_block’s
match, not a silent gap.
#2194: in an agent’s own handler, a write to the agent’s state — a :=
or a mutating store operation on one of its store fields — is not a
lifeline either, but it is not folded away: it is a
MessageKind::StateWrite from the entry to itself, rendered as a note.
Cross-context/agent calls are boundary-stop (Decision C): one Call +
one Return message: the callee’s own body is never walked, even where
reachable (an agent’s handlers are visible via ContextSequenceInfo::agents).
Model-diagrams slice 3 names the callee instead (Message::callee), so a
client can open the callee’s own diagram (a UML ref).
Model-diagrams slice 3 (ADR 0858): the model is complete. Nesting is
walked to MAX_BLOCK_DEPTH, a safety cap far beyond real code, and each
block carries its AltBlock::depth; how much to show is the client’s
call. A ? at the top of a statement’s value is an early return, modelled
as an AltKind::Break block, and the model names its Trigger.
Structs§
- AltBlock
- Branch
- Callee
- The handler a boundary-stop call reaches, named rather than walked (Decision C). The LSP layer resolves it to a location.
- Message
- Participant
- Sequence
Model - Trigger
- What starts a handler (model-diagrams slice 3).
Enums§
- AltKind
- Handler
Owner - Which declaration owns the handler being diagrammed.
- Message
Kind - Participant
Kind - Trigger
Kind
Constants§
- EARLY_
RETURN - The reply a
breakblock (a?) gives: the handler returns early with the operand’sNoneorErr(a 404 underHttpResult, the error otherwise). - MAX_
BLOCK_ DEPTH - A safety cap on
if/matchnesting, not a presentation choice (ADR 0858, model-diagrams slice 3): the model is complete to this depth and the client decides how much to show. It bounds the work and the payload for a pathological handler; real code never comes near it. Beyond it the walk emits a singleAltKind::Collapsedmarker instead of recursing further. (It was 2, a presentation cut, until slice 3.) - MIXED_
KEYS - An agent participant’s key when the handler’s calls key it differently.
Functions§
- sequence_
model default_givenis the owning service’s service-levelgivendefault (v0.155,ServiceDecl.default_given) — a handler that declares nogivenof its own inherits it. This classifier walks a freshly-parsed AST that has not been throughbynk-emit’sinject_service_defaultsnormalization pass (which is what mutateshandler.givenin the compile pipeline), so the fallback has to be applied here or a handler relying on the service default would drop every capability lifeline. Pass&[]when there is no default (always the case forHandlerOwner::Agent— agents have no service-levelgiven).default_byis the owning service’s service-levelbydefault (v0.155,ServiceDecl.default_by) — a handler that declares nobyof its own inherits it, exactly as it does thegivendefault. PassNonefor an agent (agents have no principal).