Repository navigation
[CTX-1380] feat(runtime): production component request surface reaches bitty-net (#2254) - #2296
Conversation
…2254) The ComponentBroker wired by #2267 had no production request producer, so an installed component was unreachable from any user action. This adds the narrowest existing seam: a Lua host surface, because plugins are the intended consumers and the accepted capability model already covers them. - `bitty.component.request{ id, method, url, headers?, body?, timeout_ms? }` validates shape and bounds and enqueues one submission, returning a ticket. It never spawns, sends, or waits, so no Lua callback blocks on a component. - `bitty.component.poll(ticket)` reads `nil` while in flight, a bounded response table on success, and raises the stable typed class on failure (`E_COMPONENT_CAPABILITY_DENIED`, `E_COMPONENT_NOT_ACTIVE`, `E_COMPONENT_BUDGET`, `E_COMPONENT_TIMEOUT`, ...). - Bounds: 8 KiB request payload (the existing bridge ceiling), 8 KiB response, 16 headers, 30 s deadline ceiling, 32 submissions, 4 held per plugin, and a 32-entry completion window. - Authorization is unchanged and canonical: the composition root mirrors each activated generation's manifest and grant into the runtime policy host, then `Runtime::submit_component_request` re-checks lifecycle, manifest generation, grant record, and the egress intersection before the broker resolves and digest-verifies the component. Denials fail closed before any spawn. - Wiring: `pump_component_requests` drains submissions and delivers broker events once per cold tick; deadlines cancel abandoned broker requests and a suspended/reloaded/disposed generation's tickets are purged. Evidence: `tests/component_request_surface.rs` installs the fixture through the real `bitty extension add`, drives one request through the plugin surface (200 + echoed body), and proves denied (`capability_denied`), over-bound payload (rejected before enqueue), crashed component, and deadline failures.
…ivating any (#2254) register_plugin resolves dependencies against the runtime registry, so a dependent plugin mirrored ahead of its dependency would be refused and stay unmirrored. Snapshot the active generations, register every one, then grant and activate; a refusal still warns and leaves that plugin failing closed.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Local
|
Windows job: unrelated
|
The first pass was audited at `470c20ab`; four commits merged while it was open and one of them changes a claim the entry makes. - #2296 adds the production component request surface (`bitty.component.request` / `bitty.component.poll`) and closes #2254, so the Known issues bullet no longer says no request producer exists. Its real limits replace it: no IPC verb, no streaming or retained handle, lossy UTF-8 response bodies, and a mirrored grant surviving a runtime-only suspend. - #2295 hardens the activation record against a planted symlink on both the write and read side, with a typed `ActivationWriteError`. - #2291 moves all six extracted extension pins to their upstream heads and adds the pin drift gate. - #2298 deflakes the cross-VM `command_invoke` test against the 50 ms production RC-1 wall budget. The provenance line now records the audited head `6c4ae437`. The RC-1 fuel accounting fix is still not claimed: PR #2292 remains open. Docs-only: no code, scripts, workflows, or pins touched.
The first pass was audited at `470c20ab`; four commits merged while it was open and one of them changes a claim the entry makes. - #2296 adds the production component request surface (`bitty.component.request` / `bitty.component.poll`) and closes #2254, so the Known issues bullet no longer says no request producer exists. Its real limits replace it: no IPC verb, no streaming or retained handle, lossy UTF-8 response bodies, and a mirrored grant surviving a runtime-only suspend. - #2295 hardens the activation record against a planted symlink on both the write and read side, with a typed `ActivationWriteError`. - #2291 moves all six extracted extension pins to their upstream heads and adds the pin drift gate. - #2298 deflakes the cross-VM `command_invoke` test against the 50 ms production RC-1 wall budget. The provenance line now records the audited head `6c4ae437`. The RC-1 fuel accounting fix is still not claimed: PR #2292 remains open. Docs-only: no code, scripts, workflows, or pins touched.
Priority: P1 | Area: runtime | Labels: feat,P1,area:runtime | Milestone: 0.0.24 | RFC: DIR-030 | Task: CTX-1380
What shipped
The production request producer #2254's Expected clause needed. #2267 wired the
ComponentBrokerat the composition root and #2276 added activation state, but nothingoutside tests ever submitted a request. This adds the narrowest existing seam — a Lua host
surface — because plugins are the intended consumers and the accepted capability model
already covers them. No new protocol, no new spawn path, no IPC scope invention.
bitty.component.request{ id, method, url, headers?, body?, timeout_ms? }validatesshape and bounds, enqueues one submission, and returns a ticket. It never spawns, sends,
or waits, so no Lua callback can hold the owner thread for a component deadline.
bitty.component.poll(ticket)returnsnilwhile in flight, a bounded responsetable (
status,headers,body,bytes,untrusted = true) on success, and raisesthe stable typed class on failure.
(
bitty_terminal::component_bridge) drains submissions once per cold tick, callsRuntime::submit_component_request(the [CTX-1361] feat(runtime): wire the ComponentBroker at the composition root #2267 authorization + submit path), then deliversbroker events back. Deadlines cancel the broker request; a suspended, reloaded, or
disposed generation has its tickets purged and its in-flight requests cancelled.
Activatedplugin, the activation-timemanifest generation, a non-denied grant record bound to that hash, and the canonical
GrantStore::is_granted+[[network.egress]]intersection. The enqueue-time gate onlyrefuses a generation that holds no granted
network.connectcapability; the runtimere-authorizes every submission, and the broker re-resolves and digest-verifies the
installed component before every spawn.
mirror_plugin_authoritycopies each activatedgeneration's manifest and already-decided grant into the runtime's policy host. Before
this, that host was empty in production, so every component request would have denied as
"plugin is not registered". Nothing is granted by the mirror.
Bounds (all explicit, fail-closed)
max_body_bytes+ bridge assembly; oversize failsbudgetCancelbudget)budgetTyped classes:
E_COMPONENT_CAPABILITY_DENIED(capability_denied),E_COMPONENT_NOT_ACTIVE(plugin_not_active, the #2276 label),E_COMPONENT_BUDGET(
budget),E_COMPONENT_TIMEOUT(timeout),E_COMPONENT_PAYLOAD_TOO_LARGE,E_COMPONENT_UNAVAILABLE,E_COMPONENT_UNTRUSTED,E_COMPONENT_REQUEST_FAILED, ...Evidence
Headless integration (
crates/bitty-runtime/tests/component_request_surface.rs), fixtureinstalled through the real
bitty extension addand driven by plugin Lua through theproduction pump:
Headed harness with the real
bitty-net(built from the siblingbitty-networkcheckout,installed through
bitty extension add), isolated XDG, recorded PIDs only, Hyprlandworkspace 5: the plugin's timer issues one
GET http://127.0.0.1:18080/helloand the UIreports
bitty-net (component request): status=200 body=hello.Screenshot:
recording/ctx-2254-component-request/workspace5-full.png(local, gitignored);the owner's workspace was restored afterwards and no
bitty-netchild survived.Gates
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo clippy -p bitty-terminal --features dev-tools --all-targets --locked -- -D warningscargo nextest run -p bitty-runtime -p bitty-terminal -p bitty-lua -p bitty-plugin-host --locked— 4716 passed, 3 skippedcargo check --workspace --all-targets --locked --target x86_64-pc-windows-msvc./scripts/check-scratch-paths.shjust ci-localNon-claims
does not define, and the task explicitly preferred Lua when plugins are the consumers.
bytescount; binary componentpayloads are not a supported Lua shape.
Activegenerations; a pluginsuspended only in the plugin runtime after startup keeps its mirrored grant until the next
start (component requests from it then fail closed at the plugin-runtime lifecycle, which
parks its commands).
are published ([0.1.0] Upstream extension binary distribution via R2 + CDN (registry backend) #2111).
bitty-netin the headed run came from local sources (the CDNextensions/netpaths arestill 404), same limitation as [CTX-1361] feat(cli): report component activation state + bitty-net acceptance evidence #2276.
Docs: the network candidate now records the surface (
bitty-terminal-docsPR #250).Closes #2254