feat(core): add obstruction receipt skeleton#339
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR introduces ChangesObstruction Receipt Type & Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Reconciled overlap with PR #336.\n\nPorted forward the useful pieces from #336 into this generic receipt path:\n- authority policy id/posture on ObstructionReceipt when present\n- explicit refusal-context regression coverage\n- explicit deterministic receipt regression coverage\n- grant-intent design doc diagrams now show ObstructionReceipt as the durable refusal carrier\n\nPR #336 is now superseded/closed so we do not keep both the specialized CapabilityGrantIntentObstructionReceipt shape and the generic ObstructionReceipt shape alive. |
|
@coderabbitai review please 🥕 |
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/warp-core/src/optic_artifact.rs`:
- Around line 241-264: The receipt input buffer is created with Vec::new()
causing reallocations; in capability_grant_intent_receipt_input replace
Vec::new() with Vec::with_capacity(...) using an estimated capacity computed
from the sum of the .len() of each byte slice you push (intent.intent_id,
intent.proposed_by.id, intent.subject.id, intent.artifact_hash,
intent.operation_id, intent.requirements_digest, policy_id.unwrap_or_default(),
policy_posture, obstruction_kind, intent.rights entries, intent.scope_bytes, and
any optional expiry/delegation bytes) plus a small fixed overhead for the length
prefixes (roughly 13 × 8 bytes) to avoid reallocations, then use that pre-sized
Vec for the subsequent push_receipt_field/ push_receipt_field_list/
push_optional_receipt_field calls.
- Around line 164-197: The ObstructionReceipt currently stores
receipt_input_bytes redundantly; remove the receipt_input_bytes field from the
struct and keep only receipt_digest to minimize memory, then add a method on
ObstructionReceipt (e.g., impl ObstructionReceipt { fn
build_receipt_input_bytes(&self) -> Vec<u8> }) that reconstructs the
deterministic input bytes on demand using the existing fields (kind, intent_id,
proposed_by, subject, artifact_hash, operation_id, requirements_digest,
policy_id, policy_posture, obstruction_kind, disposition) and the two
label/serialization helpers used elsewhere; update any code that previously
relied on the receipt_input_bytes field to call the new
build_receipt_input_bytes() method and verify that receipt_digest is computed
from the reconstructed bytes when needed.
- Around line 199-265: The policy_id is serialized as an empty field via
unwrap_or_default() causing None and Some("") to collide; in
capability_grant_intent_receipt_input replace push_receipt_field(...,
policy_id.unwrap_or_default().as_bytes()) with the optional encoder
push_optional_receipt_field(..., policy_id.map(|s| s.as_bytes())) so policy_id
presence is tagged like expiry_bytes/delegation_basis_bytes; update the call
site in ObstructionReceipt::capability_grant_intent_receipt_input to use
push_optional_receipt_field for policy_id and ensure types match the helper
signature (Option<&[u8]>).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1f827917-6371-4790-a941-e7b271bea243
📒 Files selected for processing (6)
CHANGELOG.mdcrates/warp-core/src/lib.rscrates/warp-core/src/optic_artifact.rscrates/warp-core/tests/capability_grant_intent_tests.rsdocs/design/obstruction-receipt-boundary.mddocs/design/optic-capability-grant-intent-boundary.md
|
|
Follow-up on the |
|
Second CI follow-up: |
Summary
Adds the first Echo-side obstruction receipt skeleton for capability grant intent refusals.
Core doctrine:
ObstructionReceiptis not an admission ticketObstructionReceiptis not a LawWitnessObstructionReceiptis not aCounterfactualCandidateWhat changed
ObstructionReceiptRewriteDispositionCapabilityGrantIntentPosturewarp-coreobstructed_intent_does_not_create_counterfactual_candidateWhat this is not
Verification
RED:
cargo test -p warp-core obstructed_intent_does_not_create_counterfactual_candidatefailed before implementation becauseObstructionReceipt,RewriteDisposition,OBSTRUCTION_RECEIPT_KIND, and the posture receipt field did not exist.GREEN:
cargo test -p warp-core obstructed_intent_does_not_create_counterfactual_candidatecargo test -p warp-core capability_grant_intentcargo check -p warp-corescripts/ban-nondeterminism.shnpx markdownlint-cli2 docs/design/obstruction-receipt-boundary.md CHANGELOG.mdgit diff --checkPush hook also passed full local verification lanes: fmt, guards, clippy-core, tests-warp-core, rustdoc.
Summary by CodeRabbit
New Features
Documentation