Skip to content

[CTX-1185] feat(dynapi): grant-revocation renewal semantics for provided APIs (#2005) - #2048

Merged
Xuepoo merged 3 commits into
mainfrom
carryctx/ctx-1185-dynapi-gating
Oct 13, 2026
Merged

Xuepoo merged 3 commits into
mainfrom
carryctx/ctx-1185-dynapi-gating

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Finishes #2005 (dynapi 2/4) on top of #2037 backing-heads: #2037 already covers unbacked rejection, grant-cover resolve/call, confused-deputy and head-spoofing hostile tests (all re-verified green here). This PR closes the one open acceptance point: revocation timing.

  • Renewal semantics: snapshot fixed at activation, immutable mid-generation; a renewed generation snapshots the narrowed set and fails closed immediately with no restart beyond re-activation.
  • Documents where revocation takes effect and where it does not: store-backed packages re-resolve the install record at reload (narrowed grants apply, no process restart); dev-root LocalPath packages reuse the discovered manifest (reload re-verifies the tree only; grant edits need fresh discovery); live generations never observe revocation retroactively.
  • New broker-seam test: granted resolves, narrowed snapshot fails resolve (E_SERVICE_RESOLUTION, nil when optional) and pinned-handle call (E_SERVICE_GONE, indistinguishable), re-approval serves again with records intact.
  • No new ambient authority: broker resolve/call path carries zero socket/process/fs references (rg evidence below); no new production edges (W-147 green).

rg evidence (crates/bitty-runtime/src/plugin_runtime/services.rs, resolve/call path): no std::net / std::process / tokio net-process / Command / TcpStream / UdpSocket / std::fs matches.

Gates: fmt clean, clippy -D warnings clean (workspace), runtime lib 269 passed, plugin_services 10 passed, plugin-host lib 404 passed, windows target check clean, verify_w147_small_core_graph 9/9. ci-local blocked by the same pre-existing sccache GHA-backend failure under act as PR #2047; scratch-paths fails pre-existing in untouched wsl.rs/component.rs.

Follow-ups (not this PR): qualified-form x gating interaction tests once #2047 merges; store-backed reload-revocation integration as future hardening.

Priority: P1 | Area: plugins | Labels: feat,P1,area:plugins | Milestone: v0.1.0 | Task: CTX-1185

Closes #2005

@Xuepoo Xuepoo added this to the v0.1.0 milestone Oct 13, 2026
@Xuepoo Xuepoo added feat Feature P1 Priority: high area:plugins labels Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 92b81c1f-a4c9-4f9f-826d-e153b6c4e6ef
📥 Commits

Reviewing files that changed from the base of the PR and between fddcda6 and 7a5b4a9.

📒 Files selected for processing: 1
  • crates/bitty-runtime/src/plugin_runtime/services.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review verdict (guard cron / separate agent reviewer)

Commit reviewed: db558a8fd (branch carryctx/ctx-1185-dynapi-gating, PR #2048)
Verdict: REQUEST_CHANGES

Checks run (read-only, against the PR checkout):

  1. git log --oneline -1 && git show --stat HEAD
  2. git show HEAD -- crates/bitty-runtime/src/plugin_runtime/services.rs
  3. git show HEAD -- crates/bitty-runtime/src/plugin_runtime/mod.rs
  4. rg -n 'std::net|std::process|TcpStream|UdpSocket|Command|std::fs' crates/bitty-runtime/src/plugin_runtime/services.rs
  5. rg -n 'E_SERVICE_RESOLUTION|E_SERVICE_GONE|revocation|narrowed|generation' crates/bitty-runtime/src/plugin_runtime/services.rs

Findings:

  1. The diff is documentation + test only (services.rs +52, mod.rs +19, 0 deletions) — no runtime behavior changed. The renewal/revocation enforcement the PR says it finishes is pre-existing code this commit neither modifies nor newly verifies.
  2. The new test grant_narrowing_on_renewed_snapshot_fails_closed_without_restart (services.rs ~5451) models "a renewed generation" by directly calling host.set_granted_capabilities(Vec::new()); it never exercises reload/re-activation or store-backed re-resolve, so the PR's central claim (renewal through the package source narrows the snapshot) is named in the test title but not actually tested.
  3. The new doc on set_granted_capabilities (services.rs ~2231-2240) and on reload (mod.rs ~1843-1861) assert specific reload/revocation semantics with no test and no code change in this commit (store-backed re-resolve vs dev-root LocalPath reusing the discovered manifest; live generations never observe revocation retroactively); reload's new doc also duplicates the pre-existing doc block on the same function.
  4. Good, and not contradicted: "no new ambient authority" holds — no std::net/std::process/TcpStream/UdpSocket on the resolve/call path (Command* hits are CommandRecord/CommandDirectory/CommandBlock, not std::process::Command); the only fs reference is the pre-existing std::fs::File::open at services.rs:366, off the resolve/call path.

Do not merge until the renewal path is actually exercised (reload / store-backed) or the claims are narrowed to what the test proves.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review verdict (guard cron / separate agent reviewer) — re-review

Commit reviewed: 0d4c245b443775f7ca2e40e03db0c4f4038b78ee (branch carryctx/ctx-1185-dynapi-gating, PR #2048)
Supersedes the REQUEST_CHANGES at db558a8fd.
Verdict: APPROVE — prior REQUEST_CHANGES resolved.

Verification of the fix delta (git diff db558a8f..HEAD):

  1. Doc/test only. git show --stat HEAD = 2 files, +15/-43; the only non-comment lines touched are the test fn name and its expect() strings. No runtime statement added or removed (services.rs:2235-2240, 5443-5482).
  2. Duplicated reload doc removed. The mod.rs hunk is pure deletion (19 removed, 0 added) of exactly the previously-added reload doc block, restoring the docstring to its pre-db558a8f state (mod.rs:1843); the pre-existing # Errors doc is preserved.
  3. No unproven claim remains. The new doc at set_granted_capabilities (services.rs:2231-2233) claims only that narrowing a live generation's snapshot closes service_resolve/service_call on the next lookup/call — exactly what the test exercises. The store-backed re-resolve / LocalPath / "immutable until renewal" prose is gone.
  4. Test rename faithful. narrowing_grant_snapshot_to_empty_fails_closed_without_restart (services.rs:5446); comments/expect() strings narrowed to the proven invariant (narrowed-to-empty snapshot fails closed for required resolve, optional nil, call-as-gone; re-widening serves again); assertions unchanged (E_SERVICE_RESOLUTION, E_SERVICE_GONE).

Fix author evidence: cargo check -p bitty-runtime --tests --offline exit 0; cargo test -p bitty-runtime --offline narrowing_grant_snapshot_to_empty_fails_closed_without_restart exit 0 (1 passed). just ci-local not run (lane lock).

Residual non-blocking note: the new sentence sits under a pre-existing sentence inherited from before db558a8f, mildly redundant — not introduced by this commit, not a blocker.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commander pre-merge check: full CI green on post-update head, no CodeRabbit findings outstanding. Merging.

@Xuepoo
Xuepoo merged commit b38db1b into main Oct 13, 2026
17 checks passed
@Xuepoo
Xuepoo deleted the carryctx/ctx-1185-dynapi-gating branch October 13, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugins feat Feature P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dynapi] Capability gating for dynamically provided APIs (no new authority)

1 participant