Skip to content

feat(id): versioned config schema and hard invariants (9111-01, #10178) - #12871

Merged
dezren39 merged 1 commit into
mainfrom
lane-cq/10178-config-schema
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-cq/10178-config-schema

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements slice 9111-01 for #10178 — the minimum validated V2 config contract needed before admission gates consume configuration. Design basis: doc/2026-11-13T03-40-00Z_design_id-atlas-summit/crosscut/versioned-design.md, section "Configuration data model and precedence" (S7.1, S7.10–S7.13).

Preflight (mandatory for this slice): native blockers #9141 and #10160 are both CLOSED (fresh-verified 2026-11-23; #9141 closed today after its done-check, #10160 closed 2026-11-14), so the triage gate passed and implementation proceeded within the approved scope only. Record: #10178 (comment)

Changed files (the four owned files + minimal wiring):

  • pkgs/id/crates/id-config/Cargo.toml + src/lib.rs (new leaf crate, no workspace deps): canonical ConfigDocument; FixedGates — any attempt to disable signature-verification / validation / replay-protection / authorization / tenant-scope is rejected (FixedGateDisabled), because gates are mechanism, not behavior; hard Ceilings that scoped overrides may only narrow (widening is CeilingWidened, never a clamp); mechanism-versus-behavior field_class classification; fail-closed unknown-field policy (deny_unknown_fields everywhere; extension keys must be namespaced and are retained verbatim, never executed); deterministic resolve() (mode defaults → document behavior → scoped overrides in scope-name order) with per-field provenance and canonical JSON output.
  • pkgs/id/config/id-config-v1.schema.json (new): JSON Schema (draft 2020-12) form of the same contract — gates as "const": true, additionalProperties: false, namespaced-extension key pattern.
  • pkgs/id/tests/config_invariants.rs (new): the slice oracle as an independent validator — it loads the schema file and generates the invalid-config matrix from it (one gate-disable attempt per schema-declared gate, one missing-field case per schema-required field, unknown fields at every level), plus semantic cases (ceiling widening, behavior beyond a narrowed ceiling, duplicate scopes, zero ceilings) and resolver determinism (authoring-order independence, byte-identical canonical JSON).
  • pkgs/id/Cargo.toml / Cargo.lock: workspace member + default-member registration and a dev-dependency (the facade does not link id-config in production builds yet; gates will take a real dependency when they start consuming resolved config).

Evidence (oracle command from the issue):

$ cargo test --manifest-path pkgs/id/Cargo.toml --test config_invariants   # in pkgs/id nix develop, laptop
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

(7 tests: schema/Rust lockstep, gate-disable matrix, missing/unknown-field matrix, invalid-config matrix, determinism, precedence+ceilings+provenance, classification stability. Re-run after rustfmt: same result.)

Rollback: reject this schema and keep the last valid version; fixed admission invariants remain compiled and enforced (per the slice manifest).


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

Slice 9111-01 of the ID/Atlas V2 program: the minimal validated V2 config
contract that admission gates will consume, per
doc/2026-11-13T03-40-00Z_design_id-atlas-summit/crosscut/versioned-design.md
("Configuration data model and precedence"; S7.1, S7.10-S7.13).

- pkgs/id/crates/id-config (new leaf crate): canonical ConfigDocument,
  FixedGates that reject any disable attempt (mechanism, not behavior),
  hard Ceilings that scopes may only narrow, a mechanism-versus-behavior
  field classification, a fail-closed unknown-field policy (namespaced
  extensions retained, never executed), and a deterministic resolver with
  per-field provenance.
- pkgs/id/config/id-config-v1.schema.json (new): the JSON Schema form of
  the same contract (gates as const true, additionalProperties false).
- pkgs/id/tests/config_invariants.rs (new): the slice oracle — an
  independent validator that generates its invalid-config matrix from the
  schema file (one disable attempt per declared gate, one missing-field
  case per required field) plus the semantic invariants (ceiling
  widening, behavior beyond ceiling, duplicate scopes) and resolver
  determinism. 7 passed, 0 failed.
- pkgs/id/Cargo.toml + Cargo.lock: workspace member/default-member and a
  dev-dependency so the root package's tests can exercise the contract.

Preflight: native blockers #9141 and #10160 both closed (verified fresh
2026-11-23), so the mandatory triage gate for 9111-01 passed; record on
#10178.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 04:08
@dezren39
dezren39 merged commit 2dc8cb8 into main Nov 23, 2026
1 check passed
@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 21 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: 0cfddeec-ab62-4bc9-84f6-5cfe89406282
Commits

Reviewing files that changed from the base of the PR and between 813c0bc and 526ba8c.

Files ignored due to path filters: 1

  • pkgs/id/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 5

  • pkgs/id/Cargo.toml
  • pkgs/id/config/id-config-v1.schema.json
  • pkgs/id/crates/id-config/Cargo.toml
  • pkgs/id/crates/id-config/src/lib.rs
  • pkgs/id/tests/config_invariants.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

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