Skip to content

refactor(prismpm): Rust module cuts for contracts, canonical, advisory and reference syntax (Part of #448) - #626

Merged
afflom merged 7 commits into
mainfrom
claude/project-thread-h6sbjv
Nov 12, 2026
Merged

afflom merged 7 commits into
mainfrom
claude/project-thread-h6sbjv

Conversation

@afflom

@afflom afflom commented Nov 12, 2026

Copy link
Copy Markdown
Member

Requested by Alex · project thread

Part of #448 (prism.errors) and #449 (prism.verify), Rust side. v0.5 workstream WS6.

Why

model/modules.toml held 15 pending forbidden edges. Twelve of them came from errors and verify calling up into images: contracts.rs ran every contract's semantic check by calling acceptance, exporter, holo::library, holo::validate, oci, release_verification and sdk; holo/canonical.rs validated model documents; sdk.rs re-exported the advisory disposition from supply_chain; and authority/sdk read OCI references through oci. docs/proposals/440-nine-modules.md asks that each check move to its owner without letting anyone hold a document whose checks did not run.

What

  • Owner-checked contracts. contracts.rs keeps the schema table and the closed-shape and ordering checks. A new OWNER_CHECKED table names the module that owns each of 19 contracts (SDK locks /2 /3, lock update /2 and migration, production acceptance, conformance result, browser export and publication receipts, native-library evidence, model documents /2 to /7). CanonicalDocument::parse/from_value refuse those ids with PP9001, and parse_owned/from_value_owned refuse a check from any module other than the registered owner. So the guarantee is the same as before: a document of one of these ids exists only after its owner's check ran.
  • Each owner holds its check and exposes contract_from_value/parse_contract: sdk, acceptance, oci, library_build, library_verification, and a new model_contract.rs (images; it lives outside holo so holo does not join a cycle with contracts). contract_owners.rs (client) routes any id to its owner for callers that hold only an id, and a test proves every owner-checked id reaches its owner.
  • holo/canonical.rs keeps only the value codec (encode_value, decode_value, content_id). encode_canonical/decode_canonical move to holo/model_document.rs.
  • Advisory disposition (validate_advisory_coverage, validate_sdk_security_disposition and their types) moves from supply_chain.rs to sdk/advisory.rs (verify). supply_chain re-exports it.
  • Reference syntax (validate_reference, digest_hex) moves from oci.rs to reference.rs (verify). oci re-exports it.
  • Every refusal test is unchanged in meaning. Tests that parsed an owner-checked id through CanonicalDocument now call the owner, so an is_err() assertion cannot pass on the PP9001 refusal by accident (I scanned the whole tree: no plain call with an owner-checked id is left). The browser-export receipt test moved from contracts to oci::browser_export.
  • Module gate. cargo xtask check-modules: 15 → 3 pending, and contracts and workbench leave legacy_cycle (19 → 17), as the proposal predicted. Remaining: the two "process helpers move to verify" rows (ProcessRecord carries an exporter field, so that cut needs its own change) and WS5's auth.mjs → attest.mjs row, which feat(prism-code): trust decisions in verify, signing in auth (Part of #449) #623 removes.

Emitter inputs

holo/canonical.rs and holo/model_document.rs are emitter inputs and controller/mod.rs's import changed, so: model/emitter-inputs.toml digest rebound, the ct-02/tm-01 applicationModelDigest rebound, and a golden refresh is dispatched for this branch. I'll import the patch and the native records before merging.

Test

  • cargo clippy -p prismpm -p repo-conformance -p xtask --all-targets -- -D warnings clean; cargo fmt clean.
  • cargo xtask check-modules, validate-model (including the emitter-input audit) pass; check-fixtures passes ct-02, and tm-01 needs lake, which this container lacks.
  • cargo test -p prismpm: 803 pass. Every failure needs lake, node, Docker or PRISMPM_TEST_SDK_IMAGE, none of which are installed here; none involves an owner check. CI runs the full suite.

Breaking

prismpm::holo::canonical::{encode_canonical, decode_canonical} moved, and plain CanonicalDocument parsing of the 19 owner-checked ids is refused. Both are in CHANGELOG.md.


Generated by Claude Code

…yntax to their module owners (Part of #448)

Each contract's semantic check now runs in the module that owns its
meaning. CanonicalDocument keeps the schema table and closed-shape checks
in errors and refuses an owner-checked id unless the owner's own check is
supplied, so no caller can hold a document whose checks did not run.

- contracts.rs: OWNER_CHECKED table, parse_owned/from_value_owned; owner
  checks in sdk, acceptance, oci, library_build, library_verification and
  the new model_contract; contract_owners routes by id.
- holo/canonical.rs keeps the value codec; encode_canonical and
  decode_canonical move to holo/model_document.rs.
- SDK advisory disposition moves from supply_chain to sdk/advisory.rs
  (verify); OCI reference syntax moves from oci to reference.rs (verify).
- modules.toml: 15 -> 3 pending, contracts and workbench leave the
  legacy cycle. Emitter digest and ct-02/tm-01 model digest rebound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ
…format gate (Part of #448)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ

afflom commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Two checks are red on 5c8631c, and this PR causes both:


Generated by Claude Code

…per digest (Part of #448)

authority.rs is the hashed wrapper source of six oracles, and the reference
syntax import changed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ
…s id (Part of #448)

Applied from golden-refresh run 43167050013 for 5c8631c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ
…oller import change (Part of #448)

controller/mod.rs now imports encode_canonical from holo::model_document;
the pin is the sha256 of the formatted file (e95ddbac).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ
…(Part of #448)

From native-source-review run 43171961132 on 5e83583.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PtscX6WjMRzTzT3xZ
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.

2 participants