Skip to content

feat(id-caps): capability-change comparison core + accepted baseline store (#12921) - #13079

Merged
dezren39 merged 1 commit into
mainfrom
lane-jl-12921
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-jl-12921

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

First landable slice of #12921, against the #5959 design record (doc/2026-11-23T05-02-30Z_design_id_capability_change_notices/) and the #5999 §6 contract (doc/2026-11-08T10-12-00Z_design_id_capability_diff_semantics/). The gate (the class field + shipped class table) landed via #12982 / PR #13002; cap_class.rs names this issue as the comparison's implementer.

What lands

crates/id-caps/src/cap_diff.rs — the pure comparison core:

  • subsumes — id: design: capability-change diff semantics — user-meaningful capability classes and re-approval triggers #5999 §3.1's declared facts only (reflexivity, cap.none under everything, fs.sandbox ≼ fs.read.arbitrary, net.host.<name> ≼ net.out); no prefix/scope inference; unknown subsumed by nothing but itself.
  • message_set — names → classes through the registry (fail-closed to unknown), cap.none dropped, maximalised; * expanded over the catalog exactly as the ledger expands a * grant (sensor caps excluded); optional names excluded (§4 rule 6).
  • compare(B, N) → CapDiff { new_classes } — exactly what the notice names; uncomputable_diff() is the invariant-10 fail-closed trigger the connect stage will use.

crates/id-caps/src/cap_baseline.rs — #5959 §1's record + §5's transitions:

  • CapBaseline in the design's JSON shape (world_id, release_identity, message_set, table_version, baseline_key = H(world_id ‖ release_identity ‖ message_set ‖ table_version), SHA-256 over a length-framed encoding, history).
  • The five re-baselining paths and only those: accept, accept_minus_denied (§4: B := N ∖ {denied}), establish (first-connect decisions / invite pin), narrow (automatic, covered-and-strictly-smaller only), revoke_class (grant-page edit) — plus yolo_auto_accept bookkeeping so YOLO never leaves a stale baseline. BaselineStore is the per-user store keyed by world.

Verification

Remainders (named on #12921)

Refs #12921 — the issue stays open for the slices above.


See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…store (#12921)

First slice of #12921 (capability-change notices, #5959 design):

- cap_diff: #5999 §6's pure comparison — the subsumption order
  (§3.1 declared facts only), message sets (names → classes via the
  registry, cap.none dropped, maximalised; `*` expanded as the
  ledger expands it; optional names excluded per §4 rule 6), and
  compare(B, N) naming exactly the uncovered classes. Fail-closed:
  unknown names/classes resolve to `unknown`; uncomputable_diff()
  is the invariant-10 trigger for the connect stage to use.
- cap_baseline: #5959 §1's client-side baseline record (world_id,
  release_identity, message_set, table_version, baseline_key =
  H(...) as SHA-256 over a length-framed encoding, history) and
  §5's five re-baselining paths only — accept, accept-minus-denied
  (§4 per-class denial composition), establish (first-connect /
  invite pin), automatic narrowing, grant-page revoke — plus YOLO
  auto-accept bookkeeping.

Oracles: proptest over (B, N, ≼) for #5999 §7 invariants 1–5, 8, 9
(each test names its invariant), unit tests for the §3/§4 rules,
and #12921's notice-level tests for denial composition, narrowing
+ re-prompt on re-addition, YOLO bookkeeping, and the invite pin.

Remainders on #12921: the connect-pipeline stage (§2) and the
notice surface (§3–§4), plus baseline persistence beside #5960's
remembered grants.
@coderabbitai

coderabbitai Bot commented Nov 23, 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 56 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 37cc84f1-abd9-4148-82cd-1485f3e899be
Commits

Reviewing files that changed from the base of the PR and between fd21893 and baca980.

Files selected for processing: 3

  • pkgs/id/crates/id-caps/src/cap_baseline.rs
  • pkgs/id/crates/id-caps/src/cap_diff.rs
  • pkgs/id/crates/id-caps/src/lib.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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T08:00:23.403410Z baca980 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant