Skip to main content

DepSource

Enum DepSource 

Source
pub enum DepSource {
    Git {
        repo: String,
        tag: Option<String>,
        rev: Option<String>,
        branch: Option<String>,
    },
    Path {
        caminho: String,
    },
}
Expand description

Where a dep is fetched from. Tagged via :tipo in Lisp.

Only two shapes — Git and local Path. No central registry variant: a caixa is just a Git repo. Omitting :fonte means “use the default resolver convention”, which is github:<default-org>/<nome>; the resolver fills that in when computing the lacre.

Variants§

§

Git

Clone from Git. One of :tag, :rev, or :branch may be set. repo can be a github:org/repo shorthand, a full https://… URL, or any git-ssh URL.

Fields

§repo: String
§branch: Option<String>
§

Path

Local filesystem path — dev only; cannot be published.

Fields

§caminho: String

Implementations§

Source§

impl DepSource

Source

pub fn default_github(org: &str, nome: &str) -> Self

Build a registry-shorthand git source (github:<org>/<nome>).

This is the resolver-side fallback for dep.fonte: None, not an author-surface value — it carries no pin (:tag/:rev/:branch all None) and is therefore rejected by Self::validate. The resolver fills the pin in at fetch time from the resolved commit; authors never serialize this shape as a Dep::fonte value.

Source

pub fn sole_pin(&self) -> Option<&str>

Substrate-canonical per-:fonte sole-set git-pin scalar accessor every consumer that reads “which single git ref does this source resolve to?” keys off — returns the author-declared :tag / :rev / :branch byte-string verbatim as an Option<&str>, borrowed from the typed slot’s own Option<String> storage; None on Self::Path (a path source carries no git-ref) and on a Self::Git variant whose tag, rev, and branch are all None (the Self::default_github shorthand shape the resolver materializes when the author omits :fonte — rejected by Self::validate, but the accessor’s return is defined on this arm too so pre-validate consumers reach for the same typed dispatch as post-validate ones).

Precedence: rev > tag > branch. The canonical precedence every per-:fonte git-ref consumer already applies: caixa-resolver’s per-fetch git checkout <ref> reads through the same rev.or(tag).or(branch) cascade at caixa-resolver/src/resolve.rs, and caixa-crd’s dep_into_ref CaixaSource.git_ref fill reads through the same cascade at caixa-crd/src/conversion.rs. The Self::validate gate enforces “exactly one pin set” — under that invariant every accepted Self::Git carries exactly one non-None pin and the precedence is unobservable, but the precedence remains defined for pre-validate consumers (the resolver’s MissingPin diagnostic path, the caixa-crd round-trip’s default "main" fallback the author never sees a diagnostic on) and defense-in-depth for a hypothetical future state where multiple pins survive the gate. The precedence is rev before tag because :rev (a git commit OID) is the reproducibility-strongest identifier — an OID resolves to exactly one commit regardless of which refname points at it, whereas :tag and :branch are refnames the remote can silently move (a tag re-push, a branch head advance); the resolver’s freeze step at fetch time promotes the resolved commit to :rev for exactly this reason. Tag before branch because :tag is conventionally immutable (a release tag) whereas :branch is conventionally mutable (a tracking ref) — a caixa carrying both a release tag and a tracking branch reads as “prefer the release pin, fall through to the tracking pin only if the release is missing”. The cascade order also matches the byte-order every per-:tag/:rev/:branch diagnostic tuple this crate emits ((":tag", tag), (":rev", rev), (":branch", branch) — see Self::validate’s pins array).

