Skip to main content

Crate cordance_cortex

Crate cordance_cortex 

Source
Expand description

Cortex adapter. Emits cordance-cortex-receipt-v1-candidate JSON only.

ADR 0005: Cordance never writes to the cortex repo or runtime. It produces a receipt; the operator hands the receipt to Cortex via Cortex’s own acceptance flow.

Every receipt’s AuthorityBoundary is constructed via AuthorityBoundary::candidate_only(), which sets every authority-grant flag to false. Receipts re-validate through validate_invariants() on the deserialise path so a tampered JSON that flips a flag is caught even if serde accepts it.

§Golden path

use cordance_core::advise::AdviseReport;
use cordance_core::lock::SourceLock;
use cordance_core::pack::{CordancePack, PackTargets, ProjectIdentity};
use cordance_core::schema;

let pack = CordancePack {
    schema: schema::CORDANCE_PACK_V1.into(),
    project: ProjectIdentity {
        name: "my-project".into(),
        repo_root: ".".into(),
        kind: "rust-workspace".into(),
        host_os: "linux".into(),
        axiom_pin: Some("v3.1.1-axiom".into()),
    },
    sources: vec![],
    doctrine_pins: vec![],
    targets: PackTargets::all(),
    outputs: vec![],
    source_lock: SourceLock::empty(),
    advise: AdviseReport::empty(),
    residual_risk: vec!["claim_ceiling=candidate".into()],
};

let receipt = cordance_cortex::build_receipt(&pack).expect("build receipt");
receipt.validate_invariants().expect("invariants hold");

let json = serde_json::to_string_pretty(&receipt).expect("serialise");
println!("{json}");

Modules§

builder
Receipt builder — produces a cordance-cortex-receipt-v1-candidate from a compiled CordancePack.
validator
Structural validator for CortexReceiptV1Candidate.

Enums§

CortexError

Functions§

build_receipt
Build a candidate receipt from a compiled pack.
safe_boundary
Quick check: a fresh AuthorityBoundary::candidate_only() is always safe.