feat(schema): ordeal-certificate artifact type (REQ-255, #693 Part 2) - #744
feat(schema): ordeal-certificate artifact type (REQ-255, #693 Part 2)#744avrabe wants to merge 2 commits into
Conversation
Ingests `ordeal-cert/v1` certificates as first-class rivet evidence. Unblocked by pulseengine/ordeal#107 (ordeal v0.17.0 `cert-bundle`). - schemas/ordeal-certificate.yaml declares the artifact type with the flat envelope fields (produced-by-*, checked-by-*, attests-claim, attests-standards, cnf-sha256, proof-sha256, recheck-command, recheck-expect-exit, recheck-exit-code, recheck-ran-at, recheck-checked-by) plus the `attests-transform` link with source-types pinned to `[ordeal-certificate]`. - Two validation rules bake in the honest boundaries: * `V-ordeal-cert-v1-inline-only` (error) mirrors ordeal's `BundleError::Unsupported` — cnf-ref / proof-ref indirection is rejected at ingest so v2 envelopes in a v1 world surface as a legible schema violation, not a mystery deserialize failure. * `V-ordeal-cert-needs-recheck` (warning) implements the "claimed vs re-checked" coverage split from the AC — a certificate whose recheck-exit-code is missing or != "0" is unverified evidence, not a verification link. - SAT-witness honesty boundary documented in the schema header and the docs topic: UNSAT verdicts carry re-checkable LRAT; SAT verdicts carry only the self-checked model until ordeal ships an independent SAT witness. - Registered in rivet-core/src/embedded.rs (const + SCHEMA_NAMES + embedded_schema match arm) so `rivet.yaml` can `schemas: - ordeal-certificate` and validate without a filesystem copy. - Docs topic `artifact-types/ordeal-certificate` in rivet-cli/src/docs.rs (following the SUPPLY_CHAIN_DOC pattern of embedded YAML + prose). - 13 integration tests in rivet-core/tests/ordeal_certificate_schema.rs cover: schema load / registration, envelope fields declared, source pinning of the attests-transform link, both validation rules firing and staying silent, and a full generic-loader round-trip of the example artifact. REQ-255 flipped from proposed to implemented, release: v0.31.0. Part 1 (the `--certify` hook on `rivet release check --variant`) stays out of scope for this PR and will be filed as a separate REQ when picked up. Implements: REQ-255 Refs: ordeal#67, ordeal#107, #693 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKjuRsu5YcXx84ZSRtapUe
The `rivet docs artifact-types/ordeal-certificate` topic added in the prior commit references ordeal's own version (`v0.17.0`, the release that ships the `cert-bundle` feature + `ordeal-cert/v1` envelope) nine times — in the schema header, docs prose, example artifact, and the worked-example blocks. `rivet docs check`'s `EmbeddedVersionLiterals` invariant flags any version literal that isn't the rivet workspace version (0.30.0), so it fails with 9 violations on the new topic. Add `"0.17.0"` to `rivet.yaml`'s `docs-check.allowed-version-literals` with a comment explaining what it is. Same pattern as the existing `0.10.0` / `1.3.0` entries — upstream tool versions that are stable identifiers, not stale rivet-version claims. `rivet docs check` now PASS (61 files, 0 violations). Refs: #693, #744 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKjuRsu5YcXx84ZSRtapUe
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📐 Rivet artifact delta
Graphgraph LR
REQ_255["REQ-255"]:::modified
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Modified
Posted by |
|
CI status on Every other check on this SHA is green (or intentionally skipped):
The bot integration can't re-run failed jobs from here ( Generated by Claude Code |
Closes #693 (Part 2 — the
ordeal-certificateingestion type).Unblocked by pulseengine/ordeal#107 (ordeal v0.17.0
cert-bundlefeature —ordeal-cert/v1envelope with both content hashes verified insideCertificate::from_cert_v1before the checker runs).Summary
schemas/ordeal-certificate.yamldeclares theordeal-certificateartifact type, theattests-transformlink (source-types pinned to[ordeal-certificate]), and two validation rules that bake in the honest boundaries the upstream envelope enforces.rivet-core/src/embedded.rs(const +SCHEMA_NAMES+embedded_schemamatch arm) so downstream projects can addordeal-certificateto theirrivet.yamlschemas:list.rivet docs artifact-types/ordeal-certificatetopic (inline inrivet-cli/src/docs.rs, mirroring theSUPPLY_CHAIN_DOCpattern) with the schema YAML + prose covering serialization contract, SAT boundary, v1 reader boundary, and a worked example.artifacts/requirements.yaml: REQ-255 flippedproposed→implemented,release: v0.31.0, description updated to note Part 1 (the--certifyhook wiring rivet's variant solver into ordeal) stays out of scope for this PR and will be filed as a separate REQ.rivet-core/tests/ordeal_certificate_schema.rs.Acceptance criteria (verbatim from the issue body) → how satisfied
New embedded schema declares
ordeal-certificateartifact type carryingproduced-by(tool + version),checked-by(verifier + version),attests(claim + standards),cnf-sha256+cnf-ref,proof-sha256+proof-ref(LRAT for UNSAT / self-checked model for SAT), and a structuredrecheckblock (command,expect-exit).→
schemas/ordeal-certificate.yaml. Fields are FLAT (not nested mappings) so the s-expression validation-rule evaluator can read them — the envelope stays 1:1 withordeal-cert/v1, just projected:produced-by-tool,produced-by-version,checked-by-verifier,checked-by-version,attests-claim(enum),attests-standards(list),cnf-sha256,cnf-ref,proof-sha256,proof-ref,recheck-command,recheck-expect-exit. Test:ordeal_certificate_declares_envelope_fields.Typed
attests-transformlink-field with allowed-target rule sorivet validate'slink-target-typecheck catches misuse.→ Link type declared with
source-types: [ordeal-certificate]. Target-types stays permissive today because none of the cross-toolchain transform artifact types (variant,loom-rule,synth-codegen,sigil-overflow,spar-layout,gale-bitvector) exist as first-class rivet artifact types yet — see the note in the schema; adding them there flips the check on automatically. Tests:attests_transform_link_source_pinned_to_ordeal_certificate,attests_transform_is_required_on_ordeal_certificate.rivet validatetreats a re-checked certificate as a verification link, not a claimed status; averifieslink to an ordeal-certificate whoserecheck.commandwas run and exited 0 (recorded viaverification-resultor an equivalent field) counts toward coverage; a certificate whoserecheckwas never run does not.→
V-ordeal-cert-needs-recheck(warning) — anordeal-certificateMUST carryrecheck-exit-code == "0"(the schema pinsrecheck-expect-exitto"0"viaallowed-values). A certificate without a recheck stamp surfaces as unverified evidence. The recheck result lives inrecheck-exit-code+recheck-ran-at+recheck-checked-by— the flat form of the AC'sverification-resultblock. Tests:needs_recheck_rule_fires_when_recheck_exit_code_missing,needs_recheck_rule_fires_when_exit_code_differs,needs_recheck_rule_silent_on_rechecked_certificate.Honest SAT boundary baked into the schema: for
attests.claim: variant-consistent(SAT), theproof-*fields hold the self-checked model — ordeal ships no independently re-checkable SAT witness yet (UNSAT is the certificate-carrying verdict).→ Documented in the schema header (
── SAT-witness honesty boundary ──) and in the docs topic.attests-claimallowed-values includevariant-consistent/variant-inconsistent/verified-transformso the two are distinguishable in the graph. No schema-side rule mistakes a SAT model for LRAT.v1 reader boundary as an expected-error fixture: ordeal-cert/v1 is inline-payload-only — a bundle using
cnf_ref/proof_refindirection must surface as a legibleUnsupported-class validation error.→
V-ordeal-cert-v1-inline-only(error) fires when eithercnf-reforproof-refis present. MirrorsCertificate::from_cert_v1'sBundleError::Unsupportedat the rivet ingest layer. Tests:v1_inline_only_rule_fires_when_cnf_ref_present,v1_inline_only_rule_silent_when_only_inline_hashes.Golden-file test: an
ordeal-certificateartifact serializes / parses round-trip byte-identical; alink-target-typefixture demonstrates theattests-transformallowed-targets enforcement; a coverage-rule fixture demonstrates the "re-checked → counts" vs. "never re-checked → does not count" split.→
ordeal_certificate_artifact_yaml_roundtripsstructurally round-trips the example artifact through the realparse_generic_yamlloader (byte-identical would pin the serde_yaml emitter, which drifts across versions — structural equality is what actually protects the schema). Theattests-transformsource-side pin + required-link tests cover the link-target-type direction rivet can enforce today. Theneeds_recheckandv1_inline_onlytests cover the coverage-split fixture.rivet docstopic explains the shape, the SAT boundary, and therecheckinvocation contract, with ordeal-cert/v1 as shipped linked.→
rivet docs artifact-types/ordeal-certificate— inline topic (following this project's docs convention where topics live inrivet-cli/src/docs.rs, not a filesystem.md). Links ordeal PR Supply chain integration: Sigil attestations + SBOM/AIBOM + Rivet traceability bridge #107, ordeal#67, rivet#693, and REQ-255.Commit trailers:
Implements: REQ-NNN+Refs: ordeal#67, #693.→
Implements: REQ-255(the existing rivet-side REQ for exactly this feature — no new REQ needed since REQ-255 was filed for both parts of Certified feature-model / variant consistency via ordeal's SAT core (EU AI Act evidence) #693 and only Part 2 lands here).Refs: ordeal#67, ordeal#107, #693.Explicitly out of scope (Part 1, filed separately): the
--certifyflag onrivet release check --variant/rivet variant solve, CI wiring,rules_ordealgate, UNSAT-core surfacing as avariant validatediagnostic.→ Confirmed out of scope. REQ-255 description now notes Part 1 will be filed as a separate REQ when picked up.
Test plan
cargo test -p rivet-core --test ordeal_certificate_schema— 13/13 passcargo test -p rivet-cli --test docs_coverage— 8/8 pass (new docs topic doesn't break subcommand-coverage)cargo run -p rivet-cli -- docs artifact-types/ordeal-certificate— topic renders (schema YAML + prose)rivet validate— PASS (589 pre-existing warnings, unchanged; REQ-255 now shows as an implemented requirement in the same missing-downstream shape as its neighbors)cargo fmt --all --checkcleancargo clippy -p rivet-core -p rivet-cli --tests -- -D warningscleanFollow-ups (deliberately not in this PR)
--certifyhook shelling rivet's variant solver into ordeal's SAT front-end) — separate REQ once picked up.variant,loom-rule,synth-codegen,sigil-overflow,spar-layout,gale-bitvector) as first-class rivet types so theattests-transformlink's target-types check can enforce.ordeal = { version = "0.17", features = ["cert-bundle"] }dependency behind acert-bundlecargo feature if rivet ever wants to invokeUnsatBundle::recheck()in-process instead of shellingrecheck-command.Generated by Claude Code