Skip to main content

Crate cordance_core

Crate cordance_core 

Source
Expand description

Cordance core: types, schemas, ports. No I/O.

Doctrine alignment:

  • modularity-and-ports-adapters.md: ports here, adapters elsewhere.
  • event-contracts.md: every emitted artifact has a versioned schema tag.
  • single-source-of-truth.md: serde structs are the single source of truth for on-disk shapes; the JSON schemas in /contracts/ are generated from these structs and round-trip-tested.

§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: None,
    },
    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 json = serde_json::to_string(&pack).expect("serialise pack");
assert!(json.contains("cordance-pack.v1"));

See fs::safe_write for the symlink-refusing write helper every emitter routes through, and paths::doctrine_cache_dir_for_url for the operator-trusted doctrine cache location.

Re-exports§

pub use advise::AdviseFinding;
pub use advise::AdviseReport;
pub use advise::Severity;
pub use evidence::EvidenceEntry;
pub use evidence::EvidenceMap;
pub use evidence::EvidenceSource;
pub use evidence::OutputEvidence;
pub use fence::find_regions;
pub use fence::replace_region;
pub use fence::replace_regions;
pub use fence::sanitise_fenced_value;
pub use fence::FenceError;
pub use fence::FenceMarker;
pub use fence::FencedRegion;
pub use fs::precheck_no_reparse_point_ancestor;
pub use fs::safe_write;
pub use fs::safe_write_with_mkdir;
pub use fs::SymlinkRefusal;
pub use harness_target::AccessMode;
pub use harness_target::AuthoritySurfaces;
pub use harness_target::AxiomProjectHarnessTargetV1;
pub use harness_target::ClaimCeiling;
pub use harness_target::HarnessBlock;
pub use harness_target::HarnessClassification;
pub use harness_target::HarnessInvariantError;
pub use harness_target::HarnessOperations;
pub use harness_target::ProjectBlock;
pub use lock::DriftReport;
pub use lock::OutputDriftEntry;
pub use lock::SourceDriftEntry;
pub use lock::SourceLock;
pub use lock::SourceLockEntry;
pub use pack::CordancePack;
pub use pack::PackOutput;
pub use pack::PackTargets;
pub use pack::ProjectIdentity;
pub use receipt::AuthorityBoundary;
pub use receipt::CortexReceiptV1Candidate;
pub use receipt::ReceiptBody;
pub use receipt::ReceiptInvariantError;
pub use receipt::SourceAnchor;
pub use receipt::TruthCeiling;
pub use source::SourceClass;
pub use source::SourceRecord;
pub use source::SurfaceCategory;

Modules§

advise
Deterministic advisory findings — cordance advise.
evidence
Evidence map: maps emitted rules and outputs back to their source anchors.
fence
Fenced editable regions: <!-- cordance:begin <key> --><!-- cordance:end <key> -->.
fs
Filesystem write helpers that refuse to follow target-controlled symlinks.
harness_target
pai-axiom-project-harness-target.v1 — verbatim conformance with the axiom schema at pai-axiom/PAI/Policy/PROJECT_HARNESS_TARGET.schema.json.
lock
cordance-source-lock.v1 — every input source + every output’s sha256.
pack
The CordancePack IR — the canonical in-repo description of a target project.
paths
Operator-trusted filesystem locations for caches and other state that must not be writable by a target repo.
receipt
cordance-cortex-receipt-v1-candidate — mirrors the axiom→Cortex receipt.
schema
Schema versions emitted by this crate. Never mutate; add a new constant.
source
Source records: every byte cordance consumes is one of these.