Repository navigation
[CTX-0406] feat(plugin): external local-path install + lifecycle + runtime reload - #670
Merged
Merged
Conversation
…ntime reload Install or update an externally authored package from a local directory into the XDG plugin store, verify it before staging, and prove the full install -> load -> run -> disable -> update -> reload -> uninstall path. - bitty-runtime: new plugin_runtime::package staging (bounded manifest read, entry point, module-tree bounds, compat ranges, capability-diff consent, quarantine copy, content digest, atomic current.json switch, owner-only modes, retained-version prune) and PluginRuntime::reload (teardown N before N+1). - resolution: staged local-path records use a store-relative immutable root (digest mismatch fails closed) while absolute dev roots keep the read-only drift-reported flow. - activation: the recorded, manifest-hash-bound grant is enforced; a record that does not cover the declared set fails closed before any VM. - bitty-app: `bitty plugin install <path>`, list/info source column, enable/disable/remove on the store, remote sources fail closed. - tests: package unit tests, runtime plugin_package e2e, CLI cli_plugin e2e with a real external fixture.
Address the CTX-0406 review findings on PR #670. - S1 (security): consent is bound to a staged snapshot. install_local_dir copies the source into .tmp-* quarantine, hashes the staged body/tree, and passes a ConsentRequest to a callback; approval commits that same snapshot (source never re-read) with a post-consent hash re-verify. Regression test swaps the source mid-prompt and asserts only the reviewed grant commits. - L1: read_store_manifest resolves through resolution::store_package_root (escape-checked); crafted `../` record roots are rejected. - L2: store installs reject bundled-catalog ids (BundledIdReserved). - L4: InvalidSource doc matches behavior (symlink-to-directory accepted and canonicalized; entry symlinks rejected by the copy/scan). - S2: the installer pre-scan uses scan_module_tree_source, matching copy_tree exactly (VCS dirs skipped, symlinks rejected). Follow-ups recorded: CTX-0416 (L3 compat re-check at resolve/activate), CTX-0417 (L5 quarantine GC + prune-failure reporting).
Contributor
Author
|
Review findings addressed on this branch (no merge). New head: Must-fix (bitty)
Recorded follow-ups (not fixed here)
Tests added
Gates (all green on
|
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Priority: P2 | Area: plugins | Labels: feat,area:plugins,P2 | Milestone: v0.1.0 | RFC: OQ-053/OQ-072 | Task: CTX-0406
Closes #669
What already existed
bitty pluginCLI (CTX-0150):list|install|remove|enable|disable|infofor bundled ids via a managed manifest; no plugin VM.
resolution with
current.json, fail-closedmanifest_hash/content_digestverification,
--safethird-party skip.bitty-plugin-hostpolicy (manifest, capabilities, grants, host reloadmechanics) and the accepted package-lifecycle / plugin-host-runtime RFCs.
What this builds (real, not mocked)
bitty plugin install <local-dir>verifies thebitty-plugin.tomlwith the runtime's bounded reader, requiresinit.lua,re-checks the ratified module-tree bounds (4096 files / 16 MiB / 1024-byte
paths, native artifacts rejected), evaluates
compat.bitty+compat.plugin-apiagainst the running host, and diffs requestedcapabilities against the recorded grant. Added capabilities need explicit
consent (
--yesor[y/N], fail-closed on EOF). Content is copied into aquarantine dir, digested, atomically renamed to
packages/<id>/<version>/, thencurrent.jsonis switched last.0700/0600modes on Unix.Staged
local-pathrecords use a store-relative immutable root (digestmismatch fails closed); absolute dev roots keep the read-only
drift-reported flow.
list/infoinclude installed packages with asourcefield;
enable/disablerewrite the index atomically; re-install updatesand retains the previous version;
remove --forceuninstalls record + tree.PluginRuntime::reloaddisposes generation Nbefore activating N+1 from the re-resolved store record; the recorded,
manifest-hash-bound grant is enforced at activation (a record that does not
cover the declared set fails closed before any VM is created).
git:/https:///ssh://) fail closed with a clearmessage; the SDK
bitty-plugin-lintis not present yet, so the Rustvalidation path is authoritative.
Exact installed-plugin flow
Evidence
just check(bitty): fmt-check, workspace clippy-D warnings, fullworkspace tests, scratch-paths, pty-gate, actionlint, markdownlint — exit 0.
cargo check --target x86_64-pc-windows-gnu --workspace --all-targets --locked— exit 0.cargo test -p bitty-runtime --test plugin_package(2 tests): realinstall → discover → activate → dispatch → update → reload → disable →
uninstall, plus recorded-grant enforcement.
cargo test -p bitty-app --test cli_plugin(9 tests): real binary installsa real external fixture, asserts store layout/index, list/info JSON, then
loads it with the real runtime and runs the command; consent decline/EOF
fail closed; remote source rejected.
git diff --checkclean.Deliberately deferred
gitsource resolution (CLI rejects it explicitly).bitty plugin reload/IPC trigger surface (OQ-072 remains Open; theruntime reload API and update-pickup-on-next-start are shipped).
bitty-plugin-lintconformance, draft seven-stage pipeline, rollbackcommands, package
assets/.Residual risks
current.jsonis user-writable state; integrity is enforced byre-verification and grant coverage, but a user can still intentionally
disable a record. Grants cannot be widened without consent because a
mismatch fails closed.
local-pathstore-relative record root is a refinement of RFCB.4/B.5 (documented in bitty-plugins-docs); it should be folded into the
next RFC revision.
PluginRuntimegrants for bundled/dev packages still default to the fulldeclared set (no record); only store records carry consented grants.