Skip to main content

SourceLock

Struct SourceLock 

Source
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

Source

pub fn empty() -> Self

Source

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:

  1. project identity (name, a fixed repo:. placeholder, optional axiom_pin), so that two unrelated empty projects can never collide on the same id, and
  2. 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.

Source

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

Source§

fn clone(&self) -> SourceLock

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceLock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SourceLock

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SourceLock

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,