Prior to this lift the “sole set pin” projection sat twice in the workspace — inline at caixa-resolver’s fetch_git (let gitref = rev.or(tag).or(branch).ok_or_else(|| ResolveError::MissingPin { … })?;) and at caixa-crd’s dep_into_ref (git_ref: rev.clone().or(tag.clone()).or(branch.clone()) .unwrap_or_else(|| "main".to_string())) — two open-coded copies of the same precedence cascade with no compile-time link back to the typed slot. A future extension of the pin axis to a richer author surface (a :commit pin peer of :rev once the substrate grows a signed-commit-verification pin, a :ref pin the M4 substrate operator resolves per-cluster ahead of fetch, a promotion of the plain Option<String> pins to a typed GitPin::{Rev(Oid), Tag(RefName), Branch(RefName)} newtype once the sibling crate::render::is_git_oid / crate::render::is_git_ref_name gates land as typed constructors) would have had to be threaded through both open-coded copies in lockstep or the resolver’s git checkout target would silently disagree with the CRD’s git_ref fill — an author’s (:fonte (:tipo git :repo "…" :rev "deadbeef" :tag "v1")) would ship with the resolver checking out deadbeef while the CRD round-trip re-emitted a Dep pointing at v1, one lacre closure disagreeing with the emitted K8s CR the operator reads. Lifting the resolution to a typed method on the substrate primitive means both downstream consumers reach for exactly one typed dispatch — the resolver’s accept-set migrates as a unit on any future pin-axis addition.

Peer of the sibling outer-Dep Dep::fonte (d65d1bf) Option<&DepSource> composite-reference accessor on the outer- Dep :fonte-slot axis — extended one nesting level down onto the per-Self::Git-variant sole-set-pin projection axis every git-fetching consumer runs after the outer :fonte slot resolves to a Self::Git shape. Same “one typed dispatch on the substrate primitive, thin projections at each consumer” discipline the outer accessor family already carries.

Source

pub fn validate(&self, nome: &str) -> Result<(), DepError>

Validate the :fonte value-shape: every author-surface :fonte (:tipo git …) must carry a non-empty :repo and exactly one of :tag / :rev / :branch set to a non-empty value; every :fonte (:tipo path …) must carry a non-empty :caminho.

Called from Dep::validate with the dep’s :nome so every diagnostic carries the offending entry verbatim — same self-locating shape the :deps :versao (2420c44), :membros :versao (9888b13), :children :versao (b38ff3a), :placement :clusters (6cbb900), and :membros :caixa (3f9d7a0) gates already expose.

Until this gate landed :fonte was the only :deps-related typed surface still untyped past Caixa::from_lisp:

  • Empty :repo ((:tipo git :repo "" :tag "v1")) silently passed parse and surfaced as a git-clone failure at lacre-resolve time, far from the source caixa.lisp.
  • A bare (:tipo git :repo "…") with no :tag/:rev/:branch passed parse and surfaced as the resolver’s ResolveError::MissingPin at fetch time, again far from the source caixa.lisp; lifting to validate-time gives the author the same diagnostic at the edit site.
  • (:tipo git :repo "…" :tag "v1" :branch "main") — multiple pins set — passed parse and the resolver silently picked :rev > :tag > :branch, ignoring the other pins with no diagnostic; the author had no way to know their :branch was dropped. This is the canonical “pin drift” footgun.
  • An empty pin value ((:tipo git :repo "…" :tag "")) silently passed parse and surfaced as git checkout "" at fetch time.
  • Empty :caminho ((:tipo path :caminho "")) silently passed parse and surfaced as ResolveError::MissingPath with path: PathBuf("") — not actionable.

Each rejected shape maps to a typed [DepError::Fonte*] variant that names the offending dep’s :nome and the specific axis, so the author can grep their caixa.lisp for the :nome "<nome>" block and fix it in one edit.

Trait Implementations§

Source§

impl Clone for DepSource

Source§

fn clone(&self) -> DepSource

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 DepSource

Source§

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

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

impl<'de> Deserialize<'de> for DepSource

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 Eq for DepSource

Source§

impl PartialEq for DepSource

Source§

fn eq(&self, other: &DepSource) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DepSource

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
Source§

impl StructuralPartialEq for DepSource

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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.