Add `d2` diagram sources + rendered SVGs
7 hand-authored `docs/diagrams/*.d2` sources (sketch-mode,
grayscale theme, `elk` layout) w/ their pre-rendered fallback SVGs
committed under `docs/_diagrams/` (served as-is when no `d2` bin is
found, eg. in CI),
- `actor_tree`: the hero supervision-tree,
- `context_handshake`: seq diagram of the
`Start`/`StartAck`/`Started`/`Yield`/`Stop`/`Return` ctx dialog,
- `streaming_pipeline`: 4-actor fan-in topology,
- `runtime_stack`: the per-actor layer cake,
- `debug_lock`: root-tty-lock REPL serialization,
- `error_propagation`: one-cancels-all boxed-err flow,
- `infected_aio`: guest-mode loop nesting.
Rendered w/ `d2` v0.7.1 via `nix run nixpkgs#d2`.
(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-06-11 19:16:44 +00:00
|
|
|
# tractor docs diagram: the inter-actor `Context`
|
|
|
|
|
# dialog; tractor's SC-transitive msg protocol as
|
|
|
|
|
# seen from both sides of `Portal.open_context()`.
|
|
|
|
|
vars: {
|
|
|
|
|
d2-config: {
|
|
|
|
|
sketch: true
|
|
|
|
|
theme-id: 1
|
|
|
|
|
pad: 16
|
|
|
|
|
layout-engine: elk
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
shape: sequence_diagram
|
|
|
|
|
parent: "parent task\n(Portal)"
|
|
|
|
|
child: "child actor task\n(@tractor.context fn)"
|
|
|
|
|
parent -> child: "Start: open_context(fn, **kwargs)"
|
|
|
|
|
child -> parent: "StartAck"
|
|
|
|
|
child -> parent: "Started: await ctx.started(value)"
|
|
|
|
|
parent -> child: "Yield: stream.send()"
|
|
|
|
|
child -> parent: "Yield: stream.send()"
|
|
|
|
|
parent -> child: "Stop: stream closed"
|
|
|
|
|
child -> parent: "Return: fn return value"
|
2026-06-29 01:55:39 +00:00
|
|
|
# the non-graceful endings: errors/cancels always
|
|
|
|
|
# propagate, both ways (`ContextCancelled` rides in
|
|
|
|
|
# an `Error` msg, hence the `Error: ...` labels).
|
|
|
|
|
"... or, instead of a graceful Return": {
|
|
|
|
|
parent-initiated: {
|
|
|
|
|
parent -> child: "ctx.cancel() | parent-side error"
|
|
|
|
|
child -> parent: "Error: ContextCancelled"
|
|
|
|
|
}
|
|
|
|
|
child-initiated: {
|
|
|
|
|
child -> parent: "Error: child raised | ContextCancelled"
|
|
|
|
|
}
|
|
|
|
|
}
|