Skip to content

id: residency policy vocabulary and evaluator (#3398 step 1) - #5629

Merged
dezren39 merged 2 commits into
mainfrom
queue/9596-5529-residency-policy
Nov 5, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/9596-5529-residency-policy

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Partial implementation of #5529 (design doc/2026-11-01_design_id3398.md §7 step 1). Adds pure, internal residency module: planes, scope, per-plane policy, operator trust roots, evidence, fail-closed evaluator with reason codes, 14 unit tests. No network/store behaviour changes. Steps 2-5 (storage/processing admission, sync+bridge, federation/relay/metadata, spill) remain; step 5 is blocked on the single-writer lease design. Refs #5529, does not close it.


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

@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 18:37
@coderabbitai

coderabbitai Bot commented Nov 4, 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 40 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: 418d10a3-93cd-4f25-9277-e1588219f611
Commits

Reviewing files that changed from the base of the PR and between 4a504c4 and fd96999.

Files selected for processing: 3
  • pkgs/id/crates/id-core/src/lib.rs
  • pkgs/id/crates/id-core/src/residency.rs
  • pkgs/id/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 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T18:51:14.233613Z fd96999 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 448019bbfc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/id/src/residency.rs Outdated
Comment on lines +63 to +67
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Policy {
pub planes: BTreeMap<Plane, PlanePolicy>,
/// Planes a path must prove. Defaults to all four through [`Policy::new`].
pub required: BTreeSet<Plane>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the default scoped policy fail closed

Constructing Scope::Scoped(Policy::default()) and evaluating an empty hop list returns Decision::Allow: the derived default leaves required empty, so neither evaluation loop records a denial, even though no planes, trust roots, or evidence are configured. This differs from Policy::new and makes the default construction of a scoped policy bypass the intended missing-evidence denial. Implement Default with all four required planes, or remove the derived implementation so callers must explicitly construct a policy.

Useful? React with 👍 / 👎.

Comment on lines +280 to +282
#[test]
fn full_evidence_allows() {
assert!(run(&evs(), 50, &OK).is_allow());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add generated coverage for residency policy invariants

The new evaluator has only hand-written example tests, despite having explicit invariants concerning required-plane coverage, evidence binding, expiry, and rejection of invalid hops. Add property-based coverage against these invariants, or generated comparisons with an independent decision model, varying required planes, hop multiplicity, bindings, and time boundaries. Root AGENTS.md requires property/model-based testing where meaningful invariants or a design model exist; fixed examples alone do not satisfy that requirement.

AGENTS.md reference: AGENTS.md:L41-L45

Useful? React with 👍 / 👎.

@dezren39

dezren39 commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Update: the policy/evaluator is now in pkgs/id/crates/id-core/src/residency.rs and re-exported through the existing pkgs/id facade. Focused tests: 18 passing in id-core; root crate resolves the same 18. This is only design #3398 §7 step 1; it does not enforce boundaries at native sync/bridge, federation, or relay seams. PR remains partial and does not satisfy or close #5529.

@dezren39
dezren39 merged commit e64fa70 into main Nov 5, 2026
1 check passed
@dezren39
dezren39 deleted the queue/9596-5529-residency-policy branch November 5, 2026 01:49
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