pub struct SourceLock {
pub schema: String,
pub pack_id: String,
pub doctrine_commit: Option<String>,
pub axiom_algorithm_pin: Option<String>,
pub sources: Vec<SourceLockEntry>,
pub outputs: Vec<SourceLockEntry>,
}Fields§
§schema: String§pack_id: String§doctrine_commit: Option<String>§axiom_algorithm_pin: Option<String>§sources: Vec<SourceLockEntry>§outputs: Vec<SourceLockEntry>Implementations§
Source§impl SourceLock
impl SourceLock
pub fn empty() -> Self
Sourcepub fn compute_from_pack(pack: &CordancePack) -> Self
pub fn compute_from_pack(pack: &CordancePack) -> Self
Compute a SourceLock from a CordancePack.
pack_id is the sha256 of a deterministic byte stream that mixes:
- project identity (
name, a fixedrepo:.placeholder, optionalaxiom_pin), so that two unrelated empty projects can never collide on the same id, and - every source’s
id:sha256, sorted by id, so the digest is stable across runs that produce the same logical pack.
axiom_algorithm_pin is propagated from pack.project.axiom_pin so
that a downstream cordance check notices a doctrine-shaped drift in
the axiom algorithm version (the cellos drift problem cordance exists
to solve).
§Cross-host determinism — Round-8 bughunt #4 (R8-bughunt-4)
Earlier rounds (round-5 R5-bughunt-5 / round-5 R5-bughunt-8 / round-6
LOW / round-7 R7-bughunt-6) hashed pack.project.repo_root.as_str()
directly. That string was the operator’s host-absolute path
(C:\\Users\\0ryant\\prj\\cordance on Windows,
/home/op/projects/cordance on Linux), so two clones of the same
git commit on different hosts produced different pack_ids — and
the cortex receipt that hashes pack_id then disagreed about pack
identity across CI runners and developer machines. The cellos drift
problem the receipt was supposed to detect was masked by a
path-shape drift cordance itself was introducing.
The mix now uses a fixed placeholder (b"."). Project distinction
still comes from name and axiom_pin. pack_cmd::run writes the
matching "." into pack.project.repo_root for the on-disk shape;
the framing constant here is the second half of the same contract
so any future code that builds a pack with a non-"." repo_root
(test fixtures, MCP shims) still hashes identically.
Sourcepub fn diff(
&self,
previous: &Self,
fenced_outputs: &HashSet<String>,
) -> DriftReport
pub fn diff( &self, previous: &Self, fenced_outputs: &HashSet<String>, ) -> DriftReport
Diff self (the current/new state) against previous.
fenced_outputs is the set of output paths (as entry.path.as_str())
that currently contain cordance fence markers on disk. The caller is
responsible for computing this set; keeping the read out of diff
preserves the modularity-and-ports-adapters boundary — SourceLock
is a pure domain type and must not touch the filesystem.
Output paths absent from fenced_outputs are treated as fenced
when they are missing on disk (so a deleted managed region still
counts as drift). This matches the previous behaviour exactly.
Trait Implementations§
Source§impl Clone for SourceLock
impl Clone for SourceLock
Source§fn clone(&self) -> SourceLock
fn clone(&self) -> SourceLock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more