feat(contract): promote ClassRbac trait + Operation to contract::rbac (keystone §11)#599
Conversation
… (keystone §11)
Threads the contract <-> rbac <-> ogar <-> callcenter chain: ClassRbac
lived in lance-graph-rbac, which lance-graph-ogar does not dep (contract
only), so OgarClassView could not impl the keystone's Q5
'impl ClassRbac for OgarClassView'. §11 places the trait in contract.
- NEW lance_graph_contract::rbac: ClassId/ActorId/RoleId, Operation<'a>
(reads contract::property::PrefetchDepth, no rbac dep), trait ClassRbac.
A contract-only impl test proves ogar can satisfy it.
- lance-graph-rbac re-exports them (policy::Operation, authorize::{ClassRbac,
ClassId, ActorId, RoleId} unchanged); authorize()+ClassGrants+Policy+
AccessDecision+auth stay in rbac.
- Zero breakage: callcenter builds against the re-exports; sibling
smb-realtime/medcare-realtime gates use AccessDecision (unmoved), untouched.
- contract::rbac 2 tests + 723 contract; rbac 21; clippy -D warnings + fmt clean.
Follow-on (not forced): converge rbac::auth::ResolvedIdentity onto the existing
contract::auth::ActorContext; OgarClassView impl needs the §6 granted tenant.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 22 minutes and 56 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
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 |
What & why — threading the
contract ↔ rbac ↔ ogar ↔ callcenterchainThe four-crate RBAC chain had one structural gap. The keystone (
CLASSID-RBAC-KEYSTONE-SPEC.md§11/Q5) prescribesimpl ClassRbac for OgarClassView— butClassRbaclived in lance-graph-rbac, and lance-graph-ogar doesn't depend on rbac (only contract). So ogar structurally could not implement the trait. §11 places it in contract.Change (scoped to exactly the trait placement)
lance_graph_contract::rbac:ClassId/ActorId/RoleId,Operation<'a>(reads the contract's ownproperty::PrefetchDepth— no rbac dep), andtrait ClassRbac { actor_roles, grant_permits }. A contract-onlyimpl ClassRbactest proves ogar can satisfy it with contract-only types.policy::Operationandauthorize::{ClassRbac, ClassId, ActorId, RoleId}paths are unchanged.authorize()+ClassGrants+Policy+AccessDecision+ the0x0Bauth membrane stay in rbac (Q5: "rbac stays contract-tier").Zero breakage (verified)
lance-graph-callcenter(in-repo consumer ofOperation/Policy) builds against the re-exports.smb-realtime/medcare-realtimegates consumeAccessDecision(which did not move) — untouched.clippy -D warnings+ fmt clean.Prior-art surfaced (deliberately NOT duplicated)
The "consult before you guess" rule caught two existing contract types this promotion sits alongside rather than re-inventing:
contract::auth::ActorContext(the resolved actor triplerbac::auth::ResolvedIdentitymirrors — convergence tracked as follow-on) andcontract::external_membrane::MembraneGate(the gate trait that consultsClassRbac; they compose, not duplicate).Follow-on (not in this PR)
A meaningful
impl ClassRbac for OgarClassViewneeds the §6project_role.grantedtyped tenant (grant data the ClassView doesn't carry yet) — the §6-gated next step. This PR is the unblock.Board:
LATEST_STATE.md+EPIPHANIES.md(E-CLASSRBAC-PROMOTED-TO-CONTRACT) updated in-commit.🤖 Generated with Claude Code
Generated by Claude Code