Skip to main content

Module boot_context

Module boot_context 

Source
Expand description

Boot-composition: the BootContext — the host’s generic-primitive surface.

editor_boot.rs was a ~1700-line god-function where every async subsystem hand-wired the same six things: mode registration, command registration, service registration, an async_landed wake, a per-tick drain, and a deferred install for late handles. BootContext is that surface made explicit — the typed bundle a subsystem’s install(boot) receives, exposing the easy-to-get-wrong operations as primitives that cannot be wired without their safety property.

Design fragment: docs/dev/architecture/boot-composition.md. Slice plan: docs/dev/operations/slice-plans/boot-composition.md.

§Status

  • BC.1 ✅ — the skeleton + the two wake-robustness primitives below.
  • BC.3a ✅ — editor_boot::Editor::boot now builds a BootContext in a Phase-A block and routes all command / mode / service registration through it (commands_mut / modes_mut / register_service), freezing each registry into the Arc the Editor literal seats. The render_state cell / BufferStore / DiagnosticsQueryHandle are fields here (built in Phase A); the §5 “forwardable cell” worry did not match the code (both are default-init / early-seeded Arc-shared cells — see the design fragment §5 re-assessment), so the hoist preserved Arc identity by moving let bindings, never reconstructing.
  • BC.3b+ 🚧 — per-subsystem install(boot) migrations (claude-code first), collapsing each subsystem’s scattered wiring into one call.

§Wake-robustness primitives

  • BootContext::inbound — the bundled inbound primitive. A channel whose send wakes async_landed (the wake is inside the sender, so it is structurally impossible to forget) and whose items are drained per-tick via the tick-callback registry through a handler. Generalizes the I3 ClaudeCodeInboundBus and LSP’s hand-rolled inbound buses. (Not yet consumed by editor_boot — BC.3b is its first caller.)
  • BootContext::wake_on_event — subscribe a typed event and wake async_landed whenever one is published. Generalizes the MultibufferExcerptsReady / L1c wake_on forwarder tasks.
  • BootContext::tick_callback — register a raw per-tick drain (the I1 registry), retaining the RAII token for boot lifetime.

Structs§

BootContext
The host’s generic-primitive surface, handed to per-subsystem wiring.