GeezerVison is showing github.com — fix(id): replay_grants folds first-use provider grants by dezren39 · Pull Request #10828 · developing-today/code
Conversation
dezren39
commented
Nov 16, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #10786.
replay_grants skipped every non-accepted record, so provider_use / first_use_grant capabilities granted by CapLedger::decide_for under grant_on_use never replayed — replayed granted under-reported vs the live ledger.
Change (pkgs/id/crates/id-worlds/src/world/audit.rs):
- provider_use with outcome first_use_grant or allowed folds parameters.capability into granted; malformed/missing capability ignored, denied/refused stay nothing. UpdateCaps/SetCapsCeiling accepted-only semantics unchanged.
- Doc comment + module doc updated.
Tests:
- New: replay_folds_first_use_grants, replay_ignores_malformed_provider_use_capability.
- Verified: cargo test -p id-worlds --lib world::audit::tests (8/8), plus retained_audit_log_replays_to_the_final_grants + admin_audit_replays_grants_and_ceiling_and_records_refusal_once (2/2). git diff --check clean; audit.rs cargo-fmt clean (repo has pre-existing fmt drift elsewhere, untouched).
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- Bug Fixes
- Grant replay now includes capabilities from provider-use records marked as first-use grants or allowed. Denied uses and records with missing or invalid capability values do not change grants.
- Documentation
- Clarified how provider-use records affect grant replay.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
replay_grants skipped every non-accepted record, so provider_use /
first_use_grant capabilities granted by CapLedger::decide_for under
grant_on_use never replayed. Fold provider_use first_use_grant (and
later allowed uses) into granted; malformed/missing capability is
ignored, denied stays nothing.
Tests: replay_folds_first_use_grants, replay_ignores_malformed_provider_use_capability; existing audit + F12.6 retained-log tests pass.
Closes #10786
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
❌ Failed 2026-11-16T16:27:49.487194Z We couldn’t complete this review. Comment @codex review to try again. |
a37c886 |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 16, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Walkthrough
-
replay_grants now adds string-valued capabilities from provider_use records with first_use_grant or allowed outcomes. Other outcomes and missing or non-string capability values do not add grants.
Changes: Provider-use grant replay
| Layer / File(s) |
Summary |
Replay provider-use grants pkgs/id/crates/id-worlds/src/world/audit.rs |
The documentation describes replaying eligible provider-use records. replay_grants adds their string-valued capabilities, and tests cover eligible outcomes, denied use, and malformed or missing capability values. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
Merge Risk: Minimal · up to a37c8
-
Grant replay now includes first-use provider grants, so replayed grants match what the live ledger holds. The change is small and covered by unit tests, and no concrete merge-blocking risk was found.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Linked Issues check |
 |
[#10786] Core fix is present at head. In pkgs/id/crates/id-worlds/src/world/audit.rs, replay_grants handles action == "provider_use" with outcome "first_use_grant" or "allowed" and inserts parameters.… |
Extend retained_audit_log_replays_to_the_final_grants in pkgs/id/crates/id-worlds/src/world/tests.rs. Enable grant_on_use, perform one provider use that produces a first_use_grant, then assert that replay_grants over the retained records yi… |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title names the main change: replay_grants now folds first-use provider grants into granted capabilities. It matches the raw summary and the PR objectives, and it names the affected function and t… |
| Out of Scope Changes check |
 |
The supplied summary shows changes only in pkgs/id/crates/id-worlds/src/world/audit.rs (+70/-6): the replay fold, its doc comments and module doc, and new unit tests. All of these relate to #10786. Th… |
Full details: Title check
-
Explanation
The title names the main change: replay_grants now folds first-use provider grants into granted capabilities. It matches the raw summary and the PR objectives, and it names the affected function and the fix type. It is concise and specific, so the check passes.
Full details: Out of Scope Changes check
-
Explanation
The supplied summary shows changes only in pkgs/id/crates/id-worlds/src/world/audit.rs (+70/-6): the replay fold, its doc comments and module doc, and new unit tests. All of these relate to #10786. The fold also accepts outcome "allowed", not only "first_use_grant". This matches the replay objective because an allowed use of an already granted capability leaves granted unchanged, and the change is limited to provider_use records. UpdateCaps and SetCapsCeiling handling is unchanged. The diff tool was unavailable, so this verdict relies on the PR summary and the head file read.
Full details: Linked Issues check
-
Explanation
[#10786] Core fix is present at head. In pkgs/id/crates/id-worlds/src/world/audit.rs, replay_grants handles action == "provider_use" with outcome "first_use_grant" or "allowed" and inserts parameters.capability (string only) into state.granted. Denied and refused outcomes add nothing. Malformed or missing capability is ignored. The new unit tests replay_folds_first_use_grants and replay_ignores_malformed_provider_use_capability cover these paths. Unmet acceptance criterion: the issue requires extending the F12.6 replay test (retained_audit_log_replays_to_the_final_grants in pkgs/id/crates/id-worlds/src/world/tests.rs) with a first-use grant, enabling grant_on_use, exercising one provider use, and asserting replay_grants(&records).granted == caps_report().granted. The PR description and the summary list only audit.rs as changed, and they do not claim tests.rs was modified. The required ledger-to-replay comparison is therefore absent. Note: the repository diff tool was unavailable, so the changed-file list relies on the supplied PR summary.
Resolution
Extend retained_audit_log_replays_to_the_final_grants in pkgs/id/crates/id-worlds/src/world/tests.rs. Enable grant_on_use, perform one provider use that produces a first_use_grant, then assert that replay_grants over the retained records yields granted equal to caps_report().granted.
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning Some tools did not complete. Review the errors below.
Clippy (1.99.1)
-
Clippy execution timed out
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|