fix(research): never re-activate a revoked grant on an approval retry #168
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 334 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #168"
general
weight: 0.35
abendrothj
What and why
Fixes #166.
An approval that fails partway leaves the request Approved without a usable grant, and the steward retries it. A retry finishes that decision; it never makes a new one.
GrantRegistry::create_unless_revoked, so a revoke that lands while the retry runs also holds. A retry that finds the grant revoked is refused with 404 and audited asdenied(reason=revoked). First approvals and explicit re-grants still usecreate. A persistentGrantRegistrybackend must implementcreate_unless_revokedas a conditional insert or a transaction.approved_budget: the steward'squery_budget, else the listing's included budget), and a retry opens that budget. A retry that names a differentquery_budgetis refused with 400 and audited asdenied(reason=budget).Retries are audited with
retry=true.Follow-up: #<issue> (retry an approval from the steward portal after a 502).
How it was tested
platform-tenancy:create_unless_revoked_creates_then_is_idempotent,reactivation_by_create_unless_revoked_is_refused(a revoked grant stays revoked, no second grant is minted beside it, an explicit re-grant still re-activates it) andapproval_records_its_budget.research_api.rs:approval_retry_after_a_revoke_is_refused,half_finished_approval_retry_after_a_revoke_is_refused,approval_retry_racing_a_revoke_is_refused(a wrapper registry revokes the grant after the retry starts and before its grant step: 404, the grant stays revoked, the research query stays 403),approval_retry_with_a_different_budget_is_refused(400, budget unchanged) andapproval_retry_after_a_budget_failure_keeps_the_approved_budget.audit_coverage.rs:research_catalog_is_auditedasserts theretry=trueapproval and both refused retries (reason=revoked,reason=budget).scripts/check.shpasses on the rebased branch.Checklist
scripts/check.shpasses locallySECURITY_AUDIT_EVENTcovered byaudit_coverage.rsdocs/DATA_POLICY.md)CHANGELOG.mdupdated for user-visible changesdocs/adr/if one was made: N/A