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.
Path
Local filesystem path — dev only; cannot be published.
Implementations§
Source§impl DepSource
impl DepSource
Sourcepub fn default_github(org: &str, nome: &str) -> Self
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.
Sourcepub fn sole_pin(&self) -> Option<&str>
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.
Sourcepub fn validate(&self, nome: &str) -> Result<(), DepError>
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/:branchpassed parse and surfaced as the resolver’sResolveError::MissingPinat 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:branchwas dropped. This is the canonical “pin drift” footgun.- An empty pin value (
(:tipo git :repo "…" :tag "")) silently passed parse and surfaced asgit checkout ""at fetch time. - Empty
:caminho((:tipo path :caminho "")) silently passed parse and surfaced asResolveError::MissingPathwithpath: 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<'de> Deserialize<'de> for DepSource
impl<'de> Deserialize<'de> for DepSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DepSource
impl StructuralPartialEq for DepSource
Auto Trait Implementations§
impl Freeze for DepSource
impl RefUnwindSafe for DepSource
impl Send for DepSource
impl Sync for DepSource
impl Unpin for DepSource
impl UnsafeUnpin for DepSource
impl UnwindSafe for DepSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.