Skip to main content

caixa_core/
dep.rs

1use serde::{Deserialize, Serialize};
2use thiserror::Error;
3
4/// A single dependency declaration in a `caixa.lisp` manifest.
5///
6/// **Store model = Git, like Zig.** There is no central registry; a caixa is
7/// just a Git repo with a `caixa.lisp` at its root. When `:fonte` is omitted,
8/// the resolver falls back to `github:<default-org>/<nome>` (org defaults to
9/// `pleme-io`, override via `~/.config/caixa/config.yaml`).
10///
11/// ```lisp
12/// ;; Shorthand — resolves to github:pleme-io/caixa-teia (or your default org):
13/// (:nome "caixa-teia" :versao "^0.1")
14///
15/// ;; Explicit git source:
16/// (:nome "caixa-teia"
17///  :versao "^0.1"
18///  :fonte (:tipo git :repo "github:pleme-io/caixa-teia" :tag "v0.1.0"))
19///
20/// ;; Arbitrary git URL (not limited to GitHub):
21/// (:nome "private-caixa"
22///  :versao "*"
23///  :fonte (:tipo git :repo "ssh://git@git.example/team/priv-caixa.git" :branch "main"))
24///
25/// ;; Local path (dev only; not publishable):
26/// (:nome "caixa-teia"
27///  :versao "0.1.0"
28///  :fonte (:tipo path :caminho "../caixa-teia"))
29/// ```
30#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
31#[serde(rename_all = "camelCase")]
32pub struct Dep {
33    /// Caixa name — must match the target caixa's `:nome`.
34    pub nome: String,
35
36    /// Semver constraint string (`"^0.1"`, `"~0.1.2"`, `"0.1.0"`, `"*"`).
37    pub versao: String,
38
39    /// Where to fetch the caixa from. Defaults to the feira registry.
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    pub fonte: Option<DepSource>,
42
43    /// If true, a missing `:fonte` is not a build failure.
44    #[serde(default, skip_serializing_if = "is_false")]
45    pub opcional: bool,
46
47    /// Feature flags to enable on the target caixa.
48    #[serde(default, skip_serializing_if = "Vec::is_empty")]
49    pub caracteristicas: Vec<String>,
50}
51
52/// Where a dep is fetched from. Tagged via `:tipo` in Lisp.
53///
54/// Only two shapes — Git and local Path. No central registry variant: a caixa
55/// is just a Git repo. Omitting `:fonte` means *"use the default resolver
56/// convention"*, which is `github:<default-org>/<nome>`; the resolver fills
57/// that in when computing the lacre.
58///
59/// The [`gen_platform::IsVariant`] derive emits per-arm arm-discriminator
60/// predicates — [`Self::is_git`], [`Self::is_path`] — so every downstream
61/// consumer that only needs the arm-discriminator projection (not the
62/// borrowed field value) reaches for one typed dispatch on the substrate
63/// primitive rather than a hand-rolled `matches!(s, DepSource::X { .. })`
64/// literal. Extends the closed-set-typed-enum discipline the sibling
65/// caixa-core enums ([`crate::CaixaKind`], [`crate::CaixaDialeto`],
66/// [`crate::supervisor::RestartStrategy`], [`crate::supervisor::RestartPolicy`],
67/// [`crate::upgrade::UpgradeInstruction`], [`crate::aplicacao::PlacementStrategy`],
68/// [`crate::aplicacao::RateLimitUnit`], [`crate::aplicacao::WitTarget`],
69/// [`crate::render::PathShapeViolation`], [`DepList`]) and the sibling
70/// out-of-crate enums (caixa-arch's `InvariantKind` + `ArchVerdict`,
71/// caixa-lint's `Severity` + `FixSafety`, caixa-provedor's
72/// `FerriteRuntime`, caixa-theme's `Semantic`, caixa-flux's `GitRefSpec`,
73/// caixa-ast's `NodeKind` + `TriviaKind`) already carry onto the
74/// two-arm `:fonte` dep-source axis — the 17th closed-set typed enum
75/// on the caixa surface, and the first on the outer-`Dep` `:fonte`-slot
76/// axis every git-fetching consumer runs after the outer `:fonte` slot
77/// resolves to a shape.
78#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, gen_platform::IsVariant)]
79#[serde(tag = "tipo", rename_all = "lowercase")]
80pub enum DepSource {
81    /// Clone from Git. One of `:tag`, `:rev`, or `:branch` may be set.
82    /// `repo` can be a `github:org/repo` shorthand, a full `https://…` URL,
83    /// or any git-ssh URL.
84    Git {
85        repo: String,
86        #[serde(default, skip_serializing_if = "Option::is_none")]
87        tag: Option<String>,
88        #[serde(default, skip_serializing_if = "Option::is_none")]
89        rev: Option<String>,
90        #[serde(default, skip_serializing_if = "Option::is_none")]
91        branch: Option<String>,
92    },
93    /// Local filesystem path — dev only; cannot be published.
94    Path { caminho: String },
95}
96
97impl DepSource {
98    /// Build a registry-shorthand git source (`github:<org>/<nome>`).
99    ///
100    /// This is the resolver-side fallback for `dep.fonte: None`, not an
101    /// author-surface value — it carries no pin (`:tag`/`:rev`/`:branch`
102    /// all `None`) and is therefore rejected by [`Self::validate`]. The
103    /// resolver fills the pin in at fetch time from the resolved commit;
104    /// authors never serialize this shape as a `Dep::fonte` value.
105    #[must_use]
106    pub fn default_github(org: &str, nome: &str) -> Self {
107        Self::Git {
108            repo: format!("github:{org}/{nome}"),
109            tag: None,
110            rev: None,
111            branch: None,
112        }
113    }
114
115    /// Substrate-canonical per-`:fonte` sole-set git-pin scalar accessor
116    /// every consumer that reads "which single git ref does this source
117    /// resolve to?" keys off — returns the author-declared `:tag` /
118    /// `:rev` / `:branch` byte-string verbatim as an `Option<&str>`,
119    /// borrowed from the typed slot's own `Option<String>` storage; `None`
120    /// on [`Self::Path`] (a path source carries no git-ref) and on a
121    /// [`Self::Git`] variant whose `tag`, `rev`, and `branch` are all
122    /// `None` (the [`Self::default_github`] shorthand shape the resolver
123    /// materializes when the author omits `:fonte` — rejected by
124    /// [`Self::validate`], but the accessor's return is defined on this
125    /// arm too so pre-validate consumers reach for the same typed dispatch
126    /// as post-validate ones).
127    ///
128    /// **Precedence: rev > tag > branch.** The canonical precedence every
129    /// per-`:fonte` git-ref consumer already applies: caixa-resolver's
130    /// per-fetch `git checkout <ref>` reads through the same
131    /// `rev.or(tag).or(branch)` cascade at caixa-resolver/src/resolve.rs,
132    /// and caixa-crd's `dep_into_ref` `CaixaSource.git_ref` fill reads
133    /// through the same cascade at caixa-crd/src/conversion.rs. The
134    /// [`Self::validate`] gate enforces "exactly one pin set" — under
135    /// that invariant every accepted [`Self::Git`] carries exactly one
136    /// non-`None` pin and the precedence is unobservable, but the
137    /// precedence remains defined for pre-validate consumers (the
138    /// resolver's `MissingPin` diagnostic path, the caixa-crd
139    /// round-trip's default `"main"` fallback the author never sees a
140    /// diagnostic on) and defense-in-depth for a hypothetical future
141    /// state where multiple pins survive the gate. The precedence is
142    /// **rev before tag** because `:rev` (a git commit OID) is the
143    /// reproducibility-strongest identifier — an OID resolves to exactly
144    /// one commit regardless of which refname points at it, whereas
145    /// `:tag` and `:branch` are refnames the remote can silently move
146    /// (a tag re-push, a branch head advance); the resolver's freeze
147    /// step at fetch time promotes the resolved commit to `:rev` for
148    /// exactly this reason. **Tag before branch** because `:tag` is
149    /// conventionally immutable (a release tag) whereas `:branch` is
150    /// conventionally mutable (a tracking ref) — a caixa carrying both
151    /// a release tag and a tracking branch reads as "prefer the release
152    /// pin, fall through to the tracking pin only if the release is
153    /// missing". The cascade order also matches the byte-order every
154    /// per-`:tag`/`:rev`/`:branch` diagnostic tuple this crate emits
155    /// (`(":tag", tag), (":rev", rev), (":branch", branch)` — see
156    /// [`Self::validate`]'s `pins` array).
157    ///
158    /// Prior to this lift the "sole set pin" projection sat twice in the
159    /// workspace — inline at caixa-resolver's `fetch_git` (`let gitref =
160    /// rev.or(tag).or(branch).ok_or_else(|| ResolveError::MissingPin
161    /// { … })?;`) and at caixa-crd's `dep_into_ref`
162    /// (`git_ref: rev.clone().or(tag.clone()).or(branch.clone())
163    /// .unwrap_or_else(|| "main".to_string())`) — two open-coded copies
164    /// of the same precedence cascade with no compile-time link back to
165    /// the typed slot. A future extension of the pin axis to a richer
166    /// author surface (a `:commit` pin peer of `:rev` once the substrate
167    /// grows a signed-commit-verification pin, a `:ref` pin the M4
168    /// substrate operator resolves per-cluster ahead of fetch, a
169    /// promotion of the plain `Option<String>` pins to a typed
170    /// `GitPin::{Rev(Oid), Tag(RefName), Branch(RefName)}` newtype
171    /// once the sibling [`crate::render::is_git_oid`] /
172    /// [`crate::render::is_git_ref_name`] gates land as typed
173    /// constructors) would have had to be threaded through both
174    /// open-coded copies in lockstep or the resolver's `git checkout`
175    /// target would silently disagree with the CRD's `git_ref` fill —
176    /// an author's `(:fonte (:tipo git :repo "…" :rev "deadbeef" :tag
177    /// "v1"))` would ship with the resolver checking out `deadbeef`
178    /// while the CRD round-trip re-emitted a Dep pointing at `v1`, one
179    /// lacre closure disagreeing with the emitted K8s CR the operator
180    /// reads. Lifting the resolution to a typed method on the substrate
181    /// primitive means both downstream consumers reach for exactly one
182    /// typed dispatch — the resolver's accept-set migrates as a unit on
183    /// any future pin-axis addition.
184    ///
185    /// Peer of the sibling outer-`Dep` [`Dep::fonte`] (d65d1bf)
186    /// `Option<&DepSource>` composite-reference accessor on the outer-
187    /// `Dep` `:fonte`-slot axis — extended one nesting level down onto
188    /// the per-[`Self::Git`]-variant sole-set-pin projection axis every
189    /// git-fetching consumer runs after the outer `:fonte` slot resolves
190    /// to a [`Self::Git`] shape. Same "one typed dispatch on the
191    /// substrate primitive, thin projections at each consumer" discipline
192    /// the outer accessor family already carries.
193    #[must_use]
194    pub fn sole_pin(&self) -> Option<&str> {
195        match self {
196            Self::Git {
197                tag, rev, branch, ..
198            } => rev.as_deref().or(tag.as_deref()).or(branch.as_deref()),
199            Self::Path { .. } => None,
200        }
201    }
202
203    /// Validate the `:fonte` value-shape: every author-surface
204    /// `:fonte (:tipo git …)` must carry a non-empty `:repo` and
205    /// exactly one of `:tag` / `:rev` / `:branch` set to a non-empty
206    /// value; every `:fonte (:tipo path …)` must carry a non-empty
207    /// `:caminho`.
208    ///
209    /// Called from [`Dep::validate`] with the dep's `:nome` so every
210    /// diagnostic carries the offending entry verbatim — same
211    /// self-locating shape the `:deps :versao` (2420c44),
212    /// `:membros :versao` (9888b13), `:children :versao` (b38ff3a),
213    /// `:placement :clusters` (6cbb900), and `:membros :caixa`
214    /// (3f9d7a0) gates already expose.
215    ///
216    /// Until this gate landed `:fonte` was the only `:deps`-related
217    /// typed surface still untyped past `Caixa::from_lisp`:
218    /// - Empty `:repo` (`(:tipo git :repo "" :tag "v1")`) silently
219    ///   passed parse and surfaced as a git-clone failure at
220    ///   lacre-resolve time, far from the source caixa.lisp.
221    /// - A bare `(:tipo git :repo "…")` with no `:tag`/`:rev`/`:branch`
222    ///   passed parse and surfaced as the resolver's
223    ///   [`ResolveError::MissingPin`](../../caixa-resolver/src/resolve.rs)
224    ///   at fetch time, again far from the source caixa.lisp; lifting
225    ///   to validate-time gives the author the same diagnostic at the
226    ///   edit site.
227    /// - `(:tipo git :repo "…" :tag "v1" :branch "main")` — multiple
228    ///   pins set — passed parse and the resolver silently picked
229    ///   `:rev > :tag > :branch`, ignoring the other pins with no
230    ///   diagnostic; the author had no way to know their `:branch`
231    ///   was dropped. This is the canonical "pin drift" footgun.
232    /// - An empty pin value (`(:tipo git :repo "…" :tag "")`) silently
233    ///   passed parse and surfaced as `git checkout ""` at fetch time.
234    /// - Empty `:caminho` (`(:tipo path :caminho "")`) silently passed
235    ///   parse and surfaced as
236    ///   [`ResolveError::MissingPath`](../../caixa-resolver/src/resolve.rs)
237    ///   with `path: PathBuf("")` — not actionable.
238    ///
239    /// Each rejected shape maps to a typed
240    /// [`DepError::Fonte*`] variant that names the offending
241    /// dep's `:nome` and the specific axis, so the author can grep
242    /// their caixa.lisp for the `:nome "<nome>"` block and fix it in
243    /// one edit.
244    pub fn validate(&self, nome: &str) -> Result<(), DepError> {
245        match self {
246            Self::Git {
247                repo,
248                tag,
249                rev,
250                branch,
251            } => {
252                if repo.is_empty() {
253                    return Err(DepError::fonte_repo_empty(nome));
254                }
255                // The `:repo` value flows verbatim into the caixa-resolver's
256                // `git clone <repo>` subprocess invocation. Until this gate
257                // landed `:repo` was the last untyped `:fonte`-related axis
258                // past the empty arm: a malformed-but-non-empty repo URL
259                // (`":repo "github:p/x ""` trailing space, paste-from-doc;
260                // `":repo "-upload-pack=evil""` leading `-` — the canonical
261                // CLI-argument-injection vector at the `git clone` boundary;
262                // `":repo "pleme-io/caixa-teia""` missing scheme — `git clone`
263                // reads as a relative filesystem path rather than the
264                // GitHub-shorthand expansion; `":repo "github:p/x\n""`
265                // embedded newline; `":repo "github:café/x""` raw non-ASCII)
266                // silently passed validate and the failure surfaced at
267                // lacre-resolve time with a porcelain-quoting-confused error
268                // far from the source caixa.lisp. The lifted predicate makes
269                // the git-porcelain-URL intersection-floor a substrate-level
270                // invariant at validate time, peer with the three pin axes
271                // (`:tag` + `:branch` via [`crate::render::is_git_ref_name`],
272                // e70d213; `:rev` via [`crate::render::is_git_oid`], be07fd5)
273                // — every `:fonte (:tipo git …)` past validate is now
274                // structurally accept-shaped on every axis the resolver
275                // consumes (the `:repo` URL the `git clone` invokes against,
276                // the `:tag`/`:branch` refname `git fetch`/`git checkout`
277                // accepts, the `:rev` commit OID the lacre's content-
278                // addressing equality probe resolves), closing the
279                // `:fonte` slot's value-shape trajectory end-to-end.
280                if let Err(reason) = crate::render::is_git_repo_url(repo) {
281                    return Err(DepError::fonte_repo_shape(nome, repo, reason));
282                }
283                let pins: [(&'static str, Option<&String>); 3] = [
284                    (":tag", tag.as_ref()),
285                    (":rev", rev.as_ref()),
286                    (":branch", branch.as_ref()),
287                ];
288                let set: Vec<&'static str> =
289                    pins.iter().filter_map(|(n, v)| v.map(|_| *n)).collect();
290                match set.len() {
291                    0 => {
292                        return Err(DepError::fonte_pin_missing(nome));
293                    }
294                    1 => {
295                        for (pin, value) in pins {
296                            if value.is_some_and(String::is_empty) {
297                                return Err(DepError::fonte_pin_empty(nome, pin));
298                            }
299                        }
300                    }
301                    _ => {
302                        return Err(DepError::fonte_pin_ambiguous(nome, &set.join(", ")));
303                    }
304                }
305                // Per-pin value-shape gate. The refname-shaped axes
306                // (`:tag` + `:branch`) route through
307                // [`crate::render::is_git_ref_name`]; the hex-OID-shaped
308                // `:rev` axis routes through
309                // [`crate::render::is_git_oid`]. The two predicates
310                // partition the `:fonte` pin axes structurally — refname
311                // vs. hex commit — so a cross-axis mis-slot (the
312                // canonical "I conflated `:rev` and `:branch`" footgun:
313                // `:rev "main"` defeating the reproducibility contract,
314                // `:tag "deadbeef…"` mis-slotting a SHA into the
315                // refname-shaped axis) lands at the offending axis's
316                // predicate, not at lacre-resolve `git fetch` /
317                // `git checkout` time. Their valid sets intersect at
318                // the empty set: every refname is rejected by
319                // `is_git_oid`, every OID is rejected by
320                // `is_git_ref_name`, structurally.
321                //
322                // Until this gate landed `:tag` / `:branch` were the
323                // refname-shaped axes still untyped past the empty-pin
324                // arm: a malformed-but-non-empty refname
325                // (`:tag "v0.1.0 "` trailing space — the canonical
326                // paste-from-doc footgun; `:tag "v0.1.0.lock"` colliding
327                // with git's atomic-rename guard suffix; `:tag "../escape"`
328                // path-traversal via consecutive dots; `:branch "main "`
329                // trailing space; `:branch "feature/foo bar"` embedded
330                // space; `:branch "@"` the literal HEAD alias;
331                // `:branch "refs/heads/main"` the fully-qualified ref
332                // copied from `git show-ref` output that resolves to
333                // a literal ref named `refs/heads/refs/heads/main` on
334                // disk) silently passed validate; the `:rev` axis was
335                // the last `:fonte`-related axis still untyped past the
336                // empty-pin arm: a malformed-but-non-empty hex-OID
337                // (`:rev "main"` conflating with `:branch` — the
338                // reproducibility-contract leak; `:rev "v0.1.0"`
339                // conflating with `:tag` — the same mis-slot on the
340                // refname/OID boundary; `:rev "c0ffee"` an abbreviated
341                // 6-char prefix that's ambiguous across repo history;
342                // `:rev "DEADBEEF…"` an uppercase OID that round-trips
343                // inconsistently against `git rev-parse HEAD`'s
344                // lowercase emission) silently passed validate and the
345                // failure surfaced at lacre-resolve `git fetch` /
346                // `git checkout` time with a quoting-confused error
347                // far from the source caixa.lisp, with no field naming
348                // which `:deps` entry carried the typo. Lifting both
349                // gates to caixa-build time matches the value-shape
350                // trajectory the peer typed axes already follow
351                // (c4213a4 typed WitContract endpoint/subject/slot;
352                // eb3456d :entrada :paths; c7d05ec :entrada :host;
353                // 4f0390b :contratos :endpoint; 6226bf4 :contratos :wit;
354                // 63e18a0 :contratos :subject; 2f4316e :contratos
355                // :slot; e70d213 :fonte :tag + :branch) — the typed
356                // slot's valid set matches its downstream consumer's
357                // accepted set (here, the git porcelain's refname /
358                // commit-OID grammars at `git fetch` / `git checkout`
359                // time), structurally. Same diagnostic shape every
360                // per-axis value-shape lift already exposes
361                // (`*Invalid { axis, reason }`); the `value:` field
362                // carries the offending refname / OID verbatim so the
363                // author can grep their caixa.lisp for the
364                // `:tag "<value>"` / `:branch "<value>"` /
365                // `:rev "<value>"` literal and fix it in one edit.
366                for (pin, value) in [(":tag", tag.as_ref()), (":branch", branch.as_ref())] {
367                    if let Some(v) = value
368                        && let Err(reason) = crate::render::is_git_ref_name(v)
369                    {
370                        return Err(DepError::fonte_pin_shape(nome, pin, v, reason));
371                    }
372                }
373                if let Some(v) = rev.as_ref()
374                    && let Err(reason) = crate::render::is_git_oid(v)
375                {
376                    return Err(DepError::fonte_pin_shape(nome, ":rev", v, reason));
377                }
378                Ok(())
379            }
380            Self::Path { caminho } => Self::validate_caminho(nome, caminho),
381        }
382    }
383
384    /// Reproducibility + path-API gate on the `:fonte (:tipo path …)`
385    /// `:caminho` axis. Walks the leading-byte cascade closed by the
386    /// b94fd83 (`/`), a5c248e (`~`), and f4efe9c (`$`) arms; the
387    /// orthogonal embedded-control-byte arm (d624c8d) covering
388    /// `0x00..=0x1F` plus `0x7F` anywhere in the value; and the
389    /// embedded-`\` Windows-path-separator arm closing the
390    /// cross-host-OS-separator divergence vector on the same
391    /// THEORY.md §V.2 render-determinism axis.
392    ///
393    /// Extracted from [`Self::validate`]'s `Self::Path` arm because the
394    /// per-arm cascade now spans nine diagnostic shapes — every new
395    /// `:caminho` arm (a future `&` / `;` / `|` shell-metachar arm,
396    /// a future glob-metachar `*` / `?` arm) lands here rather than
397    /// re-inflating `Self::validate`. The
398    /// function stays a thin per-arm linear walk for one reason: each
399    /// arm's diagnostic carries a distinct typed [`DepError`] variant
400    /// rather than a parser-shaped `reason` string, so collapsing the
401    /// cascade onto a generic [`crate::render`] predicate would regress
402    /// the per-arm self-locating diagnostic that `feira lint` consumers
403    /// depend on. The wrapped predicate trajectory ([`crate::render::is_dns_1123_label`],
404    /// [`crate::render::is_git_repo_url`], etc.) lives on the
405    /// reason-string-shaped axes; the `:caminho` axis keeps its
406    /// per-arm variant shape.
407    #[allow(
408        clippy::too_many_lines,
409        reason = "the per-arm cascade is structurally flat by design — every \
410                  `:caminho` arm carries its own typed [`DepError`] variant + \
411                  per-arm Why comment, so collapsing the cascade onto a generic \
412                  [`crate::render`] predicate would regress the per-arm self-locating \
413                  diagnostic the `feira lint` consumer surface depends on"
414    )]
415    fn validate_caminho(nome: &str, caminho: &str) -> Result<(), DepError> {
416        if caminho.is_empty() {
417            return Err(DepError::fonte_caminho_empty(nome));
418        }
419        // Reproducibility gate on the `:fonte (:tipo path …)`
420        // `:caminho` axis. The lacre pipeline embeds the value
421        // verbatim in its per-dep content-address
422        // (`conteudo: format!("path:{caminho}")`,
423        // caixa-resolver/src/resolve.rs:189) and that string
424        // folds into the BLAKE3 closure the lacre keys every
425        // downstream consumer (the substrate's reproducibility
426        // contract, CAIXA-SDLC §III.2 — the lacre is the
427        // build's content-addressed identity, peer of the Nix
428        // store path) against. Until this gate landed an
429        // absolute `:caminho` (`/home/me/work/caixa-teia` — the
430        // canonical "I dragged the folder out of Finder into
431        // my editor" footgun; `/Users/alice/dev/caixa-teia` on
432        // the macOS path-layout peer; the
433        // `${WORKSPACE}/caixa-teia` shell-expanded literal
434        // pasted from a CI manifest) silently passed validate
435        // and the failure surfaced *as a successful build with
436        // a divergent lacre*: the BLAKE3 closure on Alice's
437        // workstation differed from the closure on Bob's
438        // workstation, two CI runners with different
439        // `${HOME}` layouts emitted two distinct
440        // content-addresses for the byte-identical caixa, and
441        // the substrate's "the lacre is the build's identity"
442        // contract silently broke far from the source
443        // caixa.lisp — the most insidious failure mode the
444        // typed slot can carry (no error surfaces; the
445        // divergence is invisible until two machines compare
446        // lacres). The same THEORY.md §V.2 render-determinism
447        // discipline `is_sandboxed_relative_path` already
448        // applies on the M2 typed path-slots
449        // (`:behavior :on-*`, `:upgrade-from :state-change
450        // :script`, `:bibliotecas`, `:exe`, `:servicos`), here
451        // narrowed to the absolute-vs-relative axis only:
452        // `:fonte :caminho`'s canonical author-surface form is
453        // the `..`-traversing sibling-workspace path
454        // (`"../caixa-teia"`, the in-tree dev-dep frame), so a
455        // full `is_sandboxed_relative_path` lift would
456        // structurally reject every legitimate path-fonte
457        // dep. The narrower
458        // `std::path::Path::is_absolute` cut admits the
459        // sibling-workspace form while still rejecting the
460        // host-layout-leaking absolute shape — the
461        // reproducibility contract bites at exactly the
462        // absolute boundary, and that's the axis the
463        // substrate-level invariant is meant to hold. Same
464        // diagnostic shape every per-axis value-shape lift on
465        // the surrounding [`DepError::Fonte*`] cluster carries
466        // (the offending `:nome` + offending `:caminho`
467        // quoted verbatim so the author can grep their
468        // caixa.lisp for the `:caminho "<value>"` literal and
469        // fix it in one edit). The empty arm strictly
470        // precedes this arm so the blank-string footgun
471        // surfaces the more self-locating
472        // `FonteCaminhoEmpty` diagnostic (the empty string
473        // is not absolute under `Path::new("").is_absolute()`
474        // so the precedence is a no-op at value level — the
475        // pin matters only at the diagnostic-shape level if
476        // a future codec round-trip ever produces an empty
477        // string that probes as absolute).
478        if std::path::Path::new(caminho).is_absolute() {
479            return Err(DepError::fonte_caminho_absolute(nome, caminho));
480        }
481        // Reproducibility gate's tilde-expansion arm. The b94fd83
482        // `FonteCaminhoAbsolute` closes the leading-`/`
483        // host-layout-leak; a `:caminho "~/work/caixa-teia"` (the
484        // canonical paste-from-shell-prompt / paste-from-`cd ~`-
485        // doc footgun) silently passed both the empty arm and
486        // the absolute arm because `Path::new("~").is_absolute()`
487        // returns `false` — `~` is a shell-expansion convention,
488        // not a POSIX path component, so `std::path::Path` treats
489        // it as a literal directory-name segment. The lacre
490        // pipeline then embedded the value verbatim
491        // (`conteudo: format!("path:~/work/caixa-teia")`) and the
492        // failure mode forked per consumer:
493        //
494        //   - The caixa-resolver's `Path` arm folds `:caminho`
495        //     through `Path::new(caminho).join(<file>)` without
496        //     `~`-expansion, so the build looked for a literal
497        //     `./~/work/caixa-teia` subdirectory and failed at
498        //     resolve time with a `No such file or directory`
499        //     error far from the source caixa.lisp (the lacre
500        //     itself, though, was already byte-identical across
501        //     machines — every machine emitted the same
502        //     `path:~/work/caixa-teia` content-address).
503        //   - A future caixa-resolver pass that *does* expand `~`
504        //     (the canonical shell-convention idiom every
505        //     resolver eventually reaches for once an author
506        //     reports the literal-`~`-directory bug) would re-
507        //     introduce the host-layout-leak the b94fd83 absolute
508        //     gate closes: Alice's `~` expands to `/home/alice`,
509        //     Bob's to `/home/bob`, two CI runners with different
510        //     `$HOME` layouts resolve to two distinct paths for
511        //     the byte-identical caixa, and the substrate's
512        //     "the lacre is the build's identity" contract
513        //     silently breaks far from the source caixa.lisp.
514        //
515        // Closing the gate at `DepSource::validate` (here at the
516        // canonical caixa-build-time boundary, peer with the
517        // absolute arm above) refuses both failure modes
518        // structurally: the typed accepted set excludes every
519        // `~`-prefixed authoring shape, so the resolver is
520        // free to grow `~`-expansion (or any other convention-
521        // expansion the substrate adopts) without re-opening
522        // the host-layout-leak at the typed boundary. Same
523        // diagnostic shape every per-axis value-shape gate on
524        // the surrounding [`DepError::Fonte*`] cluster carries
525        // (the offending `:nome` + offending `:caminho` quoted
526        // verbatim so the author can grep their caixa.lisp for
527        // the `:caminho "<value>"` literal and fix it in one
528        // edit).
529        //
530        // The cascade preserves narrower-diagnostic-first
531        // ordering: `FonteCaminhoEmpty` → `FonteCaminhoAbsolute`
532        // → `FonteCaminhoTildeExpansion`. The empty arm
533        // structurally precedes both (the bytes "" / "~" don't
534        // overlap), and the absolute arm structurally precedes
535        // the tilde arm (an absolute path can't start with `~`
536        // since absolute paths start with `/`; the bytes "/" /
537        // "~" don't overlap either). Both arms are
538        // value-disjoint, so the precedence is a no-op at value
539        // level — the pin matters only at the diagnostic-shape
540        // level if a future codec round-trip ever produces a
541        // value that probes as both absolute and tilde-prefixed.
542        if caminho.starts_with('~') {
543            return Err(DepError::fonte_caminho_tilde_expansion(nome, caminho));
544        }
545        // Reproducibility gate's shell-variable-expansion arm.
546        // The b94fd83 `FonteCaminhoAbsolute` closes the leading-`/`
547        // host-layout-leak; the a5c248e `FonteCaminhoTildeExpansion`
548        // closes the leading-`~` shell-home-expansion shape; the
549        // leading-`$` is the sibling shell-variable-expansion shape
550        // — same host-layout-leaking semantic, different syntactic
551        // surface. A `:caminho "$HOME/work/caixa-teia"` (the
552        // canonical paste-from-`echo $HOME`-doc footgun) and the
553        // `${VAR}`-braced variant (`"${WORKSPACE}/caixa-teia"` —
554        // the canonical paste-from-CI-manifest footgun every
555        // GitHub Actions / GitLab CI / Drone manifest carries)
556        // silently passed every prior arm because
557        // `Path::is_absolute` returns false on `$` (the `$` is a
558        // shell convention, not a POSIX path component, so
559        // `std::path::Path` treats it as a literal directory-name
560        // segment) and the tilde arm's `starts_with('~')` doesn't
561        // fire.
562        //
563        // Same per-consumer failure-fork the tilde arm closes:
564        //
565        //   - The caixa-resolver's `Path` arm folds `:caminho`
566        //     through `Path::new(caminho).join(<file>)` without
567        //     `$`-expansion, so the build looks for a literal
568        //     `./$HOME/work/caixa-teia` subdirectory and fails at
569        //     resolve time with a `No such file or directory`
570        //     error far from the source caixa.lisp.
571        //   - A future caixa-resolver pass that *does* expand
572        //     `$VAR` (the shell-convention idiom every resolver
573        //     eventually reaches for once an author reports the
574        //     literal-`$HOME`-directory bug, especially for CI's
575        //     `${WORKSPACE}` idiom) would re-introduce the host-
576        //     layout-leak the b94fd83 absolute gate closes:
577        //     Alice's `$HOME` expands to `/home/alice`, Bob's to
578        //     `/home/bob`, two CI runners with different
579        //     `${WORKSPACE}` layouts resolve to two distinct
580        //     paths for the byte-identical caixa, and the
581        //     substrate's "the lacre is the build's identity"
582        //     contract silently breaks far from the source
583        //     caixa.lisp.
584        //
585        // Closing the gate at `DepSource::validate` (here at the
586        // canonical caixa-build-time boundary, peer with the
587        // absolute + tilde arms above) refuses both failure modes
588        // structurally. Same diagnostic shape every per-axis
589        // value-shape gate on the surrounding [`DepError::Fonte*`]
590        // cluster carries (the offending `:nome` + offending
591        // `:caminho` quoted verbatim).
592        //
593        // The cascade preserves narrower-diagnostic-first ordering:
594        // `FonteCaminhoEmpty` → `FonteCaminhoAbsolute` →
595        // `FonteCaminhoTildeExpansion` → `FonteCaminhoVarExpansion`.
596        // The empty arm structurally precedes all three subsequent
597        // arms; the absolute arm structurally precedes both the
598        // tilde and the var arms (absolute paths start with `/`,
599        // the bytes `/` / `~` / `$` don't overlap at the leading
600        // position); the tilde arm structurally precedes the var
601        // arm (`~` and `$` don't overlap at the leading position).
602        // Every pair is value-disjoint, so the precedence is a
603        // no-op at value level — the pin matters only at the
604        // diagnostic-shape level if a future codec round-trip ever
605        // produces a probe-as-both value.
606        //
607        // The gate covers every leading-`$` shape: the canonical
608        // `"$HOME/work/caixa-teia"` (POSIX shell), the braced
609        // `"${HOME}/work/caixa-teia"` (POSIX shell braces), the
610        // CI-manifest idiom `"${WORKSPACE}/caixa-teia"` (the
611        // GitHub Actions / GitLab CI / Drone paste footgun), the
612        // XDG idiom `"$XDG_CONFIG_HOME/caixa"`, and the bare `$`
613        // (degenerate "I meant `$HOME` and forgot the rest"). All
614        // shapes route through the same `caminho.starts_with('$')`
615        // byte check.
616        if caminho.starts_with('$') {
617            return Err(DepError::fonte_caminho_var_expansion(nome, caminho));
618        }
619        // Reproducibility gate's leading-space arm. The b94fd83 / a5c248e /
620        // f4efe9c arms closed the leading-byte host-layout-leak shapes
621        // (`/` / `~` / `$`); the embedded-control-byte arm below closes
622        // every byte in `0x00..=0x1F` plus `0x7F` (which already includes
623        // tab `0x09`, LF `0x0A`, CR `0x0D` — every ASCII whitespace
624        // *except* the ASCII space byte `0x20`). The bare ASCII space at
625        // the leading position is the orthogonal paste-from-aligned-doc
626        // shape that silently passed every prior arm: `Path::is_absolute`
627        // returns false on `" ../caixa-teia"` (the leading byte is `0x20`
628        // not `0x2F`), `0x20` is not `~` / `$` / `\` / a control byte, and
629        // the value's last byte is not `/`, so the canonical
630        // paste-from-aligned-`caixa.lisp`-doc footgun (every `:fonte`
631        // form in a multi-entry `:deps` block sits at the same column —
632        // an author selecting `"<sp><sp><sp>../caixa-teia"` and pasting
633        // it from the rendered alignment into a fresh entry preserves the
634        // leading whitespace verbatim) silently rendered as a path with
635        // a leading-space directory component the resolver folds through
636        // `Path::join` looking for a literal `./ ../caixa-teia`
637        // subdirectory that fails at resolve time with a non-self-
638        // locating `No such file or directory` error.
639        //
640        // The lacre pipeline's reproducibility contract bites
641        // strictly at this byte: `path:" ../caixa-teia"` and
642        // `path:"../caixa-teia"` yield distinct BLAKE3 closures
643        // (`conteudo: format!("path:{caminho}")`,
644        // caixa-resolver/src/resolve.rs:189) for the byte-divergent /
645        // semantic-identical caixa, and the substrate's "the lacre is
646        // the build's identity" contract (CAIXA-SDLC §III.2) silently
647        // breaks across two workstations whose authors differ only in
648        // paste-from-aligned-doc whitespace habits — the most insidious
649        // failure mode the typed slot can carry (no error surfaces; the
650        // divergence is invisible until two machines compare lacres).
651        //
652        // The arm fires AFTER the absolute / tilde / var leading-byte
653        // arms (each names the more self-locating shell-convention
654        // diagnostic on values that probe as that arm's leading-byte
655        // sentinel followed by a leading space — e.g.
656        // `:caminho "/  /foo"` surfaces `FonteCaminhoAbsolute` because
657        // the leading byte is `/`, not space) and BEFORE the
658        // embedded-control-byte arm (a leading-space value with an
659        // embedded control byte surfaces the broader leading-space
660        // diagnostic because the cascade walks leading-byte arms first
661        // — peer with how `FonteCaminhoAbsolute` precedes
662        // `FonteCaminhoControlChar` on `"/etc/passwd\n"`).
663        //
664        // The peer single-token-shaped axes already reject leading
665        // whitespace on the same paste-from-aligned-doc contract:
666        // [`crate::render::is_git_repo_url`] rejects leading whitespace
667        // on `:fonte :repo`, [`crate::render::is_git_ref_name`] rejects
668        // leading whitespace on `:fonte :tag`/`:branch`,
669        // [`crate::render::is_chart_description_shape`] rejects leading
670        // whitespace on `:descricao`,
671        // [`crate::render::is_spdx_expression_shape`] rejects leading
672        // whitespace on `:licenca`. Closing the same byte on
673        // `:fonte :caminho` makes the substrate-wide "no leading ASCII
674        // space anywhere in a typed string slot" invariant structurally
675        // consistent across every value-shape-gated typed surface (the
676        // `:caminho` axis was the last typed string surface still
677        // admitting a leading space byte).
678        if caminho.starts_with(' ') {
679            return Err(DepError::fonte_caminho_leading_whitespace(nome, caminho));
680        }
681        // Reproducibility gate's leading-`-` CLI-argument-injection arm.
682        // The b94fd83 + a5c248e + f4efe9c + LeadingWhitespace arms closed
683        // the four prior leading-byte shapes (`/` / `~` / `$` / space);
684        // this arm closes the orthogonal leading-`-` axis on the same
685        // subprocess-argument-boundary the peer `is_git_repo_url` arm
686        // (render.rs:2037, `-upload-pack=…` on `:fonte :repo`) and
687        // `is_git_ref_name` arm (render.rs:1381, 5a28454, `-stable` on
688        // `:fonte :tag` / `:branch`) already reject.
689        //
690        // The lacre pipeline embeds `:caminho` verbatim in its per-dep
691        // content-address (`conteudo: format!("path:{caminho}")`,
692        // caixa-resolver/src/resolve.rs:189) and the resolver folds the
693        // value through `Path::join` looking for a literal `./{caminho}`
694        // subdirectory. Every downstream subprocess that consumes the
695        // resolved path — a `git -C {caminho} <verb>` invocation, a
696        // future `feira tofu` `terraform -chdir={caminho}` shell-out, a
697        // future operator-side `nix build --path {caminho}` spawn, an
698        // `xargs` / `find {caminho}` / `stat {caminho}` /
699        // `rm -rf {caminho}` cleanup — reinterprets a leading-`-` value
700        // as a CLI flag rather than a positional path when the
701        // subprocess invocation does not carry a `--` argument-list
702        // terminator between the flag block and the path argument. The
703        // canonical footguns:
704        //
705        //   - `:caminho "-rf"` — bare short-flag paste (`rm -rf` /
706        //     `find -rf` reinterpretation; the byte the peer
707        //     `FonteCaminhoShellSemicolon` arm's `; rm -rf build`
708        //     example paste-idiom carries as its first token).
709        //   - `:caminho "-C"` — `git -C` config-injection paste
710        //     (`git -C -C` reinterprets the second `-C` as another
711        //     `--change-directory` flag rather than the path
712        //     argument; the canonical `git -C <path>` porcelain
713        //     idiom every multi-repo workspace tool carries).
714        //   - `:caminho "--upload-pack=cat /etc/passwd"` — the
715        //     canonical long-flag CLI-arg-injection vector at every
716        //     git porcelain entry point (`git clone`, `git fetch`,
717        //     `git ls-remote`) that consumes a path or URL
718        //     argument; peer with `is_git_repo_url`'s leading-`-`
719        //     arm (render.rs:2037) on the sibling `:fonte :repo`
720        //     axis, which the arm's diagnostic explicitly cites.
721        //   - `:caminho "--config=…"` / `:caminho "-c"` — git-config
722        //     override paste-idiom (paste-from-`git -c foo=bar`
723        //     shell-history footgun that reinterprets the value as
724        //     a `[foo] bar` config injection on every git porcelain
725        //     entry point).
726        //
727        // POSIX `std::path::Path` treats a leading `-` as a literal
728        // filename byte, so the resolver folds `-rf` through `Path::join`
729        // and looks for a literal `./-rf` subdirectory — the failure
730        // surfaces at resolve time with a non-self-locating `No such
731        // file or directory` error far from the source caixa.lisp, and
732        // the value rides through the lacre content-address into every
733        // downstream shell-spawned subprocess. On any consumer that
734        // shells out without the `--` terminator (the common case at
735        // every porcelain entry-point) the reinterpretation is silent
736        // and the failure mode is arbitrary-argument-injection.
737        //
738        // The arm fires AFTER the absolute / tilde / var / leading-space
739        // leading-byte arms (each names the more self-locating shell-
740        // convention diagnostic on values that probe as that arm's
741        // leading-byte sentinel — the byte sets are pairwise disjoint at
742        // the leading position, so the precedence pin is a no-op at
743        // value level, but the ordering keeps every leading-byte arm's
744        // diagnostic-shape stable) and BEFORE the embedded-control-byte
745        // arm (a leading-`-` value with an embedded control byte
746        // surfaces the narrower leading-`-` diagnostic because the
747        // cascade walks leading-byte arms first — peer with how
748        // `FonteCaminhoAbsolute` precedes `FonteCaminhoControlChar` on
749        // `"/etc/passwd\n"`, and how `FonteCaminhoLeadingWhitespace`
750        // precedes `FonteCaminhoControlChar` on `" ../foo\n"`).
751        //
752        // The peer single-token-shaped axes already reject leading `-`
753        // on the same CLI-arg-injection contract:
754        // [`crate::render::is_git_repo_url`] rejects it on `:fonte :repo`
755        // (render.rs:2037), [`crate::render::is_git_ref_name`] rejects
756        // it on `:fonte :tag` / `:fonte :branch` (render.rs:1381,
757        // 5a28454), [`crate::render::is_dns_1123_label`] rejects it on
758        // every DNS-1123-shaped axis (top-level Caixa `:nome`, `:membros
759        // :caixa`, `:children :caixa`, `:deps :nome`, cluster names),
760        // [`crate::render::is_cargo_feature_name`] rejects it on
761        // `:caracteristicas`, and the feira `init` / `add <nome>`
762        // positional gate (868c191) rejects it on the CLI positional
763        // itself. Closing the same byte on `:fonte :caminho` makes the
764        // substrate-wide "no leading `-` anywhere in a typed single-
765        // token string slot routed through a subprocess argument"
766        // invariant structurally consistent across every value-shape-
767        // gated typed surface (the `:caminho` axis was the last typed
768        // string surface still admitting a leading `-` byte).
769        if caminho.starts_with('-') {
770            return Err(DepError::fonte_caminho_leading_hyphen(nome, caminho));
771        }
772        // Reproducibility gate's embedded-control-byte arm. The
773        // b94fd83 + a5c248e + f4efe9c arms closed the three
774        // leading-byte host-layout-leak shapes (`/` / `~` / `$`);
775        // this arm closes the orthogonal embedded-control-byte
776        // axis — any ASCII control byte (`0x00..=0x1F` plus
777        // `0x7F` DEL) appearing anywhere in `:caminho`. Same
778        // shape every peer single-token-typed-slot value-shape
779        // predicate the surrounding [`crate::render`] cluster
780        // gates against (the lifted `is_git_repo_url` arm on
781        // `:fonte :repo`, the `is_git_ref_name` arm on
782        // `:tag`/`:branch`, the `is_chart_description_shape` /
783        // `is_chart_maintainer_name_shape` /
784        // `is_chart_keyword_shape` arms on the
785        // Helm-chart-shaped axes); now consistent on the
786        // `:caminho` axis too.
787        //
788        // Until this gate landed any embedded control byte
789        // silently passed validate, the lacre pipeline embedded
790        // the value verbatim in its per-dep content-address
791        // (`conteudo: format!("path:{caminho}")`,
792        // caixa-resolver/src/resolve.rs:189), and the failure
793        // forked per byte and per consumer:
794        //
795        //   - NUL (`0x00`) the canonical "POSIX paths cannot
796        //     contain a NUL byte" shape: every `std::fs` syscall
797        //     routes the path through `CString::new`, which
798        //     fails with `NulError` on the first NUL byte; the
799        //     build would surface a `NulError` at resolve time
800        //     far from the source caixa.lisp.
801        //   - LF (`0x0A`) / CR (`0x0D`) the canonical paste-from-
802        //     multiline-doc footgun: a `:caminho
803        //     "../caixa-teia\nrm -rf /"` value (paste landed mid-
804        //     `:caminho` block from a multi-line code-fence)
805        //     silently round-trips through `Path::join` but the
806        //     embedded newline class is a sibling of the CRLF-at-
807        //     subprocess-argument injection vector
808        //     `is_git_repo_url` already closes on `:repo`.
809        //   - Tab (`0x09`) the canonical paste-from-aligned-table
810        //     footgun: the tab is invisible in most editors, and
811        //     the lacre embeds the value verbatim so two
812        //     paste-from-distinct-tables yield divergent lacres
813        //     across host editors that strip vs preserve tabs.
814        //   - DEL (`0x7F`) + every other `0x00..=0x1F` byte: the
815        //     paste-from-binary-blob shape every peer single-
816        //     token-shaped slot rejects under the same
817        //     `b < 0x20 || b == 0x7F` predicate.
818        //
819        // Mirrors the cascade discipline every prior `:caminho`
820        // arm establishes: `FonteCaminhoEmpty` →
821        // `FonteCaminhoAbsolute` → `FonteCaminhoTildeExpansion`
822        // → `FonteCaminhoVarExpansion` →
823        // `FonteCaminhoLeadingWhitespace` →
824        // `FonteCaminhoLeadingHyphen` → `FonteCaminhoControlChar`.
825        // The six leading-byte arms structurally precede the
826        // embedded-byte arm because the leading-byte shapes are
827        // the more self-locating diagnostic on values that probe
828        // as both (e.g. `:caminho "/etc/passwd\n"` surfaces the
829        // narrower `FonteCaminhoAbsolute` rather than the broader
830        // embedded-control-byte arm); the precedence pin matters
831        // at the diagnostic-shape level even though the empty /
832        // absolute / tilde / var arms are value-disjoint from a
833        // bare control byte (which would itself be a leading
834        // byte under the empty / absolute / tilde / var arms'
835        // leading-position semantics, but those arms guard the
836        // specific shell-convention characters `/` / `~` / `$`
837        // — a leading `0x01` byte falls through to this arm).
838        for &b in caminho.as_bytes() {
839            if b < 0x20 || b == 0x7F {
840                return Err(DepError::fonte_caminho_control_char(nome, caminho, b));
841            }
842        }
843        // Reproducibility gate's Windows-path-separator arm. The four
844        // leading-byte arms (`/` / `~` / `$`) and the embedded-
845        // control-byte arm close the host-layout-leaking + paste-from-
846        // multiline-doc shapes; the leading-`\` / embedded-`\` byte is
847        // the orthogonal cross-host-OS-separator shape — same render-
848        // determinism axis, different semantic mechanism. POSIX
849        // [`std::path::Path`] treats `\` (0x5C) as a literal byte
850        // inside a single path component (so `..\caixa-teia` is one
851        // directory named literally `..\caixa-teia`, sibling of `.`
852        // and `..`); Windows [`std::path::Path`] treats `\` as a
853        // primary path separator equal to `/` (so `..\caixa-teia` is
854        // the parent's sibling directory `caixa-teia`). The lacre
855        // pipeline embeds the value verbatim in its per-dep content-
856        // address (`conteudo: format!("path:{caminho}")`, caixa-
857        // resolver/src/resolve.rs:189), so byte-identical caixa.lisp
858        // values resolve to two distinct directories across runner
859        // OSes — the same THEORY.md §V.2 render-determinism contract
860        // the absolute / tilde / var arms protect, here against the
861        // cross-host-OS-separator divergence vector. Even on POSIX-
862        // only resolvers (the canonical pleme-io substrate posture),
863        // a `..\caixa-teia` (the Windows-Explorer "copy as path" /
864        // PowerShell `Get-Location` paste-idiom footgun) silently
865        // passes every prior arm because `Path::is_absolute` returns
866        // false on `..` and `\` is neither a leading-byte sentinel
867        // nor a control byte, then the resolver folds the value
868        // through `Path::new(caminho).join(<file>)` looking for a
869        // literal `./..\caixa-teia` subdirectory and fails at
870        // resolve time with a non-self-locating `No such file or
871        // directory` error far from the source caixa.lisp.
872        //
873        // The peer single-token-shaped axes on the same git-CLI /
874        // path-CLI consumer cluster already reject `\` under the same
875        // Windows-path-leak banner: [`crate::render::is_git_ref_name`]
876        // line 1441 (`"must not contain \\ … the canonical Windows-
877        // path-leak footgun; use / for hierarchical refs"`) gates
878        // `:fonte :tag` / `:fonte :branch` against the same byte,
879        // and [`crate::render::is_gateway_api_http_path`] line 506
880        // includes `\` in the eleven-byte RFC-3986-reserved rejection
881        // set on `:entrada :paths`. Closing the same byte on `:fonte
882        // :caminho` makes the substrate-wide "no Windows path
883        // separator anywhere in a typed string slot" invariant
884        // structurally consistent across every path-shaped typed
885        // surface (the `:caminho` axis was the last typed string
886        // surface still admitting `\`).
887        //
888        // The arm fires AFTER the control-char arm because the
889        // control-char diagnostic is the more self-locating axis on
890        // values that probe as both (`"..\caixa\0teia"` carries both
891        // a `\` and a NUL — NUL is the load-bearing POSIX-syscall-
892        // rejected byte, so `FonteCaminhoControlChar` wins). Same
893        // narrower-diagnostic-first cascade discipline every prior
894        // arm establishes. A pure-`\` value
895        // (`"..\caixa-teia"` with no control bytes) falls through
896        // every prior arm and lands here.
897        for &b in caminho.as_bytes() {
898            if b == b'\\' {
899                return Err(DepError::fonte_caminho_backslash(nome, caminho));
900            }
901        }
902        // Reproducibility gate's shell-redirection arm. The 3a4e1d7 backslash
903        // arm closes the cross-host-OS-separator vector; `<` (`0x3C`) and `>`
904        // (`0x3E`) are the orthogonal shell-redirection sentinels — same
905        // paste-from-shell-prompt footgun class, different syntactic surface.
906        // POSIX `std::path::Path` treats `<` / `>` as literal bytes inside a
907        // single path component (so `../caixa-teia>output` is one directory
908        // named literally `../caixa-teia>output`, sibling of `.` and `..`),
909        // but every interactive shell (bash / zsh / fish / nushell) lexes
910        // `<` / `>` as input / output redirection operators — a `:caminho
911        // "../caixa-teia>build.log"` (the canonical "I pasted a shell
912        // pipeline that wrote build output and forgot to trim the redirect"
913        // footgun) or `:caminho "../<input.lisp"` (the symmetric input-
914        // redirection paste idiom) silently passes every prior arm because
915        // `Path::is_absolute` returns false, `<` / `>` are neither leading-
916        // byte sentinels nor control bytes nor `\`, and the value's last byte
917        // isn't `/`. The resolver folds the value through
918        // `Path::new(caminho).join(<file>)` looking for a literal
919        // `./..\caixa-teia>build.log` subdirectory and fails at resolve time
920        // with a non-self-locating `No such file or directory` error far
921        // from the source caixa.lisp.
922        //
923        // The lacre pipeline embeds the value verbatim in its per-dep
924        // content-address (`conteudo: format!("path:{caminho}")`,
925        // caixa-resolver/src/resolve.rs:189), so a `<` / `>` byte lands in
926        // the BLAKE3 closure and rides downstream as part of the build's
927        // identity. The bytes carry a second class of hazard the prior
928        // separator-shaped arms don't: every typed-string slot whose value
929        // ever flows verbatim into a shell-spawned subprocess (the caixa-
930        // resolver's `git clone` invocation, a future `feira tofu` shell-
931        // out, a future operator-side `nix flake check` spawn) is the
932        // canonical CRLF-at-subprocess-argument / shell-metachar injection
933        // surface that every peer single-token-shaped typed slot already
934        // closes. The peer path-shaped axis `[crate::render::is_gateway_api_http_path]`
935        // (caixa-core/src/render.rs:506) rejects `<` / `>` as part of its
936        // eleven-byte RFC-3986-reserved set on `:entrada :paths`, and the
937        // peer git-ref-shaped axis `[crate::render::is_git_ref_name]` rejects
938        // `<` / `>` on `:fonte :tag` / `:fonte :branch` under the same
939        // shell-metachar-injection banner. The `:caminho` axis was the last
940        // typed string surface still admitting these two bytes; this arm
941        // closes the gap so the substrate-wide "no shell-redirection
942        // metacharacter anywhere in a typed string slot" invariant is now
943        // structurally consistent across every path-shaped typed surface.
944        //
945        // The arm fires AFTER the control-char arm + backslash arm because
946        // both prior arms carry more self-locating diagnostics on values
947        // that probe as both (`"..\foo<bar"` carries both `\` and `<` — the
948        // cross-OS-separator divergence is the load-bearing axis, so the
949        // backslash arm wins; `"../foo\n<bar"` carries both LF and `<` —
950        // the POSIX-syscall-rejected byte is the load-bearing axis, so the
951        // control-char arm wins). The arm fires BEFORE the trailing-`/` arm
952        // because the embedded redirection byte is the more semantic-
953        // locating axis on probe-as-both values (`"../foo</"` ends in `/`
954        // but the load-bearing diagnostic is the embedded `<` shell-
955        // redirection — the trailing `/` is the secondary observation, and
956        // an author who removes the `<` is likely to also tab-strip the
957        // trailing separator).
958        for &b in caminho.as_bytes() {
959            if b == b'<' || b == b'>' {
960                return Err(DepError::fonte_caminho_shell_redirection(nome, caminho, b));
961            }
962        }
963        // Reproducibility gate's shell-pipe arm. The e457141 shell-redirection
964        // arm closes the `<` / `>` input/output redirection sentinels; `|`
965        // (`0x7C`) is the orthogonal shell-pipe sentinel — same paste-from-
966        // shell-prompt footgun class, different syntactic surface. POSIX
967        // `std::path::Path` treats `|` as a literal path-component byte (so
968        // `../caixa-teia|tee` is one directory named literally
969        // `../caixa-teia|tee`, sibling of `.` and `..`), but every interactive
970        // shell (bash / zsh / fish / nushell) lexes `|` as the pipe operator
971        // — a `:caminho "../caixa-teia | grep foo"` (the canonical "I copied a
972        // `ls ../caixa-teia | grep` line out of a shell-history block and
973        // forgot to trim the pipeline tail" footgun) or `:caminho
974        // "../foo||bar"` (the symmetric "I copied a `cmd-a || cmd-b` short-
975        // circuit OR line" idiom) silently passes every prior arm because
976        // `Path::is_absolute` returns false on `..`, `|` is neither a leading-
977        // byte sentinel nor a control byte nor `\` nor `<` / `>`, and the
978        // value's last byte isn't `/`. The resolver folds the value through
979        // `Path::new(caminho).join(<file>)` looking for a literal
980        // `./../caixa-teia | grep foo` subdirectory and fails at resolve time
981        // with a non-self-locating `No such file or directory` error far
982        // from the source caixa.lisp.
983        //
984        // The lacre pipeline embeds the value verbatim in its per-dep
985        // content-address (`conteudo: format!("path:{caminho}")`,
986        // caixa-resolver/src/resolve.rs:189), so a `|` byte lands in the
987        // BLAKE3 closure and rides downstream as part of the build's identity
988        // into every shell-spawned subprocess (the caixa-resolver's `git
989        // clone` invocation, a future `feira tofu` shell-out, a future
990        // operator-side `nix flake check` spawn) as the canonical CRLF-at-
991        // subprocess-argument / shell-metachar injection surface every peer
992        // single-token-shaped typed slot already closes. The peer path-shaped
993        // axis [`crate::render::is_gateway_api_http_path`]
994        // (caixa-core/src/render.rs:506) rejects `|` as part of its eleven-
995        // byte RFC-3986-reserved set on `:entrada :paths`. The `:caminho`
996        // axis was the last typed path-string surface still admitting this
997        // byte; this arm closes the gap so the substrate-wide "no shell-
998        // composition metacharacter anywhere in a typed string slot that
999        // flows verbatim into a shell-spawned subprocess" invariant extends
1000        // from shell-redirection (`<` / `>`) to shell-pipe (`|`) on the
1001        // `:caminho` axis.
1002        //
1003        // The arm fires AFTER the shell-redirection arm because the prior
1004        // arm's two-byte `byte: u8` payload is the more self-locating axis on
1005        // values that probe as both (`"../caixa-teia<input|tee"` carries both
1006        // `<` and `|` — the input-redirection-paste idiom is the load-bearing
1007        // root-cause edit, so `FonteCaminhoShellRedirection` wins; same
1008        // cascade discipline every prior `:caminho` arm establishes). The arm
1009        // fires BEFORE the trailing-`/` arm because the embedded pipe byte is
1010        // the more semantic-locating axis on probe-as-both values
1011        // (`"../foo|tee/"` ends in `/` but the load-bearing diagnostic is the
1012        // embedded `|` shell-pipe — the trailing `/` is the secondary
1013        // observation, and an author who removes the `|` is likely to also
1014        // tab-strip the trailing separator).
1015        for &b in caminho.as_bytes() {
1016            if b == b'|' {
1017                return Err(DepError::fonte_caminho_shell_pipe(nome, caminho));
1018            }
1019        }
1020        // Reproducibility gate's shell-command-separator arm. The 124106f
1021        // shell-pipe arm closes the `|` byte; `;` (`0x3B`) is the orthogonal
1022        // shell-command-separator sentinel — same paste-from-shell-prompt
1023        // footgun class, different syntactic surface. POSIX `std::path::Path`
1024        // treats `;` as a literal path-component byte (so
1025        // `../caixa-teia;rm -rf /` is one directory named literally
1026        // `../caixa-teia;rm -rf /`, sibling of `.` and `..`), but every
1027        // interactive shell (bash / zsh / fish / nushell) lexes `;` as the
1028        // sequential-command terminator that fires the next command
1029        // regardless of the prior command's exit status — a `:caminho
1030        // "../caixa-teia; rm -rf build"` (the canonical "I pasted a shell
1031        // one-liner that chained a cleanup tail after the directory name"
1032        // footgun) or `:caminho "../foo;;bar"` (the symmetric "I copied a
1033        // POSIX `case` arm's `;;` terminator into the middle of a path"
1034        // idiom) silently passes every prior arm because `Path::is_absolute`
1035        // returns false on `..`, `;` is neither a leading-byte sentinel nor a
1036        // control byte nor `\` nor `<` / `>` nor `|`, and the value's last
1037        // byte isn't `/`. The resolver folds the value through
1038        // `Path::new(caminho).join(<file>)` looking for a literal
1039        // `./../caixa-teia; rm -rf build` subdirectory and fails at resolve
1040        // time with a non-self-locating `No such file or directory` error far
1041        // from the source caixa.lisp.
1042        //
1043        // The lacre pipeline embeds the value verbatim in its per-dep
1044        // content-address (`conteudo: format!("path:{caminho}")`,
1045        // caixa-resolver/src/resolve.rs:189), so a `;` byte lands in the
1046        // BLAKE3 closure and rides downstream as part of the build's identity
1047        // into every shell-spawned subprocess (the caixa-resolver's `git
1048        // clone` invocation, a future `feira tofu` shell-out, a future
1049        // operator-side `nix flake check` spawn) as the canonical
1050        // shell-metachar injection surface every peer single-token-shaped
1051        // typed slot already closes. The peer path-shaped axis
1052        // [`crate::render::is_gateway_api_http_path`]
1053        // (caixa-core/src/render.rs:506) rejects `;` as part of its eleven-
1054        // byte RFC-3986-reserved set on `:entrada :paths`. The `:caminho`
1055        // axis was the last typed path-string surface still admitting this
1056        // byte; this arm closes the gap so the substrate-wide "no shell-
1057        // composition metacharacter anywhere in a typed string slot that
1058        // flows verbatim into a shell-spawned subprocess" invariant extends
1059        // from shell-pipe (`|`) to shell-command-separator (`;`) on the
1060        // `:caminho` axis.
1061        //
1062        // The arm fires AFTER the shell-pipe arm because the prior arm's
1063        // canonical-cmd-a-|-cmd-b shape is the more common shell-history
1064        // paste idiom on values that probe as both (`"../caixa-teia | tee;
1065        // rm"` carries both `|` and `;` — the pipeline-tail paste is the
1066        // load-bearing root-cause edit, so `FonteCaminhoShellPipe` wins; same
1067        // cascade discipline every prior `:caminho` arm establishes). The arm
1068        // fires BEFORE the trailing-`/` arm because the embedded
1069        // command-separator byte is the more semantic-locating axis on
1070        // probe-as-both values (`"../foo;rm/"` ends in `/` but the
1071        // load-bearing diagnostic is the embedded `;` shell-command-
1072        // separator — the trailing `/` is the secondary observation, and an
1073        // author who removes the `;` is likely to also tab-strip the trailing
1074        // separator).
1075        for &b in caminho.as_bytes() {
1076            if b == b';' {
1077                return Err(DepError::fonte_caminho_shell_semicolon(nome, caminho));
1078            }
1079        }
1080        // Reproducibility gate's shell-background / logical-AND arm. The
1081        // 05c358e shell-command-separator arm closes the `;` byte; `&`
1082        // (`0x26`) is the orthogonal shell-background / list-AND sentinel
1083        // — same paste-from-shell-prompt footgun class, different
1084        // syntactic surface. POSIX `std::path::Path` treats `&` as a
1085        // literal path-component byte (so `../caixa-teia & sleep 1` is
1086        // one directory named literally `../caixa-teia & sleep 1`,
1087        // sibling of `.` and `..`), but every interactive shell
1088        // (bash / zsh / fish / nushell) lexes `&` two ways:
1089        //
1090        //   - Single `&` as the background-task terminator that detaches
1091        //     the prior command into the background and returns control
1092        //     to the prompt immediately (the canonical `cmd &` idiom
1093        //     every long-running pipeline uses);
1094        //   - Double `&&` as the logical-AND list operator that fires
1095        //     the next command only if the prior command succeeded (the
1096        //     canonical `make && make install` idiom every build script
1097        //     carries).
1098        //
1099        // A `:caminho "../caixa-teia & sleep 1"` (the canonical "I
1100        // pasted a `cd path & sleep 1` background-launch into the
1101        // `:caminho` slot" footgun) or `:caminho "../caixa-teia && make"`
1102        // (the symmetric "I copied a `cd path && make` build chain"
1103        // idiom) silently passes every prior arm because
1104        // `Path::is_absolute` returns false on `..`, `&` is neither a
1105        // leading-byte sentinel nor a control byte nor `\` nor
1106        // `<` / `>` nor `|` nor `;`, and the value's last byte isn't `/`.
1107        // The resolver folds the value through
1108        // `Path::new(caminho).join(<file>)` looking for a literal
1109        // `./../caixa-teia & sleep 1` subdirectory and fails at resolve
1110        // time with a non-self-locating `No such file or directory`
1111        // error far from the source caixa.lisp.
1112        //
1113        // The lacre pipeline embeds the value verbatim in its per-dep
1114        // content-address (`conteudo: format!("path:{caminho}")`,
1115        // caixa-resolver/src/resolve.rs:189), so an `&` byte lands in
1116        // the BLAKE3 closure and rides downstream as part of the build's
1117        // identity into every shell-spawned subprocess (the
1118        // caixa-resolver's `git clone` invocation, a future `feira tofu`
1119        // shell-out, a future operator-side `nix flake check` spawn) as
1120        // the canonical shell-metachar injection surface every peer
1121        // single-token-shaped typed slot already closes. The peer
1122        // path-shaped axis [`crate::render::is_gateway_api_http_path`]
1123        // (caixa-core/src/render.rs:506) rejects `&` as part of its
1124        // eleven-byte RFC-3986-reserved set on `:entrada :paths`. The
1125        // `:caminho` axis was the last typed path-string surface still
1126        // admitting this byte; this arm closes the gap so the
1127        // substrate-wide "no shell-composition metacharacter anywhere
1128        // in a typed string slot that flows verbatim into a
1129        // shell-spawned subprocess" invariant extends from
1130        // shell-command-separator (`;`) to shell-background /
1131        // logical-AND (`&`) on the `:caminho` axis.
1132        //
1133        // The arm fires AFTER the shell-command-separator arm because
1134        // the prior arm's `cmd-a; cmd-b` shape is the more common
1135        // shell-history paste idiom on values that probe as both
1136        // (`"../caixa-teia; rm & sleep"` carries both `;` and `&` — the
1137        // command-separator-tail paste is the load-bearing root-cause
1138        // edit, so `FonteCaminhoShellSemicolon` wins; same cascade
1139        // discipline every prior `:caminho` arm establishes). The arm
1140        // fires BEFORE the trailing-`/` arm because the embedded
1141        // background / list-AND byte is the more semantic-locating axis
1142        // on probe-as-both values (`"../foo&bar/"` ends in `/` but the
1143        // load-bearing diagnostic is the embedded `&` shell-background
1144        // / logical-AND metachar — the trailing `/` is the secondary
1145        // observation, and an author who removes the `&` is likely to
1146        // also tab-strip the trailing separator).
1147        for &b in caminho.as_bytes() {
1148            if b == b'&' {
1149                return Err(DepError::fonte_caminho_shell_background(nome, caminho));
1150            }
1151        }
1152        // Reproducibility gate's shell-command-substitution arm. The
1153        // e12e4f3 shell-background / logical-AND arm closes the `&`
1154        // byte; the backtick (`0x60`) is the orthogonal POSIX legacy
1155        // command-substitution sentinel — every POSIX shell (sh /
1156        // bash / zsh / dash / ksh / fish / nushell) lexes the byte as
1157        // the canonical legacy wrapper that runs the enclosed command
1158        // and substitutes its standard-output verbatim into the
1159        // surrounding word (a `whoami` wrapped in backticks expands
1160        // to the current user's name; a `cat /etc/passwd` wrapped in
1161        // backticks expands to the file's contents — the canonical
1162        // CWE-78 shell-command-injection vector every shell-side
1163        // hardening guide enumerates first). POSIX
1164        // `std::path::Path` treats backtick as a literal path-
1165        // component byte (so `../caixa-teia/<backtick>whoami<backtick>`
1166        // is one directory named literally that, sibling of `.` and
1167        // `..`).
1168        //
1169        // A `:caminho "../caixa-teia/<backtick>whoami<backtick>"` (the
1170        // canonical "I pasted a shell one-liner carrying a backticked
1171        // `whoami` command-substitution expansion into the `:caminho`
1172        // slot" footgun) or `:caminho "<backtick>pwd<backtick>/caixa-
1173        // teia"` (the symmetric "I copied a `<backtick>pwd<backtick>/
1174        // path` working-directory expansion") silently passes every
1175        // prior arm because `Path::is_absolute` returns false on
1176        // `..`, the backtick byte is neither a leading-byte sentinel
1177        // (the f4efe9c `FonteCaminhoVarExpansion` arm catches the
1178        // modern `$()` form at leading position only; backtick is
1179        // the orthogonal legacy form) nor a control byte nor `\` nor
1180        // `<` / `>` nor `|` nor `;` nor `&`, and the value's last
1181        // byte isn't `/`. The resolver folds the value through
1182        // `Path::new(caminho).join(<file>)` looking for a literal
1183        // subdirectory whose name embeds the backticked token and
1184        // fails at resolve time with a non-self-locating `No such
1185        // file or directory` error far from the source caixa.lisp.
1186        //
1187        // The lacre pipeline embeds the value verbatim in its per-
1188        // dep content-address (`conteudo: format!("path:{caminho}")`,
1189        // caixa-resolver/src/resolve.rs:189), so a backtick byte
1190        // lands in the BLAKE3 closure and rides downstream as part
1191        // of the build's identity into every shell-spawned
1192        // subprocess (the caixa-resolver's `git clone` invocation, a
1193        // future `feira tofu` shell-out, a future operator-side
1194        // `nix flake check` spawn) as the canonical shell-metachar
1195        // injection surface every peer single-token-shaped typed
1196        // slot already closes. The peer path-shaped axis
1197        // [`crate::render::is_gateway_api_http_path`]
1198        // (caixa-core/src/render.rs:506) rejects backtick as part of
1199        // its eleven-byte RFC-3986-reserved set on `:entrada
1200        // :paths`. The `:caminho` axis was the last typed path-
1201        // string surface still admitting this byte; this arm closes
1202        // the gap so the substrate-wide "no shell-composition
1203        // metacharacter anywhere in a typed string slot that flows
1204        // verbatim into a shell-spawned subprocess" invariant
1205        // extends from shell-background / logical-AND (`&`) to
1206        // shell-command-substitution (backtick) on the `:caminho`
1207        // axis.
1208        //
1209        // The arm fires AFTER the shell-background arm because the
1210        // prior arm's `cmd & sleep` shape is the more common shell-
1211        // history paste idiom on values that probe as both (a
1212        // `"../caixa-teia & <backtick>whoami<backtick>"` carries
1213        // both `&` and a backtick — the background-launch tail is
1214        // the load-bearing root-cause edit, so
1215        // `FonteCaminhoShellBackground` wins; same cascade
1216        // discipline every prior `:caminho` arm establishes). The
1217        // arm fires BEFORE the trailing-`/` arm because the
1218        // embedded command-substitution byte is the more semantic-
1219        // locating axis on probe-as-both values (a
1220        // `"../<backtick>whoami<backtick>/"` ends in `/` but the
1221        // load-bearing diagnostic is the embedded backtick shell-
1222        // command-substitution metachar — the trailing `/` is the
1223        // secondary observation, and an author who removes the
1224        // backtick is likely to also tab-strip the trailing
1225        // separator).
1226        for &b in caminho.as_bytes() {
1227            if b == b'`' {
1228                return Err(DepError::fonte_caminho_shell_command_substitution(
1229                    nome, caminho,
1230                ));
1231            }
1232        }
1233        // Reproducibility gate's shell-glob arm. The c4d62b3 shell-command-
1234        // substitution arm closes the backtick byte; `*` (`0x2A`) and `?`
1235        // (`0x3F`) are the orthogonal POSIX glob-expansion sentinels — same
1236        // paste-from-shell-prompt footgun class, different syntactic surface.
1237        // Every POSIX shell (sh / bash / zsh / dash / ksh / fish / nushell)
1238        // lexes `*` and `?` as pathname-expansion wildcards: `*` matches any
1239        // sequence of characters in a path component (including the empty
1240        // sequence), `?` matches exactly one character. POSIX
1241        // `std::path::Path` treats both bytes as literal path-component bytes
1242        // (so `../caixa-teia/*.lisp` is one directory named literally
1243        // `../caixa-teia/*.lisp`, sibling of `.` and `..`).
1244        //
1245        // A `:caminho "../caixa-teia/*"` (the canonical "I pasted a
1246        // `ls ../caixa-teia/*` shell-listing one-liner into the `:caminho`
1247        // slot" footgun) or `:caminho "../foo?"` (the symmetric "I copied a
1248        // `rm foo?` single-char-wildcard removal idiom") silently passes
1249        // every prior arm because `Path::is_absolute` returns false on `..`,
1250        // `*` / `?` are neither leading-byte sentinels nor control bytes nor
1251        // `\` nor `<` / `>` nor `|` nor `;` nor `&` nor backtick, and the
1252        // value's last byte isn't `/`. The resolver folds the value through
1253        // `Path::new(caminho).join(<file>)` looking for a literal
1254        // `./../caixa-teia/*` subdirectory and fails at resolve time with a
1255        // non-self-locating `No such file or directory` error far from the
1256        // source caixa.lisp.
1257        //
1258        // The lacre pipeline embeds the value verbatim in its per-dep
1259        // content-address (`conteudo: format!("path:{caminho}")`,
1260        // caixa-resolver/src/resolve.rs:189), so a `*` or `?` byte lands in
1261        // the BLAKE3 closure and rides downstream as part of the build's
1262        // identity into every shell-spawned subprocess (the caixa-resolver's
1263        // `git clone` invocation, a future `feira tofu` shell-out, a future
1264        // operator-side `nix flake check` spawn) as the canonical
1265        // shell-metachar / pathname-expansion surface every peer
1266        // single-token-shaped typed slot already closes. The peer path-shaped
1267        // axis [`crate::render::is_gateway_api_http_path`]
1268        // (caixa-core/src/render.rs:506) rejects `*` and `?` as part of its
1269        // eleven-byte RFC-3986-reserved set on `:entrada :paths`. The
1270        // `:caminho` axis was the last typed path-string surface still
1271        // admitting these two bytes; this arm closes the gap so the
1272        // substrate-wide "no shell-composition / glob-expansion
1273        // metacharacter anywhere in a typed string slot that flows verbatim
1274        // into a shell-spawned subprocess" invariant extends from
1275        // shell-command-substitution (backtick) to glob-expansion
1276        // (`*` / `?`) on the `:caminho` axis.
1277        //
1278        // The arm fires AFTER the backtick arm because the prior arm's
1279        // CWE-78 shell-command-injection vector is the load-bearing
1280        // diagnostic on values that probe as both (a `"../`whoami`/*"`
1281        // carries both backtick and `*` — the command-substitution paste
1282        // is the load-bearing root-cause edit, so
1283        // `FonteCaminhoShellCommandSubstitution` wins; same cascade
1284        // discipline every prior `:caminho` arm establishes). The arm
1285        // fires BEFORE the trailing-`/` arm because the embedded glob
1286        // byte is the more semantic-locating axis on probe-as-both values
1287        // (`"../foo*/"` ends in `/` but the load-bearing diagnostic is the
1288        // embedded `*` glob metachar — the trailing `/` is the secondary
1289        // observation, and an author who removes the `*` is likely to
1290        // also tab-strip the trailing separator).
1291        for &b in caminho.as_bytes() {
1292            if b == b'*' || b == b'?' {
1293                return Err(DepError::fonte_caminho_shell_glob(nome, caminho, b));
1294            }
1295        }
1296        // Reproducibility gate's shell-subshell-grouping arm. The cf9034b
1297        // shell-glob arm closes the `*` / `?` pathname-expansion sentinels;
1298        // `(` (`0x28`) and `)` (`0x29`) are the orthogonal POSIX subshell-
1299        // grouping sentinels — same paste-from-shell-prompt footgun class,
1300        // different syntactic surface. Every POSIX shell (sh / bash / zsh /
1301        // dash / ksh / fish / nushell) lexes the parenthesis pair as the
1302        // subshell-grouping operator: `(<cmd>)` runs `<cmd>` in a child
1303        // shell with a fresh environment scope (the canonical sandboxing
1304        // idiom every shell-history `(cd <path> && <cmd>)` one-liner uses
1305        // to scope a `cd` to one subshell without disturbing the parent's
1306        // working directory), and `$(<cmd>)` is the modern Bourne
1307        // command-substitution shape the upstream f4efe9c
1308        // `FonteCaminhoVarExpansion` arm closes the leading `$` byte of —
1309        // the closing `)` byte completes that substitution shape and must
1310        // be refused on the same axis (peer with the
1311        // [`crate::render::is_git_repo_url`] 3b99147 arm that closes the
1312        // same byte-pair on the sibling `:fonte :repo` axis under the
1313        // same shell-subshell-grouping + RFC-3986-sub-delims banner).
1314        // POSIX `std::path::Path` treats both bytes as literal path-
1315        // component bytes (so `../caixa-teia/(date)` is one directory
1316        // named literally `../caixa-teia/(date)`, sibling of `.` and
1317        // `..`).
1318        //
1319        // A `:caminho "../caixa-teia/$(date)/build"` (the canonical "I
1320        // pasted a `cd ../caixa-teia/$(date)/build` shell-history one-
1321        // liner whose modern command-substitution expansion lands the
1322        // current date as a subdirectory name" footgun) or `:caminho
1323        // "../(cd foo && pwd)/caixa-teia"` (the symmetric "I copied a
1324        // `(cd foo && pwd)` subshell-grouping working-directory probe
1325        // idiom") silently passes every prior arm because
1326        // `Path::is_absolute` returns false on `..`, `(` / `)` are
1327        // neither leading-byte sentinels nor control bytes nor `\` nor
1328        // `<` / `>` nor `|` nor `;` nor `&` nor backtick nor `*` / `?`,
1329        // and the value's last byte isn't `/`. The resolver folds the
1330        // value through `Path::new(caminho).join(<file>)` looking for a
1331        // literal `./../caixa-teia/$(date)/build` subdirectory and fails
1332        // at resolve time with a non-self-locating `No such file or
1333        // directory` error far from the source caixa.lisp.
1334        //
1335        // The lacre pipeline embeds the value verbatim in its per-dep
1336        // content-address (`conteudo: format!("path:{caminho}")`,
1337        // caixa-resolver/src/resolve.rs:189), so a `(` or `)` byte lands
1338        // in the BLAKE3 closure and rides downstream as part of the
1339        // build's identity into every shell-spawned subprocess (the
1340        // caixa-resolver's `git clone` invocation, a future `feira tofu`
1341        // shell-out, a future operator-side `nix flake check` spawn) as
1342        // the canonical shell-metachar / subshell-grouping surface every
1343        // peer single-token-shaped typed slot already closes. The peer
1344        // git-source axis [`crate::render::is_git_repo_url`] (3b99147)
1345        // rejects the same byte pair on `:fonte :repo` under the same
1346        // shell-subshell-grouping / RFC-3986-sub-delims banner. The
1347        // `:caminho` axis was the last typed path-string surface still
1348        // admitting these two bytes;
1349        // this arm closes the gap so the substrate-wide "no shell-
1350        // composition metacharacter anywhere in a typed string slot that
1351        // flows verbatim into a shell-spawned subprocess" invariant
1352        // extends from shell-glob (`*` / `?`) to shell-subshell-grouping
1353        // (`(` / `)`) on the `:caminho` axis. Together with the f4efe9c
1354        // leading-`$` arm, the typed `:caminho` accepted set now
1355        // structurally excludes the entire modern Bourne
1356        // command-substitution surface — leading `$` closes the
1357        // leading byte of every `$(<cmd>)` shape, this arm closes the
1358        // trailing `)` boundary.
1359        //
1360        // The arm fires AFTER the shell-glob arm because the prior arm's
1361        // `*` / `?` pathname-expansion shape is the more common shell-
1362        // history paste idiom on values that probe as both
1363        // (`"../caixa-teia/*(date)"` carries both `*` and `(` — the
1364        // glob-paste-tail is the load-bearing root-cause edit, so
1365        // `FonteCaminhoShellGlob` wins; same cascade discipline every
1366        // prior `:caminho` arm establishes). The arm fires BEFORE the
1367        // trailing-`/` arm because the embedded subshell-grouping byte
1368        // is the more semantic-locating axis on probe-as-both values
1369        // (`"../foo(date)/"` ends in `/` but the load-bearing diagnostic
1370        // is the embedded `(` shell-subshell-grouping metachar — the
1371        // trailing `/` is the secondary observation, and an author who
1372        // removes the `(` is likely to also tab-strip the trailing
1373        // separator).
1374        for &b in caminho.as_bytes() {
1375            if b == b'(' || b == b')' {
1376                return Err(DepError::fonte_caminho_shell_subshell_grouping(
1377                    nome, caminho, b,
1378                ));
1379            }
1380        }
1381        // Reproducibility gate's shell-brace-expansion arm. The 0633c91
1382        // shell-subshell-grouping arm closes `(` / `)`; `{` (`0x7b`) and
1383        // `}` (`0x7d`) are the orthogonal shell-brace-expansion /
1384        // URI-Template-placeholder byte pair — same paste-from-shell-
1385        // prompt + paste-from-templated-doc footgun class, different
1386        // syntactic surface. Every POSIX-derived shell that implements
1387        // brace expansion (bash / zsh / ksh / fish; the canonical
1388        // `mkdir -p ../{caixa-teia,caixa-helm,caixa-flux}` /
1389        // `cp file{,.bak}` idiom every shell-history block carries)
1390        // expands `{a,b,c}` to the cross-product of its comma-separated
1391        // members and `{1..10}` to the integer range; RFC 6570 reserves
1392        // the matched pair for URI Template placeholders (the canonical
1393        // `https://{host}/{org}/{repo}` substitution shape every
1394        // OpenAPI / Swagger / Postman / GitHub Octokit client /
1395        // Helm chart-URL fragment / Mustache `{{org}}` doubled-brace
1396        // form carries), and Tera / Jinja2 / Handlebars / Go html/template
1397        // every IaC tool (Helm, Kustomize, Terraform's `${var}` cousin
1398        // shape) emit. POSIX `std::path::Path` treats both bytes as
1399        // literal path-component bytes (so `../{caixa-teia,caixa-helm}`
1400        // is one directory named literally `../{caixa-teia,caixa-helm}`,
1401        // sibling of `.` and `..`).
1402        //
1403        // A `:caminho "../{caixa-teia,caixa-helm}/build"` (the canonical
1404        // "I pasted a `cd ../{caixa-teia,caixa-helm}` shell brace-
1405        // expansion one-liner that fans across two siblings" footgun)
1406        // or `:caminho "../{{org}}/caixa-teia"` (the symmetric "I copied
1407        // a `{{org}}` Mustache / Helm template placeholder out of a
1408        // README quick-start and forgot to substitute") silently passes
1409        // every prior arm because `Path::is_absolute` returns false on
1410        // `..`, `{` / `}` are neither leading-byte sentinels nor control
1411        // bytes nor `\` nor `<` / `>` nor `|` nor `;` nor `&` nor
1412        // backtick nor `*` / `?` nor `(` / `)`, and the value's last
1413        // byte isn't `/`. The resolver folds the value through
1414        // `Path::new(caminho).join(<file>)` looking for a literal
1415        // `./../{caixa-teia,caixa-helm}/build` subdirectory and fails
1416        // at resolve time with a non-self-locating `No such file or
1417        // directory` error far from the source caixa.lisp.
1418        //
1419        // The lacre pipeline embeds the value verbatim in its per-dep
1420        // content-address (`conteudo: format!("path:{caminho}")`,
1421        // caixa-resolver/src/resolve.rs:189), so a `{` or `}` byte
1422        // lands in the BLAKE3 closure and rides downstream as part of
1423        // the build's identity into every shell-spawned subprocess
1424        // (the caixa-resolver's `git clone` invocation, a future
1425        // `feira tofu` shell-out, a future operator-side `nix flake
1426        // check` spawn) as the canonical shell-metachar / brace-
1427        // expansion surface every peer single-token-shaped typed
1428        // slot already closes. The peer git-source axis
1429        // [`crate::render::is_git_repo_url`] (42d8f9d — the URI Template
1430        // placeholder arm) rejects the same byte pair on `:fonte :repo`
1431        // under the same RFC-3986-'delims' / RFC-6570-URI-Template /
1432        // shell-brace-expansion banner. The `:caminho` axis was the last
1433        // typed path-string surface still admitting these two bytes;
1434        // this arm closes the gap so the substrate-wide "no shell-
1435        // composition metacharacter anywhere in a typed string slot
1436        // that flows verbatim into a shell-spawned subprocess"
1437        // invariant extends from shell-subshell-grouping (`(` / `)`)
1438        // to shell-brace-expansion (`{` / `}`) on the `:caminho` axis,
1439        // and the typed `:caminho` accepted set now also structurally
1440        // excludes the URI Template / templating-engine placeholder
1441        // surface that would silently round-trip through any
1442        // downstream IaC templating-engine layer.
1443        //
1444        // The arm fires AFTER the shell-subshell-grouping arm because
1445        // the prior arm's `(` / `)` shape is the more semantic-locating
1446        // axis on values that probe as both (`"../{cd foo}(date)"`
1447        // carries both `{` and `(` — the parenthesis-pair is the
1448        // load-bearing modern-Bourne-command-substitution surface the
1449        // prior arm closes; same cascade discipline every prior
1450        // `:caminho` arm establishes). The arm fires BEFORE the
1451        // trailing-`/` arm because the embedded brace-expansion byte
1452        // is the more semantic-locating axis on probe-as-both values
1453        // (`"../{caixa-teia,caixa-helm}/"` ends in `/` but the
1454        // load-bearing diagnostic is the embedded `{` brace-expansion
1455        // metachar — the trailing `/` is the secondary observation,
1456        // and an author who removes the `{` is likely to also tab-
1457        // strip the trailing separator).
1458        for &b in caminho.as_bytes() {
1459            if b == b'{' || b == b'}' {
1460                return Err(DepError::fonte_caminho_shell_brace_expansion(
1461                    nome, caminho, b,
1462                ));
1463            }
1464        }
1465        // Reproducibility gate's shell-bracket-expansion arm. The 598b770
1466        // shell-brace-expansion arm closes `{` / `}`; `[` (`0x5b`) and
1467        // `]` (`0x5d`) are the orthogonal POSIX glob-character-class /
1468        // shell-`test`-builtin byte pair — same paste-from-shell-prompt
1469        // footgun class, different syntactic surface. Every POSIX shell
1470        // (sh / bash / zsh / dash / ksh / fish / nushell) lexes the
1471        // bracket pair as the glob character-class operator: `[abc]`
1472        // matches one of `a`, `b`, `c`; `[a-z]` matches any lowercase
1473        // ASCII letter; `[^x]` negates (the canonical
1474        // `ls *.[ch]` C-source-file glob and the `cd ../[a-z]*`
1475        // lowercase-sibling glob every shell-history block carries —
1476        // the orthogonal axis to the cf9034b `*` / `?` shell-glob arm
1477        // closing the unbounded pathname-expansion sentinels). The
1478        // bracket pair additionally carries the POSIX `test` /
1479        // `[` builtin command (`[ -d ../caixa-teia ] && cd ...` —
1480        // the canonical idiom every shell-script conditional uses) and
1481        // bash's `[[ ... ]]` extended-test grammar. Beyond shell, the
1482        // bracket pair is the TOML inline-array delimiter
1483        // (`features = ["a", "b"]` — the canonical paste-from-Cargo-
1484        // manifest cross-idiom-leak vector), the YAML flow-sequence
1485        // delimiter (`paths: [/a, /b]` — the canonical paste-from-
1486        // values.yaml cross-idiom leak), the JSON array delimiter,
1487        // and the POSIX-ERE / PCRE bracket-expression / character-
1488        // class anchor (the canonical paste-from-regex-doc shape).
1489        // POSIX `std::path::Path` treats both bytes as literal path-
1490        // component bytes (so `../[caixa-teia]` is one directory
1491        // named literally `../[caixa-teia]`, sibling of `.` and
1492        // `..`).
1493        //
1494        // A `:caminho "../caixa-[a-z]/build"` (the canonical "I
1495        // pasted a `cd ../caixa-[a-z]/build` glob-character-class
1496        // one-liner that matches every lowercase-sibling-suffix
1497        // sibling directory" footgun), `:caminho "../[caixa-teia]/
1498        // build"` (the symmetric "I pasted a TOML inline-array /
1499        // YAML flow-sequence shape out of an aligned manifest"
1500        // idiom), or `:caminho "../caixa-[ch]"` (the canonical
1501        // `*.[ch]` C-source character-class paste-from-shell-history
1502        // shape) silently passes every prior arm because
1503        // `Path::is_absolute` returns false on `..`, `[` / `]` are
1504        // neither leading-byte sentinels nor control bytes nor `\`
1505        // nor `<` / `>` nor `|` nor `;` nor `&` nor backtick nor
1506        // `*` / `?` nor `(` / `)` nor `{` / `}`, and the value's
1507        // last byte isn't `/`. The resolver folds the value through
1508        // `Path::new(caminho).join(<file>)` looking for a literal
1509        // `./../caixa-[a-z]/build` subdirectory and fails at resolve
1510        // time with a non-self-locating `No such file or directory`
1511        // error far from the source caixa.lisp.
1512        //
1513        // The lacre pipeline embeds the value verbatim in its per-dep
1514        // content-address (`conteudo: format!("path:{caminho}")`,
1515        // caixa-resolver/src/resolve.rs:189), so a `[` or `]` byte
1516        // lands in the BLAKE3 closure and rides downstream as part of
1517        // the build's identity into every shell-spawned subprocess
1518        // (the caixa-resolver's `git clone` invocation, a future
1519        // `feira tofu` shell-out, a future operator-side `nix flake
1520        // check` spawn) as the canonical shell-metachar / glob-
1521        // character-class / TOML-array surface every peer single-
1522        // token-shaped typed slot already closes. The `:caminho` axis
1523        // was the last typed path-string surface still admitting
1524        // these two bytes; this arm closes the gap so the substrate-
1525        // wide "no shell-composition metacharacter anywhere in a
1526        // typed string slot that flows verbatim into a shell-spawned
1527        // subprocess" invariant extends from shell-brace-expansion
1528        // (`{` / `}`) to shell-bracket-expansion (`[` / `]`) on the
1529        // `:caminho` axis. Together with the cf9034b `*` / `?` arm,
1530        // the typed `:caminho` accepted set now structurally excludes
1531        // the entire POSIX pathname-expansion / glob surface —
1532        // unbounded glob (`*` / `?`) AND bounded character-class
1533        // (`[abc]` / `[a-z]`).
1534        //
1535        // The arm fires AFTER the shell-brace-expansion arm because
1536        // the prior arm's `{` / `}` shape is the more semantic-
1537        // locating axis on values that probe as both
1538        // (`"../{a,b}[ch]"` carries both `{` and `[` — the brace-
1539        // expansion fan is the load-bearing root-cause edit, so
1540        // `FonteCaminhoShellBraceExpansion` wins; same cascade
1541        // discipline every prior `:caminho` arm establishes). The arm
1542        // fires BEFORE the trailing-`/` arm because the embedded
1543        // bracket-expansion byte is the more semantic-locating axis
1544        // on probe-as-both values (`"../[a-z]/"` ends in `/` but the
1545        // load-bearing diagnostic is the embedded `[` glob-character-
1546        // class metachar — the trailing `/` is the secondary
1547        // observation, and an author who removes the `[` is likely
1548        // to also tab-strip the trailing separator).
1549        for &b in caminho.as_bytes() {
1550            if b == b'[' || b == b']' {
1551                return Err(DepError::fonte_caminho_shell_bracket_expansion(
1552                    nome, caminho, b,
1553                ));
1554            }
1555        }
1556        // Reproducibility gate's shell-quote-grouping arm. The 986963b
1557        // shell-bracket-expansion arm closes `[` / `]`; `'` (`0x27`) and
1558        // `"` (`0x22`) are the orthogonal POSIX shell-string-literal
1559        // delimiter pair — same paste-from-shell-prompt footgun class,
1560        // different syntactic surface. Every POSIX shell (sh / bash /
1561        // zsh / dash / ksh / fish / nushell) lexes the pair as the
1562        // string-literal quoting operator: `'…'` is the strong
1563        // (no-expansion) single-quoted string and `"…"` is the weak
1564        // (variable-/command-substitution-preserving) double-quoted
1565        // string — the canonical `cd '../caixa-teia'` shell-history
1566        // idiom every path-with-embedded-whitespace paste block carries,
1567        // and the symmetric `git clone "$REPO"` weak-quoted CI-manifest
1568        // shape. Beyond shell, the two bytes carry the JSON string-literal
1569        // delimiter (`"key": "value"` — the canonical paste-from-JSON-
1570        // config cross-idiom-leak vector), the YAML double-quoted +
1571        // single-quoted flow-scalar delimiters (`path: "../caixa-teia"`
1572        // — the canonical paste-from-values.yaml / paste-from-K8s-YAML-
1573        // manifest cross-idiom leak), the TOML basic + literal string
1574        // delimiters (`path = "../caixa-teia"` — the canonical paste-
1575        // from-Cargo-manifest cross-idiom-leak vector), the tatara-lisp
1576        // string-literal delimiter itself (`(:caminho "../caixa-teia")`
1577        // — the canonical "I copied the entire `:caminho "..."` slot
1578        // rather than just the string body" author-surface footgun),
1579        // and RFC 3986 §2.2's `gen-delims` / `sub-delims` grammar which
1580        // excludes both bytes from the `unreserved / pct-encoded /
1581        // sub-delims / ":" / "@"` `pchar` production. POSIX
1582        // `std::path::Path` treats both bytes as literal path-component
1583        // bytes (so `../"caixa-teia"` is one directory named literally
1584        // `../"caixa-teia"`, sibling of `.` and `..`).
1585        //
1586        // A `:caminho "'../caixa-teia'"` (the canonical "I pasted a
1587        // `cd '../caixa-teia'` shell-history one-liner whose strong-
1588        // quoting preserved the sibling-workspace path verbatim across
1589        // the whitespace paste boundary" footgun), `:caminho
1590        // "\"../caixa-teia\""` (the symmetric weak-quoted paste-from-
1591        // JSON / paste-from-YAML flow-scalar / paste-from-TOML basic-
1592        // string / paste-from-tatara-lisp string-literal cross-idiom-
1593        // leak shape), or `:caminho "../\"caixa-teia\""` (the embedded-
1594        // quote "I pasted a JSON key-value pair fragment into the
1595        // middle of the path" idiom) silently passes every prior arm
1596        // because `Path::is_absolute` returns false on `..` / `'` /
1597        // `"`, `'` / `"` are neither leading-byte sentinels nor
1598        // control bytes nor `\` nor `<` / `>` nor `|` nor `;` nor `&`
1599        // nor backtick nor `*` / `?` nor `(` / `)` nor `{` / `}` nor
1600        // `[` / `]`, and the value's last byte isn't `/`. The resolver
1601        // folds the value through `Path::new(caminho).join(<file>)`
1602        // looking for a literal `./'../caixa-teia'` subdirectory and
1603        // fails at resolve time with a non-self-locating `No such file
1604        // or directory` error far from the source caixa.lisp.
1605        //
1606        // The lacre pipeline embeds the value verbatim in its per-dep
1607        // content-address (`conteudo: format!("path:{caminho}")`,
1608        // caixa-resolver/src/resolve.rs:189), so a `'` or `"` byte
1609        // lands in the BLAKE3 closure and rides downstream as part of
1610        // the build's identity into every shell-spawned subprocess
1611        // (the caixa-resolver's `git clone` invocation, a future
1612        // `feira tofu` shell-out, a future operator-side `nix flake
1613        // check` spawn) as the canonical shell-metachar / string-
1614        // literal-delimiter surface every peer single-token-shaped
1615        // typed slot already closes. The peer `:fonte :repo` axis
1616        // closes both bytes under the same shell-quote-grouping /
1617        // RFC-3986-sub-delims banner (e7a109f `'` shell-single-quote
1618        // + 4267d8b `"` shell-double-quote on `is_git_repo_url`). The
1619        // `:caminho` axis was the last typed path-string surface
1620        // still admitting these two bytes; this arm closes the gap
1621        // so the substrate-wide "no shell-composition metacharacter
1622        // anywhere in a typed string slot that flows verbatim into a
1623        // shell-spawned subprocess" invariant extends from shell-
1624        // bracket-expansion (`[` / `]`) to shell-quote-grouping (`'`
1625        // / `"`) on the `:caminho` axis. Together with the peer
1626        // JSON / YAML / TOML string-literal delimiters closing at
1627        // this arm and the 598b770 `{` / `}` brace-expansion arm
1628        // closing the templating-engine-placeholder boundary, the
1629        // typed `:caminho` accepted set now structurally excludes
1630        // the entire cross-config-DSL string-literal / templating
1631        // paste-from-aligned-manifest cross-idiom-leak surface that
1632        // would silently round-trip through any downstream JSON /
1633        // YAML / TOML / HCL / tatara-lisp parsing layer.
1634        //
1635        // The arm fires AFTER the shell-bracket-expansion arm because
1636        // the prior arm's `[` / `]` shape is the more semantic-
1637        // locating axis on values that probe as both (`"../[a-z]'x'"`
1638        // carries both `[` and `'` — the glob-character-class
1639        // expansion is the load-bearing root-cause edit, so
1640        // `FonteCaminhoShellBracketExpansion` wins; same cascade
1641        // discipline every prior `:caminho` arm establishes). The arm
1642        // fires BEFORE the trailing-`/` arm because the embedded
1643        // quote-grouping byte is the more semantic-locating axis on
1644        // probe-as-both values (`"../'caixa-teia'/"` ends in `/` but
1645        // the load-bearing diagnostic is the embedded `'` shell-
1646        // string-literal metachar — the trailing `/` is the secondary
1647        // observation, and an author who removes the `'` is likely to
1648        // also tab-strip the trailing separator).
1649        for &b in caminho.as_bytes() {
1650            if b == b'\'' || b == b'"' {
1651                return Err(DepError::fonte_caminho_shell_quote_grouping(
1652                    nome, caminho, b,
1653                ));
1654            }
1655        }
1656        // Reproducibility gate's shell-comment / URL-fragment / YAML-comment arm.
1657        // The d14cbc5 shell-quote-grouping arm closes `'` / `"`; `#` (`0x23`) is
1658        // the orthogonal "byte at which four distinct downstream parsers all
1659        // truncate the value at the first occurrence" surface, and no prior arm
1660        // has covered it on the `:caminho` axis. Every POSIX shell (sh / bash /
1661        // zsh / dash / ksh / fish / nushell) lexes an unquoted `#` at the head
1662        // of a word (or after unquoted whitespace) as the comment-lead: from
1663        // that byte to the end of the physical line is a comment discarded
1664        // before command parsing (`cd ../caixa-teia  # legacy sibling` — the
1665        // canonical paste-from-shell-history-with-trailing-annotation shape
1666        // every operator-notebook and CI-manifest carries; POSIX.1-2017 §2.3
1667        // Token Recognition step 6). YAML 1.2 §6.6 makes `#` the comment lead
1668        // at any position preceded by whitespace or at line-start (`path:
1669        // ../caixa-teia  # pin` — the canonical paste-from-values.yaml /
1670        // paste-from-K8s-manifest cross-idiom-leak shape). tatara-lisp itself
1671        // treats `;` as the comment-lead but a growing number of consumer
1672        // config-DSL layers (HCL, Terraform, Nix flake attributes, .env
1673        // dotenv-style files, gitconfig / .gitignore, ini / TOML) use `#` as
1674        // the comment-lead too — the pair extends the cross-config-DSL
1675        // paste-idiom surface the d14cbc5 quote-grouping arm and the 598b770
1676        // brace-expansion arm already cover on adjacent axes. RFC 3986 §3.5
1677        // reserves `#` as the URL fragment-identifier delimiter (the canonical
1678        // paste-from-browser-address-bar `github.com/foo/bar#readme` /
1679        // `github.com/foo/bar#L42` permalink shape, and the symmetric
1680        // Nix-flake-ref cross-idiom leak `github:foo/bar#packageName` where
1681        // `#` selects a flake output — the same axis the peer
1682        // [`crate::render::is_git_repo_url`] closes on the `:fonte :repo`
1683        // surface at a68f818 with the same downstream-drops-the-tail
1684        // rationale).
1685        //
1686        // POSIX `std::path::Path` treats `#` as a literal path-component byte,
1687        // so a `:caminho "../caixa-teia # legacy sibling"` (the canonical
1688        // paste-from-shell-history-with-trailing-annotation footgun),
1689        // `:caminho "../caixa-teia  # pin"` (the symmetric YAML flow-scalar
1690        // paste-with-trailing-comment shape), or `:caminho "../caixa-teia
1691        // #readme"` (the URL fragment paste-from-browser-address-bar shape)
1692        // silently passes every prior arm because `Path::is_absolute` returns
1693        // false on `..`, `#` is neither a leading-byte sentinel nor a control
1694        // byte nor `\` nor `<` / `>` nor `|` nor `;` nor `&` nor backtick nor
1695        // `*` / `?` nor `(` / `)` nor `{` / `}` nor `[` / `]` nor `'` / `"`,
1696        // and the value's last byte isn't `/`. The resolver folds the value
1697        // through `Path::new(caminho).join(<file>)` looking for a literal
1698        // subdirectory named `../caixa-teia # legacy sibling` and fails at
1699        // resolve time with a non-self-locating `No such file or directory`
1700        // error far from the source caixa.lisp — while every downstream
1701        // shell / YAML / URL parser silently truncates the value at the `#`
1702        // byte to `../caixa-teia`, so a `feira tofu` shell-out to a
1703        // `cd '{caminho}'` command line and a `nix flake check` invocation on
1704        // an emitted YAML `path:` scalar disagree with the resolver on which
1705        // directory the value names. Two workstations whose downstream
1706        // shell / YAML / URL parsing layers differ in unquoted-`#`
1707        // recognition emit divergent build artifacts for the byte-identical
1708        // caixa.lisp value.
1709        //
1710        // The lacre pipeline embeds the value verbatim in its per-dep
1711        // content-address (`conteudo: format!("path:{caminho}")`,
1712        // caixa-resolver/src/resolve.rs:189), so the byte lands in the BLAKE3
1713        // closure and rides downstream as part of the build's identity into
1714        // every shell-spawned subprocess (the caixa-resolver's `git clone`
1715        // invocation, a future `feira tofu` shell-out, a future operator-side
1716        // `nix flake check` spawn) as the canonical shell-metachar /
1717        // comment-lead / URL-fragment-delimiter surface every peer
1718        // single-token-shaped typed slot already closes. The peer `:fonte
1719        // :repo` axis closes the byte under the URL-fragment-identifier
1720        // banner (a68f818 `#` on `is_git_repo_url`); the `:caminho` axis was
1721        // the last typed path-string surface still admitting the byte. This
1722        // arm closes the gap so the substrate-wide "no shell-composition
1723        // metacharacter / comment-lead / URL-fragment-delimiter anywhere in a
1724        // typed string slot that flows verbatim into a shell-spawned
1725        // subprocess or downstream YAML / URL parser" invariant extends from
1726        // shell-quote-grouping (`'` / `"`) to shell-comment / URL-fragment
1727        // (`#`) on the `:caminho` axis. Together with the peer JSON / YAML /
1728        // TOML string-literal delimiters the d14cbc5 quote-grouping arm
1729        // closes and the 598b770 `{` / `}` brace-expansion arm closes on the
1730        // templating-engine-placeholder boundary, the typed `:caminho`
1731        // accepted set now structurally excludes the entire
1732        // paste-with-trailing-annotation / paste-from-URL-permalink /
1733        // paste-from-YAML-comment cross-idiom-leak surface that would
1734        // silently round-trip through any downstream shell / YAML / URL /
1735        // dotenv / gitconfig / HCL parsing layer to a different value than
1736        // the resolver's `Path::join` sees.
1737        //
1738        // The arm fires AFTER the shell-quote-grouping arm because the prior
1739        // arm's `'` / `"` shape is the more semantic-locating axis on values
1740        // that probe as both (`"../'x'#pin"` carries both `'` and `#` — the
1741        // shell-string-literal-delimiter is the load-bearing root-cause edit,
1742        // so `FonteCaminhoShellQuoteGrouping` wins; same cascade discipline
1743        // every prior `:caminho` arm establishes). The arm fires BEFORE the
1744        // trailing-`/` arm because the embedded comment-lead / fragment-
1745        // delimiter byte is the more semantic-locating axis on probe-as-both
1746        // values (`"../caixa-teia#pin/"` ends in `/` but the load-bearing
1747        // diagnostic is the embedded `#` — the trailing `/` is the secondary
1748        // observation, and an author who removes the `#pin` fragment is
1749        // likely to also tab-strip the trailing separator).
1750        for &b in caminho.as_bytes() {
1751            if b == b'#' {
1752                return Err(DepError::fonte_caminho_shell_comment(nome, caminho, b));
1753            }
1754        }
1755        // Reproducibility gate's URL-percent-encoding-escape arm. The 6622063
1756        // shell-comment arm closes the `#` URL-fragment-identifier byte; `%`
1757        // (`0x25`) is the orthogonal RFC 3986 §2.1 URL percent-encoding-escape
1758        // byte — the mandatory encoding mechanism for every byte outside the
1759        // `unreserved` alphanumeric / `-` / `.` / `_` / `~` set, and `%`
1760        // itself must be percent-encoded as `%25` to appear literally inside
1761        // a URL value. The byte carries three distinct render-determinism
1762        // hazards on the `:caminho` axis, no prior arm has covered it, and
1763        // the peer `:fonte :repo` axis (a323db8 `%` on `is_git_repo_url`)
1764        // already closes the same byte under the same URL-percent-encoding
1765        // banner — the `:caminho` axis was the last typed path-string surface
1766        // still admitting the byte.
1767        //
1768        // First, the paste-from-browser-address-bar percent-encoded-space
1769        // footgun: an author copies `../caixa%20teia` out of a URL-encoded
1770        // README hyperlink / a browser address bar / a percent-encoded
1771        // permalink expecting `%20` to decode to a literal space at the
1772        // filesystem layer. POSIX `std::path::Path` treats the byte as a
1773        // literal path-component byte, so `Path::join` looks for a literal
1774        // `./../caixa%20teia` subdirectory and fails at resolve time with a
1775        // non-self-locating `No such file or directory` error far from the
1776        // source caixa.lisp — while the author's mental model was
1777        // `../caixa teia`, the decoded shape. Two authors whose only
1778        // difference is percent-encoding presence resolve to two distinct
1779        // BLAKE3 closures (`path:../caixa%20teia` vs `path:../caixa teia`)
1780        // for what they intended as the byte-identical sibling-workspace
1781        // dep. The lacre pipeline embeds the value verbatim in its per-dep
1782        // content-address (`conteudo: format!("path:{caminho}")`,
1783        // caixa-resolver/src/resolve.rs:189), so the divergence rides
1784        // downstream into the BLAKE3 closure and locks the substrate's
1785        // "the lacre is the build's identity" contract (CAIXA-SDLC §III.2)
1786        // to the wrong encoding — the same THEORY.md §V.2 render-
1787        // determinism vector every prior `:caminho` arm protects.
1788        //
1789        // Second, the printf-format-specifier lead footgun: `%` is the C /
1790        // POSIX printf format-directive lead-in (`%s`, `%d`, `%02x`, the
1791        // canonical `printf "path=%s\n" ../caixa-teia` invocation every
1792        // shell-diagnostic one-liner carries) and the printf builtin is
1793        // wired into every POSIX shell (bash / zsh / dash / ksh / busybox
1794        // ash) as the format-string lead. A `:caminho "../caixa-%s-teia"`
1795        // value flowing into any future `feira` verb that shells out with a
1796        // printf-formatted path template silently gets reinterpreted as a
1797        // format-directive rather than a literal byte — the canonical
1798        // CWE-134 format-string-injection vector.
1799        //
1800        // Third, the bash-job-control-specifier lead footgun: bash / zsh /
1801        // ksh reserve `%N` at word-start as the job-control specifier —
1802        // `%1` names "job 1", `%%` names "the current job", `%foo` names
1803        // "the most recent job whose command started with `foo`". A future
1804        // `feira` verb that invokes `kill %1` on a caminho-scoped
1805        // subprocess would silently redirect the signal to a wrong target.
1806        //
1807        // Beyond the three shell-side hazards, `%` is a first-class parser
1808        // byte in three cross-config-DSL layers the substrate's paste-idiom
1809        // surface routinely crosses: YAML 1.2 §6.8.1 lexes `%` at
1810        // line-start as the directive lead (`%YAML 1.2` / `%TAG` — a
1811        // `:caminho "%YAML/1.2/../caixa-teia"` paste from a top-of-doc
1812        // YAML directive block silently trips the YAML directive parser on
1813        // any downstream emitted YAML manifest); Prometheus / Grafana
1814        // template syntax uses `%(var)s` as the substitution lead; and Nix
1815        // interpolation uses `${var}` (not `%`) but Envsubst /
1816        // Kubernetes / OpenShift template layers use `%VAR%` as the
1817        // Windows-shell env-var-reference lead — the paste-from-`.bat` /
1818        // paste-from-PowerShell-`%env:PATH%` cross-idiom leak.
1819        //
1820        // The three malformed-`%HH` classes documented on the peer
1821        // `is_git_repo_url` `%` arm (a323db8) apply here too:
1822        //
1823        //   - The lone-`%` malformed-escape shape (`"../caixa-teia%foo"`
1824        //     where `%` isn't followed by two hex digits) — every WHATWG-
1825        //     conformant URL parser rejects the value at parse time per
1826        //     RFC 3986 §2.1, but the byte rides into the lacre before
1827        //     the resolver subprocess crosses the URL-parser boundary.
1828        //   - The over-encoded path-separator shape (`"../caixa%2Fteia"`
1829        //     intending the `%2F` as the URL encoding of `/`) locks a
1830        //     `path:../caixa%2Fteia` BLAKE3 closure that diverges from
1831        //     the byte-identical `path:../caixa/teia` form.
1832        //   - The double-encoded shape (`"../caixa%2520teia"` — the `%25`
1833        //     already itself an encoded `%`, so the intent was likely a
1834        //     literal `%20` that survived one round-trip through a
1835        //     URL-encoder that shouldn't have run) locks a triply-
1836        //     divergent closure across the encoded / once-decoded /
1837        //     twice-decoded chain.
1838        //
1839        // POSIX `std::path::Path` treats the byte as a literal path-
1840        // component byte, so a `:caminho "../caixa%20teia"` (the canonical
1841        // paste-from-browser-address-bar percent-encoded-space footgun),
1842        // `:caminho "%YAML/../caixa-teia"` (the symmetric paste-from-YAML-
1843        // directive-block cross-idiom leak), or `:caminho
1844        // "../caixa-%s-teia"` (the printf-format-specifier paste-from-
1845        // shell-diagnostic-one-liner shape) silently passes every prior arm
1846        // because `Path::is_absolute` returns false on `..`, `%` is neither
1847        // a leading-byte sentinel nor a control byte nor `\` nor `<` / `>`
1848        // nor `|` nor `;` nor `&` nor backtick nor `*` / `?` nor `(` / `)`
1849        // nor `{` / `}` nor `[` / `]` nor `'` / `"` nor `#`, and the
1850        // value's last byte isn't `/`. The resolver folds the value through
1851        // `Path::new(caminho).join(<file>)` looking for a literal
1852        // subdirectory named `../caixa%20teia` and fails at resolve time
1853        // with a non-self-locating `No such file or directory` error far
1854        // from the source caixa.lisp — while every downstream URL parser /
1855        // shell printf builtin / YAML directive parser silently
1856        // reinterprets the byte to a different value than the resolver's
1857        // `Path::join` sees. Two workstations whose downstream URL / shell
1858        // / YAML layers differ in `%HH` recognition emit divergent build
1859        // artifacts for the byte-identical caixa.lisp value.
1860        //
1861        // The lacre pipeline embeds the value verbatim in its per-dep
1862        // content-address (`conteudo: format!("path:{caminho}")`, caixa-
1863        // resolver/src/resolve.rs:189), so the byte lands in the BLAKE3
1864        // closure and rides into every shell-spawned subprocess (the
1865        // resolver's `git clone`, a future `feira tofu` shell-out, a
1866        // future operator-side `nix flake check` spawn) as the canonical
1867        // URL-percent-encoding-escape / printf-format-specifier / bash-
1868        // job-control-specifier surface every peer single-token-shaped
1869        // typed slot already closes. This arm closes the gap so the
1870        // substrate-wide "no URL-percent-encoding-escape / printf-format-
1871        // specifier / job-control-specifier / YAML-directive-lead byte
1872        // anywhere in a typed string slot that flows verbatim into a
1873        // shell-spawned subprocess or downstream URL / printf / YAML
1874        // parser" invariant extends from shell-comment / URL-fragment
1875        // (`#` — 6622063) to URL-percent-encoding-escape (`%`) on the
1876        // `:caminho` axis.
1877        //
1878        // The arm fires AFTER the shell-comment arm because the prior
1879        // arm's `#` shape is the more semantic-locating axis on values
1880        // that probe as both (`"../caixa%20teia#pin"` carries both `%`
1881        // and `#` — the URL-fragment-identifier is the load-bearing
1882        // downstream-truncation edit, so `FonteCaminhoShellComment` wins;
1883        // same cascade discipline every prior `:caminho` arm establishes).
1884        // The arm fires BEFORE the trailing-`/` arm because the embedded
1885        // percent-encoding-escape byte is the more semantic-locating axis
1886        // on probe-as-both values (`"../caixa%20teia/"` ends in `/` but
1887        // the load-bearing diagnostic is the embedded `%` percent-
1888        // encoding-escape — the trailing `/` is the secondary observation,
1889        // and an author who decodes the `%20` to a literal space is
1890        // likely to also tab-strip the trailing separator).
1891        for &b in caminho.as_bytes() {
1892            if b == b'%' {
1893                return Err(DepError::fonte_caminho_url_percent_encoding(
1894                    nome, caminho, b,
1895                ));
1896            }
1897        }
1898        // Reproducibility gate's embedded-`$` shell-variable-expansion /
1899        // command-substitution / arithmetic-expansion arm. The f4efe9c
1900        // leading-`$` arm at line 540 routes `caminho.starts_with('$')`
1901        // through `FonteCaminhoVarExpansion` under the leading-byte-
1902        // sentinel host-layout-leak banner (peer with the b94fd83
1903        // absolute / a5c248e tilde leading-byte arms), but the arm
1904        // fires only at position 0 — a `:caminho "../foo$HOME/bar"`
1905        // (embedded `$HOME` in a nested path segment — the canonical
1906        // paste-from-`ls ../foo$HOME/bar`-shell-one-liner footgun where
1907        // an author copies a partially-substituted shell one-liner and
1908        // the leading segment is a literal `../foo` while the mid
1909        // segment carries the un-substituted `$HOME` template), a
1910        // `:caminho "../foo${WORKSPACE}/bar"` (the symmetric braced-CI-
1911        // manifest paste-from-`.gitlab-ci.yml` / paste-from-GitHub-
1912        // Actions-workflow shape), a `:caminho "../foo$(whoami)/bar"`
1913        // (the paste-from-shell-prompt command-substitution idiom), or
1914        // a `:caminho "../foo$((1+2))/bar"` (the arithmetic-expansion
1915        // idiom) silently passes every prior arm because
1916        // `Path::is_absolute` returns false on `..`, `$` is neither a
1917        // leading-byte sentinel (the f4efe9c arm fires only at position
1918        // 0) nor a control byte nor `\` nor `<` / `>` nor `|` nor `;`
1919        // nor `&` nor backtick nor `*` / `?` nor `(` / `)` nor `{` /
1920        // `}` nor `[` / `]` nor `'` / `"` nor `#` nor `%`, and the
1921        // value's last byte isn't `/`. Note that `$(...)` command-
1922        // substitution and `$((...))` arithmetic-expansion each carry
1923        // an embedded `(` byte that the 0633c91 shell-subshell-grouping
1924        // arm catches structurally at the earlier `(` position — but
1925        // an author who reaches for the sh-brace-substitution
1926        // `${VAR}` or the bare `$VAR` shape carries only the `$` byte,
1927        // which no prior arm covers. This arm closes the last
1928        // positional gap on the `$` byte on the `:caminho` axis so
1929        // every position — leading (`FonteCaminhoVarExpansion`) and
1930        // embedded (`FonteCaminhoShellVariableExpansion`) — is
1931        // structurally rejected.
1932        //
1933        // Every POSIX shell (sh / bash / zsh / dash / ksh / busybox
1934        // ash / fish / nushell) lexes `$` as the variable-expansion /
1935        // command-substitution / arithmetic-expansion operator per
1936        // POSIX.1-2017 §2.6 (Word Expansions): `$<name>` (Parameter
1937        // Expansion) expands a named variable, `${<name>}` (Parameter
1938        // Expansion braced form) does the same with an explicit token
1939        // boundary, `$(<cmd>)` (Command Substitution modern form,
1940        // `` `<cmd>` `` legacy form which the c370458 backtick arm
1941        // already closes) runs a subshell and substitutes its stdout,
1942        // and `$((<expr>))` (Arithmetic Expansion) evaluates an
1943        // arithmetic expression. Every form is a host-layout /
1944        // environment-state / shell-subprocess-side-effect leak when
1945        // the byte lands in a value the resolver passes to a shell-
1946        // spawned subprocess. Beyond the POSIX shell layer, `$` is
1947        // the Nix `${var}` string-interpolation lead (the paste-from-
1948        // `flake.nix` / paste-from-`.nix`-attribute cross-idiom leak
1949        // where an author copies `"${pkgs.hello}/bin/hello"` out of a
1950        // nix expression), the Make `$(var)` / `$@` / `$<` automatic-
1951        // variable lead (the paste-from-`Makefile` shape), the
1952        // JavaScript / TypeScript template-literal `${expr}` interp
1953        // lead (the paste-from-JS-template-string idiom in a
1954        // multi-lang-monorepo where a `path` attribute gets copied out
1955        // of a `package.json` script or a Vite config), the envsubst /
1956        // Kubernetes / OpenShift template `${VAR}` interp lead (the
1957        // paste-from-Helm-values / paste-from-K8s-manifest cross-idiom
1958        // leak), the PHP variable lead (`$_GET`, `$_ENV` — the paste-
1959        // from-`.php`-config footgun), the Perl scalar-variable lead
1960        // (`$foo`), the SASS / SCSS variable lead (`$primary-color`),
1961        // and the SQL bind-parameter lead in PostgreSQL / SQLite
1962        // (`$1`, `$2` — the paste-from-`.sql`-migration idiom). The
1963        // cross-idiom paste-footgun surface is broader than any single
1964        // shell layer — `$` is a first-class parser byte in nearly
1965        // every config / templating / build-system DSL the substrate's
1966        // paste-idiom surface routinely crosses. The peer `:fonte
1967        // :repo` axis closes the byte under the shell-variable-
1968        // expansion / URL-sub-delim banner (b9d187c `$` on
1969        // `is_git_repo_url`), the peer `:fonte :tag` / `:fonte :branch`
1970        // axes close `$` as part of `is_git_ref_name`'s printable-
1971        // ASCII-restricted grammar (`git check-ref-format` rejects the
1972        // byte outright), and the peer `:entrada :paths` axis closes
1973        // `$` via `is_gateway_api_http_path`'s eleven-byte RFC-3986-
1974        // reserved set. The `:caminho` axis was the last typed path-
1975        // string surface still admitting `$` at positions other than 0.
1976        //
1977        // POSIX `std::path::Path` treats `$` as a literal path-
1978        // component byte, so `:caminho "../foo$HOME/bar"` silently
1979        // routes through `Path::new(caminho).join(<file>)` looking for
1980        // a literal `./{caminho}` subdirectory that fails at resolve
1981        // time with a non-self-locating `No such file or directory`
1982        // error far from the source caixa.lisp. But every downstream
1983        // shell / envsubst / Nix / Make / K8s-template parser silently
1984        // reinterprets the byte to a different value than the
1985        // resolver's `Path::join` sees — so a `feira tofu` shell-out
1986        // to a `cd '{caminho}'` command line, a `nix flake check`
1987        // invocation on an emitted YAML `path:` scalar folded through
1988        // envsubst, or a `helm template` invocation with a
1989        // `values.yaml` `path: {caminho}` embedded in a `{{`-quoted
1990        // template all disagree with the resolver on which directory
1991        // the value names. Two workstations whose downstream shell /
1992        // envsubst / Nix / Make / K8s-template parsing layers differ
1993        // in `$VAR` recognition (or, worse, expand the byte against
1994        // divergent environments — Alice's `$HOME=/home/alice`, Bob's
1995        // `$HOME=/home/bob`) emit divergent build artifacts for the
1996        // byte-identical caixa.lisp value. Even in the case where the
1997        // resolver strictly does NOT expand `$VAR` (the current
1998        // implementation) the divergence still bites at the lacre-
1999        // identity axis: the lacre pipeline embeds the value verbatim
2000        // in its per-dep content-address (`conteudo:
2001        // format!("path:{caminho}")`, caixa-resolver/src/resolve.rs:189),
2002        // so `path:../foo$HOME/bar` locks a BLAKE3 closure distinct
2003        // from the byte-identical-semantic `path:../foo/home/alice/bar`
2004        // one author would have produced by substituting the literal
2005        // value at author time, defeating the THEORY.md §V.2 render-
2006        // determinism contract on the same axis every prior `:caminho`
2007        // arm protects.
2008        //
2009        // Beyond the render-determinism / host-layout-leak vectors,
2010        // `$` at any position in a value flowing verbatim into a
2011        // shell-spawned subprocess is the canonical CWE-78 shell-
2012        // command-injection surface every peer single-token-shaped
2013        // typed slot already closes. A `:caminho "../foo$(whoami)/bar"`
2014        // that rides into a future `feira tofu` shell-out as `cd
2015        // '../foo$(whoami)/bar'` gets substituted by the shell at
2016        // subprocess-argument-expansion time even inside single quotes
2017        // in fewer positions than one might expect (the substitution
2018        // fires only outside single-quoting per POSIX §2.2.2, but
2019        // eval-style wrappers and `sh -c` layers that route the value
2020        // through re-parsing round-trip the substitution — the same
2021        // vector the c370458 backtick arm closes at the sibling
2022        // command-substitution-legacy-form surface). Every future
2023        // `feira` verb that shells out with a `caminho`-formatted
2024        // subprocess argument silently inherits this substitution
2025        // vector unless the typed slot's accepted set structurally
2026        // excludes the byte.
2027        //
2028        // Frontier inspiration: OTP's `gen_server` return-value grammar
2029        // rejects mid-tuple shell-metachar bytes by construction —
2030        // `{noreply, State}` never carries a raw `$` because the
2031        // Erlang term type system has no notion of "string that gets
2032        // shelled out"; caixa's typed slots inherit the same
2033        // structural discipline (types-are-theorems, the compounding
2034        // mandate's leverage-point-1) by refusing values that would
2035        // silently reinterpret at any downstream layer. Peer with
2036        // Unison's content-addressed code (no ambient environment —
2037        // every reference is a hash, no `$VAR` substitution possible)
2038        // and Pony's capabilities (a path capability that carries a
2039        // `$` would be ill-typed at the reference layer).
2040        //
2041        // The arm fires AFTER the URL-percent-encoding-escape arm (the
2042        // e3558fa `%` arm) because a value carrying both `%` and `$`
2043        // (`"../foo%20$HOME/bar"` — the canonical "I pasted a percent-
2044        // encoded space next to a `$HOME` template") surfaces the
2045        // narrower URL-encoding diagnostic first — the paste-from-
2046        // browser-address-bar shape is the load-bearing self-locating
2047        // edit on every probe-as-both value; same cascade discipline
2048        // every prior `:caminho` arm establishes (a323db8 %  before
2049        // this arm, this arm before trailing-`/`). The arm fires
2050        // BEFORE the trailing-`/` arm because the embedded shell-
2051        // variable-expansion byte is the more semantic-locating axis
2052        // on probe-as-both values (`"../foo$HOME/bar/"` ends in `/`
2053        // but the load-bearing diagnostic is the embedded `$` — the
2054        // trailing `/` is the secondary observation, and an author
2055        // who substitutes the `$HOME` template with a literal value is
2056        // likely to also tab-strip the trailing separator).
2057        for &b in caminho.as_bytes() {
2058            if b == b'$' {
2059                return Err(DepError::fonte_caminho_shell_variable_expansion(
2060                    nome, caminho, b,
2061                ));
2062            }
2063        }
2064        // Reproducibility gate's shell-history-expansion / RFC-3986-sub-delims
2065        // arm. The immediate-predecessor `$` embedded arm closes the shell-
2066        // variable-expansion / command-substitution byte; `!` (`0x21`) is the
2067        // orthogonal POSIX shell-history-expansion sentinel every interactive
2068        // shell with history enabled (bash / ksh / zsh's `bashcompat` /
2069        // csh / tcsh) lexes as the history-expansion prefix: `!command`
2070        // re-runs the most recent history entry beginning with `command`,
2071        // `!!` re-runs the prior command verbatim, `!$` substitutes the
2072        // last word of the prior command, `!:N` substitutes the Nth word,
2073        // `^old^new` rewrites the prior command's `old` to `new` (the
2074        // canonical set of `set -o histexpand` operators bash's default
2075        // interactive session enables). Beyond the shell-history layer,
2076        // RFC 3986 §2.2 lists `!` in the `sub-delims` set (the URL grammar
2077        // admits the byte inside a path segment, but every WHATWG-conformant
2078        // special-scheme URL parser percent-encodes it inside a query
2079        // component via the 'special-query percent-encode set' the peer
2080        // `is_git_repo_url` `*` / `(` / `)` / `'` arms close on); the byte
2081        // is also the C / C++ / Rust / JavaScript / Python bang-operator
2082        // (logical-negation prefix — the paste-from-source-code idiom where
2083        // an author copies `!path.exists()` out of a Rust snippet and the
2084        // trailing punctuation crosses the string-literal boundary); the
2085        // canonical English-typography emphasis / exclamation mark (the
2086        // paste-from-prose enthusiasm-form idiom where an author writes
2087        // `:caminho "../caixa-teia!"` expecting the substrate to coerce it
2088        // to a kebab-case slug); and the Nix flake-ref import-attribute
2089        // `import ./foo.nix { … }` sibling operator surface.
2090        //
2091        // POSIX `std::path::Path` treats `!` as a literal path-component
2092        // byte, so a `:caminho "../caixa-teia!sudo"` (the canonical paste-
2093        // from-shell-history footgun where the author copies a `cd
2094        // ../caixa-teia && !sudo make install` one-liner from a quick-
2095        // start README and the trailing `!sudo` rides in verbatim as a
2096        // history-expansion reference), a `:caminho "../foo!!/bar"` (the
2097        // `!!` repeat-prior-command paste idiom), a `:caminho
2098        // "../caixa-teia!"` (the English-typography enthusiasm-form
2099        // paste-from-prose footgun), or a `:caminho "../foo!$"` (the
2100        // last-word-substitution shape) silently pass every prior arm
2101        // because `Path::is_absolute` returns false on `..`, `!` is neither
2102        // a leading-byte sentinel nor a control byte nor `\` nor `<` / `>`
2103        // nor `|` nor `;` nor `&` nor backtick nor `*` / `?` nor `(` / `)`
2104        // nor `{` / `}` nor `[` / `]` nor `'` / `"` nor `#` nor `%` nor `$`,
2105        // and the value's last byte isn't `/`. The resolver folds the value
2106        // through `Path::new(caminho).join(<file>)` looking for a literal
2107        // `./../caixa-teia!sudo` subdirectory and fails at resolve time
2108        // with a non-self-locating `No such file or directory` error far
2109        // from the source caixa.lisp — while every downstream interactive
2110        // shell with `set -o histexpand` reinterprets the byte as the
2111        // history-expansion prefix, and the failure mode forks per
2112        // consumer: a `feira tofu` shell-out to a `cd '{caminho}'` command
2113        // line executed under `bash -i` (the operator-notebook interactive
2114        // shell) substitutes the `!sudo` reference to the most recent
2115        // history entry starting with `sudo`, silently invoking whatever
2116        // privileged command that entry named.
2117        //
2118        // The lacre pipeline embeds the value verbatim in its per-dep
2119        // content-address (`conteudo: format!("path:{caminho}")`,
2120        // caixa-resolver/src/resolve.rs:189), so the byte lands in the
2121        // BLAKE3 closure and rides into every shell-spawned subprocess
2122        // (the resolver's `git clone`, a future `feira tofu` shell-out,
2123        // a future operator-side `nix flake check` spawn) as the
2124        // canonical shell-history-expansion / RFC-3986-sub-delims surface
2125        // every peer single-token-shaped typed slot already closes. The
2126        // peer `:fonte :repo` axis closes the byte under the same shell-
2127        // history-expansion / RFC-3986-sub-delims banner (7d53c68 `!` on
2128        // `is_git_repo_url`); the `:caminho` axis was the last typed
2129        // path-string surface still admitting the byte. This arm closes
2130        // the gap so the substrate-wide "no shell-composition
2131        // metacharacter / history-expansion sentinel anywhere in a typed
2132        // string slot that flows verbatim into a shell-spawned subprocess"
2133        // invariant extends from shell-variable-expansion (`$`) to shell-
2134        // history-expansion (`!`) on the `:caminho` axis. Together with
2135        // the peer c370458 backtick command-substitution-legacy-form arm
2136        // and the b9d187c-`$`-embedded-variable-expansion arm on the
2137        // sibling `:repo` axis, the typed `:caminho` accepted set now
2138        // structurally excludes every byte the POSIX shell §2.6 Word
2139        // Expansions section, §2.3 Token Recognition step 6, and every
2140        // history-expansion / brace-expansion / pathname-expansion /
2141        // parameter-expansion / command-substitution / arithmetic-
2142        // expansion operator lexes as a first-class parser byte.
2143        //
2144        // Frontier inspiration: Unison's content-addressed code (no
2145        // ambient environment — every reference is a hash, no `!<num>`
2146        // history-index substitution possible; the caixa substrate's
2147        // lacre discipline arrives at the same guarantee by refusing
2148        // bytes at manifest-parse time that would reinterpret against
2149        // ambient shell history state); Pony's capabilities (a path
2150        // capability that carries a `!` would be ill-typed at the
2151        // reference layer).
2152        //
2153        // The arm fires AFTER the shell-variable-expansion arm because a
2154        // value carrying both `$` and `!` (`"../foo$HOME/bar!sudo"` — the
2155        // canonical "I pasted a `$HOME`-templated path adjacent to a
2156        // trailing `!sudo` history-expansion") surfaces the narrower
2157        // shell-variable-expansion diagnostic first — the paste-from-CI-
2158        // manifest-with-`$VAR`-template shape is the load-bearing self-
2159        // locating edit on every probe-as-both value; same cascade
2160        // discipline every prior `:caminho` arm establishes. The arm
2161        // fires BEFORE the trailing-`/` arm because the embedded shell-
2162        // history-expansion byte is the more semantic-locating axis on
2163        // probe-as-both values (`"../foo!sudo/"` ends in `/` but the
2164        // load-bearing diagnostic is the embedded `!` — the trailing `/`
2165        // is the secondary observation, and an author who removes the
2166        // `!sudo` history reference is likely to also tab-strip the
2167        // trailing separator).
2168        for &b in caminho.as_bytes() {
2169            if b == b'!' {
2170                return Err(DepError::fonte_caminho_shell_history_expansion(
2171                    nome, caminho, b,
2172                ));
2173            }
2174        }
2175        // Reproducibility gate's shell-history-substitution / RFC-3986-unwise
2176        // / regex-anchor arm. The immediate-predecessor `!` arm closes the
2177        // POSIX `!command` / `!!` / `!$` history-expansion prefix; `^`
2178        // (`0x5E`) is the paired-operator half of the same bash-reference
2179        // §9.3 histexpand feature — the `^old^new^` "quick substitution"
2180        // form (POSIX bash rewrites the prior command's `old` string to
2181        // `new` and re-executes it, the canonical typo-correction one-
2182        // liner idiom `git clone <bad-url>` → `^bad^good` that pastes the
2183        // trailing substitution fragment verbatim into a `:caminho` value
2184        // when the author trims only the leading `git clone` prefix). The
2185        // peer `:fonte :repo` axis closes the byte under the same
2186        // shell-history-substitution / RFC-3986-unwise banner (49e142f `^`
2187        // on `is_git_repo_url`); the `:caminho` axis was the last typed
2188        // path-string surface still admitting the byte after 6a04767
2189        // landed the `!` arm.
2190        //
2191        // Beyond bash history-substitution, `^` carries five distinct
2192        // downstream-reinterpretation surfaces the typed slot's accepted
2193        // set must structurally exclude:
2194        //
2195        // 1. **RFC 3986 §2 'unwise' set** — the four-byte cross-transport
2196        //    layer set (`{`, `}`, `|`, `\`) plus `^` every URL parser is
2197        //    required to percent-encode-or-refuse at the wire boundary.
2198        //    The WHATWG URL spec's 'fragment percent-encode set' maps
2199        //    `^` → `%5E` at the query / fragment component transition;
2200        //    libcurl silently percent-encodes the byte on the wire, so a
2201        //    `:caminho "../foo^bar"` value the resolver's `Path::join`
2202        //    sees as a literal `./../foo^bar` subdirectory diverges from
2203        //    the byte-transformed `%5E` shape any downstream `feira tofu`
2204        //    curl-invocation or artifact-registry-fetch would emit — the
2205        //    canonical wire-boundary divergence vector the peer
2206        //    `{`, `}`, `|`, `\` `:caminho` arms already close (
2207        //    `FonteCaminhoShellBraceExpansion` at 598b770,
2208        //    `FonteCaminhoShellPipe` at the pipe arm,
2209        //    `FonteCaminhoBackslash` at the backslash arm).
2210        // 2. **Regex character-class negation prefix `[^abc]`** — the
2211        //    canonical paste-from-doc-regex-pipeline footgun where an
2212        //    author copies a `grep '[^abc]'` idiom from a docs quick-
2213        //    listing and the character-class negation byte rides in
2214        //    verbatim.
2215        // 3. **Bitwise XOR operator** in C / C++ / Rust / Python /
2216        //    JavaScript / Nix / Go — the paste-from-source-code idiom
2217        //    where an author copies an `x ^ y`-shaped expression out of
2218        //    a source snippet and the operator crosses the string-
2219        //    literal boundary.
2220        // 4. **Windows `cmd.exe` escape metacharacter** — the byte
2221        //    escapes the next character in a `cmd.exe` batch context (a
2222        //    peer of the backslash arm's Windows-separator-leak vector).
2223        //    A `:caminho "..^&whoami"` cross-platform paste-from-batch-
2224        //    file footgun reinterprets at every `cmd.exe`-spawned
2225        //    subprocess (the resolver's future Windows-runner shell-out,
2226        //    the operator's WinRM path, a future PowerShell-embedded
2227        //    invocation).
2228        // 5. **LaTeX / Markdown / BibTeX superscript operator** — the
2229        //    paste-from-typeset-doc footgun where a mathematical
2230        //    superscript notation (`x^2` / `M^T`) leaks from prose.
2231        //
2232        // POSIX `std::path::Path` treats `^` as a literal path-component
2233        // byte, so `:caminho "../foo^bar/baz"` (embedded quick-
2234        // substitution), `:caminho "../foo^"` (trailing history-
2235        // substitution-open shape), `:caminho "../[^a-z]/foo"` (regex-
2236        // negation-prefix paste from a grep pipeline; note the `[` / `]`
2237        // arm at 986963b fires first on this shape), or `:caminho
2238        // "../x^y"` (XOR-expression paste-from-source) all silently pass
2239        // every prior arm (`^` isn't `\` / `<` / `>` / `|` / `;` / `&` /
2240        // backtick / `*` / `?` / `(` / `)` / `{` / `}` / `[` / `]` / `'`
2241        // / `"` / `#` / `%` / `$` / `!`) and route through
2242        // `Path::new(caminho).join(<file>)` looking for a literal
2243        // `./{caminho}` subdirectory that fails at resolve time with a
2244        // non-self-locating `No such file or directory` error far from
2245        // the source caixa.lisp — while every downstream shell / curl /
2246        // regex / `cmd.exe` layer reinterprets the byte to its own
2247        // semantic.
2248        //
2249        // The lacre pipeline embeds the value verbatim in its per-dep
2250        // content-address (`conteudo: format!("path:{caminho}")`,
2251        // caixa-resolver/src/resolve.rs:189), so the byte lands in the
2252        // BLAKE3 closure and rides into every shell-spawned subprocess
2253        // (the resolver's `git clone`, a future `feira tofu` shell-out,
2254        // a future operator-side `nix flake check` spawn) as the
2255        // canonical shell-history-substitution / RFC-3986-unwise /
2256        // regex-negation surface every peer single-token-shaped typed
2257        // slot already closes. This arm together with the immediate-
2258        // predecessor `!` arm (6a04767) closes the full `set -o
2259        // histexpand` operator surface on the `:caminho` axis — the
2260        // `!command` / `!!` / `!$` prefix form via `!`, the `^old^new^`
2261        // quick-substitution form via `^` — so the substrate-wide "no
2262        // shell-history operator anywhere in a typed string slot that
2263        // flows verbatim into a shell-spawned subprocess" invariant
2264        // extends from the `!` prefix half to the `^` quick-substitution
2265        // half. Every peer bash-history operator now fails at manifest-
2266        // parse time with a self-locating diagnostic naming the offending
2267        // caixa.lisp rather than at resolve-time as a `Path::join`-
2268        // derived `No such file or directory` (harmless but non-self-
2269        // locating) or worse riding into a downstream `bash -i` context
2270        // that reinterprets the byte-pair against ambient history state.
2271        //
2272        // Frontier inspiration: bash reference §9.3 HISTORY EXPANSION
2273        // "Quick substitution. Repeat the previous command, replacing
2274        // string1 with string2." + RFC 3986 §2 'unwise' set
2275        // ("characters that gateways and other transport agents are
2276        // known to sometimes modify") + Pony's capabilities (a path
2277        // capability that carries a `^` would be ill-typed at the
2278        // reference layer, matching the same structural discipline the
2279        // sibling `!` history-expansion arm inherits from Unison's
2280        // content-addressed no-ambient-history discipline).
2281        //
2282        // The arm fires AFTER the shell-history-expansion `!` arm because
2283        // a value carrying both `!` and `^` (`"../foo!sudo^bad^good"` —
2284        // the canonical "I pasted a `!sudo` history-reference next to a
2285        // `^bad^good` quick-substitution") surfaces the narrower prefix-
2286        // form `!` diagnostic first — the `!` form is the load-bearing
2287        // self-locating edit on every probe-as-both value (an author who
2288        // removes the `!sudo` reference is likely to also strip the
2289        // paired `^` substitution fragment); same cascade discipline
2290        // every prior `:caminho` arm establishes. The arm fires BEFORE
2291        // the trailing-`/` arm because the embedded shell-history-
2292        // substitution byte is the more semantic-locating axis on
2293        // probe-as-both values (`"../foo^bar/"` ends in `/` but the
2294        // load-bearing diagnostic is the embedded `^` — the trailing `/`
2295        // is the secondary observation, and an author who removes the
2296        // `^bar` substitution fragment is likely to also tab-strip the
2297        // trailing separator).
2298        for &b in caminho.as_bytes() {
2299            if b == b'^' {
2300                return Err(DepError::fonte_caminho_shell_history_substitution(
2301                    nome, caminho, b,
2302                ));
2303            }
2304        }
2305        // Reproducibility gate's trailing-`/` arm. The b94fd83 absolute arm
2306        // closes the leading-`/` host-layout-leak; the embedded-control-byte
2307        // arm closes any byte-in-the-`0x00..=0x1F` / `0x7F` range; the
2308        // backslash arm closes the cross-host-OS-separator vector. The
2309        // trailing-`/` is the orthogonal shell-tab-completion-on-a-directory
2310        // footgun — `Path::join("../caixa-teia")` and
2311        // `Path::join("../caixa-teia/")` resolve to the same directory
2312        // (POSIX path-component-walk treats trailing `/` as a no-op for
2313        // directory targets, which `:caminho` always names — the sibling-
2314        // workspace dep root is structurally a directory). The lacre
2315        // pipeline embeds the value verbatim in its per-dep content-address
2316        // (`conteudo: format!("path:{caminho}")`,
2317        // caixa-resolver/src/resolve.rs:189), so byte-identical caixa
2318        // semantic-meaning yields two distinct BLAKE3 closures depending on
2319        // whether the author shell-tab-completed the path (every interactive
2320        // shell appends `/` on tab-completing a directory, idiomatic in
2321        // bash / zsh / fish / nushell), pasted from `pwd` (which on most
2322        // shells emits without trailing `/`, but `realpath -e -m` on a
2323        // directory with trailing `/` preserves it), or copied a Cargo
2324        // `path = "../caixa-teia/"` entry from cross-substrate documentation
2325        // (Cargo accepts both shapes and folds them the same way). Two
2326        // workstations whose authors differ only in tab-completion habits
2327        // emit byte-divergent lacres for the byte-identical-semantic caixa,
2328        // and the substrate's "the lacre is the build's identity" contract
2329        // (CAIXA-SDLC §III.2) silently breaks far from the source caixa.lisp.
2330        //
2331        // Same THEORY.md §V.2 render-determinism axis every prior `:caminho`
2332        // arm protects, here against the trailing-separator divergence
2333        // vector: every typed slot's accepted set excludes byte-divergent
2334        // values that round-trip to the same downstream semantic. The peer
2335        // path-shaped axes already reject trailing separators on the same
2336        // contract: [`crate::render::is_gateway_api_http_path`] gates
2337        // `:entrada :paths` against any non-canonical normalization, and
2338        // [`crate::render::is_sandboxed_relative_path`] gates the M2 typed
2339        // path-slots (`:behavior :on-*`, `:upgrade-from :state-change
2340        // :script`, `:bibliotecas`, `:exe`, `:servicos`) against shapes
2341        // whose canonical form would re-introduce determinism divergence.
2342        //
2343        // The arm fires last in the cascade because every prior arm carries
2344        // a more self-locating diagnostic on values that probe as both
2345        // (e.g. `:caminho "../foo/\0/"` ends in `/` but the load-bearing
2346        // diagnostic is the NUL byte's POSIX-syscall-rejection — the
2347        // control-char arm wins; `:caminho "/etc/passwd/"` ends in `/` but
2348        // the load-bearing diagnostic is the absolute host-layout-leak —
2349        // the absolute arm wins; `:caminho "..\caixa-teia/"` ends in `/`
2350        // but the load-bearing diagnostic is the Windows-separator cross-
2351        // OS divergence — the backslash arm wins). The arm covers every
2352        // shape where the last byte is `/` regardless of length, including
2353        // the degenerate single-`/` (which the absolute arm catches first)
2354        // and the consecutive-`//` (where every prior arm passes on the
2355        // bytes other than the trailing `/`).
2356        if caminho.as_bytes().last() == Some(&b'/') {
2357            return Err(DepError::fonte_caminho_trailing_slash(nome, caminho));
2358        }
2359        Ok(())
2360    }
2361}
2362
2363impl Dep {
2364    /// Substrate-canonical per-`:deps` / `:deps-dev` entry `:nome` scalar
2365    /// accessor every consumer of the dep-graph identity axis keys off —
2366    /// returns the author-declared `:nome` byte-string verbatim as a
2367    /// `&str`, borrowed from the typed slot's own [`String`] storage.
2368    ///
2369    /// The `:deps :nome` / `:deps-dev :nome` slot carries the DNS-1123
2370    /// label that names the target caixa (validated by [`Self::validate`]
2371    /// through the shared [`crate::render::is_dns_1123_label`] predicate,
2372    /// same accept-set the peer caixa-identifier axes carry — top-level
2373    /// [`crate::Caixa::nome`], per-`:membros` [`crate::Membro::nome`],
2374    /// per-`:children` [`crate::supervisor::ChildSpec::nome`]). Every
2375    /// downstream consumer that fans on the dep's name-identity keys off
2376    /// this scalar: the [`crate::Caixa::validate_deps`] per-list
2377    /// [`crate::render::insert_first_seen`] dedup key + the paired
2378    /// [`DepError::DuplicateNome`] carrier the walk raises on collision,
2379    /// the cross-list [`validate_no_self_dep`] parent-name equality gate
2380    /// on both `:deps` and `:deps-dev` traversals, the `caixa-resolver`
2381    /// pipeline's `HashSet<String>` seen-set the closure walker gates
2382    /// requeueing off (`caixa-resolver/src/resolve.rs:55`), the resolver's
2383    /// per-transitive-target requeue path (`resolve.rs:63,66`), the
2384    /// [`crate::DepSource::default_github`]-shaped resolver-side shorthand
2385    /// fill-in that folds `:nome` into the fetched-git-URL (`resolve.rs:147`),
2386    /// every `caixa-resolver` `ResolveError::MissingPath` /
2387    /// `ResolveError::MissingPin` carrier that names the offending dep
2388    /// (`resolve.rs:177,206`), each resolved
2389    /// `caixa-lacre::LacreEntry` `nome:` field the closure hash keys off
2390    /// (`resolve.rs:108,113`), and the peer `feira lock` stub-resolver's
2391    /// `LacreEntry` emitter (`caixa-feira/src/cmd/lock.rs:59,61,64`).
2392    ///
2393    /// Prior to this lift the `.nome` byte-string was read inline at every
2394    /// production site — the [`crate::Caixa::validate_deps`] paired
2395    /// `dep.nome.as_str()` / `dep.nome.clone()` accesses on both `:deps`
2396    /// and `:deps-dev` traversals, the [`validate_no_self_dep`] pair of
2397    /// parent-equality checks, and every caixa-resolver / caixa-feira
2398    /// site enumerated above — open-coded field-accesses that expressed
2399    /// no compile-time link back to the typed slot. A future extension of
2400    /// the `:deps :nome` axis to a richer author surface (a per-scope
2401    /// alias table the resolver folds through the `~/.config/caixa/config.yaml`
2402    /// entry the [`crate::dep::Dep`] docstring already acknowledges, a
2403    /// namespace-qualified rewrite the future M4 lacre-federation layer
2404    /// applies per-cluster, a promotion of the plain [`String`] byte-string
2405    /// to a richer scoped-identifier newtype once cross-registry federation
2406    /// lands) would have had to be threaded through every open-coded copy
2407    /// in lockstep or two consumers would silently disagree on which caixa
2408    /// a given dep resolves to — the [`crate::Caixa::validate_deps`] dedup
2409    /// set treating the name as `"caixa-teia"` while the caixa-resolver
2410    /// closure walker treated it as `"tenant-a/caixa-teia"` would silently
2411    /// split the [`DepError::DuplicateNome`] refusal from the resolver's
2412    /// requeue-suppression seen-set, one build-time diagnostic
2413    /// disagreeing with the run-time closure the substrate's lacre
2414    /// pipeline actually materializes. Lifting the resolution rule to a
2415    /// typed method on the substrate primitive means every downstream
2416    /// consumer of the caixa's per-`:deps` identity surface reaches for
2417    /// exactly one typed dispatch — the resolver's accept-set migrates as
2418    /// a unit on any future axis addition.
2419    ///
2420    /// First accessor on the outer `Dep` type — opens the outer-`Dep`
2421    /// `&str`-return required-scalar projection pattern the sibling
2422    /// per-`Dep` `:versao` future lift folds on. Peer of the sibling
2423    /// per-`:membros` [`crate::Membro::nome`] (4a32abf) /
2424    /// per-`:children` [`crate::supervisor::ChildSpec::nome`] (dfb4a81)
2425    /// / top-level [`crate::Caixa::nome`] (e6b7d97) caixa-identity scalar
2426    /// accessors — same "one typed dispatch on the substrate primitive,
2427    /// thin projections at each consumer" discipline extended onto the
2428    /// third named-caixa-referencing axis (`:deps` / `:deps-dev`), the
2429    /// remaining unlifted caixa-name-referencing accessor family in the
2430    /// substrate. Named `nome()` to match the tatara-lisp author-surface
2431    /// term the field's docstring already reaches for ("Caixa name — must
2432    /// match the target caixa's `:nome`") and the peer caixa-identity
2433    /// accessor family the substrate already carries.
2434    #[must_use]
2435    pub const fn nome(&self) -> &str {
2436        self.nome.as_str()
2437    }
2438
2439    /// Substrate-canonical per-`:deps` / `:deps-dev` entry `:versao`
2440    /// Cargo-shaped semver-requirement scalar accessor every consumer of
2441    /// the dep-graph version-pin axis keys off — returns the author-
2442    /// declared `:versao` requirement byte-string verbatim as a `&str`,
2443    /// borrowed from the typed slot's own [`String`] storage.
2444    ///
2445    /// The `:deps :versao` / `:deps-dev :versao` slot carries the
2446    /// Cargo-shaped semver requirement string (`"^0.1"`, `"~0.1.2"`,
2447    /// `"0.1.0"`, `"*"`) the shared [`crate::version::parse_requirement`]
2448    /// entry-point consumes — same accept-set the peer requirement-
2449    /// carrying axes carry (per-`:membros`
2450    /// [`crate::Membro::versao_requirement`], per-`:children`
2451    /// [`crate::supervisor::ChildSpec::versao_requirement`]), validated
2452    /// through the shared
2453    /// [`crate::render::require_valid_versao_requirement`] cascade in
2454    /// [`Self::validate`]. Every downstream consumer that fans on the
2455    /// dep's version-pin keys off this scalar: the [`Self::validate`]
2456    /// `require_valid_versao_requirement` gate + the paired
2457    /// [`DepError::VersaoInvalid`] carrier the cascade raises on
2458    /// requirement-shape rejection, the `feira lock` stub-resolver's
2459    /// `format!("{}@{}", dep.nome(), dep.versao_requirement())`
2460    /// `conteudo` hash-input interpolation and the paired
2461    /// `LacreEntry.versao:` `String`-carry fill (`caixa-feira/src/cmd/lock.rs`),
2462    /// and the peer `feira lock` end-to-end fixture in `caixa-feira/tests/feira_e2e.rs`.
2463    ///
2464    /// Prior to this lift the `.versao` byte-string was read inline at
2465    /// every production site — the [`Self::validate`] paired
2466    /// `&self.versao` requirement-gate reference and `self.versao.clone()`
2467    /// error-body carrier, the `caixa-feira/src/cmd/lock.rs` paired
2468    /// `format!("{}@{}", dep.nome(), dep.versao)` `conteudo` interpolation
2469    /// and `versao: dep.versao.clone()` `LacreEntry` fill, and the
2470    /// `caixa-feira/tests/feira_e2e.rs` end-to-end fixture's pair of the
2471    /// same shapes — open-coded field-accesses that expressed no
2472    /// compile-time link back to the typed slot. A future extension of
2473    /// the `:deps :versao` axis to a richer author surface (a per-scope
2474    /// version-lock overlay the resolver folds through the
2475    /// `~/.config/caixa/config.yaml` entry the [`crate::dep::Dep`]
2476    /// docstring already acknowledges, a per-cluster canary-version
2477    /// overlay per MESH-COMPOSITION §III.2, a promotion of the plain
2478    /// [`String`] requirement to a richer parsed-`VersionReq` newtype
2479    /// once cross-registry federation lands) would have had to be
2480    /// threaded through every open-coded copy in lockstep or two
2481    /// consumers would silently disagree on which release constraint a
2482    /// given dep resolves to — the [`Self::validate`] requirement-gate
2483    /// call reading `"^0.1"` while the `feira lock` stub-resolver's
2484    /// `conteudo` hash-input read `"tenant-a-pin/^0.1"` would silently
2485    /// split the [`DepError::VersaoInvalid`] refusal from the lacre's
2486    /// content-addressed hash the substrate's fetch pipeline actually
2487    /// materializes, one build-time diagnostic disagreeing with the
2488    /// run-time closure. Lifting the resolution rule to a typed method
2489    /// on the substrate primitive means every downstream consumer of
2490    /// the caixa's per-`:deps` version-pin surface reaches for exactly
2491    /// one typed dispatch — the resolver's accept-set migrates as a
2492    /// unit on any future axis addition.
2493    ///
2494    /// Second accessor on the outer `Dep` type — folds on the outer-
2495    /// `Dep` `&str`-return required-scalar projection pattern the
2496    /// sibling per-`Dep` [`Self::nome`] (eba2cde) accessor opened. Peer
2497    /// of the per-`:membros` [`crate::Membro::versao_requirement`]
2498    /// (a40b0e3) / per-`:children`
2499    /// [`crate::supervisor::ChildSpec::versao_requirement`] (7844f4e
2500    /// family) member/child version-pin accessors — the three
2501    /// requirement-carrying axes (`Dep::versao_requirement` on the
2502    /// per-caixa dep-graph edge, `Membro::versao_requirement` on the M3
2503    /// Aplicacao side, `ChildSpec::versao_requirement` on the M2
2504    /// Supervisor side) now share one accessor discipline for the
2505    /// shared substrate concept "another caixa referenced by a
2506    /// Cargo-shaped semver requirement". The pair
2507    /// `(nome(), versao_requirement())` jointly projects the
2508    /// `(nome, versao)` field pair every dep-graph consumer that fans
2509    /// on per-dep identity + version pin keys off. Named
2510    /// `versao_requirement()` rather than `versao()` because the field's
2511    /// storage-side `.versao` label is already the author-surface term
2512    /// (`:versao`); the accessor's name carries the semantic role — the
2513    /// semver *requirement* string the shared
2514    /// [`crate::version::parse_requirement`] entry-point consumes — so a
2515    /// raw field access and a typed dispatch read differently at every
2516    /// consumer site. Matches the peer
2517    /// [`crate::Membro::versao_requirement`] /
2518    /// [`crate::supervisor::ChildSpec::versao_requirement`] naming
2519    /// discipline verbatim.
2520    #[must_use]
2521    pub const fn versao_requirement(&self) -> &str {
2522        self.versao.as_str()
2523    }
2524
2525    /// Substrate-canonical per-`:deps` / `:deps-dev` entry `:fonte`
2526    /// Zig-store-model per-dep source-tuple optional-composite-reference
2527    /// accessor every consumer of the dep-graph fetch-source axis keys
2528    /// off — returns the author-declared `:fonte` typed [`DepSource`]
2529    /// verbatim as an `Option<&DepSource>` borrowed from the typed slot's
2530    /// own `Option<DepSource>` storage, with `None` naming the "author
2531    /// omitted `:fonte`" shorthand every resolver-side default-fill
2532    /// (`caixa-feira/src/cmd/lock.rs`'s stub, `caixa-resolver/src/resolve.rs`'s
2533    /// canonical fetcher, per the [`DepSource::default_github`] fallback
2534    /// the [`Dep::fonte`] field docstring already documents) treats as
2535    /// the "resolve through the configured default host / org
2536    /// (`github:<default-org>/<nome>`)" partition.
2537    ///
2538    /// The `:deps :fonte` / `:deps-dev :fonte` slot carries the two-
2539    /// arm typed [`DepSource`] the `Zig-style git-only store model` the
2540    /// enclosing [`Dep`] docstring names — `DepSource::Git { repo, tag,
2541    /// rev, branch }` for the git-clone arm every published caixa
2542    /// resolves through, `DepSource::Path { caminho }` for the dev-only
2543    /// local-filesystem arm every unpublishable in-tree checkout
2544    /// resolves through. Every downstream consumer that fans on the
2545    /// dep's fetch-source keys off this accessor: [`Self::validate`]'s
2546    /// per-`:fonte` [`DepSource::validate`] delegation (which raises
2547    /// the empty-`:repo` / missing-pin / multiple-pin / empty-`:caminho`
2548    /// diagnostics through the [`DepError::Fonte*`] carrier family
2549    /// naming the offending `Dep::nome`), the caixa-crd conversion
2550    /// crate's `dep_into_ref` two-arm projection into the `CaixaSource`
2551    /// `{repo, git_ref}` pair the K8s-CR side consumes
2552    /// (`caixa-crd/src/conversion.rs`), and — through the paired
2553    /// resolver-side default-fill's `Option::unwrap_or_else` — every
2554    /// `caixa-feira` / `caixa-resolver` fetch site that requires a
2555    /// concrete `DepSource` at run time.
2556    ///
2557    /// Prior to this lift the `.fonte` typed slot was read inline at
2558    /// every production site — the [`Self::validate`]
2559    /// `if let Some(ref fonte) = self.fonte` bracket the per-`:fonte`
2560    /// gate delegates through, the caixa-crd `dep_into_ref`
2561    /// `d.fonte.as_ref().and_then(...)` two-arm `CaixaSource` projector,
2562    /// the resolver-side `caixa-feira/src/cmd/lock.rs` / `caixa-resolver/src/resolve.rs`
2563    /// `dep.fonte.clone().unwrap_or_else(...)` default-fill pair — open-
2564    /// coded field-accesses that expressed no compile-time link back to
2565    /// the typed slot. A future extension of the `:deps :fonte` axis
2566    /// to a richer author surface (a per-scope source-override table
2567    /// the resolver folds through the `~/.config/caixa/config.yaml`
2568    /// entry the [`Dep`] docstring already acknowledges, a per-org
2569    /// mirror-fallback list the future M4 lacre-federation resolver
2570    /// consults ahead of the `default_github` fallback, a promotion of
2571    /// the plain `Option<DepSource>` to a richer
2572    /// `{primary, mirrors, integrity}` triple once cross-registry
2573    /// federation lands, a per-dep `sri:sha256-…` integrity slot the
2574    /// M4 lacre gate binds against ahead of the git-fetch) would have
2575    /// had to be threaded through every open-coded copy in lockstep or
2576    /// two consumers would silently disagree on which fetch source a
2577    /// given dep resolves to — the [`Self::validate`] per-`:fonte`
2578    /// gate reading the author-declared source while the caixa-crd
2579    /// projector read a per-scope-override-resolved source would
2580    /// silently split the build-time refusal from the CR the
2581    /// substrate's admission pipeline actually materializes, one
2582    /// build-time diagnostic disagreeing with the run-time closure.
2583    /// Lifting the resolution rule to a typed method on the substrate
2584    /// primitive means every downstream consumer of the caixa's per-
2585    /// `:deps` fetch-source surface reaches for exactly one typed
2586    /// dispatch — the resolver's accept-set migrates as a unit on any
2587    /// future axis addition.
2588    ///
2589    /// First outer-`Dep` `Option<&Composite>`-return composite-reference
2590    /// accessor — opens the outer-`Dep` `Option<&Composite>` composite-
2591    /// reference projection pattern the sibling per-`Dep` `:opcional`
2592    /// (`Option<Copy>` — the plain-bool axis) / `:caracteristicas`
2593    /// (`&[String]` — the feature-flag list) future outer scalar / slice
2594    /// lifts fold on. Peer of the outer-top-level [`crate::Caixa`]
2595    /// `Option<&Composite>` composite-reference sub-family the
2596    /// [`crate::Caixa::limits`] (b2bd9d7) / [`crate::Caixa::behavior`]
2597    /// (35d8b52) / [`crate::Caixa::politicas`] (5d23d29) /
2598    /// [`crate::Caixa::placement`] (4fb8074) / [`crate::Caixa::entrada`]
2599    /// (e4128e4) accessors already close on the outer [`crate::Caixa`]
2600    /// altitude, and of the outer M3 mesh-slot [`crate::AplicacaoSpec`]
2601    /// altitude the sibling [`crate::AplicacaoSpec::entrada`] (d32111c)
2602    /// accessor already carries — extends that "one typed dispatch on
2603    /// the substrate primitive, thin projections at each consumer"
2604    /// discipline onto the third outer typed-slot altitude that carries
2605    /// an `Option<Composite>` axis (`Dep`, the outer per-dep-list-entry
2606    /// slot). Returns `Option<&DepSource>` (not the owning composite by
2607    /// copy or clone) because every downstream consumer of the fonte
2608    /// composite treats it as a read-only per-arm dispatch source — the
2609    /// reference-view is the narrowest borrow that supports every
2610    /// present + roadmapped consumer (per-arm match projection at the
2611    /// caixa-crd `CaixaSource` two-arm emitter, presence-probe early
2612    /// return on the "author-omitted `:fonte` ⇒ resolver-side
2613    /// `default_github` fill applies" partition every resolver
2614    /// consults, `.cloned()`-on-demand for the two resolver-side
2615    /// default-fill call sites that require an owned `DepSource` for
2616    /// `Option::unwrap_or_else`) without cloning the composite through
2617    /// every consumer's fast path. The `Option` half of the return-type
2618    /// preserves the load-bearing "author-omitted `:fonte` ⇒ resolver-
2619    /// side default applies" partition (not a default composite the
2620    /// downstream must reject on emptiness) — the accessor projects the
2621    /// raw `Option<DepSource>` slot's presence bit through the
2622    /// reference-return unchanged. Named `fonte()` to match the storage
2623    /// field's name verbatim and the tatara-lisp author-surface term
2624    /// (`:fonte`) the field's own docstring already carries.
2625    ///
2626    /// Declared `pub const fn` — the body projects through
2627    /// `Option::<DepSource>::as_ref`, const-stable since Rust 1.83 and
2628    /// well within the workspace MSRV, so every downstream `const`-
2629    /// context consumer of the per-`Dep` `:fonte` composite-reference
2630    /// accessor reaches through the same typed dispatch on the
2631    /// substrate primitive at const-eval time as at runtime. The
2632    /// paired [`dep_outer_accessor_family_is_const_fn`][pin] pin
2633    /// (a `const fn <name>_via_const_fn(d: &Dep) -> …` wrapper family
2634    /// that forwards through each lifted accessor) locks the posture
2635    /// load-bearing at caixa-core build time — any future accidental
2636    /// downgrade to non-`const` fails the wrapper with E0015
2637    /// (`cannot call non-const method`), strictly stronger than a
2638    /// runtime `assert!` and side-stepping the destructor-in-const
2639    /// restriction the `Dep` fixture's `String` / `Option<DepSource>`
2640    /// / `Vec<String>` carriers rule out. Peer of the sibling per-
2641    /// `WitContract` pre-projection accessor family's `const`-eval-
2642    /// surface pass (279823b) and of the outer-`Caixa` slice-return
2643    /// accessor family's parallel pass (231a968) — same "one canonical
2644    /// dispatch per axis, `const`-eval posture pinned at the substrate
2645    /// primitive, thin projections at each consumer" discipline
2646    /// extended onto the outer per-dep-list-entry [`Dep`] altitude.
2647    ///
2648    /// [pin]: tests::dep_outer_accessor_family_is_const_fn
2649    #[must_use]
2650    pub const fn fonte(&self) -> Option<&DepSource> {
2651        self.fonte.as_ref()
2652    }
2653
2654    /// Substrate-canonical per-`:deps` / `:deps-dev` entry
2655    /// `:caracteristicas` Cargo-shaped feature-toggle-set slice accessor
2656    /// every consumer of the dep-graph feature-flag axis keys off —
2657    /// returns the author-declared `:caracteristicas` feature-name list
2658    /// verbatim as a `&[String]` slice-view over the same backing buffer
2659    /// the raw `self.caracteristicas.as_slice()` field access borrows
2660    /// from. Empty-list-carrying (`:caracteristicas` is a default-empty
2661    /// axis every `Dep` supplies with `Vec::new()` when the author omits
2662    /// the slot; the [`crate::Caixa::from_lisp`] derive folds an omitted
2663    /// `:caracteristicas` through `#[serde(default)]` to `Vec::new()`,
2664    /// so a `Dep` past parse definitionally carries a `Vec<String>` slot
2665    /// — possibly empty — and the returned `&[String]` degenerates to
2666    /// an empty slice on that arm without any silent `None` collapse).
2667    ///
2668    /// The `:deps :caracteristicas` / `:deps-dev :caracteristicas` slot
2669    /// carries the set-shaped feature-toggle list the substrate walks
2670    /// through the [`Self::validate_caracteristicas`] per-entry shape +
2671    /// duplicate cascade — same Cargo `[dependencies.<dep>.features]`
2672    /// accept-set (per-entry Cargo-feature-name grammar via the shared
2673    /// [`crate::render::is_cargo_feature_name`] predicate, cross-entry
2674    /// uniqueness via the shared [`crate::render::insert_first_seen`]
2675    /// walk, empty-first / value-shape-second / duplicate-third
2676    /// precedence via the peer per-axis two-arm cascade discipline every
2677    /// substrate-blessed Vec-keyed-by-name slot already follows).
2678    /// Every downstream consumer that fans on the dep's feature-toggle
2679    /// keys off this accessor: [`Self::validate_caracteristicas`]'s
2680    /// per-entry linear walk that gates each feature-name byte-string
2681    /// through the empty / value-shape / duplicate arms (raising the
2682    /// [`DepError::CaracteristicaEmpty`] / [`DepError::CaracteristicaInvalid`]
2683    /// / [`DepError::CaracteristicaDuplicate`] carrier family naming the
2684    /// offending `Dep::nome`), and every future
2685    /// per-`Caixa`-manifest / caixa-resolver / caixa-crd feature-toggle-
2686    /// facing consumer the CAIXA-SDLC §I roadmap acknowledges (the
2687    /// future caixa-resolver per-dep feature-projection walk that folds
2688    /// the toggle set into the resolved [`crate::Caixa`]'s activated
2689    /// [`crate::render::CARGO_FEATURE_NAME_MAX_LEN`]-bounded feature
2690    /// closure ahead of the lacre hash, the future caixa-crd per-`spec.deps`
2691    /// features slice the K8s-CR admission gate consumes, the future
2692    /// per-cluster feature-overlay the M4 lacre-federation resolver
2693    /// composes ahead of the substrate-wide feature-name accept-set).
2694    ///
2695    /// Prior to this lift the `.caracteristicas` byte-string list was
2696    /// read inline at the [`Self::validate_caracteristicas`] `for c in
2697    /// &self.caracteristicas` walk — the only in-crate consumer of the
2698    /// raw field beyond the per-`Dep` constructor pair
2699    /// ([`Self::simple`] / [`Self::git`]) and the paired serde
2700    /// round-trip / per-test fixture-mutation paths — an open-coded
2701    /// field-access that expressed no compile-time link back to the
2702    /// typed slot. A future extension of the `:caracteristicas` axis to
2703    /// a richer author surface (a per-scope feature-overlay the resolver
2704    /// folds through the `~/.config/caixa/config.yaml` entry the
2705    /// [`Dep`] docstring already acknowledges, a per-cluster feature-
2706    /// activation overlay the future M4 lacre-federation layer applies
2707    /// per-CR, a promotion of the plain `Vec<String>` byte-string list
2708    /// to a richer parsed-feature-set newtype once the Cargo-shaped
2709    /// namespaced-dep `dep/feat` syntax the value-shape gate's
2710    /// docstring anticipates lands) would have had to be threaded
2711    /// through every open-coded copy in lockstep or two consumers
2712    /// would silently disagree on which feature closure a given dep
2713    /// activates — the [`Self::validate_caracteristicas`] gate walking
2714    /// the author-declared list while a downstream caixa-resolver
2715    /// consumer walked a per-scope-override-resolved list would
2716    /// silently split the build-time refusal from the lacre closure
2717    /// the substrate's fetch pipeline actually materializes, one
2718    /// build-time diagnostic disagreeing with the run-time closure.
2719    /// Lifting the resolution rule to a typed method on the substrate
2720    /// primitive means every downstream consumer of the caixa's per-
2721    /// `:deps` feature-toggle surface reaches for exactly one typed
2722    /// dispatch — the resolver's accept-set migrates as a unit on any
2723    /// future axis addition.
2724    ///
2725    /// First outer-`Dep` `&[T]`-return slice accessor — opens the
2726    /// outer-`Dep` `&[String]` slice projection pattern the sibling
2727    /// per-`Dep` `:opcional` (`bool` — the plain-`Copy`-scalar axis)
2728    /// future outer scalar lift folds on and closes the outer-`Dep`
2729    /// slot-family the sibling [`Self::nome`] (eba2cde) /
2730    /// [`Self::versao_requirement`] (05529b1) / [`Self::fonte`] (d65d1bf)
2731    /// accessors already open, leaving the `:opcional` `Copy`-scalar arm
2732    /// as the sole remaining unlifted outer-`Dep` slot. Peer of the
2733    /// outer top-level [`crate::Caixa`] `&[String]`-return foreign-code-
2734    /// slot sub-family ([`crate::Caixa::bibliotecas`] 8a36c23,
2735    /// [`crate::Caixa::exe`] 65d9527, [`crate::Caixa::servicos`]
2736    /// 611f78b) and the outer top-level [`crate::Caixa`] universal-axis
2737    /// text-tag family ([`crate::Caixa::autores`] b5d813f,
2738    /// [`crate::Caixa::etiquetas`] 78c7d3c) that already carry the
2739    /// `&[String]` slice-projection discipline on the outer-`Caixa`
2740    /// altitude — extends the "one typed dispatch on the substrate
2741    /// primitive, thin projections at each consumer" discipline onto the
2742    /// outer per-dep-list-entry [`Dep`] altitude's set-shaped byte-
2743    /// string list slot. Returns `&[String]` (not `&Vec<String>`)
2744    /// because every downstream consumer of the feature-toggle list
2745    /// treats it as a read-only sequence — the slice-view is the
2746    /// narrowest borrow that supports every present + roadmapped
2747    /// consumer (`.iter()`, `.len()`, `.is_empty()`) without leaking
2748    /// the backing `Vec`'s grow/push/reserve surface no consumer of
2749    /// the typed view reaches for (the storage-side `Vec` remains
2750    /// reachable through the `pub caracteristicas` field for the
2751    /// mutation-carrying serde round-trip and per-test fixture-mutation
2752    /// paths). Named `caracteristicas()` to match the storage field's
2753    /// name verbatim and the tatara-lisp author-surface term
2754    /// (`:caracteristicas`) the field's own docstring already carries.
2755    ///
2756    /// Declared `pub const fn` — the body projects through
2757    /// `Vec::<String>::as_slice`, const-stable since Rust 1.83 and
2758    /// well within the workspace MSRV, so every downstream `const`-
2759    /// context consumer of the per-`Dep` `:caracteristicas` slice-
2760    /// accessor reaches through the same typed dispatch on the
2761    /// substrate primitive at const-eval time as at runtime. Pinned
2762    /// load-bearing by the paired
2763    /// [`dep_outer_accessor_family_is_const_fn`][pin] wrapper family
2764    /// alongside its sibling [`Self::fonte`] — see [`Self::fonte`] for
2765    /// the full pin-shape rationale.
2766    ///
2767    /// [pin]: tests::dep_outer_accessor_family_is_const_fn
2768    #[must_use]
2769    pub const fn caracteristicas(&self) -> &[String] {
2770        self.caracteristicas.as_slice()
2771    }
2772
2773    /// Substrate-canonical per-`:deps` / `:deps-dev` entry `:opcional`
2774    /// missing-source-tolerance flag scalar accessor every consumer of
2775    /// the dep-graph opt-in-fetch axis keys off — returns the author-
2776    /// declared `:opcional` `bool` verbatim, `Copy`-projected from the
2777    /// typed slot's own `bool` storage (no borrow of `&self` past the
2778    /// call; the `Copy`-return arm matches the peer
2779    /// [`crate::Caixa::max_restarts`] (eba5211) `Option<u32>` `Copy`-
2780    /// projected sibling discipline the outer flat-spread family
2781    /// already carries). Default-`false` (`#[serde(default,
2782    /// skip_serializing_if = "is_false")]` on the storage slot, so a
2783    /// `Dep` past parse definitionally carries a `bool` — `false` when
2784    /// the author omits `:opcional` — and the returned value degenerates
2785    /// to `false` on that arm without any silent `None` collapse).
2786    ///
2787    /// The `:deps :opcional` / `:deps-dev :opcional` slot carries the
2788    /// per-entry "if this dep's `:fonte` cannot be resolved, treat the
2789    /// missing-source arm as a soft-fail rather than a build refusal"
2790    /// bit — the same Cargo-shaped `[dependencies.<dep>.optional = true]`
2791    /// accept-set (an opcional dep whose `:fonte` fails to resolve is
2792    /// dropped from the resolved dep-graph rather than tripping the
2793    /// build-refusal edge that a mandatory `:opcional false` entry
2794    /// would). Every downstream consumer that fans on the dep's
2795    /// missing-source-tolerance keys off this accessor: the future
2796    /// caixa-resolver's per-`:fonte` resolve-fail arm (drop-vs-error
2797    /// dispatch on the opcional bit ahead of the lacre closure
2798    /// materialization), the future caixa-crd per-`spec.deps`
2799    /// `optional` boolean the K8s-CR admission gate consumes on the
2800    /// per-dep partition, and the future feira / caixa-resolver /
2801    /// caixa-crd feature-projection walk that folds the opcional bit
2802    /// into the resolved feature-closure the future M4 lacre-federation
2803    /// layer emits.
2804    ///
2805    /// Prior to this lift the `.opcional` `bool` slot was read inline
2806    /// at the sole in-crate consumer site — the tests-module
2807    /// `registry_dep_is_minimal` fixture's `assert!(!d.opcional)` gate
2808    /// pinning the [`Self::simple`] constructor's default-`false` fill
2809    /// (the only in-crate read of the raw field beyond the per-`Dep`
2810    /// constructor pair [`Self::simple`] / [`Self::git`] and the paired
2811    /// serde round-trip / per-test fixture-mutation paths) — an open-
2812    /// coded field-access that expressed no compile-time link back to
2813    /// the typed slot. A future extension of the `:opcional` axis to a
2814    /// richer author surface (a per-scope opcional-override the resolver
2815    /// folds through the `~/.config/caixa/config.yaml` entry the [`Dep`]
2816    /// docstring already acknowledges, a per-cluster opcional-override
2817    /// the future M4 lacre-federation layer applies per-CR, a promotion
2818    /// of the plain `bool` to a richer `OpcionalPolicy { drop, warn,
2819    /// error }` tri-state once the CAIXA-SDLC §II opcional-policy
2820    /// roadmap lands) would have had to be threaded through every open-
2821    /// coded copy in lockstep or two consumers would silently disagree
2822    /// on which missing-source arm a given dep resolves to — the
2823    /// [`Self::simple`] constructor's default-`false` fill reading
2824    /// verbatim while a downstream caixa-resolver consumer read a per-
2825    /// scope-override-resolved bit would silently split the build-time
2826    /// arm from the lacre closure the substrate's fetch pipeline
2827    /// actually materializes, one build-time diagnostic disagreeing
2828    /// with the run-time closure. Lifting the resolution rule to a
2829    /// typed method on the substrate primitive means every downstream
2830    /// consumer of the caixa's per-`:deps` opcional-tolerance surface
2831    /// reaches for exactly one typed dispatch — the resolver's accept-
2832    /// set migrates as a unit on any future axis addition.
2833    ///
2834    /// Fifth and final outer-`Dep` accessor — closes the outer-`Dep`
2835    /// slot-family the sibling per-`Dep` [`Self::nome`] (eba2cde) /
2836    /// [`Self::versao_requirement`] (05529b1) / [`Self::fonte`] (d65d1bf)
2837    /// / [`Self::caracteristicas`] (9197944) accessors opened, so every
2838    /// outer-`Dep` slot (`:nome`, `:versao`, `:fonte`, `:opcional`,
2839    /// `:caracteristicas`) now routes through exactly one typed
2840    /// dispatch on the substrate primitive. First outer-`Dep`
2841    /// `bool`-return / plain-`Copy`-scalar accessor — opens the
2842    /// outer-`Dep` `Copy`-scalar projection pattern that folds on the
2843    /// peer outer-top-level [`crate::Caixa`] `Option<Copy>`
2844    /// flat-spread sub-family ([`crate::Caixa::max_restarts`] eba5211,
2845    /// [`crate::Caixa::estrategia`] ed04d3c) the outer-`Caixa` altitude
2846    /// already carries — extends the "one typed dispatch on the
2847    /// substrate primitive, thin projections at each consumer"
2848    /// discipline onto the outer per-dep-list-entry [`Dep`] altitude's
2849    /// bool-shaped missing-source-tolerance slot. Returns `bool` by
2850    /// `Copy` (not by `&bool` reference) because `bool` is `Copy` and
2851    /// every downstream consumer treats it as a plain discriminant
2852    /// value — the by-value return is the narrowest return-shape that
2853    /// supports every present + roadmapped consumer (`.then(…)` early
2854    /// return on the resolver-side drop-vs-error partition, direct
2855    /// bool composition with a per-scope-override projector, plain
2856    /// `if dep.opcional() { … }` early return at every future admission
2857    /// gate) without leaking the storage field's `bool`-in-`&self`
2858    /// lifetime the by-value return elides. Marked `pub const fn` so
2859    /// the accessor is `const`-callable — same discipline the peer
2860    /// [`crate::Caixa::max_restarts`] `Option<u32>` `Copy`-return
2861    /// accessor carries. Named `opcional()` to match the storage
2862    /// field's name verbatim and the tatara-lisp author-surface term
2863    /// (`:opcional`) the field's own docstring already carries.
2864    #[must_use]
2865    pub const fn opcional(&self) -> bool {
2866        self.opcional
2867    }
2868
2869    /// Build a minimal registry-sourced dep.
2870    #[must_use]
2871    pub fn simple(nome: impl Into<String>, versao: impl Into<String>) -> Self {
2872        Self {
2873            nome: nome.into(),
2874            versao: versao.into(),
2875            fonte: None,
2876            opcional: false,
2877            caracteristicas: Vec::new(),
2878        }
2879    }
2880
2881    /// Build a Git-sourced dep (tag-based).
2882    #[must_use]
2883    pub fn git(
2884        nome: impl Into<String>,
2885        versao: impl Into<String>,
2886        repo: impl Into<String>,
2887        tag: impl Into<String>,
2888    ) -> Self {
2889        Self {
2890            nome: nome.into(),
2891            versao: versao.into(),
2892            fonte: Some(DepSource::Git {
2893                repo: repo.into(),
2894                tag: Some(tag.into()),
2895                rev: None,
2896                branch: None,
2897            }),
2898            opcional: false,
2899            caracteristicas: Vec::new(),
2900        }
2901    }
2902
2903    /// Reject dependency entries whose `:nome` or `:versao` are empty,
2904    /// whose `:nome` is non-empty but not a valid DNS-1123 label,
2905    /// or whose `:versao` is non-empty but not a valid Cargo-shaped
2906    /// semver requirement.
2907    ///
2908    /// The author surface for `:deps :versao` (and `:deps-dev :versao`)
2909    /// is the same Cargo-shaped requirement string `:membros :versao`
2910    /// (validated at [`crate::AplicacaoSpec::validate`] since 9888b13)
2911    /// and `:children :versao` (validated at
2912    /// [`crate::SupervisorSpec::validate`] since b38ff3a) carry — and
2913    /// the lacre pipeline resolves all three axes through the same
2914    /// [`crate::parse_requirement`] entry-point. Until 2420c44 landed
2915    /// `:deps :versao` was the last `:versao` axis untyped past
2916    /// `Caixa::from_lisp`: a malformed-but-non-empty requirement
2917    /// (`"^bad-version"`, `"^^0.1"`, the canonical git-tag-shape-
2918    /// leaking-into-:versao `"v0.1"` typo, the accidental
2919    /// `"not-a-req"`) silently passed parse and the `semver::Error`
2920    /// surfaced at lacre-resolve time, far from the source
2921    /// caixa.lisp, with no field naming which `:deps` entry carried
2922    /// the typo. The diagnostic [`DepError::VersaoInvalid`] carries
2923    /// the offending entry's `:nome` + the offending `:versao`
2924    /// verbatim + the parser's own wording in `reason`, so the
2925    /// author's grep target is unambiguous.
2926    ///
2927    /// The author surface for `:deps :nome` is the same DNS-1123 label
2928    /// the peer caixa-identifier axes carry — top-level Caixa `:nome`
2929    /// (validated at [`crate::Caixa::validate_nome`] since 6c992f8),
2930    /// `:membros :caixa` (validated at
2931    /// [`crate::AplicacaoSpec::validate_membros`] since 3f9d7a0),
2932    /// `:children :caixa` (validated at
2933    /// [`crate::SupervisorSpec::validate`] since 31bfa43). A `:deps
2934    /// :nome` value flows verbatim through the lacre pipeline as the
2935    /// target caixa's `:nome` (which the gate at the *target* side now
2936    /// rejects if non-DNS-1123) and lands as the rendered caixa's
2937    /// `lareira-<nome>` Helm chart name segment, the per-dep
2938    /// `LABEL_PROGRAM` label value, and the `caixa-resolver`'s
2939    /// `~/.cache/caixa/<org>/<nome>` checkout-directory leaf. Until
2940    /// this gate landed `:deps :nome` was the fourth and last
2941    /// DNS-1123-shaped caixa-identifier axis still untyped past
2942    /// `Caixa::from_lisp`: a syntactically wrong dep name (`"Caixa-
2943    /// Teia"` uppercase — the canonical "I copied the README header"
2944    /// typo; `"caixa_teia"` underscore — the Go module / Python
2945    /// identifier leak; `"caixa-teia."` trailing dot — the FQDN
2946    /// confusion; `"-caixa-teia"` leading hyphen; a 64-byte slug)
2947    /// silently passed parse and surfaced at lacre-resolve time when
2948    /// the resolved target caixa's `:nome` failed *its* DNS-1123 gate
2949    /// — far from the source `:deps` entry, with a diagnostic naming
2950    /// the *target's* `:nome` rather than the dep entry that referenced
2951    /// it. Mirroring the 3f9d7a0 / 31bfa43 / 6c992f8 trajectory through
2952    /// the lifted [`crate::render::is_dns_1123_label`] predicate (the
2953    /// "before its third occurrence" PRIME DIRECTIVE boundary, THEORY.md
2954    /// §I.3.5): every `Dep::nome` past validate is DNS-1123-label-shaped,
2955    /// so every downstream consumer (caixa-resolver's lacre fetch,
2956    /// caixa-helm's `lareira-<nome>` chart name, the future M4 per-dep
2957    /// fan-out emitter) reaches for the name knowing the value is
2958    /// apiserver-valid without re-validating.
2959    ///
2960    /// Empty checks fire first (narrower diagnostic), parse last —
2961    /// same ordering discipline as
2962    /// [`crate::AplicacaoSpec::validate_membros`] and
2963    /// [`crate::SupervisorSpec::validate`]. `parse_requirement("")`
2964    /// returns `Ok(VersionReq::STAR)`, so the empty-`:versao` arm is
2965    /// structurally necessary even with the parse arm in place. The
2966    /// `:nome` shape gate runs after the `:nome` empty gate and before
2967    /// the `:versao` checks so a one-entry caixa.lisp with both wrong
2968    /// sees the name-side diagnostic first (the name is the
2969    /// self-locating axis — without it, the parse diagnostic can't
2970    /// quote `:nome "<bad>"`).
2971    pub fn validate(&self) -> Result<(), DepError> {
2972        if self.nome.is_empty() {
2973            return Err(DepError::NomeEmpty);
2974        }
2975        if let Err(reason) = crate::render::is_dns_1123_label(&self.nome) {
2976            return Err(DepError::nome_invalid(&self.nome, reason));
2977        }
2978        // Delegate the empty-first + `parse_requirement` cascade to the
2979        // shared [`crate::render::require_valid_versao_requirement`]
2980        // helper — same two-arm shape the peer
2981        // [`crate::AplicacaoSpec::validate_membros`] on `:membros
2982        // :versao` and [`crate::SupervisorSpec::validate`] on `:children
2983        // :versao` route through, so drift between the three axes'
2984        // accepted requirement sets is structurally impossible and the
2985        // parse-side no-op the empty-first arm closes (semver's empty
2986        // parse yields an implicit `*`) lives in exactly one predicate.
2987        crate::render::require_valid_versao_requirement(
2988            self.versao_requirement(),
2989            || DepError::versao_empty(&self.nome),
2990            |reason| DepError::versao_invalid(&self.nome, self.versao_requirement(), reason),
2991        )?;
2992        if let Some(fonte) = self.fonte() {
2993            fonte.validate(&self.nome)?;
2994        }
2995        self.validate_caracteristicas()?;
2996        Ok(())
2997    }
2998
2999    /// Reject per-entry `:caracteristicas` (feature-flag) values that
3000    /// are operationally meaningless. The `:caracteristicas` slot is
3001    /// a set of feature toggles to enable on the target caixa — same
3002    /// shape as Cargo's `[dependencies.<dep>.features]` list — and
3003    /// two structural footguns close here:
3004    ///
3005    ///   - empty-string entry (`(:caracteristicas (""))`): the future
3006    ///     caixa-resolver lacre pipeline would consume the empty
3007    ///     identifier as a no-op feature enable, silently dropping the
3008    ///     author's intent far from the source `caixa.lisp`;
3009    ///   - duplicate entry within one dep (`(:caracteristicas ("http"
3010    ///     "http"))`): the feature-toggle slot is set-shaped (enabling
3011    ///     a feature twice has no additional semantic — there is no
3012    ///     `feature × 2`), so two entries naming the same feature are
3013    ///     a silent miscount, the same set-not-multiset distinction
3014    ///     every peer Vec-keyed-by-name axis already closes
3015    ///     ([`crate::SupervisorError::DuplicateChildCaixa`] on
3016    ///     `:children :caixa`, [`crate::AplicacaoError::MembroDuplicate`]
3017    ///     on `:membros :caixa`, [`crate::AplicacaoError::ContratoDuplicate`]
3018    ///     on `:contratos`, [`crate::AplicacaoError::PlacementClusterDuplicate`]
3019    ///     on `:placement :clusters`, [`crate::AplicacaoError::EntradaPathDuplicate`]
3020    ///     on `:entrada :paths`, [`crate::UpgradeError::DuplicateFrom`]
3021    ///     on `:upgrade-from :from`, [`crate::UpgradeError::DuplicateLoadModule`]
3022    ///     / [`crate::UpgradeError::DuplicateStateChange`] /
3023    ///     [`crate::UpgradeError::DuplicateCleanup`] on the within-
3024    ///     entry `:upgrade-from` axes, and [`DepError::DuplicateNome`]
3025    ///     on the cross-entry `:deps`/`:deps-dev` `:nome` axis the
3026    ///     immediate-predecessor 359fba5 closed).
3027    ///
3028    /// Same linear-walk + `HashSet` + first-collision diagnostic shape
3029    /// every peer set-not-multiset gate uses; the empty arm fires
3030    /// before the duplicate arm so an entry with both an empty feature
3031    /// *and* a duplicate of some later feature surfaces the empty-
3032    /// shape diagnostic first (the empty-feature axis is the
3033    /// more-actionable defect since the missing-name renders the
3034    /// duplicate-key arm ambiguous: two `""` entries would both report
3035    /// `caracteristica: ""` with no way to distinguish the offending
3036    /// site). Empty-first cascade discipline mirrors every peer per-
3037    /// entry shape + duplicate gate
3038    /// (`SupervisorSpec::validate`'s `EmptyChildName` before
3039    /// `DuplicateChildCaixa`; `validate_membros`'s `MembroCaixaEmpty`
3040    /// before `MembroDuplicate`).
3041    ///
3042    /// The per-entry value-shape gate (Cargo-feature-name grammar via
3043    /// the lifted [`crate::render::is_cargo_feature_name`] predicate)
3044    /// fires between the empty arm and the duplicate arm — the
3045    /// canonical per-entry-shape-before-cross-entry-uniqueness
3046    /// precedence every peer two-arm + value-shape gate establishes
3047    /// ([`crate::SupervisorSpec::validate`]'s `EmptyChildName` →
3048    /// `ChildCaixaInvalid` → `DuplicateChildCaixa`,
3049    /// [`crate::AplicacaoSpec::validate_membros`]'s `MembroCaixaEmpty`
3050    /// → `MembroCaixaInvalid` → `MembroDuplicate`, [`Dep::validate`]'s
3051    /// `NomeEmpty` → `NomeInvalid` → cross-list `DuplicateNome`).
3052    /// Until the value-shape arm landed `:caracteristicas` accepted
3053    /// every non-empty distinct string — a structurally invalid
3054    /// feature name (`"http feature"` whitespace, `"+http"` the
3055    /// canonical paste-from-`+optional-feature` doc activation-form
3056    /// footgun, `"-flag"` leading hyphen, `".feat"` leading dot,
3057    /// `"http/json"` Cargo's `dep/feat` namespaced-dep syntax that
3058    /// only applies inside list-grammar contexts, `"http,json"`
3059    /// list-separator-belongs-to-the-list-grammar miscomprehension,
3060    /// `"café"` un-percent-encoded non-ASCII silently round-tripping
3061    /// inconsistently across NFC/NFD normalization, the 65-byte
3062    /// paste-from-binary slug) silently passed validate and the
3063    /// failure surfaced at `cargo metadata` time as the
3064    /// `restricted_names::validate_feature_name` parser's rejection,
3065    /// far from the source `caixa.lisp`, with no field naming which
3066    /// `:deps` entry's `:caracteristicas` carried the typo. The
3067    /// lifted predicate makes the Cargo-feature-name-grammar
3068    /// intersection-floor a substrate-level invariant at validate
3069    /// time — same trajectory as the eight peer
3070    /// [`crate::render`] value-shape predicates each typed surface
3071    /// downstream of a structured grammar already follows
3072    /// ([`is_dns_1123_label`](crate::render::is_dns_1123_label),
3073    /// [`is_gateway_api_http_path`](crate::render::is_gateway_api_http_path),
3074    /// [`is_wit_world_ref`](crate::render::is_wit_world_ref),
3075    /// [`is_nats_subject`](crate::render::is_nats_subject),
3076    /// [`is_wasi_keyvalue_slot`](crate::render::is_wasi_keyvalue_slot),
3077    /// [`is_git_ref_name`](crate::render::is_git_ref_name),
3078    /// [`is_git_oid`](crate::render::is_git_oid),
3079    /// [`is_git_repo_url`](crate::render::is_git_repo_url)).
3080    fn validate_caracteristicas(&self) -> Result<(), DepError> {
3081        let mut seen = std::collections::HashSet::new();
3082        for c in self.caracteristicas() {
3083            if c.is_empty() {
3084                return Err(DepError::caracteristica_empty(&self.nome));
3085            }
3086            if let Err(reason) = crate::render::is_cargo_feature_name(c) {
3087                return Err(DepError::caracteristica_invalid(&self.nome, c, reason));
3088            }
3089            crate::render::insert_first_seen(&mut seen, c.as_str(), || {
3090                DepError::caracteristica_duplicate(&self.nome, c)
3091            })?;
3092        }
3093        Ok(())
3094    }
3095}
3096
3097/// Cross-slot coherence gate on the dep-graph axis: no `:deps` or
3098/// `:deps-dev` entry may name the caixa's own `:nome`.
3099///
3100/// A caixa that lists itself as a dep is a degenerate self-edge in the
3101/// lacre closure's dep-graph — the closure is a DAG rooted at the
3102/// caixa's `:nome`, and the caixa-resolver's lacre pipeline traverses
3103/// every `:deps` / `:deps-dev` entry's target by name. A self-dep
3104/// hands the resolver a node that is its own parent: a one-node cycle
3105/// it either rejects mid-traversal far from the source `caixa.lisp`
3106/// (the resolver detecting infinite recursion on the closure walk) or,
3107/// worse, recurses on until it exhausts its stack. Because every
3108/// `:nome` is a globally-unique substrate identity (DNS-1123 label +
3109/// lacre closure root), a dep entry whose `:nome` equals the caixa's
3110/// own `:nome` *is* the caixa itself, not a coincidentally-named peer.
3111///
3112/// Lives outside [`Caixa::validate_deps`] because the dep-list view
3113/// carries the entries but not the parent `:nome`; mirrors the
3114/// cross-slot self-edge gates [`crate::supervisor::validate_no_self_supervision`]
3115/// (ad4abf1) on the `:children :caixa` axis and
3116/// [`crate::aplicacao::validate_no_self_membership`] on the
3117/// `:membros :caixa` axis — the same "an edge from a graph node to
3118/// itself is structurally not a tree/graph edge" discipline, here on
3119/// the third typed-name-graph axis (the dep closure; the supervision
3120/// tree and the Aplicacao membership set were the prior two).
3121///
3122/// Walks `:deps` first then `:deps-dev` so the diagnostic for a caixa
3123/// that self-references on both axes surfaces the `:deps` arm first —
3124/// the load-bearing axis the lacre closure resolves at every build,
3125/// peer with the canonical [`Caixa::validate_deps`] walk order
3126/// (`:deps` → `:deps-dev`).
3127///
3128/// Carries the offending list tag (`":deps"` or `":deps-dev"`)
3129/// verbatim into the diagnostic so the author can grep their
3130/// `caixa.lisp` for the offending block in one edit — same
3131/// `list: &'static str` shape [`DepError::DuplicateNome`] (359fba5)
3132/// uses on the cross-list duplicate-name axis.
3133///
3134/// `Code paths` (`:bibliotecas` / `:exe` / `:servicos`) are the
3135/// substrate-blessed shape for referencing the caixa's *own* code, so
3136/// the diagnostic names them as the corrective surface — every
3137/// legitimate "I want to use code from this caixa" authoring intent
3138/// routes through one of those three slots, not a self-dep.
3139pub fn validate_no_self_dep(
3140    deps: &[Dep],
3141    deps_dev: &[Dep],
3142    parent_nome: &str,
3143) -> Result<(), DepError> {
3144    for dep in deps {
3145        if dep.nome() == parent_nome {
3146            return Err(DepError::dep_is_self(
3147                parent_nome,
3148                crate::render::DEP_AUTHOR_KEY_DEPS,
3149            ));
3150        }
3151    }
3152    for dep in deps_dev {
3153        if dep.nome() == parent_nome {
3154            return Err(DepError::dep_is_self(
3155                parent_nome,
3156                crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
3157            ));
3158        }
3159    }
3160    Ok(())
3161}
3162
3163/// Closed-set typed enum for the two dep-list author-surface axes every
3164/// top-level [`crate::Caixa`] carries — the runtime-closure `:deps` slot
3165/// (`Prod`) and the dev-only-closure `:deps-dev` slot (`Dev`). Every
3166/// substrate consumer that dispatches on "which of the two dep-lists"
3167/// (the `feira add` mutation head, the future per-cluster dev-closure-
3168/// audit overlay the M4 CR materializer resolves per-CR, the future
3169/// `caixa app graph` per-list dep summary, every future
3170/// `Caixa::push_dep` / `Caixa::deps_by_list` typed-method dispatch a
3171/// caller reaches for) reads through this enum rather than through a
3172/// bare `&'static str` — the closed-set is expressed at the type layer,
3173/// so a future third dep-list axis (a `:deps-build` build-only closure
3174/// once the substrate grows cross-artifact heterogeneous dep-graphs,
3175/// per CAIXA-SDLC §I) is one variant plus one arm per method and the
3176/// compiler enforces exhaustiveness on every consumer's `match` arms.
3177///
3178/// The wire byte-string [`Self::as_str`] returns is the same author-
3179/// surface tag the sibling [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3180/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] constants carry — the
3181/// [`DepError::DuplicateNome`] / [`DepError::DepIsSelf`] `list:
3182/// &'static str` payload family the substrate already emits routes
3183/// through the same source of truth (an author reading a
3184/// [`DepError::DuplicateNome`] refusal can grep their `caixa.lisp`
3185/// for the offending `:deps` / `:deps-dev` block in one edit whether
3186/// the diagnostic came from a `Caixa::validate_deps` walk or a
3187/// `Caixa::push_dep` mutation).
3188///
3189/// Same "closed-set typed-enum discriminator with canonical
3190/// projections per axis" discipline the sibling closed-set typed enums
3191/// on the caixa typed surface carry
3192/// ([`crate::aplicacao::PlacementStrategy`] cc8f749,
3193/// [`crate::aplicacao::RateLimitUnit`] 6bce03d,
3194/// [`crate::supervisor::RestartStrategy`],
3195/// [`crate::supervisor::RestartPolicy`],
3196/// [`crate::upgrade::UpgradeInstruction`], [`crate::CaixaKind`])
3197/// — extended onto the outer-`Caixa` two-list dep-graph axis, the
3198/// substrate's last unlifted closed-set-shaped `&'static str`-carrying
3199/// axis on the top-level manifest surface.
3200#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, gen_platform::IsVariant)]
3201pub enum DepList {
3202    /// Runtime-closure `:deps` axis — the load-bearing dep-list the
3203    /// lacre closure resolves at every build. Wire-format
3204    /// [`crate::render::DEP_AUTHOR_KEY_DEPS`].
3205    Prod,
3206    /// Dev-only-closure `:deps-dev` axis — Cargo's `[dev-dependencies]`
3207    /// table's dev-time-only visibility contract per CAIXA-SDLC §I.
3208    /// Wire-format [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`].
3209    Dev,
3210}
3211
3212impl DepList {
3213    /// Exhaustive iteration surface for every consumer that reads the
3214    /// full closed-set (the future M4 admission webhook's per-list
3215    /// summary rejection body, any future round-trip pin harness). A
3216    /// future variant addition extends this slice as a single edit and
3217    /// every consumer picks up the new entry by construction — the
3218    /// compiler-checked exhaustiveness on the sibling method `match`
3219    /// arms is the build-time guarantee that no arm forgets to grow.
3220    pub const ALL: &'static [Self] = &[Self::Prod, Self::Dev];
3221
3222    /// Substrate-canonical exhaustive accept-set on the [`DepList`]
3223    /// `:`-prefixed kebab-case tatara-lisp author-surface key axis —
3224    /// the closed two-arm roster of every byte-string [`Self::as_str`]
3225    /// returns, routed byte-for-byte through the paired
3226    /// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3227    /// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] lifted `pub const`
3228    /// scalars the [`Self::as_str`] emitter (and the
3229    /// [`std::fmt::Display`] / [`AsRef<str>`] / `From<{Self,&Self}> for
3230    /// {&'static str, String, Cow<'static, str>, Box<str>, Arc<str>}`
3231    /// trait triple + quintuple routed through it) walks, and the same
3232    /// two strings the paired [`Self::from_wire`] reverse projection
3233    /// accepts.
3234    ///
3235    /// Peer of the sibling [`crate::CaixaKind::WIRE_NAMES`] (bd708bd) /
3236    /// [`crate::supervisor::RestartStrategy::WIRE_NAMES`] (3033f45) /
3237    /// [`crate::supervisor::RestartPolicy::WIRE_NAMES`] (ce9412b) /
3238    /// [`crate::aplicacao::PlacementStrategy::WIRE_NAMES`] (3e5b194)
3239    /// rosters on the `PascalCase` wire byte-string axis, the sibling
3240    /// [`crate::CaixaKind::LABELS`] (427fe75) /
3241    /// [`crate::aplicacao::WitShape::LABELS`] (9d9f585) rosters on the
3242    /// lowercase kebab census-label byte-string axis, the sibling
3243    /// [`crate::aplicacao::RateLimitUnit::SUFFIXES`] (b553ec9) roster
3244    /// on the single-char canonical-suffix axis, and the sibling
3245    /// [`crate::upgrade::UpgradeInstruction::LISP_FORMS`] (1898d77) /
3246    /// [`crate::upgrade::UpgradeInstruction::WIRE_FORMS`] (cc42c0e)
3247    /// rosters on the OTP-appup discriminator's two-axis roster split
3248    /// — the same closed-set exhaustive-accept-set roster discipline
3249    /// extended here onto the outer-`Caixa` two-list dep-graph
3250    /// closed-set typed enum, the ninth substrate-side closed-set
3251    /// typed enum on the roster-discipline axis and the last unlifted
3252    /// `&'static str`-carrying closed-set typed enum on the top-level
3253    /// manifest surface (the sibling `AsRef<str>` doc block at
3254    /// [`AsRef<str>`] already names the two-list dep-graph as "the
3255    /// seventh (and last unlifted) closed-set typed enum on the caixa
3256    /// surface" for the trait-idiomatic projection family — the same
3257    /// closure applies here on the exhaustive-roster family).
3258    ///
3259    /// Downstream consumers of the closed accepted-key set — a future
3260    /// `feira dep --list <deps|deps-dev>` CLI arg-parse's "did you
3261    /// mean" hint that scans this slice rather than open-coding a
3262    /// two-string array literal, a future M4
3263    /// `mesh.pleme.io/v1alpha1/Caixa` CR admission-webhook rejection
3264    /// body enumerating the accepted `:deps` / `:deps-dev` author-
3265    /// surface keys verbatim on an unknown-key miss, a future
3266    /// `feira dep census` per-Caixa `:deps` / `:deps-dev` histogram
3267    /// column that walks the roster to render every arm's tally
3268    /// (including zero-count arms — a hand-rolled projection off
3269    /// [`Self::ALL`] alone would need a companion per-variant-to-key
3270    /// map at every consumer; this roster closes the two-axis walk in
3271    /// one lifted const), any future K8s CRD generation tool that
3272    /// emits the accepted-key enum on the Caixa CR schema, a future
3273    /// [`DepError`] widening that promotes the two `list: &'static
3274    /// str` fields to a typed `list: DepList` carry so downstream
3275    /// consumers dispatch on the enum rather than string-comparing
3276    /// the wire scalar — every consumer that wants to enumerate the
3277    /// closed dep-list author-key set outside caixa-core now reaches
3278    /// for one lifted substrate-primitive roster rather than open-
3279    /// coding a `[":deps", ":deps-dev"]` array-literal whose arm-set
3280    /// has no compile-time link back to the typed [`DepList`] enum.
3281    /// A future arm addition (a `:build-dep` third list once the
3282    /// substrate grows Cargo-style split-graphs, a `:tool-dep` for
3283    /// build-time-only tooling per the peer Cargo
3284    /// `[build-dependencies]` / `[target.<cfg>.dev-dependencies]`
3285    /// future admission surface — both trajectory items the sibling
3286    /// [`Self::from_wire`] doc block already names) extends this
3287    /// roster as a single edit — paired with the [`Self::as_str`]
3288    /// match's compiler-checked exhaustiveness on the new arm — and
3289    /// every consumer picks up the new key by construction rather
3290    /// than a coordinated array-literal rewrite across every
3291    /// downstream site.
3292    ///
3293    /// Length is pinned load-bearing at `DepList::ALL.len()` (two) by
3294    /// [`tests::dep_list_author_keys_covers_every_arm`], every
3295    /// variant's [`Self::as_str`] projection is pinned to a member of
3296    /// the roster on every arm so a silent skew between the emitter's
3297    /// arm-set and this const's arm-set trips at caixa-core test time
3298    /// rather than at a downstream consumer's accepted-set enumeration
3299    /// miss, and every entry is further pinned to open with the ASCII
3300    /// `:` byte (the tatara-lisp author-surface keyword marker) so a
3301    /// silent collapse with any hypothetical peer un-prefixed wire-form
3302    /// axis (an entry byte-identical to a sibling `deps` / `deps-dev`
3303    /// bare-kebab byte-string that would let an author-key-axis
3304    /// consumer accept the un-prefixed vocabulary) trips here rather
3305    /// than at a downstream K8s-CR round-trip miss.
3306    pub const AUTHOR_KEYS: &'static [&'static str] = &[
3307        crate::render::DEP_AUTHOR_KEY_DEPS,
3308        crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
3309    ];
3310
3311    /// Canonical author-surface tag every substrate consumer that
3312    /// names the offending dep-list in a diagnostic reaches for —
3313    /// [`crate::render::DEP_AUTHOR_KEY_DEPS`] for [`Self::Prod`] and
3314    /// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] for [`Self::Dev`],
3315    /// the same `&'static str` payload the sibling
3316    /// [`DepError::DuplicateNome`] and [`DepError::DepIsSelf`] variants
3317    /// already carry. Routing every dep-list diagnostic through the
3318    /// closed-set enum's `as_str` closes the last `&'static str`-shape
3319    /// literal-carry axis on the two-list dep-graph surface — a
3320    /// future kebab-case rebrand (`":deps"` → `":packages"`) or a
3321    /// wire-format promotion (a distinct diagnostic form for the
3322    /// `Dev` arm) reaches every consumer through one edit on the
3323    /// canonical constant, not a coordinated rewrite across the
3324    /// substrate's dep-graph consumers.
3325    #[must_use]
3326    pub const fn as_str(self) -> &'static str {
3327        match self {
3328            Self::Prod => crate::render::DEP_AUTHOR_KEY_DEPS,
3329            Self::Dev => crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
3330        }
3331    }
3332
3333    /// Substrate-canonical reverse projection on the two-list dep-graph
3334    /// axis — parses the author-surface wire tag back to the typed
3335    /// variant, or `None` when `s` is outside the closed-set arm-string
3336    /// set [`Self::as_str`] emits. Dispatches on the same lifted
3337    /// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3338    /// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] constants the
3339    /// [`Self::as_str`] emitter walks, so the parse and emit halves of
3340    /// the round-trip migrate through one caixa-core edit on any future
3341    /// list-axis addition.
3342    ///
3343    /// Prior to this lift the substrate carried only the forward
3344    /// `Self → &str` projection on the two-list dep-graph axis (the
3345    /// [`Self::as_str`] emitter, the [`std::fmt::Display`] impl routed
3346    /// through it, the two [`DepError::DuplicateNome`] /
3347    /// [`DepError::DepIsSelf`] variants that carry the wire tag verbatim
3348    /// as a `&'static str` `list:` field). Every future consumer that
3349    /// wanted to promote the wire tag back to the typed enum (a future
3350    /// `feira dep --list <deps|deps-dev>` CLI arg-parse that binds the
3351    /// wire form into the typed enum before dispatching to
3352    /// [`crate::Caixa::deps_of`] / [`crate::Caixa::push_dep`], the M4
3353    /// `mesh.pleme.io/v1alpha1/Caixa` CR materializer's admission-time
3354    /// wire re-parse of the per-list diagnostic body, a future
3355    /// [`DepError`] widening that promotes the two `list: &'static str`
3356    /// fields to a typed `list: DepList` carry so downstream consumers
3357    /// dispatch on the enum rather than string-comparing the wire
3358    /// scalar) would have had to re-inline a two-arm `match s { ":deps"
3359    /// => …, ":deps-dev" => …, _ => … }` cascade that expressed no
3360    /// compile-time link back to the typed [`DepList`] enum. A future
3361    /// variant addition (a `:build-dep` or `:test-dep` third list once
3362    /// the substrate grows Cargo-style split-graphs, a `:tool-dep` for
3363    /// build-time-only tooling per the peer Cargo `[build-dependencies]`
3364    /// / `[target.<cfg>.dev-dependencies]` future admission surface)
3365    /// would silently split the wire byte-string the emitter walks from
3366    /// the parser's arm-set — the round-trip would carry the new list
3367    /// through the forward projection but land on the fallback silently
3368    /// at every non-updated reverse parser, far from the arm-addition
3369    /// commit that caused the drift. Lifting the resolver to a typed
3370    /// method on the substrate primitive closes the drift footgun by
3371    /// construction: the parser's accept-set is the same set the
3372    /// [`Self::as_str`] emitter walks (routed through the same lifted
3373    /// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3374    /// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] consts), so both halves
3375    /// of the round-trip migrate through one caixa-core edit on any
3376    /// future list-axis addition.
3377    ///
3378    /// Same closed-set-reverse-projection discipline the sibling
3379    /// [`crate::CaixaKind::from_wire`] (2aa6d23) /
3380    /// [`crate::supervisor::RestartStrategy::from_wire`] (4eec29c) /
3381    /// [`crate::supervisor::RestartPolicy::from_wire`] (dd32ccf) /
3382    /// [`crate::aplicacao::PlacementStrategy::from_wire`] (18c7342) /
3383    /// [`crate::aplicacao::RateLimitUnit::from_suffix`] typed enums
3384    /// carry on the peer wire-side `str → Self` axes — extended onto
3385    /// the two-list dep-graph closed-set axis, the sixth substrate-side
3386    /// closed-set typed enum on the caixa surface to converge on the
3387    /// two-way `str ↔ Self` round-trip. Method-named `from_wire` (not
3388    /// `from_str`) to match the peer shapes verbatim and side-step the
3389    /// derived [`std::str::FromStr`] impls the sibling
3390    /// [`gen_platform::FromStrKind`]-carrying axes install on their
3391    /// kebab-case dispatcher-catalog identity. Returns `Option<Self>`
3392    /// (rather than `Result<Self, _>`) to match the peer shapes: the
3393    /// caller picks the diagnostic form appropriate for its use site —
3394    /// a future `feira dep --list …` arg-parse that surfaces
3395    /// `unknown list: <arg>` at the CLI builds one on top by iterating
3396    /// [`Self::ALL`], while the future M4 admission-webhook's rejection
3397    /// path folds `None` onto its per-CR structured refusal body.
3398    #[must_use]
3399    pub fn from_wire(s: &str) -> Option<Self> {
3400        match s {
3401            crate::render::DEP_AUTHOR_KEY_DEPS => Some(Self::Prod),
3402            crate::render::DEP_AUTHOR_KEY_DEPS_DEV => Some(Self::Dev),
3403            _ => None,
3404        }
3405    }
3406}
3407
3408/// Route [`std::fmt::Display`] through [`DepList::as_str`], so every
3409/// consumer that formats the axis as user-facing text (a future
3410/// `feira app graph` per-list summary, a future M4 admission-webhook
3411/// rejection body naming the offending list, this crate's own
3412/// [`DepError`] `#[error(...)]` templates when they widen to carry a
3413/// typed [`DepList`]) lands on the same author-surface tag the
3414/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3415/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] constants carry. Same
3416/// as-str-through-Display convergence discipline the sibling
3417/// [`crate::aplicacao::PlacementStrategy`],
3418/// [`crate::aplicacao::RateLimitUnit`],
3419/// [`crate::supervisor::RestartStrategy`],
3420/// [`crate::supervisor::RestartPolicy`], and [`crate::CaixaKind`]
3421/// closed-set typed enums carry.
3422impl std::fmt::Display for DepList {
3423    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3424        f.write_str(self.as_str())
3425    }
3426}
3427
3428/// Substrate-canonical [`AsRef<str>`] projection on the two-list
3429/// dep-graph closed-set typed enum — routes through the same
3430/// [`DepList::as_str`] `pub const fn` scalar accessor the paired
3431/// [`std::fmt::Display`] impl already delegates through, so any future
3432/// consumer that binds a [`DepList`] through the standard-library
3433/// `impl AsRef<str>` bound (a [`std::process::Command::arg`] shell-out
3434/// that composes the canonical author-surface tag into a
3435/// `feira dep --list <deps|deps-dev>` diagnostic overlay, a
3436/// `tracing::field::Value::Str`-arm structured-log recorder on the
3437/// [`DepError::DuplicateNome`] / [`DepError::DepIsSelf`] refusal paths,
3438/// a [`std::collections::HashMap`] lookup keyed on the canonical tag
3439/// through `map.get::<str>(list.as_ref())` on a future M4 admission-
3440/// webhook's per-list rejection-body composition table) reaches the
3441/// paired [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3442/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-string through one
3443/// substrate-primitive dispatch rather than an open-coded `.as_str()`
3444/// re-inlining at every wire-up.
3445///
3446/// Same "route the trait impl through the substrate-primitive
3447/// accessor" discipline the sibling [`crate::CaixaDialeto`]
3448/// [`AsRef<str>`] impl (1723611), the [`crate::aplicacao::RateLimitUnit`]
3449/// [`AsRef<str>`] impl (d8136db), the [`crate::CaixaKind`]
3450/// [`AsRef<str>`] impl (cd2091f), the M3
3451/// [`crate::aplicacao::PlacementStrategy`] [`AsRef<str>`] impl
3452/// (d86edd2), the M2 [`crate::supervisor::RestartPolicy`]
3453/// [`AsRef<str>`] impl (419ea81), the M2
3454/// [`crate::supervisor::RestartStrategy`] [`AsRef<str>`] impl
3455/// (63eb1a4), and the [`crate::CaixaVersion`] [`AsRef<str>`] impl
3456/// (16d5c7e) carry — closes the substrate primitive's
3457/// [`AsRef<str>`] projection axis on the seventh (and last unlifted)
3458/// closed-set typed enum on the caixa surface: the two-list dep-graph
3459/// axis previously carried [`fmt::Display`]-through-`as_str` but not
3460/// yet the paired [`AsRef<str>`] impl, so a downstream consumer that
3461/// bound the enum through the standard-library `AsRef<str>` trait had
3462/// to reach the canonical byte-string through an open-coded
3463/// `.as_str()` call rather than the trait-idiomatic `.as_ref()` the
3464/// peer closed-set typed enums already admit.
3465///
3466/// Pinned load-bearing by
3467/// [`tests::dep_list_as_ref_str_routes_through_as_str_accessor`]
3468/// (byte-parity pin against [`DepList::as_str`] across the two-arm
3469/// closed set) and
3470/// [`tests::dep_list_as_ref_str_routes_through_display_via_shared_accessor`]
3471/// (three-path convergence: `AsRef<str>` + `Display` + `as_str` all
3472/// resolve to the same byte-string per arm) — any future silent detour
3473/// that routes the impl through a divergent projection (a per-arm
3474/// inline `match self { DepList::Prod => ":deps", … }` re-inlining
3475/// that opens a compile-time link to the un-lifted arm-literal, a
3476/// swap onto a second projection axis) trips at caixa-core test time
3477/// under `assert_eq!` rather than at a downstream
3478/// `impl AsRef<str>`-bound consumer's silent split.
3479impl AsRef<str> for DepList {
3480    fn as_ref(&self) -> &str {
3481        self.as_str()
3482    }
3483}
3484
3485/// Trait-idiomatic *reverse* projection on the two-list dep-graph
3486/// [`DepList`] closed-set typed enum — routes through the paired
3487/// substrate-primitive [`DepList::from_wire`] `Option<Self>` accessor
3488/// so `<DepList>::try_from(":deps")` reaches the same two-arm
3489/// accept-set the sibling [`DepList::from_wire`] resolver dispatches
3490/// through, rather than an open-coded per-arm
3491/// `match s { ":deps" => Ok(Self::Prod), … }` cascade whose arm-set
3492/// has no compile-time link back to the substrate primitive.
3493///
3494/// Corrects a completeness gap in the substrate-wide trait-idiomatic
3495/// reverse-projection campaign (opened by [`crate::CaixaKind`] via
3496/// 3c83606, closed onto 14 sibling closed-set fieldless typed enums
3497/// across the caixa surface — 5b828ed, 6fdd0d9, 5472902, bf78400,
3498/// e67e48a, e21a857, 0a4cc45, a7bf74c, df86c94, bd7da69, 42ab951 —
3499/// which silently omitted [`DepList`] despite this enum being listed
3500/// as a sibling closed-set fieldless typed enum in every peer's
3501/// docstring). Every sibling closed-set fieldless typed enum on the
3502/// caixa surface now carries both trait-idiomatic axes
3503/// (`TryFrom<&str> for Self` + `From<Self> for &'static str`) paired
3504/// against the substrate-primitive canonical projection accessors
3505/// (`as_str`/`variant_slug` + `from_wire`) — the two-list dep-graph
3506/// closed-set is the fifteenth and true-final peer.
3507///
3508/// `type Error = ()` matches the sibling [`DepList::from_wire`]'s
3509/// `Option<Self>` return-shape's deliberate deferral of error typing:
3510/// the caller picks the diagnostic form appropriate for its use site
3511/// (a future `feira dep --list <deps|deps-dev>` arg-parse composes
3512/// `unknown list: <arg> — accepted: {…}` enumerating [`DepList::ALL`];
3513/// the M4 admission-webhook rejection body wraps `Err(())` with the
3514/// accepted-set enumeration).
3515///
3516/// Pinned load-bearing by
3517/// [`tests::dep_list_try_from_str_routes_through_from_wire_accessor`]
3518/// (byte-parity pin against [`DepList::from_wire`] across the two-arm
3519/// accept-set) and
3520/// [`tests::dep_list_try_from_str_rejects_unknown_byte_strings`]
3521/// (rejection witness against silent accept-set widening).
3522impl TryFrom<&str> for DepList {
3523    type Error = ();
3524
3525    fn try_from(s: &str) -> Result<Self, Self::Error> {
3526        Self::from_wire(s).ok_or(())
3527    }
3528}
3529
3530/// Trait-idiomatic *forward* projection on the two-list dep-graph
3531/// [`DepList`] closed-set typed enum onto the `&'static str` axis —
3532/// routes byte-for-byte through the paired substrate-primitive
3533/// [`DepList::as_str`] `pub const fn` accessor so
3534/// `<&'static str>::from(list)` / `list.into::<&'static str>()`
3535/// reaches the same two-arm lifted
3536/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3537/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] const the sibling
3538/// [`std::fmt::Display`], [`AsRef<str>`], and [`DepList::as_str`]
3539/// surfaces already return.
3540///
3541/// Closes the substrate-wide trait-idiomatic forward-projection
3542/// campaign for real — the campaign opened on [`crate::supervisor::RestartStrategy`]
3543/// via 523157d and traced through the 13 sibling closed-set typed
3544/// enums (9fb37d0, edb827b, c189a6f, afa3562, 56998ec, 7fdfbf4,
3545/// 070a6de, f2ca7bc, d4559cb, 5cc3b8b, 2a56127, 07f36bb, 85d0443)
3546/// silently omitted [`DepList`] on both trait-idiomatic axes despite
3547/// every peer's docstring naming it as a sibling. Paired with the
3548/// [`TryFrom<&str> for DepList`] impl immediately above, this closes
3549/// the two-way `DepList ↔ &'static str` round-trip on the trait-
3550/// idiomatic axis pair, mirroring the pre-existing method-named
3551/// [`DepList::as_str`] + [`DepList::from_wire`] pair on the
3552/// substrate-primitive axis pair.
3553///
3554/// The paired [`DepList::as_str`] returns `&'static str` by
3555/// construction — each arm resolves to a
3556/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3557/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` with
3558/// static lifetime — so the trait's return-type promise is upheld
3559/// structurally.
3560///
3561/// Pinned load-bearing by
3562/// [`tests::dep_list_from_into_static_str_routes_through_as_str_accessor`]
3563/// (byte-parity pin against [`DepList::as_str`] across the two-arm
3564/// emit-set, plus a `const`-context materialization witness for the
3565/// `&'static str` lifetime promise) and
3566/// [`tests::dep_list_from_into_static_str_and_as_str_partition_the_emit_set`]
3567/// (partition pin + two-way round-trip through the paired
3568/// [`TryFrom<&str>`] axis).
3569impl From<DepList> for &'static str {
3570    fn from(list: DepList) -> &'static str {
3571        list.as_str()
3572    }
3573}
3574
3575/// Trait-idiomatic *forward* projection on the two-list dep-graph
3576/// [`DepList`] closed-set typed enum from a *borrowed* input onto the
3577/// `&'static str` axis — the borrowed-input companion to the paired
3578/// owned-input [`From<DepList> for &'static str`] impl immediately
3579/// above. Routes byte-for-byte through the same substrate-primitive
3580/// [`DepList::as_str`] `pub const fn` accessor so every consumer that
3581/// binds a `&DepList` through the standard-library `.into()` /
3582/// [`From<&Self> for &'static str`] axis (a
3583/// `DepList::ALL.iter().map(<&'static str>::from).collect::<Vec<_>>()`
3584/// per-arm accept-set materializer that iterates the substrate-
3585/// canonical [`DepList::ALL`] slice — whose iterator yields `&DepList`,
3586/// not `DepList`, so the owned-input [`From<DepList>`] axis alone
3587/// forces every call site through an explicit `.copied()` /
3588/// dereference / [`Copy`]-bound restatement rather than the direct
3589/// trait-idiomatic projection; a future generic
3590/// `<T: Copy + for<'a> Into<&'static str>>`-bound diagnostic column
3591/// that walks the `iter().map(Into::into)` shape verbatim; the future
3592/// M4 admission-webhook rejection body that composes the accepted-set
3593/// enumeration from an iterated `DepList::ALL.iter().map(|l| l.into())`
3594/// pipe rather than a per-arm `match l { … }` cascade) reaches the same
3595/// two-arm lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3596/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] const the paired
3597/// owned-input [`From<DepList> for &'static str`], the sibling
3598/// [`std::fmt::Display`], [`AsRef<str>`], and [`DepList::as_str`]
3599/// surfaces already return.
3600///
3601/// Opens the substrate-wide trait-idiomatic *borrowed-input*
3602/// forward-projection family on the last-touched closed-set fieldless
3603/// typed enum — first-mover on the borrowed-input axis, mirroring the
3604/// role [`crate::supervisor::RestartStrategy`] played on the owned-
3605/// input axis (523157d). Rust's `From` trait does not auto-derive the
3606/// `From<&Self>` sibling from a `From<Self>` impl (the blanket
3607/// `impl<T, U> From<&T> for U where T: Copy, U: From<T>` does not exist
3608/// in `core`), so every closed-set typed enum that carries the
3609/// owned-input axis but not the borrowed-input axis forces every
3610/// borrowed-input call site through a `.copied()` /
3611/// `<&'static str>::from(*list)` / `list.as_str()` detour whose type
3612/// bounds have no compile-time link to the substrate primitive. The
3613/// remaining fourteen substrate-wide closed-set fieldless typed enum
3614/// peers (`CaixaKind`, `CaixaDialeto`, `RestartStrategy`,
3615/// `RestartPolicy`, `WitShape`, `RateLimitUnit`, `PlacementStrategy`,
3616/// `PathShapeViolation`, `InvariantKind`, `ArchVerdict`, `Severity`,
3617/// `FixSafety`, `Semantic`, `FerriteRuntime`) are the future targets
3618/// of this campaign.
3619///
3620/// Pinned load-bearing by
3621/// [`tests::dep_list_from_borrowed_into_static_str_routes_through_as_str_accessor`]
3622/// (byte-parity pin against [`DepList::as_str`] across the two-arm
3623/// emit-set via a borrowed input, plus a `const`-context materialization
3624/// witness) and
3625/// [`tests::dep_list_from_owned_and_borrowed_into_static_str_agree_on_every_arm`]
3626/// (cross-axis partition pin against the paired owned-input
3627/// [`From<DepList> for &'static str`] impl).
3628impl From<&DepList> for &'static str {
3629    fn from(list: &DepList) -> &'static str {
3630        list.as_str()
3631    }
3632}
3633
3634/// Trait-idiomatic *forward* projection on the two-list dep-graph
3635/// [`DepList`] closed-set typed enum from an *owned* input onto the
3636/// owned-[`String`] axis — routes byte-for-byte through the
3637/// substrate-primitive [`DepList::as_str`] `pub const fn` accessor so
3638/// every consumer that binds a [`DepList`] through the standard-library
3639/// `.into()` / [`From<Self> for String`] (equivalently [`Into<String>`])
3640/// axis reaches the same two-arm lifted
3641/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3642/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-string the paired
3643/// owned-input [`From<DepList> for &'static str`], the borrowed-input
3644/// [`From<&DepList> for &'static str`], the sibling [`std::fmt::Display`],
3645/// [`AsRef<str>`], and [`DepList::as_str`] surfaces already return.
3646///
3647/// Extends the trait-idiomatic *owned-[`String`]* forward-projection
3648/// family (opened on [`crate::supervisor::RestartStrategy`] — 7baa18a —
3649/// the first-mover on the M2 OTP-shape sibling-restart-strategy axis,
3650/// extended onto [`crate::supervisor::RestartPolicy`] — 7851725 — the
3651/// second-of-two-in-M2 per-child restart-decision axis, then onto
3652/// [`crate::CaixaKind`] — 231a18c — the structurally most fundamental
3653/// closed-set fieldless typed enum on the caixa surface, then onto
3654/// [`crate::CaixaDialeto`] — 88942cd — the dialect-classification axis)
3655/// onto the fifth peer: the two-list dep-graph axis [`DepList`] carries.
3656/// Rust's standard library does not carry a blanket
3657/// `impl<T: AsRef<str>> From<T> for String` (nor an
3658/// `impl<T: fmt::Display> From<T> for String`), so every closed-set
3659/// typed enum that carries the paired [`AsRef<str>`] / [`std::fmt::Display`] /
3660/// [`From<Self> for &'static str`] / [`From<&Self> for &'static str`]
3661/// quadruple but not the owned-[`String`] axis forces every owned-string
3662/// call site through a `.to_string()` / `.as_str().to_owned()` /
3663/// `String::from(list.as_str())` detour whose type bounds have no
3664/// compile-time link to the substrate primitive.
3665///
3666/// Same as the peer [`crate::supervisor::RestartStrategy`] /
3667/// [`crate::supervisor::RestartPolicy`] / [`crate::CaixaDialeto`]
3668/// owned-[`String`] axis pairs (whose forward emit and reverse parse
3669/// share one vocabulary by construction — `PascalCase` on the three
3670/// prior peers, the `":deps"` / `":deps-dev"` leading-colon lispy
3671/// author-surface tags on this one), [`DepList`]'s [`DepList::as_str`]
3672/// emit and [`DepList::from_wire`] parse resolve through the same
3673/// lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3674/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] consts by construction
3675/// (there is no wire/diagnostic axis split on this enum — both halves
3676/// of the round-trip route through the same two `pub const &str` values),
3677/// so the owned-[`String`] forward projection this impl exposes composes
3678/// directly with the paired trait-idiomatic reverse
3679/// [`TryFrom<&str>`] axis on the owned-[`String`]'s [`String::as_str`]
3680/// borrow — no intermediate wire-vocab hop like the peer
3681/// [`crate::CaixaKind`] axis pair requires.
3682///
3683/// The remaining ten closed-set typed enums on the caixa substrate
3684/// surface (`PlacementStrategy`, `WitShape`, `RateLimitUnit`,
3685/// `PathShapeViolation`, `InvariantKind`, `ArchVerdict`, `Severity`,
3686/// `FixSafety`, `Semantic`, `FerriteRuntime`) are the future targets of
3687/// this campaign — each carries the same paired [`AsRef<str>`] /
3688/// [`std::fmt::Display`] / [`From<Self> for &'static str`] /
3689/// [`From<&Self> for &'static str`] quadruple that this owned-[`String`]
3690/// axis extends onto.
3691///
3692/// Pinned load-bearing by
3693/// [`tests::dep_list_from_into_owned_string_routes_through_as_str_accessor`]
3694/// (byte-parity pin against [`DepList::as_str`] across the two-arm
3695/// [`DepList::ALL`] emit-set plus a blanket `.into::<String>()` shape
3696/// witness) and
3697/// [`tests::dep_list_from_into_owned_string_and_static_str_agree_on_every_arm`]
3698/// (cross-axis partition against the sibling owned-`&'static str` axis
3699/// and the [`ToString::to_string`] surface, a
3700/// `.iter().copied().map(String::from)` pipe witness over
3701/// [`DepList::ALL`], plus a direct `Self → String → Self` round-trip
3702/// via [`TryFrom<&str>`] on the owned-[`String`]'s [`String::as_str`]
3703/// borrow — composes directly without the wire-vocab intermediate hop
3704/// the peer [`crate::CaixaKind`] axis pair requires).
3705impl From<DepList> for String {
3706    fn from(list: DepList) -> String {
3707        list.as_str().to_owned()
3708    }
3709}
3710
3711/// Trait-idiomatic *borrowed-input, owned-`String` output* forward
3712/// projection on the two-list dep-graph [`DepList`] closed-set typed
3713/// enum — the fourth (and closing) corner of the
3714/// `{Self, &Self} × {&'static str, String}` 2×2 trait-idiomatic
3715/// projection family on this enum, mirror of the peer M2 OTP-shape
3716/// [`From<&RestartStrategy> for String`] (579385f) and
3717/// [`From<&RestartPolicy> for String`] (8465740) that opened and
3718/// closed the corner on the sibling supervisor-level restart-strategy
3719/// and per-child restart-decision enums. Routes byte-for-byte through
3720/// the substrate-primitive [`DepList::as_str`] `pub const fn` accessor
3721/// (via [`str::to_owned`]) so every consumer that holds a borrowed
3722/// [`&DepList`] and needs an owned [`String`] — a future
3723/// `serde_json::Value::String(String::from(&list))` structured-payload
3724/// composer over a borrowed field, a future `Iterator::map` over
3725/// `&[DepList]` that projects to owned keys through
3726/// `.iter().map(String::from)` (whose iterator yields `&DepList`, not
3727/// `DepList`, so the owned-input [`From<DepList> for String`] axis
3728/// alone forces every call site through an explicit `.copied()` /
3729/// spurious [`Copy`] deref restatement rather than the direct trait-
3730/// idiomatic projection), a future `HashMap::<String, DepList>::from_iter`
3731/// that keys off a borrowed-iteration axis where dereferencing the list
3732/// would force an unnecessary `Copy` at every step, the future
3733/// wasm-operator's per-manifest `list_axes.iter().map(String::from).collect()`
3734/// per-list author-surface-tag diagnostic emit whose iteration axis is
3735/// borrowed by construction — reaches the same two-arm lifted
3736/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3737/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] const the paired
3738/// [`std::fmt::Display`], [`AsRef<str>`], [`DepList::as_str`], and the
3739/// three other trait-idiomatic forward-projection impls
3740/// ([`From<DepList> for &'static str`],
3741/// [`From<&DepList> for &'static str`],
3742/// [`From<DepList> for String`]) already return.
3743///
3744/// Third peer on the substrate-wide trait-idiomatic *borrowed-input,
3745/// owned-`String` output* forward-projection family opened on
3746/// [`crate::supervisor::RestartStrategy`] (579385f) and closed on
3747/// [`crate::supervisor::RestartPolicy`] (8465740) — extends the
3748/// `{Self, &Self} × {&'static str, String}` 2×2 projection corner off
3749/// the M2 OTP-shape axis pair onto the first non-M2 closed-set
3750/// fieldless typed enum peer (the two-list dep-graph axis). Rust's
3751/// standard library does not carry a blanket
3752/// `impl<T: AsRef<str>> From<&T> for String` (nor an
3753/// `impl<T: fmt::Display> From<&T> for String`), so every closed-set
3754/// typed enum that carries the paired `AsRef<str>` / `Display` /
3755/// `From<Self> for &'static str` / `From<&Self> for &'static str` /
3756/// `From<Self> for String` quintuple but not the borrowed-input owned-
3757/// [`String`] axis forces every borrowed-input owned-string call site
3758/// through a `list.as_str().to_owned()` / `String::from(*list)` (with a
3759/// spurious `Copy`) / `list.to_string()` (through `Display`) detour
3760/// whose type bounds have no compile-time link to the substrate
3761/// primitive.
3762///
3763/// Same as the peer [`crate::supervisor::RestartStrategy`] /
3764/// [`crate::supervisor::RestartPolicy`] borrowed-input owned-[`String`]
3765/// axis pairs (whose forward emit and reverse parse share one
3766/// vocabulary by construction — `PascalCase` on the M2 OTP-shape
3767/// peers), [`DepList`]'s [`DepList::as_str`] emit and
3768/// [`DepList::from_wire`] parse resolve through the same lifted
3769/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3770/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] consts by construction
3771/// (the `":deps"` / `":deps-dev"` leading-colon lispy author-surface
3772/// tags — there is no wire/diagnostic axis split on this enum), so the
3773/// borrowed-input owned-[`String`] projection this impl exposes
3774/// composes directly with the paired trait-idiomatic reverse
3775/// [`TryFrom<&str>`] axis on the owned-[`String`]'s [`String::as_str`]
3776/// borrow — no intermediate wire-vocab hop like the peer
3777/// [`crate::CaixaKind`] axis pair requires.
3778///
3779/// The remaining ten closed-set typed enums on the caixa substrate
3780/// surface (`CaixaKind`, `CaixaDialeto`, `PlacementStrategy`,
3781/// `WitShape`, `RateLimitUnit`, `PathShapeViolation`, `InvariantKind`,
3782/// `ArchVerdict`, `Severity`, `FixSafety`, `Semantic`, `FerriteRuntime`)
3783/// are the future targets of this 2×2-completion campaign — each
3784/// carries the same paired quintuple that this borrowed-input owned-
3785/// [`String`] axis extends onto.
3786///
3787/// Pinned load-bearing by
3788/// [`tests::dep_list_from_into_borrowed_owned_string_routes_through_as_str_accessor`]
3789/// (byte-parity pin against [`DepList::as_str`] across the two-arm
3790/// emit-set through the borrowed-input surface) and
3791/// [`tests::dep_list_from_into_borrowed_owned_string_agrees_with_paired_axes_on_every_arm`]
3792/// (cross-axis partition pin against the paired owned-input owned-
3793/// [`String`] [`From<DepList> for String`] impl, the paired borrowed-
3794/// input owned-[`&'static str`] [`From<&DepList> for &'static str`]
3795/// impl, and the sibling [`ToString::to_string`] surface routed through
3796/// [`std::fmt::Display`], plus a direct round-trip witness through
3797/// [`TryFrom<&str>`] on the owned-[`String`]'s [`String::as_str`]
3798/// borrow that closes the two-way `&Self → String → Self` round-trip
3799/// on the trait-idiomatic borrowed-input owned-[`String`] forward +
3800/// reverse axis pair).
3801impl From<&DepList> for String {
3802    fn from(list: &DepList) -> String {
3803        list.as_str().to_owned()
3804    }
3805}
3806
3807/// Trait-idiomatic *forward* projection on the two-list dep-graph
3808/// [`DepList`] closed-set typed enum from an *owned* input onto the
3809/// borrowed-heap-string [`std::borrow::Cow<'static, str>`] axis —
3810/// routes byte-for-byte through the substrate-primitive
3811/// [`DepList::as_str`] `pub const fn` accessor (via
3812/// [`std::borrow::Cow::Borrowed`]) so every consumer that binds a
3813/// [`DepList`] through the standard-library `.into()` /
3814/// [`From<Self> for std::borrow::Cow<'static, str>`] (equivalently
3815/// [`Into<std::borrow::Cow<'static, str>>`]) axis reaches the same
3816/// two-arm lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3817/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] canonical `pub const
3818/// &str` values the paired [`From<DepList> for &'static str`],
3819/// [`From<&DepList> for &'static str`], [`From<DepList> for String`],
3820/// and [`From<&DepList> for String`] 2×2 trait-idiomatic forward-
3821/// projection corners, the sibling [`std::fmt::Display`],
3822/// [`AsRef<str>`], and [`DepList::as_str`] surfaces already return,
3823/// rather than an open-coded per-call-site
3824/// `std::borrow::Cow::Borrowed(list.as_str())` /
3825/// `std::borrow::Cow::Owned(list.to_string())` composition whose
3826/// type bounds have no compile-time link back to the substrate
3827/// primitive.
3828///
3829/// Deliberately returns [`std::borrow::Cow::Borrowed`] rather than
3830/// [`std::borrow::Cow::Owned`] — the substrate-primitive
3831/// [`DepList::as_str`] accessor's return carries the `&'static str`
3832/// lifetime by construction (each `match` arm resolves to one of
3833/// the two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3834/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
3835/// values with static lifetime), so the zero-alloc borrowed arm is
3836/// the type-correct projection with no runtime allocation. The
3837/// paired [`std::borrow::Cow::Owned`] arm stays reachable at the
3838/// call site through the existing [`From<DepList> for String`] axis
3839/// composed with [`std::borrow::Cow::from`] on the resulting owned
3840/// [`String`] — a caller who chose to mutate the projection lands
3841/// on the owned arm by their own composition, not by the substrate-
3842/// primitive projection silently allocating on their behalf.
3843///
3844/// Rust's standard library carries no blanket `impl<T: AsRef<str>>
3845/// From<T> for Cow<'static, str>` (nor an `impl<T: fmt::Display>
3846/// From<T> for Cow<'static, str>`), so the paired sibling
3847/// [`From<DepList> for &'static str`], [`From<DepList> for String`],
3848/// [`AsRef<str>`], and [`std::fmt::Display`] surfaces do not
3849/// implicitly extend to a [`std::borrow::Cow<'static, str>`]-bound
3850/// call site — every such site is forced through a
3851/// `Cow::Borrowed(list.as_str())` / `Cow::Owned(list.to_string())`
3852/// open-code whose type bounds have no compile-time link back to
3853/// the substrate primitive until this lift.
3854///
3855/// First-mover on the outside-M3 substrate-wide tier of the
3856/// substrate-wide trait-idiomatic [`std::borrow::Cow<'static, str>`]
3857/// forward-projection campaign, opening the tier on the first
3858/// caixa-core-internal closed-set fieldless typed enum peer outside
3859/// the M2 OTP-shape and M3 mesh-shape tiers. The
3860/// [`crate::CaixaKind`] top-level first-mover
3861/// (99c1735 owned-input, d45c409 borrowed-input) opened the axis on
3862/// the structurally most fundamental closed-set fieldless typed
3863/// enum; the paired M2 OTP-shape
3864/// [`crate::supervisor::RestartStrategy`] (7dd28b3, 9b3e4b3) and
3865/// [`crate::supervisor::RestartPolicy`] (0612398, ee577fd) closed
3866/// the M2 OTP-shape tier; the paired M3-mesh-shape
3867/// [`crate::aplicacao::WitShape`] `:contratos :wit` census-label
3868/// (8634dec, 25690ef), [`crate::aplicacao::PlacementStrategy`]
3869/// `:placement :estrategia` distribution-strategy (eee504d,
3870/// afdf0f4), and [`crate::aplicacao::RateLimitUnit`] `:politicas
3871/// :rate-limit` canonical-suffix (1d59925, `From<&RateLimitUnit>`
3872/// Cow closer) closed the M3-mesh-shape tier. The remaining
3873/// outside-M3 caixa-core peers ([`crate::CaixaDialeto`],
3874/// [`crate::render::PathShapeViolation`]) and the outside-
3875/// `caixa-core` peers (`InvariantKind`, `ArchVerdict`, `Severity`,
3876/// `FixSafety`, `Semantic`, `FerriteRuntime`) are the remaining
3877/// future targets of this campaign; the paired borrowed-input
3878/// [`From<&DepList> for std::borrow::Cow<'static, str>`]
3879/// `{Self, &Self}`-closer on this outside-M3-tier-opening peer is
3880/// the next commit's target.
3881///
3882/// Same three-path convergence discipline as the paired sibling
3883/// [`From<DepList> for &'static str`] / [`From<DepList> for String`]
3884/// / [`std::fmt::Display`] / [`AsRef<str>`] surfaces (this
3885/// [`std::borrow::Cow<'static, str>`] axis, the paired sibling
3886/// surfaces, and [`DepList::as_str`] all route through the same two
3887/// lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3888/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
3889/// values by construction), so a future variant addition, rename,
3890/// or per-arm wire-tag drift reaches every forward-projection path
3891/// through exactly one caixa-core edit at the [`DepList::as_str`]
3892/// `match` head.
3893///
3894/// Pinned load-bearing by
3895/// [`tests::dep_list_from_into_static_cow_str_routes_through_as_str_accessor`]
3896/// (byte-parity + zero-alloc [`std::borrow::Cow::Borrowed`]-arm pin
3897/// against [`DepList::as_str`] across the two-arm [`DepList::ALL`])
3898/// and
3899/// [`tests::dep_list_from_into_static_cow_str_agrees_with_paired_axes_on_every_arm`]
3900/// (cross-axis partition pin against the paired
3901/// [`From<DepList> for &'static str`], [`From<DepList> for String`],
3902/// and [`ToString`]-through-[`std::fmt::Display`] axes, plus a
3903/// `.iter().copied().map(Cow::from)` pipe witness over
3904/// [`DepList::ALL`] that materializes the two-arm accept-set through
3905/// the [`std::borrow::Cow<'static, str>`] axis alone and pins the
3906/// zero-alloc discipline on every element).
3907impl From<DepList> for std::borrow::Cow<'static, str> {
3908    fn from(list: DepList) -> std::borrow::Cow<'static, str> {
3909        std::borrow::Cow::Borrowed(list.as_str())
3910    }
3911}
3912
3913/// Trait-idiomatic *borrowed-input, [`std::borrow::Cow<'static, str>`]
3914/// output* forward projection on the two-list dep-graph [`DepList`]
3915/// closed-set typed enum — the borrowed-input companion to the paired
3916/// owned-input [`From<DepList> for std::borrow::Cow<'static, str>`] impl
3917/// immediately above (6858bac). Routes byte-for-byte through the same
3918/// substrate-primitive [`DepList::as_str`] `pub const fn` accessor (via
3919/// [`std::borrow::Cow::Borrowed`]) so every consumer that holds a
3920/// `&DepList` and needs a [`std::borrow::Cow<'static, str>`] — a
3921/// `DepList::ALL.iter().map(std::borrow::Cow::from).collect::<Vec<_>>()`
3922/// per-arm accept-set materializer whose iterator over
3923/// `&'static [DepList]` yields `&DepList` (not `DepList`, so the paired
3924/// owned-input [`From<DepList> for std::borrow::Cow<'static, str>`] axis
3925/// alone forces every call site through an explicit `.copied()` /
3926/// dereference / [`Copy`]-bound restatement rather than the direct
3927/// trait-idiomatic projection), a future generic
3928/// `<T: for<'a> Into<std::borrow::Cow<'static, str>>>`-bound emitter on
3929/// a per-`:deps` / `:deps-dev` diagnostic column that walks the
3930/// `iter().map(Into::into)` shape verbatim, the future M4
3931/// `caixa.pleme.io/v1alpha1/Caixa` CR admission-webhook rejection body
3932/// that composes the accepted-`:deps` / `:deps-dev` list-key enumeration
3933/// from an iterated `DepList::ALL.iter().map(|l| l.into())` pipe rather
3934/// than a per-arm `match l { … }` cascade — reaches the same two-arm
3935/// lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3936/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-string the paired
3937/// [`std::fmt::Display`], [`AsRef<str>`], [`DepList::as_str`], the four
3938/// `{Self, &Self} × {&'static str, String}` 2×2 trait-idiomatic
3939/// forward-projection corners, and the paired owned-input
3940/// [`From<DepList> for std::borrow::Cow<'static, str>`] impl already
3941/// return.
3942///
3943/// Deliberately returns [`std::borrow::Cow::Borrowed`] rather than
3944/// [`std::borrow::Cow::Owned`] — the substrate-primitive
3945/// [`DepList::as_str`] accessor's return carries the `&'static str`
3946/// lifetime by construction (each `match` arm resolves to one of the
3947/// two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3948/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
3949/// byte-strings with static lifetime), so the zero-alloc borrowed arm
3950/// is the type-correct projection with no runtime allocation on the
3951/// borrowed-input surface just as on the paired owned-input surface.
3952///
3953/// Closes the `{Self, &Self}` input-shape corner on the outside-M3
3954/// caixa-core two-list dep-graph [`std::borrow::Cow<'static, str>`]
3955/// axis opened one commit prior (6858bac) on the paired owned-input
3956/// [`From<DepList> for std::borrow::Cow<'static, str>`] impl — first
3957/// outside-M3 caixa-core peer on the axis, one commit after the paired
3958/// M3-mesh-shape [`crate::aplicacao::RateLimitUnit`] `:politicas
3959/// :rate-limit` canonical-suffix (1d59925), the paired M3-mesh-shape
3960/// [`crate::aplicacao::PlacementStrategy`] `:placement :estrategia`
3961/// distribution-strategy (eee504d + afdf0f4), the paired M3-mesh-shape
3962/// [`crate::aplicacao::WitShape`] `:contratos :wit` census-label
3963/// (8634dec + 25690ef), the paired M2 OTP-shape
3964/// [`crate::supervisor::RestartStrategy`] (7dd28b3 + 9b3e4b3) and
3965/// [`crate::supervisor::RestartPolicy`] (0612398 + ee577fd), and the
3966/// paired top-level [`crate::CaixaKind`] (99c1735 + d45c409) peers
3967/// closed the M3-mesh-shape, M2-OTP-shape, and top-level tiers.
3968/// Rust's standard library does not carry a blanket
3969/// `impl<T: AsRef<str>> From<&T> for Cow<'static, str>` (nor an
3970/// `impl<T: fmt::Display> From<&T> for Cow<'static, str>`), so every
3971/// closed-set fieldless typed enum peer on the substrate that carries
3972/// the paired owned-input [`Cow<'static, str>`] axis but not the
3973/// borrowed-input axis forces every borrowed-input
3974/// [`Cow<'static, str>`]-parameterized call site through a spurious
3975/// [`Copy`] deref (`std::borrow::Cow::from(*list)`) or a
3976/// `std::borrow::Cow::Borrowed(list.as_str())` open-code whose type
3977/// bounds have no compile-time link to the substrate primitive.
3978///
3979/// The remaining outside-M3 caixa-core peers ([`crate::CaixaDialeto`],
3980/// [`crate::render::PathShapeViolation`]) and the outside-`caixa-core`
3981/// peers (`InvariantKind`, `ArchVerdict`, `Severity`, `FixSafety`,
3982/// `Semantic`, `FerriteRuntime`) are the remaining future targets of
3983/// the campaign; closing this borrowed-input corner on [`DepList`]
3984/// leaves [`crate::CaixaDialeto`] as the next outside-M3 caixa-core
3985/// closed-set fieldless typed enum peer target on the
3986/// [`std::borrow::Cow<'static, str>`] axis.
3987///
3988/// Same three-path convergence discipline as the paired sibling
3989/// [`From<&DepList> for &'static str`], [`From<&DepList> for String`],
3990/// [`std::fmt::Display`], and [`AsRef<str>`] surfaces (this borrowed-
3991/// input [`std::borrow::Cow<'static, str>`] axis, the paired owned-
3992/// input [`From<DepList> for std::borrow::Cow<'static, str>`] axis, the
3993/// paired sibling `{Self, &Self} × {&'static str, String}` 2×2 corners,
3994/// and [`DepList::as_str`] all route through the same two lifted
3995/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
3996/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` values
3997/// by construction), so a future variant addition, rename, or per-arm
3998/// wire-tag drift reaches every forward-projection path through
3999/// exactly one caixa-core edit at the [`DepList::as_str`] `match` head.
4000///
4001/// Pinned load-bearing by
4002/// [`tests::dep_list_from_borrowed_into_static_cow_str_routes_through_as_str_accessor`]
4003/// (byte-parity + zero-alloc [`std::borrow::Cow::Borrowed`]-arm pin
4004/// against [`DepList::as_str`] across the two-arm [`DepList::ALL`]
4005/// through the borrowed-input surface) and
4006/// [`tests::dep_list_from_borrowed_into_static_cow_str_agrees_with_paired_axes_on_every_arm`]
4007/// (cross-axis partition pin against the paired owned-input
4008/// [`From<DepList> for std::borrow::Cow<'static, str>`], the paired
4009/// borrowed-input owned-`&'static str` [`From<&DepList> for &'static
4010/// str`], and the paired borrowed-input owned-`String` [`From<&DepList>
4011/// for String`] impls, plus a `.iter().map(std::borrow::Cow::from)`
4012/// pipe witness over [`DepList::ALL`] — whose iterator yields
4013/// `&DepList` by construction, so the borrowed-input
4014/// [`std::borrow::Cow<'static, str>`] axis is what routes the pipe
4015/// through the substrate-primitive [`DepList::as_str`] accessor with
4016/// the zero-alloc [`std::borrow::Cow::Borrowed`] arm by construction
4017/// and without a spurious [`Copy`] deref).
4018impl From<&DepList> for std::borrow::Cow<'static, str> {
4019    fn from(list: &DepList) -> std::borrow::Cow<'static, str> {
4020        std::borrow::Cow::Borrowed(list.as_str())
4021    }
4022}
4023
4024/// Trait-idiomatic *owned-input, [`Box<str>`] output* forward projection on
4025/// the outside-M3 caixa-core two-list dep-graph [`DepList`] closed-set
4026/// fieldless typed enum. Routes byte-for-byte through the substrate-
4027/// primitive [`DepList::as_str`] `pub const fn` accessor via
4028/// [`Box::<str>::from`] on the returned `&'static str`, so every consumer
4029/// that binds a `let key: Box<str> = list.into();`-shaped call site — a
4030/// per-`:deps` / `:deps-dev` census-key materializer that stashes the
4031/// dep-list discriminator in a [`Box<str>`]-typed heap-owned scalar for
4032/// cheap clone off an owned handle, a future M4
4033/// [`caixa.pleme.io/v1alpha1/Caixa`] CR materializer's per-list admission-
4034/// webhook rejection body whose per-arm [`Box<str>`] field composes from
4035/// an owned [`DepList`] handle naming the accepted-list-tag list, a future
4036/// `feira lint --explain-dep-list=<axis>` per-arm listing that stashes
4037/// each arm as an owned [`Box<str>`] label — reaches the same two lifted
4038/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4039/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-strings
4040/// the sibling `{Self, &Self} × {&'static str, String, Cow<'static, str>}`
4041/// forward-projection corner already returns.
4042///
4043/// Rust's standard library carries `impl From<&str> for Box<str>` and
4044/// `impl From<String> for Box<str>` but no blanket
4045/// `impl<T: AsRef<str>> From<T> for Box<str>`, so this axis is a distinct
4046/// trait-idiomatic surface that a downstream `DepList → Box<str>`
4047/// `.into()` reaches through this impl and no other — without a
4048/// `Box::from(list.as_str())` open-code whose type bounds have no
4049/// compile-time link back to the substrate primitive.
4050///
4051/// Extends the caixa-core-internal tier of the substrate-wide trait-
4052/// idiomatic [`Box<str>`] forward-projection campaign onto the second
4053/// caixa-core-internal peer, after the render-side path-shape-diagnostic
4054/// [`crate::render::PathShapeViolation`] pair (0d87a72, both corners in
4055/// one axis) opened the tier. Follows the M2 OTP-shape
4056/// [`crate::supervisor::RestartStrategy`] / [`crate::supervisor::RestartPolicy`]
4057/// pair (59ae5dc + cb1d068), the M3 mesh-shape
4058/// [`crate::aplicacao::PlacementStrategy`] / [`crate::aplicacao::WitShape`] /
4059/// [`crate::aplicacao::RateLimitUnit`] triple (6d73e84 → df7040c) that
4060/// closed the M3 mesh-shape tier, and the outside-`caixa-core` tier
4061/// (`InvariantKind` 10613a7 + 5901887, `ArchVerdict` 3e08f5a + c4319a8,
4062/// `Severity` 5116c95, `FixSafety` cf0174b, `Semantic` 0cd7dc3,
4063/// `FerriteRuntime` 14886a8) that closed one tier prior. Same discipline
4064/// as those peers: forward emit (this impl, the sibling `{&'static str,
4065/// String, Cow<'static, str>}` forward-projection corner, [`std::fmt::Display`],
4066/// [`AsRef<str>`], [`DepList::as_str`]) and reverse parse
4067/// ([`DepList::from_wire`], [`TryFrom<&str>`]) route through the same two
4068/// lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4069/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-strings
4070/// by construction, so the round-trip composes directly without the
4071/// wire-vocab intermediate hop the peer [`crate::CaixaKind`] axis pair
4072/// requires.
4073///
4074/// A future variant addition (a `Build` build-time-only dep-list axis the
4075/// CAIXA-SDLC hints name as a trajectory item once the Cargo
4076/// `[build-dependencies]` table gains substrate visibility) reaches the
4077/// paired [`Box<str>`] output axis through one match-arm edit on the
4078/// [`DepList::as_str`] `pub const fn` accessor, not a coordinated rewrite
4079/// of every downstream `Box::from(list.as_str())` open-code.
4080///
4081/// Pinned load-bearing by
4082/// [`tests::dep_list_from_into_box_str_routes_through_as_str_accessor`]
4083/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4084/// [`DepList::ALL`] emit-set on the owned-input surface, plus a blanket-
4085/// derived [`Into`] shape witness).
4086impl From<DepList> for Box<str> {
4087    fn from(list: DepList) -> Box<str> {
4088        Box::<str>::from(list.as_str())
4089    }
4090}
4091
4092/// Trait-idiomatic *borrowed-input, [`Box<str>`] output* forward projection
4093/// on the outside-M3 caixa-core two-list dep-graph [`DepList`] closed-set
4094/// fieldless typed enum. Routes byte-for-byte through the substrate-
4095/// primitive [`DepList::as_str`] `pub const fn` accessor via
4096/// [`Box::<str>::from`] on the returned `&'static str`, so every consumer
4097/// that binds a `let key: Box<str> = (&list).into();`-shaped call site or
4098/// a `DepList::ALL.iter().map(Box::<str>::from)`-shaped pipe (whose
4099/// iterator over `&'static [DepList]` yields `&DepList` by construction)
4100/// — a per-`:deps` / `:deps-dev` census-key materializer that stashes the
4101/// dep-list discriminator in a [`Box<str>`]-typed heap-owned scalar for
4102/// cheap clone off a borrowed handle, a future M4 admission-webhook
4103/// rejection body whose per-arm [`Box<str>`] field composes from a
4104/// borrowed [`DepList`] handle off a `&DepList` borrow, a future
4105/// `feira lint --explain-dep-list` per-axis listing that iterates
4106/// [`DepList::ALL`] into per-arm owned [`Box<str>`] labels — reaches the
4107/// same two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4108/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-strings
4109/// the sibling `{Self, &Self} × {&'static str, String, Cow<'static, str>}`
4110/// forward-projection corner and the paired owned-input
4111/// [`From<DepList> for Box<str>`] already return.
4112///
4113/// Rust's standard library carries `impl From<&str> for Box<str>` and
4114/// `impl From<String> for Box<str>` but no blanket
4115/// `impl<T: AsRef<str>> From<&T> for Box<str>` (nor a `Copy`-based
4116/// `impl<T: Copy, U: From<T>> From<&T> for U`), so this borrowed-input
4117/// axis is a distinct trait-idiomatic surface that the pipe shape
4118/// [`DepList::ALL`]`.iter().map(Box::<str>::from)` reaches through this
4119/// impl and no other — without it, the same pipe would force an explicit
4120/// `.copied()` restatement (`.iter().copied().map(Box::<str>::from)`)
4121/// whose type bounds have no compile-time link back to the substrate
4122/// primitive, and a `let key: Box<str> = (&list).into();`-shaped call
4123/// site would force an explicit `Copy` deref (`Box::<str>::from(*list)`)
4124/// or a `Box::<str>::from(list.as_str())` open-code with the same defect.
4125///
4126/// Closes the `{Self, &Self}` input-shape corner on the second caixa-
4127/// core-internal closed-set fieldless typed enum peer of the substrate-
4128/// wide trait-idiomatic [`Box<str>`] forward-projection campaign — one
4129/// commit after the paired render-side path-shape-diagnostic
4130/// [`crate::render::PathShapeViolation`] pair (0d87a72) opened the caixa-
4131/// core-internal tier — matching the trajectory the paired caixa-theme
4132/// [`caixa_theme::style::Semantic`] pair (0cd7dc3, both corners in one
4133/// axis), the caixa-provedor [`caixa_provedor::FerriteRuntime`] pair
4134/// (14886a8, both corners in one axis), and the render-side
4135/// [`crate::render::PathShapeViolation`] pair (0d87a72, both corners in
4136/// one axis) walked before it.
4137///
4138/// Same discipline as the paired outside-`caixa-core`,
4139/// [`crate::supervisor`], [`crate::aplicacao`], and [`crate::render`]
4140/// [`Box<str>`] `{Self, &Self}`-closers: forward emit (this impl, the
4141/// paired owned-input [`From<DepList> for Box<str>`] impl, the sibling
4142/// `{&'static str, String, Cow<'static, str>}` forward-projection corner,
4143/// [`std::fmt::Display`], [`AsRef<str>`], [`DepList::as_str`]) and reverse
4144/// parse ([`DepList::from_wire`], [`TryFrom<&str>`]) route through the
4145/// same two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4146/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-strings
4147/// by construction, so the round-trip composes directly without the
4148/// wire-vocab intermediate hop the peer [`crate::CaixaKind`] axis pair
4149/// requires.
4150///
4151/// Pinned load-bearing by
4152/// [`tests::dep_list_from_borrowed_into_box_str_routes_through_as_str_accessor`]
4153/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4154/// [`DepList::ALL`] emit-set on the borrowed-input surface, plus a
4155/// blanket-derived [`Into`] shape witness, plus a
4156/// `.iter().map(Box::<str>::from)` pipe witness over [`DepList::ALL`] —
4157/// whose iterator yields `&DepList` by construction, so the borrowed-
4158/// input [`Box<str>`] axis is what routes the pipe through the substrate-
4159/// primitive [`DepList::as_str`] accessor without a spurious [`Copy`]
4160/// deref).
4161impl From<&DepList> for Box<str> {
4162    fn from(list: &DepList) -> Box<str> {
4163        Box::<str>::from(list.as_str())
4164    }
4165}
4166
4167/// Trait-idiomatic *owned-input, [`std::sync::Arc<str>`] output* forward
4168/// projection on the outside-M3 caixa-core two-list dep-graph [`DepList`]
4169/// closed-set fieldless typed enum. Routes byte-for-byte through the
4170/// substrate-primitive [`DepList::as_str`] `pub const fn` accessor via
4171/// [`std::sync::Arc::<str>::from`] on the returned `&'static str`, so
4172/// every consumer that binds a
4173/// `let key: std::sync::Arc<str> = list.into();`-shaped call site reaches
4174/// the same two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4175/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-strings
4176/// the sibling
4177/// `{Self, &Self} × {&'static str, String, Cow<'static, str>, Box<str>}`
4178/// forward-projection corner already returns.
4179///
4180/// Rust's standard library carries `impl From<&str> for std::sync::Arc<str>`
4181/// and `impl From<String> for std::sync::Arc<str>` but no blanket
4182/// `impl<T: AsRef<str>> From<T> for std::sync::Arc<str>` (nor an
4183/// `impl<T: fmt::Display> From<T> for std::sync::Arc<str>`), so this axis
4184/// is a distinct trait-idiomatic surface that a
4185/// `let key: std::sync::Arc<str> = list.into();`-shaped call site reaches
4186/// through this impl and no other — a paired
4187/// `std::sync::Arc::<str>::from(list.as_str())` open-code has no compile-
4188/// time link back to the substrate primitive, and a two-step
4189/// `std::sync::Arc::<str>::from(String::from(list))` composition through
4190/// the owned-`String` axis allocates twice (once into the intermediate
4191/// `String`, once into the [`std::sync::Arc<str>`] on the `From<String>`
4192/// conversion) where the single-step trait impl allocates once. The
4193/// shared-ownership + [`Sync`] + [`Send`] contract [`std::sync::Arc<str>`]
4194/// provides is the distinct value the sibling [`Box<str>`] axis's owned-
4195/// move return-shape cannot provide — a per-`:deps` / `:deps-dev` census
4196/// key reachable from multiple concurrent per-Caixa reconcile / per-lint
4197/// tasks through the same two lifted
4198/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4199/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-strings, without a
4200/// `.clone()`-per-task materialization the owned-move [`Box<str>`] axis
4201/// would force.
4202///
4203/// Extends the caixa-core-internal tier of the substrate-wide trait-
4204/// idiomatic [`std::sync::Arc<str>`] forward-projection campaign onto the
4205/// second caixa-core-internal peer, after the top-level
4206/// [`crate::CaixaKind`] pair (c17be64, both corners in one axis) opened
4207/// the tier. Follows the M2 OTP-shape
4208/// [`crate::supervisor::RestartStrategy`] / [`crate::supervisor::RestartPolicy`]
4209/// pair (bca2ec8 + b3e72d7 / b05724e + ea91551), the M3 mesh-shape
4210/// [`crate::aplicacao::PlacementStrategy`] / [`crate::aplicacao::WitShape`] /
4211/// [`crate::aplicacao::RateLimitUnit`] triple (977d577 → dae722f), and
4212/// the outside-`caixa-core` tier (`InvariantKind` 4e923c1 + 03c043f,
4213/// `ArchVerdict` 1682f8b + 92ddfb2, `Severity` a7a9a6d + 4f041e1,
4214/// `FixSafety` fb73edb + 822138e, `Semantic` 65dbcff + f3a55c7,
4215/// `FerriteRuntime` 938d915 + 0afef4b) that closed prior tiers on this
4216/// same Arc<str> axis. Same discipline as those peers: forward emit
4217/// (this impl, the sibling
4218/// `{Self, &Self} × {&'static str, String, Cow<'static, str>, Box<str>}`
4219/// forward-projection corner, [`std::fmt::Display`], [`AsRef<str>`],
4220/// [`DepList::as_str`]) and reverse parse ([`DepList::from_wire`],
4221/// [`TryFrom<&str>`]) route through the same two lifted
4222/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4223/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-
4224/// strings by construction, so the round-trip composes directly without
4225/// the wire-vocab intermediate hop the peer [`crate::CaixaKind`] axis
4226/// pair requires.
4227///
4228/// A future variant addition (a `Build` build-time-only dep-list axis the
4229/// CAIXA-SDLC hints name as a trajectory item once the Cargo
4230/// `[build-dependencies]` table gains substrate visibility) reaches the
4231/// paired [`std::sync::Arc<str>`] output axis through one match-arm edit
4232/// on the [`DepList::as_str`] `pub const fn` accessor, not a coordinated
4233/// rewrite of every downstream
4234/// `std::sync::Arc::<str>::from(list.as_str())` open-code.
4235///
4236/// Pinned load-bearing by
4237/// [`tests::dep_list_from_into_arc_str_routes_through_as_str_accessor`]
4238/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4239/// [`DepList::ALL`] emit-set on the owned-input surface, plus a blanket-
4240/// derived [`Into`] shape witness and cross-axis byte-parity pins against
4241/// the sibling owned-input
4242/// `{&'static str, String, Cow<'static, str>, Box<str>}` return-shape
4243/// axes).
4244impl From<DepList> for std::sync::Arc<str> {
4245    fn from(list: DepList) -> std::sync::Arc<str> {
4246        std::sync::Arc::<str>::from(list.as_str())
4247    }
4248}
4249
4250/// Trait-idiomatic *borrowed-input, [`std::sync::Arc<str>`] output*
4251/// forward projection on the outside-M3 caixa-core two-list dep-graph
4252/// [`DepList`] closed-set fieldless typed enum — the borrowed-input
4253/// companion to the paired owned-input
4254/// [`From<DepList> for std::sync::Arc<str>`] impl immediately above.
4255/// Routes byte-for-byte through the substrate-primitive
4256/// [`DepList::as_str`] `pub const fn` accessor via
4257/// [`std::sync::Arc::<str>::from`] on the returned `&'static str`, so
4258/// every consumer that binds a
4259/// `let key: std::sync::Arc<str> = (&list).into();`-shaped call site or a
4260/// `DepList::ALL.iter().map(std::sync::Arc::<str>::from)`-shaped pipe
4261/// (whose iterator over `&'static [DepList]` yields `&DepList` by
4262/// construction) reaches the same two lifted
4263/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4264/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-
4265/// strings the paired owned-input
4266/// [`From<DepList> for std::sync::Arc<str>`] and the sibling
4267/// `{Self, &Self} × {&'static str, String, Cow<'static, str>, Box<str>}`
4268/// forward-projection corner already return.
4269///
4270/// Rust's standard library carries `impl From<&str> for std::sync::Arc<str>`
4271/// and `impl From<String> for std::sync::Arc<str>` but no blanket
4272/// `impl<T: AsRef<str>> From<&T> for std::sync::Arc<str>` (nor a `Copy`-
4273/// based `impl<T: Copy, U: From<T>> From<&T> for U`), so this borrowed-
4274/// input axis is a distinct trait-idiomatic surface that the pipe shape
4275/// [`DepList::ALL`]`.iter().map(std::sync::Arc::<str>::from)` reaches
4276/// through this impl and no other — without it, the same pipe would
4277/// force a spurious [`Copy`] deref
4278/// (`std::sync::Arc::<str>::from((*list).as_str())`) or a `.copied()`
4279/// restatement whose type bounds have no compile-time link back to the
4280/// substrate primitive.
4281///
4282/// Closes the `{Self, &Self}` input-shape corner on the second caixa-
4283/// core-internal closed-set fieldless typed enum peer of the substrate-
4284/// wide trait-idiomatic [`std::sync::Arc<str>`] forward-projection
4285/// campaign — one commit after the paired top-level [`crate::CaixaKind`]
4286/// pair (c17be64) opened the caixa-core-internal Arc<str> tier — matching
4287/// the trajectory the paired top-level [`crate::CaixaKind`] pair
4288/// (c17be64, both corners in one axis) walked before it. Leaves the
4289/// remaining caixa-core-internal closed-set fieldless typed enum peers
4290/// ([`crate::dialeto::CaixaDialeto`],
4291/// [`crate::render::PathShapeViolation`]) as the campaign's next multi-
4292/// peer targets on the caixa-core-internal tier of the Arc<str> axis.
4293///
4294/// Pinned load-bearing by
4295/// [`tests::dep_list_from_borrowed_into_arc_str_routes_through_as_str_accessor`]
4296/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4297/// [`DepList::ALL`] emit-set on the borrowed-input surface, plus a
4298/// blanket-derived [`Into`] shape witness, a cross-axis partition pin
4299/// against the paired owned-input
4300/// [`From<DepList> for std::sync::Arc<str>`] and the sibling borrowed-
4301/// input `{&'static str, String, Cow<'static, str>, Box<str>}` return-
4302/// shape axes, and a `.iter().map(std::sync::Arc::<str>::from)` pipe
4303/// witness over [`DepList::ALL`] that resolves through the borrowed-
4304/// input axis without a spurious [`Copy`] deref).
4305impl From<&DepList> for std::sync::Arc<str> {
4306    fn from(list: &DepList) -> std::sync::Arc<str> {
4307        std::sync::Arc::<str>::from(list.as_str())
4308    }
4309}
4310
4311/// Trait-idiomatic *owned-input, [`std::rc::Rc<str>`] output* forward
4312/// projection on the outside-M3 caixa-core two-list dep-graph
4313/// [`DepList`] closed-set fieldless typed enum — routes byte-for-byte
4314/// through the substrate-primitive [`DepList::as_str`] `pub const fn`
4315/// accessor via [`std::rc::Rc::<str>::from`] on the returned
4316/// `&'static str`, so every consumer that binds a [`DepList`] through
4317/// the standard-library `.into()` / `From::from` surfaces onto the
4318/// non-atomic single-threaded-reference-counted `std::rc::Rc<str>` axis
4319/// reaches the same two lifted
4320/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4321/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-
4322/// strings the sibling `{&'static str, String, Cow<'static, str>,
4323/// Box<str>, std::sync::Arc<str>}` return-shape axes already return.
4324///
4325/// Rust's standard library carries `impl From<&str> for
4326/// std::rc::Rc<str>` and `impl From<String> for std::rc::Rc<str>` but
4327/// no blanket `impl<T: AsRef<str>> From<T> for std::rc::Rc<str>`, and
4328/// the [`std::sync::Arc<str>`] and [`std::rc::Rc<str>`] trait tables
4329/// are disjoint — so a single-threaded caixa-core dep-graph pass whose
4330/// per-list `:deps` / `:deps-dev` bucket key is cloned across intra-
4331/// pass tree nodes through the cheaper non-atomic [`std::rc::Rc<str>`]
4332/// refcount (the atomically-reference-counted [`std::sync::Arc<str>`]
4333/// axis cannot elide the CAS-fence cost within a single-threaded
4334/// caixa-core pass), a future `feira dep --list <deps|deps-dev>`-
4335/// side per-list histogram-column emitter keyed on a shared-ownership
4336/// per-arm bucket key, a future `caixa-lsp`-side dep-graph quick-fix
4337/// panel composer holding a shared per-list canonical `:`-prefixed
4338/// kebab tag across intra-file dep tree nodes without atomic contention
4339/// — reaches the substrate primitive through this impl and no other.
4340/// A paired `std::rc::Rc::<str>::from(list.as_str())` open-code has no
4341/// compile-time link back to the substrate primitive, and a two-step
4342/// `std::rc::Rc::<str>::from(String::from(list))` composition through
4343/// the owned-`String` axis allocates twice (once into the intermediate
4344/// `String`, once into the [`std::rc::Rc<str>`] on the `From<String>`
4345/// conversion) where the single-step trait impl allocates once.
4346///
4347/// Opens the caixa-core-internal tier of the [`std::rc::Rc<str>`]
4348/// forward-projection campaign onto the caixa-core two-list dep-graph
4349/// peer, following the trajectory the paired top-level
4350/// [`crate::CaixaKind`] pair (e04aff0), the second caixa-core-internal
4351/// peer [`crate::dialeto::CaixaDialeto`] pair (c5595e5), the render-
4352/// side path-shape-diagnostic peer [`crate::render::PathShapeViolation`]
4353/// pair (31fc43e), the M3-mesh-primitive-defining
4354/// [`crate::aplicacao::PlacementStrategy`] pair (91b4c92), and the
4355/// outside-`caixa-core` peers (`InvariantKind` c71818b, `ArchVerdict`
4356/// cc759ef, `Severity` d7c58b6, `FixSafety` 046cc5f) walked before it
4357/// on the same axis — closes the caixa-core-internal tier's third-peer
4358/// slot after the render-side [`crate::render::PathShapeViolation`]
4359/// second-peer pair. Leaves the outside-`caixa-core` peers
4360/// (`caixa_theme::Semantic`, `caixa_provedor::FerriteRuntime`) as the
4361/// campaign's next multi-peer targets on the [`std::rc::Rc<str>`] axis.
4362///
4363/// Pinned load-bearing by
4364/// [`tests::dep_list_from_into_rc_str_routes_through_as_str_accessor`]
4365/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4366/// [`DepList::ALL`] emit-set on the owned-input surface, plus a
4367/// blanket-derived [`Into`] shape witness and cross-axis byte-parity
4368/// pins against the sibling owned-input `{&'static str, String,
4369/// Cow<'static, str>, Box<str>, std::sync::Arc<str>}` return-shape
4370/// axes).
4371impl From<DepList> for std::rc::Rc<str> {
4372    fn from(list: DepList) -> std::rc::Rc<str> {
4373        std::rc::Rc::<str>::from(list.as_str())
4374    }
4375}
4376
4377/// Trait-idiomatic *borrowed-input, [`std::rc::Rc<str>`] output*
4378/// forward projection on the outside-M3 caixa-core two-list dep-graph
4379/// [`DepList`] closed-set fieldless typed enum — the borrowed-input
4380/// companion to the paired owned-input
4381/// [`From<DepList> for std::rc::Rc<str>`] impl immediately above,
4382/// closing the `{Self, &Self}` input-shape corner of the caixa-core-
4383/// internal tier of the [`std::rc::Rc<str>`] axis on the two-list
4384/// dep-graph peer. Routes byte-for-byte through the substrate-primitive
4385/// [`DepList::as_str`] `pub const fn` accessor via
4386/// [`std::rc::Rc::<str>::from`] on the returned `&'static str`, so a
4387/// `DepList::ALL.iter().map(std::rc::Rc::<str>::from)`-shaped pipe
4388/// (whose iterator over `&'static [DepList]` yields `&DepList` by
4389/// construction) reaches the same two lifted
4390/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4391/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` byte-
4392/// strings the paired owned-input axis and the sibling
4393/// `{Self, &Self} × {&'static str, String, Cow<'static, str>, Box<str>,
4394/// std::sync::Arc<str>}` forward-projection corner already return.
4395///
4396/// Rust's standard library carries no blanket
4397/// `impl<T: AsRef<str>> From<&T> for std::rc::Rc<str>` (nor a `Copy`-
4398/// based `impl<T: Copy, U: From<T>> From<&T> for U`), so this borrowed-
4399/// input axis is a distinct trait-idiomatic surface that the pipe
4400/// shape [`DepList::ALL`]`.iter().map(std::rc::Rc::<str>::from)`
4401/// reaches through this impl and no other — without it, the same pipe
4402/// would force a spurious [`Copy`] deref
4403/// (`std::rc::Rc::<str>::from((*list).as_str())`) or a `.copied()`
4404/// restatement whose type bounds have no compile-time link back to
4405/// the substrate primitive, and a `let key: std::rc::Rc<str> =
4406/// (&list).into();`-shaped call site would force an explicit [`Copy`]
4407/// deref (`std::rc::Rc::<str>::from(*list)`) or a
4408/// `std::rc::Rc::<str>::from(list.as_str())` open-code with the same
4409/// defect.
4410///
4411/// Closes the `{Self, &Self}` input-shape corner on the third caixa-
4412/// core-internal closed-set fieldless typed enum peer of the
4413/// substrate-wide trait-idiomatic [`std::rc::Rc<str>`] forward-
4414/// projection campaign, matching the trajectory the paired
4415/// [`crate::CaixaKind`] (e04aff0),
4416/// [`crate::dialeto::CaixaDialeto`] (c5595e5), and
4417/// [`crate::render::PathShapeViolation`] (31fc43e) pairs walked before
4418/// it on the caixa-core-internal tier of the same axis. Leaves the
4419/// outside-`caixa-core` peers ([`caixa_theme::Semantic`],
4420/// [`caixa_provedor::FerriteRuntime`]) as the campaign's next multi-
4421/// peer targets on the [`std::rc::Rc<str>`] axis — this commit gives
4422/// them a fifth-peer `{Self, &Self}` caixa-core-internal-tier template
4423/// to converge onto.
4424///
4425/// Pinned load-bearing by
4426/// [`tests::dep_list_from_borrowed_into_rc_str_routes_through_as_str_accessor`]
4427/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4428/// [`DepList::ALL`] emit-set on the borrowed-input surface, plus a
4429/// blanket-derived [`Into`] shape witness, a cross-axis partition pin
4430/// against the paired owned-input
4431/// [`From<DepList> for std::rc::Rc<str>`] and the sibling borrowed-
4432/// input `{&'static str, String, Cow<'static, str>, Box<str>,
4433/// std::sync::Arc<str>}` return-shape axes, and a
4434/// `.iter().map(std::rc::Rc::<str>::from)` pipe witness over
4435/// [`DepList::ALL`] that resolves through the borrowed-input axis
4436/// without a spurious [`Copy`] deref).
4437impl From<&DepList> for std::rc::Rc<str> {
4438    fn from(list: &DepList) -> std::rc::Rc<str> {
4439        std::rc::Rc::<str>::from(list.as_str())
4440    }
4441}
4442
4443/// Trait-idiomatic [`std::str::FromStr`] parse axis on the two-list
4444/// dep-graph [`DepList`] closed-set typed enum — routes byte-for-byte
4445/// through the paired [`TryFrom<&str> for DepList`] impl (which in
4446/// turn routes through the substrate-primitive [`DepList::from_wire`]
4447/// `Option<Self>` accessor), so `"...".parse::<DepList>()` /
4448/// `<DepList as FromStr>::from_str(…)` reaches the same two-arm
4449/// accept-set the sibling method-named [`DepList::from_wire`]
4450/// resolver and the paired [`TryFrom<&str>`] impl already resolve
4451/// against.
4452///
4453/// Opens the trait-idiomatic `str::parse`-axis campaign on the
4454/// substrate-wide closed-set fieldless typed-enum surface. The
4455/// substrate already carries three peers per enum on the projection
4456/// star: the method-named substrate-primitive pair
4457/// ([`DepList::as_str`] `pub const fn` accessor + [`DepList::from_wire`]
4458/// `Option<Self>` resolver), the emit-set trait pair
4459/// ([`std::fmt::Display`], [`AsRef<str>`], the owned-input +
4460/// borrowed-input `{&'static str, String, Cow<'static, str>, Box<str>,
4461/// std::sync::Arc<str>}` `From<{Self,&Self}>` return-shape matrix),
4462/// and the parse-set `TryFrom<&str>` reverse trait. [`FromStr`] is the
4463/// canonical Rust-idiomatic parse-set entry point every stdlib-shaped
4464/// consumer reaches for — [`str::parse::<T>()`] is a
4465/// `T: FromStr`-bounded generic, not a `T: for<'a> TryFrom<&'a str>`-
4466/// bounded one — so lifting [`FromStr`] onto the closed-set enum
4467/// unlocks the `.parse::<DepList>()` short-form on every consumer
4468/// (a future `feira dep --list <deps|deps-dev>` clap-style arg-parse
4469/// composes `arg.parse::<DepList>()`; a `serde` string-tagged
4470/// deserializer routes through the same `FromStr` bound; the future
4471/// M4 admission webhook's `Deserialize` derive reaches the enum
4472/// through its `FromStr` impl via `serde_with::DisplayFromStr`).
4473///
4474/// The impl trivially delegates to the paired [`TryFrom<&str>`] —
4475/// same `type Err = ()` deliberate-deferral shape the sibling
4476/// reverse-projection trait carries — so both trait-idiomatic
4477/// parse-axis paths (`TryFrom<&str>` and `FromStr::from_str`) resolve
4478/// to the same two-arm accept-set by construction. A future accept-set
4479/// widening (a `":packages"` rebrand, a `":dev-deps"` alias) reaches
4480/// every parse path through one edit on the substrate-primitive
4481/// [`DepList::from_wire`] accessor, not a coordinated rewrite across
4482/// the two reverse-projection trait impls.
4483///
4484/// Pinned load-bearing by
4485/// [`tests::dep_list_from_str_routes_through_try_from_str_impl`]
4486/// (byte-parity pin across the two-arm accept-set + delegated-
4487/// `.parse()`-projection witness) and
4488/// [`tests::dep_list_from_str_rejects_unknown_byte_strings`]
4489/// (rejection witness against silent accept-set widening).
4490impl std::str::FromStr for DepList {
4491    type Err = ();
4492
4493    fn from_str(s: &str) -> Result<Self, Self::Err> {
4494        <Self as TryFrom<&str>>::try_from(s)
4495    }
4496}
4497
4498/// Substrate-canonical [`AsRef<[u8]>`] byte-view projection on the
4499/// caixa-core-internal two-list dep-graph [`DepList`] closed-set
4500/// fieldless typed enum — routes byte-for-byte through the substrate-
4501/// primitive [`DepList::as_str`] `pub const fn` accessor via
4502/// [`str::as_bytes`] on the returned `&'static str`, so any future
4503/// consumer that binds a [`DepList`] through a standard-library
4504/// `<T: AsRef<[u8]>>` trait bound reaches the same lifted
4505/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4506/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str` roster
4507/// the paired sibling [`AsRef<str>`] / [`std::fmt::Display`] /
4508/// [`DepList::as_str`] / `{Self, &Self} × {&'static str, String,
4509/// Cow<'static, str>, Box<str>, std::sync::Arc<str>, std::rc::Rc<str>}`
4510/// str-view + reverse-projection surfaces already return — through the
4511/// byte-view axis, which the str-view axes cannot express.
4512///
4513/// The primary compounding target is the same [`crate`]-adjacent
4514/// [`caixa-lacre`](../../caixa-lacre/) BLAKE3 content-address closure
4515/// the peer [`crate::CaixaKind`] (69d8d86) and
4516/// [`crate::dialeto::CaixaDialeto`] (8151347) `AsRef<[u8]>` impls open
4517/// onto: [`blake3::hash`] and [`blake3::Hasher::update`] both bind
4518/// their input through `impl AsRef<[u8]>`, so any future per-caixa
4519/// content-address tag that folds a dep-list discriminator byte-tag
4520/// into the [`crate::Lacre`] closure (a hypothetical
4521/// `hasher.update(list);`-shape composition on the per-caixa BLAKE3
4522/// closure builder that partitions the runtime-closure `:deps` closure
4523/// from the dev-only-closure `:deps-dev` closure at content-address
4524/// time so a downstream `Lacre` consumer can key its per-list build
4525/// cache off the typed discriminator directly rather than the sibling
4526/// `&'static str` wire scalar) reaches the substrate-primitive
4527/// [`DepList::as_str`] accessor through this impl and no other —
4528/// without it, every such call site opens the two-hop composition
4529/// `list.as_str().as_bytes()` whose byte-tail has no compile-time link
4530/// back to the byte-projection axis. Peer consumer paths on the byte-
4531/// view axis: any future [`std::io::Write::write_all`]-bound
4532/// `feira dep census` per-list histogram-column emitter (whose input
4533/// binds through `impl AsRef<[u8]>`), any future byte-keyed
4534/// [`std::collections::HashMap`] `<K: AsRef<[u8]>, V>` per-list tally
4535/// lookup whose entry-key trait bound rules out the sibling
4536/// [`AsRef<str>`] str-view projection, and any future
4537/// `ring::digest::Context::update` / `sha2::Sha256::update` /
4538/// `blake3::Hasher::update` byte-input surface on any future per-list
4539/// content-address digest.
4540///
4541/// Rust's standard library carries `impl AsRef<[u8]> for str` and
4542/// `impl AsRef<[u8]> for String`, so the two-hop composition
4543/// `list.as_str().as_bytes()` (or, equivalently,
4544/// `AsRef::<str>::as_ref(&list).as_bytes()`) is reachable through the
4545/// pre-existing str-view axis alone. But that two-hop shape has no
4546/// compile-time link back to the byte-projection axis, forces every
4547/// downstream `<T: AsRef<[u8]>>`-bound consumer to open-code the two-
4548/// hop composition at every call site rather than pass a [`DepList`]
4549/// through the trait bound directly, and admits a silent split
4550/// whenever a future call site takes the sibling [`std::fmt::Display`]
4551/// or [`From<Self> for String`] axis (whose `.as_bytes()` byte-tails
4552/// byte-equal `as_str`'s by construction but carry no compile-time
4553/// byte-view surface, since `Display` returns a formatter and `String`
4554/// allocates). The lifted single-hop impl closes the byte-view axis so
4555/// every future `<T: AsRef<[u8]>>`-bound consumer reaches the
4556/// substrate primitive through one trait dispatch, and every future
4557/// arm addition (a `:build-dep` third list once the substrate grows
4558/// Cargo-style split-graphs, a `:tool-dep` for build-time-only tooling
4559/// per the peer Cargo `[build-dependencies]` /
4560/// `[target.<cfg>.dev-dependencies]` future admission surface — both
4561/// trajectory items the sibling [`DepList::from_wire`] doc block
4562/// already names) grows the byte-view axis through one edit on the
4563/// substrate-primitive `as_str` accessor, not a coordinated rewrite
4564/// across every future `<T: AsRef<[u8]>>`-bound consumer's arm-set.
4565///
4566/// Extends the trait-idiomatic *byte-view* axis onto the third
4567/// caixa-core-internal closed-set fieldless typed-enum peer on the
4568/// substrate — the two-list dep-graph enum — matching the trajectory
4569/// the sibling [`crate::CaixaKind`] first-mover [`AsRef<[u8]>`] impl
4570/// (69d8d86) and [`crate::dialeto::CaixaDialeto`] second-mover impl
4571/// (8151347) walked before it on the caixa-core tier of the byte-view
4572/// axis, and matching the discipline the paired sibling closed-set
4573/// fieldless typed enums already carry on the peer str-view
4574/// ([`AsRef<str>`]), parse ([`std::str::FromStr`]), and reverse-
4575/// projection (`{Self, &Self} × {&'static str, String,
4576/// Cow<'static, str>, Box<str>, std::sync::Arc<str>, std::rc::Rc<str>}`)
4577/// axes on this same enum. Unlike [`crate::CaixaKind`] — which carries
4578/// a two-axis split ([`crate::CaixaKind::as_str`] returning
4579/// lowercase-Portuguese diagnostic form vs
4580/// [`crate::CaixaKind::wire_name`] returning `PascalCase` tatara-lisp
4581/// author-surface bytes) — [`DepList`] carries a single canonical
4582/// axis: [`DepList::as_str`] returns the `:`-prefixed kebab-case
4583/// tatara-lisp author-surface key ([`crate::render::DEP_AUTHOR_KEY_DEPS`]
4584/// / [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`]), which is
4585/// simultaneously the wire form the paired [`DepList::from_wire`]
4586/// resolver reads back. The byte-view axis therefore lands on the
4587/// same `:`-prefixed kebab byte-string every str-view and reverse-
4588/// projection axis on this enum already returns, and no wire-axis
4589/// cross-witness applies.
4590///
4591/// Pinned load-bearing by
4592/// [`tests::dep_list_as_ref_bytes_routes_through_as_str_accessor`]
4593/// (fail-before-pass-after byte-parity pin against
4594/// [`DepList::as_str`] `.as_bytes()` across the two-arm
4595/// [`DepList::ALL`] emit-set, cross-axis witness against the paired
4596/// str-view [`AsRef<str>`] / [`std::fmt::Display`] /
4597/// [`DepList::as_str`] axes' `.as_bytes()` byte-tails, cross-axis
4598/// witness against the paired reverse-projection
4599/// `{&'static str, String, Cow<'static, str>, Box<str>,
4600/// std::sync::Arc<str>, std::rc::Rc<str>}` return-shape axes'
4601/// `.as_bytes()` byte-tails, a `<T: AsRef<[u8]>>`-bound-consumer
4602/// witness that a generic byte-input function accepts a [`DepList`]
4603/// directly through the trait bound on both owned and borrowed input
4604/// shapes, and a `blake3::Hasher::update`-shape byte-input surface
4605/// witness routed through the `<T: AsRef<[u8]>>`-bound consumer axis
4606/// to reach the caixa-lacre compounding target on both owned and
4607/// borrowed input shapes). Any future silent detour that routes the
4608/// byte-view impl off the substrate-primitive [`DepList::as_str`]
4609/// accessor (a per-arm inline `b":deps".as_slice()`-shaped re-inlining
4610/// that opens a compile-time link to the un-lifted arm-literal, a
4611/// hypothetical un-prefixed bare-kebab byte-string swap that would
4612/// silently collapse the `:`-prefixed tatara-lisp author-surface
4613/// discipline the sibling [`DepList::AUTHOR_KEYS`] doc block
4614/// explicitly pins) trips at caixa-core test time rather than at a
4615/// downstream byte-consumer's silent split.
4616impl AsRef<[u8]> for DepList {
4617    fn as_ref(&self) -> &[u8] {
4618        self.as_str().as_bytes()
4619    }
4620}
4621
4622/// Trait-idiomatic *owned-input, owned-`Vec<u8>` output* byte-owned
4623/// reverse projection on the third caixa-core-internal closed-set
4624/// fieldless typed enum peer ([`DepList`]) — the byte-mirror of the
4625/// [`From<DepList> for String`] str-owned reverse-projection axis and
4626/// the owned-`Vec<u8>` reverse-projection sibling of the paired
4627/// [`AsRef<[u8]>`] borrowed byte-view axis lifted on this same enum.
4628/// Routes byte-for-byte through the substrate-primitive
4629/// [`DepList::as_str`] `pub const fn` accessor via [`str::as_bytes`] +
4630/// [`slice::to_vec`] so every consumer that binds a [`DepList`]
4631/// through the standard-library `impl From<DepList> for Vec<u8>` axis
4632/// (equivalently `<T: Into<Vec<u8>>>`) — a future
4633/// [`std::io::Write::write_all`]-shape per-`:deps` audit-log byte-sink
4634/// whose input parameter is an owned [`Vec<u8>`] payload, a future
4635/// `bytes::Bytes::from(Vec::<u8>::from(list))` composer folding the
4636/// per-arm dep-list discriminator byte-tag into the [`bytes::Bytes`]
4637/// framing surface, a future `hasher.update(&Vec::<u8>::from(list))`-
4638/// shape BLAKE3 content-address closure that needs the owned byte-tail
4639/// buffered before folding into the [`crate::Lacre`] closure body so a
4640/// downstream `Lacre` consumer can partition the runtime-closure
4641/// `:deps` from the dev-only-closure `:deps-dev` at content-address
4642/// time, a future per-dep-list protobuf/CBOR/msgpack payload composer
4643/// whose framer takes an owned [`Vec<u8>`] rather than a borrowed
4644/// byte-slice — reaches the same two-arm lifted
4645/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4646/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] const roster the paired
4647/// [`AsRef<[u8]>`] borrowed byte-view axis, the four
4648/// `{Self, &Self} × {&'static str, String}` 2×2 str-view forward-
4649/// projection corners, the [`std::borrow::Cow<'static, str>`] /
4650/// [`Box<str>`] / [`std::sync::Arc<str>`] / [`std::rc::Rc<str>`] str-
4651/// owned reverse-projection quartet, and the substrate-primitive
4652/// [`DepList::as_str`] accessor already return, rather than an open-
4653/// coded per-call-site `list.as_str().as_bytes().to_vec()` /
4654/// `<DepList as AsRef<[u8]>>::as_ref(&list).to_vec()` /
4655/// `String::from(list).into_bytes()` composition whose type bounds
4656/// have no compile-time link back to the substrate primitive.
4657///
4658/// Third peer on the substrate-wide trait-idiomatic *byte-owned
4659/// reverse-projection* family opened on the sibling top-level
4660/// [`crate::CaixaKind`] enum (b245fd6 first-mover) and extended onto
4661/// [`crate::dialeto::CaixaDialeto`] (4cceaf5 second-mover) — Rust's
4662/// standard library carries `impl From<&[u8]> for Vec<u8>` and
4663/// `impl From<String> for Vec<u8>`, so a two-hop composition
4664/// `list.as_str().as_bytes().to_vec()` (or
4665/// `String::from(list).into_bytes()`, or
4666/// `<DepList as AsRef<[u8]>>::as_ref(&list).to_vec()`) is reachable
4667/// through the pre-existing str-view axes and the paired
4668/// [`AsRef<[u8]>`] borrowed byte-view axis alone. But that two-hop
4669/// shape has no compile-time link back to the byte-owned reverse-
4670/// projection axis, forces every downstream `<T: Into<Vec<u8>>>`-bound
4671/// consumer to open-code the composition at every call site, and
4672/// admits a silent split whenever a future call site takes a sibling
4673/// projection axis whose `into_bytes()` / `to_vec()` byte-tail carries
4674/// no compile-time byte-owned surface. The lifted single-hop impl
4675/// closes the byte-owned reverse-projection axis so every future
4676/// `Vec<u8>`-parameterized consumer reaches the substrate primitive
4677/// through one trait dispatch, and every future arm addition (the
4678/// sibling [`DepList::from_wire`] doc block's `:deps-build` build-only
4679/// dep-list trajectory item and the `[target.<cfg>.dev-dependencies]`
4680/// future admission surface both name) grows the byte-owned axis
4681/// through one edit on the substrate-primitive [`DepList::as_str`]
4682/// accessor.
4683///
4684/// Unlike the sibling first-mover [`crate::CaixaKind`] enum — which
4685/// carries a two-axis split (lowercase-Portuguese diagnostic form vs
4686/// `PascalCase` tatara-lisp author-surface bytes) so its byte-owned
4687/// axis pins a wire-axis rejection witness — [`DepList`] carries a
4688/// single canonical axis: [`DepList::as_str`] returns the `:`-prefixed
4689/// kebab-case tatara-lisp author-surface key
4690/// ([`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4691/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`]), which is
4692/// simultaneously the wire form the paired [`DepList::from_wire`]
4693/// resolver reads back. The byte-owned axis therefore lands on the
4694/// same `:`-prefixed kebab byte-string every str-view / reverse-
4695/// projection / byte-view axis on this enum already returns, and no
4696/// wire-axis cross-witness applies (matching the discipline
4697/// [`crate::dialeto::CaixaDialeto`]'s `From<{Self, &Self}> for Vec<u8>`
4698/// impls established on the caixa-core-internal tier).
4699///
4700/// Extends the byte-owned reverse-projection axis onto the third
4701/// closed-set fieldless typed enum peer on the caixa-core-internal
4702/// tier — every remaining closed-set fieldless typed enum peer on the
4703/// substrate ([`crate::supervisor::RestartStrategy`],
4704/// [`crate::supervisor::RestartPolicy`],
4705/// [`crate::aplicacao::PlacementStrategy`],
4706/// [`crate::aplicacao::RateLimitUnit`], and the outside-`caixa-core`
4707/// peers `WitShape`, `PathShapeViolation`, `InvariantKind`,
4708/// `ArchVerdict`, `Severity`, `FixSafety`, `Semantic`,
4709/// `FerriteRuntime`) is a future target of the campaign, mirroring
4710/// the discipline the paired [`AsRef<[u8]>`] borrowed byte-view axis
4711/// campaign already tracked across every closed-set fieldless typed
4712/// enum peer on the substrate.
4713///
4714/// Pinned load-bearing by
4715/// [`tests::dep_list_from_into_owned_vec_bytes_routes_through_as_str_accessor`]
4716/// (byte-parity pin against [`DepList::as_str`] across the two-arm
4717/// emit-set binding the byte-owned reverse-projection axis against the
4718/// paired [`AsRef<[u8]>`] borrowed byte-view axis and the str-view
4719/// family's `.as_bytes().to_vec()` byte-tails, plus a
4720/// `<T: Into<Vec<u8>>>`-bound generic-consumer witness and a
4721/// `std::io::Write::write_all`-shape owned-byte-sink surface witness
4722/// on both owned and borrowed input shapes).
4723impl From<DepList> for Vec<u8> {
4724    fn from(list: DepList) -> Vec<u8> {
4725        list.as_str().as_bytes().to_vec()
4726    }
4727}
4728
4729/// Trait-idiomatic *borrowed-input, owned-`Vec<u8>` output* byte-owned
4730/// reverse projection on the third caixa-core-internal closed-set
4731/// fieldless typed enum peer ([`DepList`]) — the borrowed-input peer
4732/// of [`From<DepList> for Vec<u8>`], closing the
4733/// `{Self, &Self} → Vec<u8>` pair on the byte-owned reverse-projection
4734/// axis in one lift. Routes byte-for-byte through the substrate-
4735/// primitive [`DepList::as_str`] `pub const fn` accessor so every
4736/// consumer that holds a borrowed [`&DepList`] and needs an owned
4737/// [`Vec<u8>`] — a future `.iter().map(Vec::<u8>::from).collect()`
4738/// pipe over `&[DepList]` (whose iterator yields `&DepList`, not
4739/// `DepList`, so the owned-input axis alone forces every call site
4740/// through an explicit `.copied()` / spurious [`Copy`] deref
4741/// restatement rather than the direct trait-idiomatic projection), a
4742/// future dep-graph audit-report body composer that walks
4743/// [`DepList::ALL`] through an `Into<Vec<u8>>`-bound per-arm byte-
4744/// writer to surface the accepted dep-list set — reaches the same two-
4745/// arm lifted `crate::render::DEP_AUTHOR_KEY_DEPS*` const roster the
4746/// paired owned-input peer already returns.
4747impl From<&DepList> for Vec<u8> {
4748    fn from(list: &DepList) -> Vec<u8> {
4749        list.as_str().as_bytes().to_vec()
4750    }
4751}
4752
4753/// Trait-idiomatic *owned-input, [`std::borrow::Cow<'static, [u8]>`] output*
4754/// byte-owned reverse projection on the third caixa-core-internal closed-set
4755/// fieldless typed enum peer ([`DepList`]) — the [`Cow<'static, [u8]>`]
4756/// companion to the paired owned-input [`From<DepList> for Vec<u8>`] impl
4757/// above on the same primitive, opening the `{Self, &Self} → Cow<'static, [u8]>`
4758/// byte-owned reverse-projection axis on this peer at the owned-input corner.
4759/// Routes byte-for-byte through the substrate-primitive [`DepList::as_str`]
4760/// `pub const fn` accessor via
4761/// [`std::borrow::Cow::Borrowed`]`(list.as_str().as_bytes())` — the two
4762/// `match` arms in [`Self::as_str`] resolve to
4763/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4764/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &'static str` bodies,
4765/// so `.as_bytes()` returns `&'static [u8]` by construction and the zero-alloc
4766/// [`Cow::Borrowed`] arm is reachable without a runtime allocation.
4767///
4768/// Extends the substrate-wide trait-idiomatic byte-owned reverse-projection
4769/// matrix onto the third caixa-core-internal closed-set fieldless typed enum
4770/// peer at the [`Cow<'static, [u8]>`] corner — mirroring the trajectory the
4771/// same axis walked on the structurally most fundamental peer
4772/// [`crate::CaixaKind`] (b3451c8), the M2-OTP-shape supervisor-slot peers
4773/// [`crate::supervisor::RestartStrategy`] (7f81539) /
4774/// [`crate::supervisor::RestartPolicy`] (65f381b), the M3 mesh-primitive-
4775/// defining slot peers [`crate::aplicacao::PlacementStrategy`] (05e4054) /
4776/// [`crate::aplicacao::RateLimitUnit`] (ef00bea) /
4777/// [`crate::aplicacao::WitShape`] (4ae2ad4), and the sibling second-mover
4778/// caixa-core-internal peer [`crate::dialeto::CaixaDialeto`] (92a8777) before
4779/// it. Rust's `From` trait carries no blanket
4780/// `impl<T: AsRef<[u8]>> From<T> for Cow<'static, [u8]>`, so every closed-set
4781/// fieldless typed enum peer that carries the paired [`Vec<u8>`] axis but not
4782/// the [`Cow<'static, [u8]>`] axis forces every
4783/// `Cow<'static, [u8]>`-parameterized call site through an open-coded
4784/// `Cow::Borrowed(list.as_str().as_bytes())` composition whose type bounds
4785/// have no compile-time link back to the substrate primitive.
4786///
4787/// Unlike the sibling first-mover [`crate::CaixaKind`] enum — which carries a
4788/// two-axis split (lowercase-Portuguese diagnostic form vs `PascalCase`
4789/// tatara-lisp author-surface bytes) so its byte-owned axis pins a wire-axis
4790/// rejection witness — [`DepList`] carries a single canonical axis:
4791/// [`DepList::as_str`] returns the `:`-prefixed kebab-case tatara-lisp
4792/// author-surface key ([`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4793/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`]), which is simultaneously the
4794/// wire form the paired [`DepList::from_wire`] resolver reads back. The
4795/// byte-owned axis therefore lands on the same `:`-prefixed kebab byte-string
4796/// every str-view / reverse-projection / byte-view axis on this enum already
4797/// returns, and no wire-axis cross-witness applies (matching the discipline
4798/// [`crate::dialeto::CaixaDialeto`]'s `From<{Self, &Self}> for Cow<'static,
4799/// [u8]>` impls established on the caixa-core-internal tier).
4800///
4801/// Pinned load-bearing by
4802/// [`tests::dep_list_from_into_owned_cow_bytes_routes_through_as_str_accessor`]
4803/// (byte-parity pin against [`DepList::as_str`]`.as_bytes()` across the
4804/// two-arm [`DepList::ALL`] accept-set on both owned and borrowed input
4805/// shapes, plus a [`std::borrow::Cow::Borrowed`] discriminator witness pinning
4806/// the zero-alloc arm, plus cross-axis witnesses against the paired
4807/// [`Vec<u8>`] byte-owned reverse-projection axis, the paired
4808/// [`Cow<'static, str>`] str-owned reverse-projection axis, and the paired
4809/// [`AsRef<[u8]>`] borrowed byte-view axis on the same primitive).
4810impl From<DepList> for std::borrow::Cow<'static, [u8]> {
4811    fn from(list: DepList) -> std::borrow::Cow<'static, [u8]> {
4812        std::borrow::Cow::Borrowed(list.as_str().as_bytes())
4813    }
4814}
4815
4816/// Trait-idiomatic *borrowed-input, [`std::borrow::Cow<'static, [u8]>`] output*
4817/// byte-owned reverse projection on the third caixa-core-internal closed-set
4818/// fieldless typed enum peer ([`DepList`]) — the borrowed-input companion
4819/// to the paired owned-input [`From<DepList> for std::borrow::Cow<'static,
4820/// [u8]>`] impl immediately above, closing the `{Self, &Self} → Cow<'static,
4821/// [u8]>` byte-owned reverse-projection family on this primitive at the
4822/// borrowed-input corner. Routes byte-for-byte through the same substrate-
4823/// primitive [`DepList::as_str`] `pub const fn` accessor via
4824/// [`std::borrow::Cow::Borrowed`]`(list.as_str().as_bytes())` — the
4825/// [`Cow::Borrowed`] arm is reachable on both input axes because
4826/// [`Self::as_str`] returns `&'static str` regardless of the input shape, so
4827/// no runtime allocation is forced on either corner.
4828///
4829/// Rust's `From` trait carries no blanket
4830/// `impl<T> From<&T> for U where U: From<T>` (nor an
4831/// `impl<T: AsRef<[u8]>> From<&T> for Cow<'static, [u8]>`), so every closed-
4832/// set fieldless typed enum peer that carries the paired owned-input axis but
4833/// not the borrowed-input axis forces every borrowed call site through a
4834/// spurious [`Copy`] deref (`Cow::<'static, [u8]>::from(*list)`) or an
4835/// open-coded `Cow::Borrowed(list.as_str().as_bytes())` whose type bounds
4836/// have no compile-time link to the substrate primitive. The borrowed-input
4837/// axis is the one a `DepList::ALL.iter().map(Cow::<'static, [u8]>::from)`
4838/// pipe binds against (its iterator over `&'static [DepList]` yields
4839/// `&DepList`, not `DepList`, so the owned-input axis alone forces every
4840/// such per-arm accept-set materializer through an explicit `.copied()`
4841/// restatement).
4842impl From<&DepList> for std::borrow::Cow<'static, [u8]> {
4843    fn from(list: &DepList) -> std::borrow::Cow<'static, [u8]> {
4844        std::borrow::Cow::Borrowed(list.as_str().as_bytes())
4845    }
4846}
4847
4848/// Trait-idiomatic *owned-input, [`Box<[u8]>`] output* byte-owned reverse
4849/// projection on the third caixa-core-internal closed-set fieldless typed
4850/// enum peer ([`DepList`]) — extends the byte-owned reverse-projection
4851/// matrix onto this primitive at the [`Box<[u8]>`] corner, tracking the
4852/// trajectory the same axis walked on the structurally most fundamental
4853/// first-mover peer [`crate::CaixaKind`] (4f47901), the M2-OTP-shape
4854/// supervisor-slot peers [`crate::supervisor::RestartStrategy`] /
4855/// [`crate::supervisor::RestartPolicy`] (6bc74c9), the M3 mesh-primitive-
4856/// defining slot peers [`crate::aplicacao::PlacementStrategy`] (fb48599) /
4857/// [`crate::aplicacao::RateLimitUnit`] (b22c283) /
4858/// [`crate::aplicacao::WitShape`] (c6fee5c), and the sibling second-mover
4859/// caixa-core-internal peer [`crate::dialeto::CaixaDialeto`] (61f5ecb).
4860/// Routes byte-for-byte through the substrate-primitive [`DepList::as_str`]
4861/// `pub const fn` accessor via [`Box::<[u8]>::from`] on the returned
4862/// `&'static str`'s [`str::as_bytes`] — the two `match` arms in
4863/// [`Self::as_str`] resolve to [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4864/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &'static str`
4865/// bodies, so a downstream [`Box<[u8]>`] consumer (a future admission-
4866/// webhook rejection body binding the two-arm accepted-list enumeration
4867/// through the fit-to-length `Box<[u8]>` slot, a future
4868/// `bytes::Bytes::from(Box<[u8]>)` framer at the mesh-ingest boundary that
4869/// keeps the fit-to-length allocation reachable at the framer's entry
4870/// point) reaches the wire byte-string through this one trait dispatch
4871/// rather than an open-coded per-call-site
4872/// `Box::<[u8]>::from(list.as_str().as_bytes())` composition whose type
4873/// bounds have no compile-time link back to the substrate primitive, or a
4874/// `Box::<[u8]>::from(Vec::<u8>::from(list))` double-hop through the
4875/// sibling [`Vec<u8>`] axis.
4876///
4877/// The [`Box<[u8]>`] slot is the fit-to-length ownership corner of the
4878/// byte-owned family: unlike [`Vec<u8>`] (three-word header carrying a
4879/// heap-slack `cap ≥ len`), [`Box<[u8]>`] carries only a two-word
4880/// `(ptr, len)` fat pointer, so per-arm heap footprint on an accept-set
4881/// interner is `mem::size_of::<usize>() * 2` (16 on `x86_64`) rather than
4882/// `mem::size_of::<usize>() * 3` (24 on `x86_64`), the difference
4883/// [`Vec<u8>`]'s capacity slot forces on every allocation. Downstream
4884/// consumers that already carry `Box<[u8]>` in their public shape (a
4885/// future `bytes::Bytes::from(Box<[u8]>)` framer at the mesh-ingest
4886/// boundary) then reach this primitive without an intermediary
4887/// [`Vec<u8>`] hop.
4888///
4889/// Pinned load-bearing by
4890/// [`tests::dep_list_from_into_owned_box_bytes_routes_through_as_str_accessor`]
4891/// (byte-parity pin against [`DepList::as_str`]`.as_bytes()` across the
4892/// two-arm [`DepList::ALL`] accept-set on both owned and borrowed input
4893/// shapes, fit-to-length length-check witness on both surfaces, plus
4894/// cross-axis witnesses against the paired [`Vec<u8>`] byte-owned axis,
4895/// the paired [`std::borrow::Cow<'static, [u8]>`] byte-owned axis, the
4896/// paired [`Box<str>`] str-owned axis, and the borrowed byte-view
4897/// [`AsRef<[u8]>`] axis on the same primitive).
4898impl From<DepList> for Box<[u8]> {
4899    fn from(list: DepList) -> Box<[u8]> {
4900        Box::<[u8]>::from(list.as_str().as_bytes())
4901    }
4902}
4903
4904/// Trait-idiomatic *borrowed-input, [`Box<[u8]>`] output* byte-owned
4905/// reverse projection on the third caixa-core-internal closed-set
4906/// fieldless typed enum peer ([`DepList`]) — the borrowed-input companion
4907/// to the paired owned-input [`From<DepList> for Box<[u8]>`] impl
4908/// immediately above, closing the `{Self, &Self} → Box<[u8]>` byte-owned
4909/// reverse-projection family on this primitive at the borrowed-input
4910/// corner. Routes byte-for-byte through the same substrate-primitive
4911/// [`DepList::as_str`] `pub const fn` accessor via [`Box::<[u8]>::from`]
4912/// on the returned `&'static str`'s [`str::as_bytes`] byte-view.
4913///
4914/// Rust's `From` trait carries no blanket `impl<T> From<&T> for U where
4915/// U: From<T>`, so every closed-set fieldless typed enum peer that carries
4916/// the paired owned-input axis but not the borrowed-input axis forces
4917/// every borrowed call site through a spurious [`Copy`] deref
4918/// (`Box::<[u8]>::from(*list)`) or an open-coded
4919/// `Box::<[u8]>::from(list.as_str().as_bytes())` whose type bounds have
4920/// no compile-time link to the substrate primitive. The borrowed-input
4921/// axis is the one a `DepList::ALL.iter().map(Box::<[u8]>::from)` pipe
4922/// binds against — its iterator over `&'static [DepList]` yields
4923/// `&DepList`, not `DepList`, so the owned-input axis alone forces every
4924/// per-arm accept-set materializer through an explicit `.copied()`
4925/// restatement.
4926impl From<&DepList> for Box<[u8]> {
4927    fn from(list: &DepList) -> Box<[u8]> {
4928        Box::<[u8]>::from(list.as_str().as_bytes())
4929    }
4930}
4931
4932/// Trait-idiomatic *owned-input, [`std::sync::Arc<[u8]>`] output* byte-owned
4933/// reverse projection on the third caixa-core-internal closed-set fieldless
4934/// typed enum peer ([`DepList`]) — extends the byte-owned reverse-projection
4935/// matrix onto this primitive at the [`std::sync::Arc<[u8]>`] corner,
4936/// tracking the trajectory the same axis walked on the structurally most
4937/// fundamental first-mover peer [`crate::CaixaKind`] (d8872df), the sibling
4938/// second-mover caixa-core-internal peer [`crate::dialeto::CaixaDialeto`]
4939/// (cca8d7c), the M2-OTP-shape supervisor-slot peers
4940/// [`crate::supervisor::RestartStrategy`] (98da8f6) /
4941/// [`crate::supervisor::RestartPolicy`] (bbb78ee), and the M3-mesh-primitive-
4942/// defining slot peers [`crate::aplicacao::PlacementStrategy`] (64cdf90) /
4943/// [`crate::aplicacao::RateLimitUnit`] (e872c77) /
4944/// [`crate::aplicacao::WitShape`] (d2976c2). Routes byte-for-byte through
4945/// the substrate-primitive [`DepList::as_str`] `pub const fn` accessor via
4946/// [`std::sync::Arc::<[u8]>::from`] on the returned `&'static str`'s
4947/// [`str::as_bytes`] — the two `match` arms in [`Self::as_str`] resolve to
4948/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
4949/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &'static str`
4950/// bodies, so `.as_bytes()` returns `&'static [u8]` by construction and the
4951/// standard-library [`std::sync::Arc::<[u8]>::from(&[u8])`] impl allocates
4952/// an atomically-refcounted heap slab whose header carries the strong +
4953/// weak counters the [`std::sync::Arc<[u8]>`] layout requires in one heap
4954/// allocation without an intermediary [`Vec<u8>`] or [`Box<[u8]>`].
4955///
4956/// A future [`std::sync::Arc<[u8]>`]-typed consumer on a [`DepList`] — a
4957/// future M4 admission-webhook per-request `:deps` / `:deps-dev` partition-
4958/// tag byte-tail fanned out across a `tokio::spawn`ed worker pool through
4959/// pointer-width [`std::sync::Arc::clone`] handles (an atomic refcount bump,
4960/// cheaper than a fresh [`Box<[u8]>`] allocation on hot per-reconcile-tick
4961/// call sites), a future thread-safe
4962/// `HashMap::<std::sync::Arc<[u8]>, _>::from_iter` per-partition lookup
4963/// keyed by the wire byte-tail across the lacre closure's per-file fan-out
4964/// cache, a future `Send`-bound audit-report emitter that ships the wire
4965/// byte-string across a channel through the [`std::sync::Arc<[u8]>`] slot —
4966/// reaches the wire byte-string through this one dispatch, without the
4967/// pre-lift `Box::<[u8]>::from(list).into()` or
4968/// `Arc::<[u8]>::from(Vec::<u8>::from(list))` double-hop that would still
4969/// allocate the same [`Arc<[u8]>`] slab plus one intermediary [`Box<[u8]>`]
4970/// or [`Vec<u8>`] between the enum peer and the [`std::sync::Arc<[u8]>`]
4971/// slot.
4972///
4973/// Rust's standard library does not derive `From<Self> for Arc<[u8]>` from
4974/// `From<Self> for Box<[u8]>` (nor from `From<Self> for Vec<u8>`), so every
4975/// closed-set fieldless typed enum peer that carries the paired
4976/// [`Box<[u8]>`] axis but not the paired [`Arc<[u8]>`] axis forces every
4977/// [`Arc<[u8]>`]-typed call site through a `Box::<[u8]>::from(list).into()`
4978/// / `Arc::<[u8]>::from(Vec::<u8>::from(list))` intermediary allocation
4979/// whose bounds carry no compile-time link back to the substrate primitive.
4980///
4981/// Pinned load-bearing by
4982/// [`tests::dep_list_from_into_owned_arc_bytes_routes_through_as_str_accessor`]
4983/// (byte-parity pin against [`DepList::as_str`]`.as_bytes()` across the
4984/// two-arm [`DepList::ALL`] accept-set on both owned and borrowed input
4985/// shapes, fit-to-length length-check witness on both surfaces, plus
4986/// cross-axis witnesses against the paired [`Vec<u8>`],
4987/// [`std::borrow::Cow<'static, [u8]>`], [`Box<[u8]>`] byte-owned axes, the
4988/// paired [`std::sync::Arc<str>`] str-side axis, and the borrowed byte-view
4989/// [`AsRef<[u8]>`] axis on the same primitive).
4990impl From<DepList> for std::sync::Arc<[u8]> {
4991    fn from(list: DepList) -> std::sync::Arc<[u8]> {
4992        std::sync::Arc::<[u8]>::from(list.as_str().as_bytes())
4993    }
4994}
4995
4996/// Trait-idiomatic *borrowed-input, [`std::sync::Arc<[u8]>`] output* byte-
4997/// owned reverse projection on the third caixa-core-internal closed-set
4998/// fieldless typed enum peer ([`DepList`]) — the borrowed-input companion
4999/// to the paired owned-input [`From<DepList> for std::sync::Arc<[u8]>`]
5000/// impl immediately above, closing the `{Self, &Self} → std::sync::Arc<[u8]>`
5001/// byte-owned reverse-projection family on this primitive at the borrowed-
5002/// input corner in one lift. Routes byte-for-byte through the same
5003/// substrate-primitive [`DepList::as_str`] `pub const fn` accessor via
5004/// [`std::sync::Arc::<[u8]>::from`] on the returned `&'static str`'s
5005/// [`str::as_bytes`] — the [`std::sync::Arc<[u8]>`] allocation happens on
5006/// both input axes because [`Self::as_str`] returns `&'static str`
5007/// regardless of the input shape, so the borrowed-input peer reaches the
5008/// same wire byte-string through the same one-heap-allocation path the
5009/// owned-input peer already carries.
5010///
5011/// Rust's `From` trait carries no blanket `impl<T> From<&T> for U where
5012/// U: From<T>` (nor a `Copy`-based `impl<T: Copy, U: From<T>> From<&T>
5013/// for U`), so every closed-set fieldless typed enum peer that carries the
5014/// paired owned-input [`std::sync::Arc<[u8]>`] axis but not the borrowed-
5015/// input axis forces every borrowed call site through a spurious [`Copy`]
5016/// deref (`std::sync::Arc::<[u8]>::from(*list)`) or an open-coded
5017/// `std::sync::Arc::<[u8]>::from(list.as_str().as_bytes())` whose type
5018/// bounds have no compile-time link to the substrate primitive. The
5019/// borrowed-input axis is the one a
5020/// `DepList::ALL.iter().map(std::sync::Arc::<[u8]>::from)` pipe binds
5021/// against (its iterator over `&'static [DepList]` yields `&DepList`, not
5022/// `DepList`), so the owned-input axis alone forces every such per-arm
5023/// accept-set materializer through an explicit `.copied()` restatement.
5024impl From<&DepList> for std::sync::Arc<[u8]> {
5025    fn from(list: &DepList) -> std::sync::Arc<[u8]> {
5026        std::sync::Arc::<[u8]>::from(list.as_str().as_bytes())
5027    }
5028}
5029
5030/// Trait-idiomatic *owned-input, [`std::rc::Rc<[u8]>`] output* byte-owned
5031/// reverse projection on the third caixa-core-internal closed-set fieldless
5032/// typed enum peer ([`DepList`]) — the single-threaded-refcounted byte-slice
5033/// mirror of the paired owned-input [`From<DepList> for std::rc::Rc<str>`]
5034/// impl on the string-side reverse-projection matrix, and the fifth (and
5035/// final) axis on the byte-side reverse-projection matrix that already
5036/// carries [`From<DepList> for Vec<u8>`],
5037/// [`From<DepList> for std::borrow::Cow<'static, [u8]>`] (c817930),
5038/// [`From<DepList> for Box<[u8]>`] (1e14c64), and
5039/// [`From<DepList> for std::sync::Arc<[u8]>`] (bdaf405). Routes byte-for-
5040/// byte through the substrate-primitive [`DepList::as_str`] `pub const fn`
5041/// accessor via [`std::rc::Rc::<[u8]>::from`] on the returned `&'static
5042/// str`'s [`str::as_bytes`] — the two `match` arms in [`Self::as_str`]
5043/// resolve to the [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
5044/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &'static str`
5045/// bodies, so `.as_bytes()` returns `&'static [u8]` by construction, and
5046/// the standard-library [`std::rc::Rc::<[u8]>::from(&[u8])`] impl allocates
5047/// a fresh single-threaded-refcounted heap slab whose header carries the
5048/// non-atomic strong-and-weak counters the [`std::rc::Rc<[u8]>`] layout
5049/// requires in one heap allocation without an intermediary [`Vec<u8>`],
5050/// [`Box<[u8]>`], or [`std::sync::Arc<[u8]>`].
5051///
5052/// A future [`std::rc::Rc<[u8]>`]-typed consumer on a [`DepList`] — a
5053/// single-threaded `feira lock` per-file per-caixa `:deps` / `:deps-dev`
5054/// partitioning byte-tail carried through a chain of Nord-themed
5055/// diagnostic emitters via the pointer-width [`std::rc::Rc::clone`] handle
5056/// (a non-atomic refcount bump, cheaper than the paired atomic increment
5057/// on the sibling [`std::sync::Arc<[u8]>`] axis by a measurable margin on
5058/// hot single-threaded call sites), a future single-threaded
5059/// `HashMap::<std::rc::Rc<[u8]>, _>::from_iter` per-partition lookup keyed
5060/// by the wire byte-string across the lacre closure's per-caixa
5061/// dependency-classification cache, a future non-`Send` `feira lint` audit
5062/// emitter that materializes decoded `:deps` / `:deps-dev` partition-tag
5063/// bytes as [`std::rc::Rc<[u8]>`] slices so downstream single-threaded
5064/// diagnostic sinks share the immutable byte-tail without a per-consumer
5065/// [`Vec::<u8>::clone`] — reaches the wire byte-string through this one
5066/// dispatch, without the pre-lift `Box::<[u8]>::from(list).into()` or
5067/// `Rc::<[u8]>::from(Vec::<u8>::from(list))` double-hop that would still
5068/// allocate the same [`Rc<[u8]>`] slab plus one intermediary [`Box<[u8]>`]
5069/// or [`Vec<u8>`] between the enum peer and the [`std::rc::Rc<[u8]>`]
5070/// slot.
5071///
5072/// Rust's standard library does not derive `From<Self> for Rc<[u8]>` from
5073/// `From<Self> for Arc<[u8]>` (the two layouts share the same on-disk
5074/// shape but the trait tables are disjoint, and no blanket
5075/// `impl<T> From<T> for Rc<[u8]> where Arc<[u8]>: From<T>` exists in
5076/// `core`), so every closed-set fieldless typed enum peer that carries the
5077/// paired [`Arc<[u8]>`] axis but not the paired [`Rc<[u8]>`] axis forces
5078/// every single-threaded [`Rc<[u8]>`]-typed call site through a
5079/// `Arc::<[u8]>::from(list).into()` /
5080/// `Rc::<[u8]>::from(Vec::<u8>::from(list))` double-allocation detour
5081/// whose bounds carry no compile-time link back to the substrate primitive.
5082///
5083/// Closes the trait-idiomatic *owned-input* byte-family reverse-projection
5084/// matrix on the third caixa-core-internal closed-set fieldless typed enum
5085/// peer at the [`std::rc::Rc<[u8]>`] corner — completing the full
5086/// `{Vec<u8>, Cow<'static, [u8]>, Box<[u8]>, Arc<[u8]>, Rc<[u8]>}` five-
5087/// corner partition on [`DepList`], mirroring the trajectory the same axis
5088/// walked on the sibling second-mover caixa-core-internal peer
5089/// [`crate::dialeto::CaixaDialeto`] (ae5577b closed its Rc<[u8]> corner),
5090/// on the sibling third M3-mesh-primitive-defining
5091/// [`crate::aplicacao::WitShape`] peer (5569794), on the sibling second
5092/// M3-mesh-primitive-defining [`crate::aplicacao::RateLimitUnit`] peer
5093/// (15d22b1), on the sibling first M3-mesh-primitive-defining
5094/// [`crate::aplicacao::PlacementStrategy`] peer (3d8170c), on the sibling
5095/// [`crate::CaixaKind`] structurally most fundamental closed-set fieldless
5096/// typed-enum peer (db8dcc2), and on the M2-OTP-shape
5097/// [`crate::supervisor::RestartStrategy`] (2620e42) and
5098/// [`crate::supervisor::RestartPolicy`] (6848c05) peers.
5099///
5100/// Pinned load-bearing by
5101/// [`tests::dep_list_from_into_owned_rc_bytes_routes_through_as_str_accessor`]
5102/// (byte-parity pin against [`DepList::as_str`]`.as_bytes()` across the
5103/// two-arm [`DepList::ALL`] accept-set on both owned and borrowed input
5104/// shapes, fit-to-length length-check witness on both surfaces, plus
5105/// cross-axis witnesses against the paired [`Vec<u8>`],
5106/// [`std::borrow::Cow<'static, [u8]>`], [`Box<[u8]>`],
5107/// [`std::sync::Arc<[u8]>`] byte-owned axes, the paired
5108/// [`std::rc::Rc<str>`] str-side axis, and the borrowed byte-view
5109/// [`AsRef<[u8]>`] axis on the same primitive).
5110impl From<DepList> for std::rc::Rc<[u8]> {
5111    fn from(list: DepList) -> std::rc::Rc<[u8]> {
5112        std::rc::Rc::<[u8]>::from(list.as_str().as_bytes())
5113    }
5114}
5115
5116/// Trait-idiomatic *borrowed-input, [`std::rc::Rc<[u8]>`] output* byte-
5117/// owned reverse projection on the third caixa-core-internal closed-set
5118/// fieldless typed enum peer ([`DepList`]) — the borrowed-input companion
5119/// to the paired owned-input [`From<DepList> for std::rc::Rc<[u8]>`] impl
5120/// immediately above, closing the `{Self, &Self} → std::rc::Rc<[u8]>`
5121/// byte-owned reverse-projection family on this primitive at the
5122/// borrowed-input corner in one lift. Routes byte-for-byte through the
5123/// same substrate-primitive [`DepList::as_str`] `pub const fn` accessor
5124/// via [`std::rc::Rc::<[u8]>::from`] on the returned `&'static str`'s
5125/// [`str::as_bytes`] — the [`std::rc::Rc<[u8]>`] allocation happens on
5126/// both input axes because [`Self::as_str`] returns `&'static str`
5127/// regardless of the input shape, so the borrowed-input peer reaches the
5128/// same wire byte-string through the same one-heap-allocation path the
5129/// owned-input peer already carries.
5130///
5131/// Rust's `From` trait carries no blanket `impl<T> From<&T> for U where
5132/// U: From<T>` (nor a `Copy`-based `impl<T: Copy, U: From<T>> From<&T>
5133/// for U`), so every closed-set fieldless typed enum peer that carries
5134/// the paired owned-input [`std::rc::Rc<[u8]>`] axis but not the
5135/// borrowed-input axis forces every borrowed call site through a spurious
5136/// [`Copy`] deref (`std::rc::Rc::<[u8]>::from(*list)`) or an open-coded
5137/// `std::rc::Rc::<[u8]>::from(list.as_str().as_bytes())` whose type
5138/// bounds have no compile-time link to the substrate primitive. The
5139/// borrowed-input axis is the one a
5140/// `DepList::ALL.iter().map(std::rc::Rc::<[u8]>::from)` pipe binds against
5141/// (its iterator over `&'static [DepList]` yields `&DepList`, not
5142/// `DepList`), so the owned-input axis alone forces every such per-arm
5143/// accept-set materializer through an explicit `.copied()` restatement.
5144impl From<&DepList> for std::rc::Rc<[u8]> {
5145    fn from(list: &DepList) -> std::rc::Rc<[u8]> {
5146        std::rc::Rc::<[u8]>::from(list.as_str().as_bytes())
5147    }
5148}
5149
5150/// Trait-idiomatic *borrowed byte-slice input* reverse projection on the
5151/// third caixa-core-internal closed-set fieldless typed enum peer
5152/// ([`DepList`]) — the byte-view mirror of the str-view reverse-projection
5153/// axis carried by the paired [`TryFrom<&str> for DepList`] impl (which
5154/// routes through the substrate-primitive [`DepList::from_wire`]
5155/// `Option<Self>` accessor on the two-arm `:`-prefixed kebab-case accept-
5156/// set the sibling [`DepList::as_str`] emitter returns —
5157/// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
5158/// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`]). Routes byte-for-byte
5159/// through the standard-library [`std::str::from_utf8`] UTF-8 validator
5160/// and then through [`DepList::from_wire`] so every consumer that holds a
5161/// borrowed [`&[u8]`] and needs to project it back into a typed
5162/// [`DepList`] — a future `bytes::Bytes::as_ref()`-fed reader that parses
5163/// a per-caixa `:deps` / `:deps-dev` classification tag from an already-
5164/// borrowed framing byte-tail (a `tracing::field::valuable::Value::Bytes`
5165/// recorder on the caixa-lacre `:deps` / `:deps-dev` partitioning
5166/// pipeline, a future audit-report re-loader binding a prior
5167/// [`DepList::as_str`] output from an mmap'd byte-slice back through the
5168/// typed enum for cross-run comparison), a future admission-webhook
5169/// rejection body that reads a `spec.dep_list` field off a raw HTTP body
5170/// byte-slice before UTF-8 validation commits allocation, a future
5171/// generic `<T: for<'a> TryFrom<&'a [u8]>>`-bound loader over any of the
5172/// substrate's closed-set typed enums — reaches the same two-arm
5173/// `:`-prefixed kebab-case wire accept-set the sibling method-named
5174/// [`DepList::from_wire`] resolver and the paired trait-idiomatic
5175/// [`TryFrom<&str>`] axis already resolve against, rather than an open-
5176/// coded per-call-site
5177/// `std::str::from_utf8(bytes).ok().and_then(DepList::from_wire)`
5178/// composition or a
5179/// `<DepList as TryFrom<&str>>::try_from(std::str::from_utf8(bytes)?)`
5180/// two-hop shape whose type bounds have no compile-time link to the
5181/// substrate primitive.
5182///
5183/// Extends the substrate-wide trait-idiomatic *byte-view reverse-
5184/// projection* family — opened on the structurally most fundamental
5185/// closed-set fieldless typed enum peer ([`crate::CaixaKind`], commit
5186/// 18d1940) and extended onto [`crate::dialeto::CaixaDialeto`] (d102cb8
5187/// second-mover) — onto the third caixa-core-internal closed-set
5188/// fieldless typed enum peer, tracking the "route through `from_wire` via
5189/// `std::str::from_utf8`" discipline the first-mover established. Rust's
5190/// standard library carries no blanket
5191/// `impl<T: for<'a> TryFrom<&'a str>> TryFrom<&[u8]> for T`, so a two-hop
5192/// composition through [`std::str::from_utf8`] + the paired
5193/// [`TryFrom<&str>`] axis is reachable at every call site but has no
5194/// compile-time link back to the byte-view reverse-projection axis. Every
5195/// future closed-set fieldless typed enum peer on the substrate
5196/// ([`crate::supervisor::RestartStrategy`],
5197/// [`crate::supervisor::RestartPolicy`],
5198/// [`crate::aplicacao::PlacementStrategy`],
5199/// [`crate::aplicacao::RateLimitUnit`], [`crate::aplicacao::WitShape`],
5200/// and the outside-`caixa-core` peers `PathShapeViolation`,
5201/// `InvariantKind`, `ArchVerdict`, `Severity`, `FixSafety`, `Semantic`,
5202/// `FerriteRuntime`) is a future target of the campaign, mirroring the
5203/// trajectory the closed byte-owned reverse-projection family walked
5204/// arm-by-arm onto each peer.
5205///
5206/// `type Error = ()` matches the sibling [`DepList::from_wire`]'s
5207/// `Option<Self>` return-shape's deliberate deferral of error typing and
5208/// the paired trait-idiomatic [`TryFrom<&str>`] axis's unit-error shape —
5209/// the caller picks the diagnostic form appropriate for its use site (a
5210/// future `feira dep --list <deps|deps-dev>` arg-parse composes its own
5211/// per-verb "unknown list: <arg> — accepted: {…}" message enumerating
5212/// [`DepList::ALL`]; the M4 admission-webhook rejection body wraps
5213/// `Err(())` with the accepted-set enumeration for operator diagnostics;
5214/// a `Result::map_err` at the call site lifts the unit-error to a per-
5215/// verb error type). Two rejection paths route through the single unit-
5216/// error: an invalid UTF-8 byte-sequence ([`std::str::from_utf8`] returns
5217/// `Err`) and a valid UTF-8 byte-string that falls outside the two-arm
5218/// `:`-prefixed kebab-case accept-set ([`DepList::from_wire`] returns
5219/// `None`) — both collapse onto `Err(())` so the trait signature stays
5220/// consistent with the sibling str-view reverse axis, and a caller that
5221/// needs to distinguish the two failure modes composes
5222/// [`std::str::from_utf8`] + [`DepList::from_wire`] explicitly.
5223///
5224/// Pinned load-bearing by
5225/// [`tests::dep_list_try_from_bytes_routes_through_from_wire_accessor`]
5226/// (byte-parity pin against [`DepList::from_wire`] across the two-arm
5227/// [`DepList::ALL`] accept-set on the borrowed byte-slice surface, plus a
5228/// cross-axis witness that the byte-view reverse projection agrees with
5229/// the paired [`TryFrom<&str>`] str-view reverse axis on every accepted
5230/// arm) and
5231/// [`tests::dep_list_try_from_bytes_rejects_unknown_and_non_utf8_bytes`]
5232/// (rejection witness against silent accept-set widening on both the
5233/// non-UTF-8 byte-sequence rejection path and the unknown-wire-vocabulary
5234/// rejection path).
5235impl TryFrom<&[u8]> for DepList {
5236    type Error = ();
5237
5238    fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
5239        std::str::from_utf8(bytes)
5240            .ok()
5241            .and_then(Self::from_wire)
5242            .ok_or(())
5243    }
5244}
5245
5246/// Trait-idiomatic *owned byte-vec input* reverse projection on the
5247/// third caixa-core-internal closed-set fieldless typed enum peer
5248/// ([`DepList`]) — the owned-input peer of
5249/// [`TryFrom<&[u8]> for DepList`], mirroring the closed
5250/// [`From<DepList> for Vec<u8>`] + [`From<&DepList> for Vec<u8>`]
5251/// byte-owned *forward*-projection pair on this same enum onto the
5252/// byte-owned *reverse*-projection axis. Routes byte-for-byte through
5253/// [`<Self as TryFrom<&[u8]>>::try_from`] on the [`Vec<u8>::as_slice`]
5254/// borrow, so the owned-input surface reaches the same
5255/// [`std::str::from_utf8`] + [`DepList::from_wire`] resolution chain
5256/// the borrowed-input peer already carries — one substrate-primitive
5257/// accessor, one trait dispatch, no per-consumer detour.
5258///
5259/// Rust's standard library carries no blanket
5260/// `impl<T: for<'a> TryFrom<&'a [u8]>> TryFrom<Vec<u8>> for T`, so a
5261/// consumer that holds an owned [`Vec<u8>`] and needs a typed
5262/// [`DepList`] otherwise picks between (a) an open-coded
5263/// `<DepList as TryFrom<&[u8]>>::try_from(bytes.as_slice())` at every
5264/// call site (whose type bounds have no compile-time link to the byte-
5265/// owned reverse-projection axis), (b) a two-hop
5266/// `String::from_utf8(bytes)` + [`DepList::from_wire`] composition
5267/// whose error surface leaks the standard-library [`std::string::FromUtf8Error`]
5268/// (widening the sibling [`TryFrom<&[u8]>`] axis's unit-error) and
5269/// silently allocates a [`String`] on inputs that will never make it
5270/// past the wire vocabulary, or (c) an intermediate
5271/// `<DepList as TryFrom<&str>>::try_from(std::str::from_utf8(&bytes)?)`
5272/// three-hop shape. This impl closes the owned-byte-vec reverse-
5273/// projection axis at the substrate-primitive
5274/// [`DepList::from_wire`] accessor so every future
5275/// `<T: TryFrom<Vec<u8>>>`-bound owned-byte-vec consumer — a future
5276/// admission-webhook body reader that hands raw request bytes off as
5277/// a [`Vec<u8>`] before UTF-8 validation commits, a future
5278/// `std::io::Read::read_to_end`-shape audit-log source whose framing
5279/// yields an owned byte-vec per frame, a future protobuf/CBOR/msgpack
5280/// per-field decoder whose bytes arm surfaces an owned [`Vec<u8>`]
5281/// before dispatch, a `bytes::Bytes::to_vec()`-shape wire-body
5282/// composer walking a prior audit's payload back to the typed enum,
5283/// an `<T: TryFrom<Vec<u8>>>`-bound generic loader over any of the
5284/// substrate's closed-set typed enums — reaches the same two-arm
5285/// `:`-prefixed kebab-case wire accept-set through one trait dispatch.
5286///
5287/// Extends the substrate-wide trait-idiomatic *byte-owned reverse-
5288/// projection* family onto the third caixa-core-internal closed-set
5289/// fieldless typed enum peer, tracking the trajectory the sibling
5290/// first-mover [`TryFrom<Vec<u8>> for crate::CaixaKind`] (99c2849)
5291/// opened on the structurally most fundamental enum and the sibling
5292/// second-mover [`TryFrom<Vec<u8>> for crate::CaixaDialeto`] (83a1526)
5293/// continued through. Peer of the sibling closed byte-view reverse-
5294/// projection family (`TryFrom<&[u8]>`; extended onto this enum
5295/// b8f25d5) and of the closed byte-owned forward-projection family
5296/// (`From<{Self, &Self}> for Vec<u8>`; extended onto this enum on the
5297/// same commit as its `TryFrom<&[u8]>` peer) on this same enum — the
5298/// {owned-input, borrowed-input} × {owned-output byte-vec, borrowed-
5299/// output byte-slice} byte-view reverse-projection square now closes
5300/// on [`DepList`].
5301///
5302/// `type Error = ()` matches the sibling [`TryFrom<&[u8]> for DepList`]
5303/// unit-error shape, preserving the trait-family consistency across
5304/// the borrowed-and-owned byte-view reverse-projection pair. Both
5305/// rejection paths (invalid UTF-8, valid-UTF-8-but-unknown-wire)
5306/// collapse onto `Err(())` through the delegated borrowed axis.
5307/// The owned [`Vec<u8>`] input is dropped on the error path (the
5308/// standard-library `String::from_utf8` convention of returning the
5309/// input in the error deliberately declined — a caller that needs
5310/// the bytes back holds a clone before the call, and the closed-set-
5311/// enum use site rarely wants the raw bytes back past a "did you
5312/// mean" diagnostic that operates on the wire vocabulary rather than
5313/// the input).
5314///
5315/// Like the peer [`TryFrom<Vec<u8>> for crate::CaixaDialeto`] and
5316/// unlike [`TryFrom<Vec<u8>> for crate::CaixaKind`] (which carries a
5317/// wire-vs-diagnostic two-axis split — lowercase Portuguese
5318/// `as_str` vs `PascalCase` `wire_name`), [`DepList`] has no such
5319/// split: [`Self::as_str`] and [`Self::from_wire`] operate on the
5320/// same two-arm `:`-prefixed kebab-case byte-vocabulary
5321/// (`":deps"`, `":deps-dev"`). So on this enum the byte-owned reverse-
5322/// projection axis *can* round-trip against the paired byte-owned
5323/// forward-projection pair ([`From<DepList> for Vec<u8>`],
5324/// [`From<&DepList> for Vec<u8>`]) — a four-corner witness the pinned
5325/// load-bearing test makes explicit, and a witness the sibling
5326/// [`TryFrom<Vec<u8>> for crate::CaixaKind`] axis deliberately
5327/// declines.
5328///
5329/// Pinned load-bearing by
5330/// [`tests::dep_list_try_from_vec_bytes_routes_through_borrowed_byte_view_axis`]
5331/// (byte-parity pin against the paired borrowed [`TryFrom<&[u8]>`]
5332/// axis across the two-arm [`DepList::ALL`] accept-set on the owned
5333/// byte-vec surface, plus a cross-axis witness that the byte-owned
5334/// reverse projection agrees with the paired str-view reverse-
5335/// projection axis ([`TryFrom<&str>`]) on every accepted arm through
5336/// the shared substrate-primitive [`DepList::from_wire`] accessor,
5337/// plus a four-corner {owned-input, borrowed-input} × {owned-output
5338/// byte-vec, borrowed-output byte-slice} round-trip witness against
5339/// the paired [`From<{Self, &Self}> for Vec<u8>`] byte-owned forward-
5340/// projection pair) and
5341/// [`tests::dep_list_try_from_vec_bytes_rejects_unknown_and_non_utf8_bytes`]
5342/// (rejection witness against silent accept-set widening on both the
5343/// non-UTF-8 byte-sequence rejection path and the unknown-wire-
5344/// vocabulary rejection path, plus a cross-axis witness that the
5345/// owned byte-vec reverse-projection axis agrees with the borrowed
5346/// byte-slice reverse-projection axis on every rejected input).
5347impl TryFrom<Vec<u8>> for DepList {
5348    type Error = ();
5349
5350    fn try_from(bytes: Vec<u8>) -> Result<Self, Self::Error> {
5351        <Self as TryFrom<&[u8]>>::try_from(bytes.as_slice())
5352    }
5353}
5354
5355/// Trait-idiomatic *owned-`String` input, `Result<Self, ()>` output*
5356/// string-owned reverse projection on the third caixa-core-internal
5357/// closed-set fieldless typed enum peer ([`DepList`]) — the owned-
5358/// input peer of the paired [`TryFrom<&str> for DepList`] str-view
5359/// reverse-projection axis (which routes through the substrate-
5360/// primitive [`DepList::from_wire`] `Option<Self>` accessor on the
5361/// two-arm `:`-prefixed kebab-case accept-set the sibling
5362/// [`DepList::as_str`] emitter returns), and the string-owned reverse
5363/// companion of the pre-existing string-owned *forward*-projection
5364/// pair ([`From<DepList> for String`] / [`From<&DepList> for String`])
5365/// already lifted on this same enum. Routes owned [`String`] input
5366/// byte-for-byte through the paired borrowed-input [`TryFrom<&str>`]
5367/// axis via [`String::as_str`], so every consumer that holds an owned
5368/// [`String`] and needs a typed [`DepList`] — a future M4
5369/// `mesh.pleme.io/v1alpha1/Caixa` CR admission-webhook body reader
5370/// that hands a per-manifest `spec.deps`/`spec.deps-dev` scalar off as
5371/// an owned [`String`] after UTF-8 validation commits allocation, a
5372/// `serde_yaml::from_str` / `serde_json::from_str` de-serialize
5373/// composer that surfaces the two-list dep-graph author-surface
5374/// scalar as an owned [`String`] typed field, a future
5375/// `feira dep --list <deps|deps-dev>` `clap`-derived arg-parse whose
5376/// owned-`String` positional lands the canonical arm at the typed
5377/// dispatch, a per-caixa overlay resolver reading an owned [`String`]
5378/// out of a `ConfigMap` `data.dep-list` scalar, an
5379/// `<T: TryFrom<String>>`-bound generic loader over any of the
5380/// substrate's closed-set typed enums — reaches the same two-arm
5381/// `:`-prefixed kebab-case wire accept-set through one trait
5382/// dispatch off the shared [`DepList::from_wire`] substrate primitive.
5383///
5384/// Closes the substrate-wide trait-idiomatic *string-owned reverse-
5385/// projection* family on the caixa-core-internal closed-set peer
5386/// census — opened on the compound M3-mesh `:politicas :rate-limit`
5387/// primitive [`crate::aplicacao::RateLimit`] (a2e6f02), lifted onto
5388/// the first closed-set fieldless typed-enum peer
5389/// [`crate::aplicacao::WitShape`] (e6aac29), extended onto the second
5390/// closed-set fieldless typed-enum peer
5391/// [`crate::aplicacao::RateLimitUnit`] (94a9c5e), extended onto the
5392/// third closed-set fieldless typed-enum peer
5393/// [`crate::aplicacao::PlacementStrategy`] (d81a70a), extended onto
5394/// the first M2-OTP-shape supervisor-slot closed-set fieldless typed-
5395/// enum peer [`crate::supervisor::RestartStrategy`] (78fe8c8), closed
5396/// on the M2-OTP-shape supervisor-slot pair by
5397/// [`crate::supervisor::RestartPolicy`] (35dea5a), extended onto the
5398/// structurally most fundamental caixa-core enum peer
5399/// [`crate::CaixaKind`] (e7df24f), and extended onto the second
5400/// caixa-core-internal closed-set fieldless typed-enum peer
5401/// [`crate::CaixaDialeto`] (9e07f5c) — onto the third and last
5402/// caixa-core-internal closed-set fieldless typed-enum peer, the
5403/// outer-`Caixa` two-list dep-graph discriminator. This mirrors the
5404/// trajectory the byte-view (b8f25d5) / byte-owned (42091cb) / str-
5405/// view reverse-projection families already walked on this same enum.
5406///
5407/// Rust's standard library carries no blanket
5408/// `impl<T: for<'a> TryFrom<&'a str>> TryFrom<String> for T`, so a
5409/// consumer that holds an owned [`String`] and needs a typed
5410/// [`DepList`] otherwise picks between (a) an open-coded
5411/// `<DepList as TryFrom<&str>>::try_from(s.as_str())` at every call
5412/// site whose type bounds have no compile-time link back to the
5413/// string-owned reverse-projection axis, (b) a `let s: &str = &s;
5414/// DepList::try_from(s)` two-step whose borrow arithmetic leaks a
5415/// per-call-site lifetime dance rather than a single trait dispatch,
5416/// or (c) a `String::into_bytes` + [`TryFrom<Vec<u8>>`] detour that
5417/// reaches the substrate-primitive `from_wire` accessor through a
5418/// UTF-8 re-validation hop the owned-`String` axis already knows to
5419/// skip. This impl closes the string-owned reverse-projection axis
5420/// at the substrate-primitive [`DepList::from_wire`] accessor so
5421/// every future `<T: TryFrom<String>>`-bound owned-string consumer
5422/// reaches the same two-arm `:`-prefixed kebab-case accept-set
5423/// through one trait dispatch.
5424///
5425/// `type Error = ()` matches the sibling [`TryFrom<&str> for DepList`],
5426/// [`TryFrom<&[u8]> for DepList`], and [`TryFrom<Vec<u8>> for DepList`]
5427/// unit-error shapes, preserving the trait-family consistency across
5428/// the {str-view, byte-view, byte-owned, string-owned} reverse-
5429/// projection square. The owned [`String`] input is dropped on the
5430/// error path (the standard-library `String::from_utf8` convention of
5431/// returning the input in the error deliberately declined — a caller
5432/// that needs the string back holds a clone before the call, and the
5433/// closed-set-enum use site rarely wants the raw string back past a
5434/// "did you mean" diagnostic that operates on the wire vocabulary
5435/// rather than the input).
5436///
5437/// Unlike the peer [`crate::CaixaKind`] axis (whose paired string-
5438/// owned *forward* projection ([`From<crate::CaixaKind> for String`])
5439/// emits lowercase Portuguese diagnostic bytes while its reverse axis
5440/// parses `PascalCase` wire bytes — the two-axis wire/diagnostic
5441/// split forces the closed-cycle round-trip witness to cross through
5442/// [`crate::CaixaKind::wire_name`]), [`DepList`] carries exactly one
5443/// author-facing `:`-prefixed kebab-case axis (the [`DepList::as_str`]
5444/// and [`DepList::from_wire`] resolvers share one byte-vocabulary, as
5445/// the sibling `dep_list_try_from_vec_bytes_routes_through_borrowed_byte_view_axis`
5446/// four-corner witness makes explicit on the byte-owned axis), so the
5447/// string-owned forward and reverse axes here round-trip directly
5448/// through the shared `:`-prefixed kebab-case vocabulary — a four-
5449/// corner witness the pinned load-bearing test makes explicit,
5450/// mirroring the peer four-corner witness the sibling
5451/// [`crate::CaixaDialeto`] axis (9e07f5c) pins on the same string-
5452/// owned reverse-projection surface.
5453///
5454/// Pinned load-bearing by
5455/// [`tests::dep_list_try_from_owned_string_routes_through_borrowed_str_view_axis`]
5456/// (byte-parity pin against the paired borrowed [`TryFrom<&str>`]
5457/// axis across the two-arm [`DepList::ALL`] accept-set on the owned-
5458/// `String` surface, cross-axis witness that the string-owned reverse
5459/// projection agrees with the sibling byte-view and byte-owned
5460/// reverse-projection axes on every accepted arm through the shared
5461/// substrate-primitive [`DepList::from_wire`] accessor, plus a four-
5462/// corner {owned-input, borrowed-input} × {`From<Self> → String`,
5463/// `From<&Self> → String`} round-trip witness against the paired
5464/// [`From<{Self, &Self}> for String`] string-owned forward-projection
5465/// pair) and
5466/// [`tests::dep_list_try_from_owned_string_rejects_unknown_wire_strings`]
5467/// (rejection witness against silent accept-set widening — mirrors
5468/// the corpus the paired [`TryFrom<&str>`] and [`TryFrom<Vec<u8>>`]
5469/// rejection witnesses already pin, including empty / whitespace-
5470/// only inputs, case-fold variants of accepted arms, un-`:`-prefixed
5471/// bare-kebab forms, rebrand candidates, English-rebrand candidates,
5472/// and whitespace-padded / trailing-newline / quote-wrapped forms,
5473/// with per-input cross-axis parity against the borrowed
5474/// [`TryFrom<&str>`] reverse-projection axis).
5475impl TryFrom<String> for DepList {
5476    type Error = ();
5477
5478    fn try_from(s: String) -> Result<Self, Self::Error> {
5479        <Self as TryFrom<&str>>::try_from(s.as_str())
5480    }
5481}
5482
5483/// Errors raised by [`Dep::validate`].
5484///
5485/// Mirrors the per-axis error families the other `:versao`-carrying
5486/// typed surfaces expose
5487/// ([`crate::AplicacaoError::MembroVersaoEmpty`] /
5488/// [`crate::AplicacaoError::MembroVersaoInvalid`],
5489/// [`crate::SupervisorError::EmptyChildVersion`] /
5490/// [`crate::SupervisorError::ChildVersaoInvalid`]) so a future top-
5491/// level `CaixaError` (M4) sums these without reshaping the diagnostic.
5492#[derive(Debug, Error, PartialEq, Eq)]
5493pub enum DepError {
5494    #[error(
5495        ":deps entry has empty :nome (every dep must name a target caixa; \
5496         omit the entry instead of carrying an empty name)"
5497    )]
5498    NomeEmpty,
5499    #[error(
5500        ":deps entry :nome {nome:?} is not a valid DNS-1123 label: {reason} \
5501         (the value flows verbatim as the target caixa's `:nome`, the rendered \
5502         `lareira-<nome>` Helm chart name segment, the `LABEL_PROGRAM` label \
5503         value, and the resolver's checkout-directory leaf — each apiserver-side \
5504         schema rejects non-DNS-1123 names at admission time; use a lowercase \
5505         RFC 1123 label like `\"caixa-teia\"` or `\"pleme-mesh\"`, 1..=63 bytes, \
5506         pattern `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`)"
5507    )]
5508    NomeInvalid { nome: String, reason: String },
5509    #[error(
5510        ":deps entry {nome:?} has empty :versao (every dep must pin a semver \
5511         constraint that resolves through the lacre pipeline)"
5512    )]
5513    VersaoEmpty { nome: String },
5514    #[error(
5515        ":deps entry {nome:?} :versao {versao:?} is not a valid semver \
5516         requirement: {reason} (use Cargo-shaped forms like `\"^0.1\"`, \
5517         `\"~0.1.2\"`, `\"0.1.0\"`, or `\"*\"` — the same shape `:membros :versao` \
5518         and `:children :versao` carry; the lacre pipeline resolves all three \
5519         through the same parser)"
5520    )]
5521    VersaoInvalid {
5522        nome: String,
5523        versao: String,
5524        reason: String,
5525    },
5526    #[error(
5527        ":deps entry {nome:?} :fonte (:tipo git …) has empty :repo \
5528         (every git source must name a repo — use a `github:org/repo` \
5529         shorthand, an `https://…` URL, or an ssh-git URL; omit the \
5530         entire :fonte block to fall back to the default-host resolver \
5531         convention)"
5532    )]
5533    FonteRepoEmpty { nome: String },
5534    #[error(
5535        ":deps entry {nome:?} :fonte (:tipo git …) :repo {repo:?} has \
5536         invalid value-shape: {reason} (the value flows verbatim into the \
5537         caixa-resolver's `git clone <repo>` subprocess invocation; every \
5538         documented form carries a `:` separator and no whitespace / \
5539         control / non-ASCII bytes — use a `github:org/repo` shorthand, \
5540         an `https://host/path` / `ssh://[user@]host/path` / \
5541         `git://host/path` / `file:///path` URL, or the `git@host:path` \
5542         scp-style SSH form)"
5543    )]
5544    FonteRepoShape {
5545        nome: String,
5546        repo: String,
5547        reason: String,
5548    },
5549    #[error(
5550        ":deps entry {nome:?} :fonte (:tipo git …) has no pin set \
5551         (set exactly one of :tag, :rev, or :branch so the resolver \
5552         can pick a reproducible commit; omit the entire :fonte block \
5553         to fall back to the default-host resolver convention, which \
5554         resolves the latest tag matching :versao)"
5555    )]
5556    FontePinMissing { nome: String },
5557    #[error(
5558        ":deps entry {nome:?} :fonte (:tipo git …) has multiple pins \
5559         set ({pins}); exactly one of :tag, :rev, or :branch must be \
5560         set so the resolver's checkout target is unambiguous (the \
5561         resolver's silent precedence is :rev > :tag > :branch — if \
5562         you intended one specifically, drop the others)"
5563    )]
5564    FontePinAmbiguous { nome: String, pins: String },
5565    #[error(
5566        ":deps entry {nome:?} :fonte (:tipo git …) has empty {pin} \
5567         (a set pin must name a non-empty git ref; drop the {pin} key \
5568         entirely to fall through to another pin axis)"
5569    )]
5570    FontePinEmpty { nome: String, pin: String },
5571    #[error(
5572        ":deps entry {nome:?} :fonte (:tipo git …) {pin} {value:?} has invalid \
5573         value-shape: {reason} (the git porcelain enforces the same shape at \
5574         `git fetch` / `git checkout` time on every pin; use a leaf refname \
5575         like `\"v0.1.0\"` for `:tag` or `\"main\"` / `\"feature/foo\"` for \
5576         `:branch`, or a full 40/64 lowercase-hex commit OID for `:rev` — \
5577         drop any `refs/heads/` or `refs/tags/` prefix the caixa-resolver \
5578         prepends at clone time, and avoid abbreviated SHAs which are \
5579         ambiguous across repository history)"
5580    )]
5581    FontePinShape {
5582        nome: String,
5583        pin: String,
5584        value: String,
5585        reason: String,
5586    },
5587    #[error(
5588        ":deps entry {nome:?} :fonte (:tipo path …) has empty :caminho \
5589         (every path source must name a non-empty filesystem path; \
5590         omit the entire :fonte block to fall back to the default-host \
5591         resolver convention)"
5592    )]
5593    FonteCaminhoEmpty { nome: String },
5594    #[error(
5595        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} is \
5596         absolute (the lacre pipeline embeds the value verbatim in its \
5597         per-dep content-address `path:{caminho}` at \
5598         caixa-resolver/src/resolve.rs:189, so an absolute path makes the \
5599         BLAKE3 closure differ across machines — defeating the \
5600         reproducibility contract that's load-bearing for CSE; express \
5601         the path relative to the caixa.lisp location, e.g. \
5602         \"../caixa-teia\" for a sibling workspace dep)"
5603    )]
5604    FonteCaminhoAbsolute { nome: String, caminho: String },
5605    #[error(
5606        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} starts \
5607         with `~` (the leading-tilde is a shell-expansion convention, not a \
5608         POSIX path component — `Path::is_absolute` returns false on it, so \
5609         the b94fd83 absolute-path gate doesn't catch it, but the lacre \
5610         pipeline embeds the value verbatim in its per-dep content-address \
5611         `path:{caminho}` at caixa-resolver/src/resolve.rs:189 and the \
5612         caixa-resolver folds it through `Path::join` without `~`-expansion, \
5613         so the build looks for a literal `./{caminho}` subdirectory and \
5614         fails at resolve time far from the source caixa.lisp; even worse, a \
5615         future caixa-resolver pass that *does* expand `~` would silently \
5616         re-open the host-layout-leak the b94fd83 absolute gate closes — \
5617         Alice's `~` resolves to `/home/alice`, Bob's to `/home/bob`, two CI \
5618         runners with different `$HOME` layouts resolve to two distinct paths \
5619         for the byte-identical caixa, defeating the THEORY.md §V.2 render-\
5620         determinism contract; express the path relative to the caixa.lisp \
5621         location, e.g. \"../caixa-teia\" for a sibling workspace dep, or \
5622         spell out the full relative path explicitly if a workstation-rooted \
5623         dep is genuinely intended)"
5624    )]
5625    FonteCaminhoTildeExpansion { nome: String, caminho: String },
5626    #[error(
5627        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} starts \
5628         with `$` (the leading-`$` is a shell-variable-expansion convention, \
5629         not a POSIX path component — `Path::is_absolute` returns false on it \
5630         and the a5c248e tilde gate doesn't catch it, but the lacre pipeline \
5631         embeds the value verbatim in its per-dep content-address \
5632         `path:{caminho}` at caixa-resolver/src/resolve.rs:189 and the \
5633         caixa-resolver folds it through `Path::join` without `$`-expansion, \
5634         so the build looks for a literal `./{caminho}` subdirectory and \
5635         fails at resolve time far from the source caixa.lisp; even worse, a \
5636         future caixa-resolver pass that *does* expand `$VAR` (the canonical \
5637         shell-convention idiom that CI's `${{WORKSPACE}}` paste-idiom \
5638         invites) would silently re-open the host-layout-leak the b94fd83 \
5639         absolute gate closes — Alice's `$HOME` resolves to `/home/alice`, \
5640         Bob's to `/home/bob`, two CI runners with different `${{WORKSPACE}}` \
5641         layouts resolve to two distinct paths for the byte-identical caixa, \
5642         defeating the THEORY.md §V.2 render-determinism contract; express \
5643         the path relative to the caixa.lisp location, e.g. \"../caixa-teia\" \
5644         for a sibling workspace dep, or spell out the full relative path \
5645         explicitly if a workstation-rooted dep is genuinely intended)"
5646    )]
5647    FonteCaminhoVarExpansion { nome: String, caminho: String },
5648    #[error(
5649        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} starts \
5650         with a space (the leading ASCII space `0x20` is the orthogonal \
5651         paste-from-aligned-doc footgun that silently passes \
5652         `Path::is_absolute` and every prior leading-byte arm — \
5653         `\" ../caixa-teia\"` resolves via `Path::join` to a literal \
5654         `./ ../caixa-teia` subdirectory the resolver fails to find at \
5655         resolve time with a non-self-locating `No such file or directory` \
5656         error far from the source caixa.lisp; the lacre pipeline embeds \
5657         the value verbatim in its per-dep content-address `path:{caminho}` \
5658         at caixa-resolver/src/resolve.rs:189, so byte-divergent / \
5659         semantic-identical caixa values (` ../caixa-teia` vs \
5660         `../caixa-teia`) yield two distinct BLAKE3 closures across two \
5661         workstations whose authors differ only in paste-from-aligned- \
5662         caixa.lisp-doc whitespace habits — the most insidious failure \
5663         mode the typed slot can carry (no error surfaces; the divergence \
5664         is invisible until two machines compare lacres), defeating the \
5665         THEORY.md §V.2 render-determinism contract. The canonical \
5666         paste-from-aligned-`:deps`-block footgun (every `:fonte` form in \
5667         a multi-entry `:deps` block sits at the same column — an author \
5668         selecting `\"<sp><sp><sp>../caixa-teia\"` and pasting it from \
5669         the rendered alignment into a fresh entry preserves the leading \
5670         whitespace verbatim); peer `:fonte :repo` axis already rejects \
5671         leading whitespace via `is_git_repo_url`, `:fonte :tag` / \
5672         `:fonte :branch` via `is_git_ref_name`, `:descricao` via \
5673         `is_chart_description_shape`, `:licenca` via \
5674         `is_spdx_expression_shape`. Drop the leading space; express the \
5675         path as a bare relative single-token like \"../caixa-teia\")"
5676    )]
5677    FonteCaminhoLeadingWhitespace { nome: String, caminho: String },
5678    #[error(
5679        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} starts \
5680         with `-` (the canonical CLI-argument-injection footgun on the \
5681         `:caminho` axis — the lacre pipeline embeds the value verbatim in \
5682         its per-dep content-address `path:{caminho}` at \
5683         caixa-resolver/src/resolve.rs:189 and the caixa-resolver folds it \
5684         through `Path::join` looking for a literal `./{caminho}` \
5685         subdirectory. Every downstream subprocess that consumes the resolved \
5686         path — `git -C {caminho} <verb>`, `terraform -chdir={caminho}`, \
5687         `nix build --path {caminho}`, `find {caminho}`, `stat {caminho}`, \
5688         `cp -r {caminho} …`, `rm -rf {caminho}` — reinterprets a leading-`-` \
5689         value as a CLI flag rather than a positional path when the invocation \
5690         does not carry a `--` argument-list terminator between the flag block \
5691         and the path (the common case at every porcelain entry point). The \
5692         canonical footguns: `:caminho \"-rf\"` (bare short-flag paste), \
5693         `:caminho \"-C\"` (`git -C -C` config-injection paste), \
5694         `:caminho \"--upload-pack=cat /etc/passwd\"` (the canonical long-flag \
5695         CLI-arg-injection vector at every git porcelain entry point that \
5696         consumes a path or URL argument, peer with is_git_repo_url's \
5697         leading-`-` arm on the sibling `:fonte :repo` axis), \
5698         `:caminho \"--config=…\"` (`git -c foo=bar` config-override paste). \
5699         POSIX `std::path::Path` treats a leading `-` as a literal filename \
5700         byte so the resolver folds `\"-rf\"` through `Path::join` and looks \
5701         for a literal `./-rf` subdirectory that fails at resolve time with a \
5702         non-self-locating `No such file or directory` error far from the \
5703         source caixa.lisp — but on any downstream shell-out without `--` the \
5704         reinterpretation is silent and the failure mode is arbitrary-\
5705         argument-injection. Peer arms: `is_git_repo_url` (render.rs:2037) \
5706         rejects leading `-` on `:fonte :repo` for `git clone <repo>` CLI-\
5707         arg-injection; `is_git_ref_name` (render.rs:1381, 5a28454) rejects \
5708         leading `-` on `:fonte :tag` / `:branch` for `git checkout <ref>` \
5709         CLI-arg-injection; `is_dns_1123_label` rejects leading `-` on every \
5710         DNS-1123-shaped axis (top-level Caixa `:nome`, `:membros :caixa`, \
5711         `:children :caixa`, `:deps :nome`, cluster names); \
5712         `is_cargo_feature_name` rejects leading `-` on `:caracteristicas`; \
5713         the feira `init` / `add <nome>` positional gate (868c191) rejects \
5714         leading `-` on the CLI positional itself. Express the path as a bare \
5715         relative single-token like \"../caixa-teia\" — the sibling-workspace \
5716         directory name carries no leading-hyphen semantic, and `./` / `../` \
5717         prefixes structurally partition the leading-byte set to safe values.)"
5718    )]
5719    FonteCaminhoLeadingHyphen { nome: String, caminho: String },
5720    #[error(
5721        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains \
5722         ASCII control byte 0x{byte:02x} (POSIX paths reject NUL `0x00` outright — \
5723         every `std::fs` syscall routes the path through `CString::new` which \
5724         fails with `NulError` at resolve time; the lacre pipeline embeds the \
5725         value verbatim in its per-dep content-address `path:{caminho}` at \
5726         caixa-resolver/src/resolve.rs:189 so a control byte anywhere in the \
5727         value lands in the BLAKE3 closure and breaks the THEORY.md §V.2 render-\
5728         determinism contract — the canonical paste-from-multiline-doc \
5729         (`\\n`/`\\r`), paste-from-aligned-table (`\\t`), or paste-from-binary-\
5730         blob (`0x00`-DEL) footgun every peer single-token-shaped axis \
5731         (`:fonte :repo`, `:fonte :tag`/`:branch`, the Helm chart-string axes) \
5732         already gates against. Express the path as a relative single-line ASCII \
5733         string, e.g. \"../caixa-teia\" for a sibling workspace dep)"
5734    )]
5735    FonteCaminhoControlChar {
5736        nome: String,
5737        caminho: String,
5738        byte: u8,
5739    },
5740    #[error(
5741        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains `\\` \
5742         (POSIX `std::path::Path` treats `\\` as a literal byte inside a single path \
5743         component, so `..\\caixa-teia` is one directory named literally `..\\caixa-teia` — \
5744         not the parent's sibling — and the caixa-resolver folds the value through \
5745         `Path::join` looking for a literal `./{caminho}` subdirectory that fails at \
5746         resolve time with a non-self-locating `No such file or directory` error far \
5747         from the source caixa.lisp; Windows `std::path::Path` treats `\\` as a \
5748         primary path separator equal to `/`, so byte-identical caixa.lisp values \
5749         resolve to two distinct directories across runner OSes — the lacre pipeline \
5750         embeds the value verbatim in its per-dep content-address `path:{caminho}` at \
5751         caixa-resolver/src/resolve.rs:189, defeating the THEORY.md §V.2 render-\
5752         determinism contract via the cross-host-OS-separator divergence vector. The \
5753         canonical Windows-Explorer `Copy as path` / PowerShell `Get-Location` \
5754         paste-idiom footgun; peer `:fonte :tag` / `:fonte :branch` axis already \
5755         rejects `\\` via `is_git_ref_name` for the same Windows-path-leak reason, \
5756         and `:entrada :paths` rejects `\\` via `is_gateway_api_http_path`'s eleven-\
5757         byte RFC-3986-reserved set. Express the path with `/` as the separator, e.g. \
5758         \"../caixa-teia\" for a sibling workspace dep)"
5759    )]
5760    FonteCaminhoBackslash { nome: String, caminho: String },
5761    #[error(
5762        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5763         redirection metacharacter 0x{byte:02x} `{ch}` (every interactive shell — bash / \
5764         zsh / fish / nushell — lexes `<` and `>` as input / output redirection \
5765         operators, so `:caminho \"../caixa-teia>build.log\"` is the canonical \
5766         paste-from-shell-pipeline footgun where an author copies a `command > log` \
5767         tail without trimming the redirect; POSIX `std::path::Path` treats both bytes \
5768         as literal path-component bytes, so the resolver folds the value through \
5769         `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` \
5770         subdirectory and fails at resolve time with a non-self-locating `No such \
5771         file or directory` error far from the source caixa.lisp. The lacre pipeline \
5772         embeds the value verbatim in its per-dep content-address `path:{caminho}` at \
5773         caixa-resolver/src/resolve.rs:189, so the byte lands in the BLAKE3 closure \
5774         and rides into every shell-spawned subprocess (the resolver's `git clone`, a \
5775         future `feira tofu` shell-out, a future operator-side `nix` spawn) as the \
5776         canonical CRLF-at-subprocess-argument / shell-metachar injection surface every \
5777         peer single-token-shaped typed slot already closes. The peer `:fonte :tag` / \
5778         `:fonte :branch` axis already rejects `<` / `>` via `is_git_ref_name`, and \
5779         `:entrada :paths` rejects them via `is_gateway_api_http_path`'s eleven-byte \
5780         RFC-3986-reserved set. Express the path as a bare relative single-token like \
5781         \"../caixa-teia\" — the sibling-workspace directory name carries no shell-\
5782         redirection semantic.",
5783        ch = *byte as char
5784    )]
5785    FonteCaminhoShellRedirection {
5786        nome: String,
5787        caminho: String,
5788        byte: u8,
5789    },
5790    #[error(
5791        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-pipe \
5792         metacharacter `|` (every interactive shell — bash / zsh / fish / nushell — lexes \
5793         `|` as the pipe operator that wires one command's stdout to the next command's \
5794         stdin, so `:caminho \"../caixa-teia | grep foo\"` is the canonical paste-from-\
5795         shell-history footgun where an author copies a `ls ../caixa-teia | grep` line \
5796         without trimming the pipeline tail, and `:caminho \"../foo||bar\"` is the \
5797         symmetric `cmd-a || cmd-b` short-circuit-OR paste shape; POSIX `std::path::Path` \
5798         treats `|` as a literal path-component byte, so the resolver folds the value \
5799         through `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` \
5800         subdirectory and fails at resolve time with a non-self-locating `No such file or \
5801         directory` error far from the source caixa.lisp. The lacre pipeline embeds the \
5802         value verbatim in its per-dep content-address `path:{caminho}` at caixa-resolver/\
5803         src/resolve.rs:189, so the byte lands in the BLAKE3 closure and rides into every \
5804         shell-spawned subprocess (the resolver's `git clone`, a future `feira tofu` \
5805         shell-out, a future operator-side `nix` spawn) as the canonical CRLF-at-\
5806         subprocess-argument / shell-metachar injection surface every peer single-token-\
5807         shaped typed slot already closes. The peer `:entrada :paths` axis rejects `|` \
5808         via `is_gateway_api_http_path`'s eleven-byte RFC-3986-reserved set. Express the \
5809         path as a bare relative single-token like \"../caixa-teia\" — the sibling-\
5810         workspace directory name carries no shell-pipe semantic."
5811    )]
5812    FonteCaminhoShellPipe { nome: String, caminho: String },
5813    #[error(
5814        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5815         command-separator metacharacter `;` (every interactive shell — bash / zsh / fish \
5816         / nushell — lexes `;` as the sequential-command terminator that fires the next \
5817         command regardless of the prior command's exit status, so `:caminho \
5818         \"../caixa-teia; rm -rf build\"` is the canonical paste-from-shell-one-liner \
5819         footgun where an author copies a `cd path; do-thing` chain without trimming \
5820         the cleanup tail, and `:caminho \"../foo;;bar\"` is the symmetric POSIX `case` \
5821         arm `;;` terminator paste shape; POSIX `std::path::Path` treats `;` as a \
5822         literal path-component byte, so the resolver folds the value through \
5823         `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` \
5824         subdirectory and fails at resolve time with a non-self-locating `No such file \
5825         or directory` error far from the source caixa.lisp. The lacre pipeline embeds \
5826         the value verbatim in its per-dep content-address `path:{caminho}` at \
5827         caixa-resolver/src/resolve.rs:189, so the byte lands in the BLAKE3 closure and \
5828         rides into every shell-spawned subprocess (the resolver's `git clone`, a \
5829         future `feira tofu` shell-out, a future operator-side `nix` spawn) as the \
5830         canonical shell-metachar injection surface every peer single-token-shaped \
5831         typed slot already closes. The peer `:entrada :paths` axis rejects `;` via \
5832         `is_gateway_api_http_path`'s eleven-byte RFC-3986-reserved set. Express the \
5833         path as a bare relative single-token like \"../caixa-teia\" — the sibling-\
5834         workspace directory name carries no shell-command-separator semantic."
5835    )]
5836    FonteCaminhoShellSemicolon { nome: String, caminho: String },
5837    #[error(
5838        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5839         background / list-AND metacharacter `&` (every interactive shell — bash / zsh \
5840         / fish / nushell — lexes `&` two ways: single `&` as the background-task \
5841         terminator detaching the prior command and returning control immediately to \
5842         the prompt, double `&&` as the logical-AND list operator firing the next \
5843         command only if the prior succeeded; POSIX `std::path::Path` treats it as a \
5844         literal byte. The canonical paste-from-shell-prompt footgun is a `cd path & \
5845         sleep 1` background-launch one-liner or a `cd path && make install` build-\
5846         chain idiom selected whole into the `:caminho` slot — the prior `;` arm at \
5847         05c358e closed the sequential-command-separator vector, this arm closes the \
5848         orthogonal background-task / logical-AND vector on the same paste-from-shell-\
5849         prompt class. The lacre pipeline embeds the value verbatim in its per-dep \
5850         content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the \
5851         byte lands in the BLAKE3 closure and rides into every shell-spawned \
5852         subprocess (the resolver's `git clone`, a future `feira tofu` shell-out, a \
5853         future operator-side `nix` spawn) as the canonical shell-metachar injection \
5854         surface every peer single-token-shaped typed slot already closes. The peer \
5855         `:entrada :paths` axis rejects `&` via `is_gateway_api_http_path`'s eleven-\
5856         byte RFC-3986-reserved set. Express the path as a bare relative single-token \
5857         like \"../caixa-teia\" — the sibling-workspace directory name carries no \
5858         shell-background / logical-AND semantic."
5859    )]
5860    FonteCaminhoShellBackground { nome: String, caminho: String },
5861    #[error(
5862        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5863         command-substitution metacharacter `` ` `` (every POSIX shell — sh / bash / zsh / \
5864         dash / ksh / fish / nushell — lexes the byte as the legacy command-substitution \
5865         wrapper that runs the enclosed command and substitutes its standard-output \
5866         verbatim into the surrounding word, so a backticked `whoami` expands to the \
5867         current user's name and a backticked `cat /etc/passwd` expands to the file's \
5868         contents — the canonical CWE-78 shell-command-injection vector; POSIX \
5869         `std::path::Path` treats the byte as a literal path-component byte. The canonical \
5870         paste-from-shell-prompt footgun is a `cd ../path/<backtick>whoami<backtick>` legacy substitution \
5871         one-liner or a `cd <backtick>pwd<backtick>/path` working-directory expansion idiom selected whole \
5872         into the `:caminho` slot — the prior `&` arm at e12e4f3 closed the shell-\
5873         background / logical-AND vector, this arm closes the orthogonal command-\
5874         substitution vector on the same paste-from-shell-prompt class (the modern `$()` \
5875         form is gated at leading position by the f4efe9c `FonteCaminhoVarExpansion` arm; \
5876         the legacy backtick form is the orthogonal axis). The lacre pipeline embeds the \
5877         value verbatim in its per-dep content-address `path:{caminho}` at \
5878         caixa-resolver/src/resolve.rs:189, so the byte lands in the BLAKE3 closure and \
5879         rides into every shell-spawned subprocess (the resolver's `git clone`, a future \
5880         `feira tofu` shell-out, a future operator-side `nix` spawn) as the canonical \
5881         shell-metachar injection surface every peer single-token-shaped typed slot \
5882         already closes. The peer `:entrada :paths` axis rejects the byte via \
5883         `is_gateway_api_http_path`'s eleven-byte RFC-3986-reserved set. Express the path \
5884         as a bare relative single-token like \"../caixa-teia\" — the sibling-workspace \
5885         directory name carries no shell-command-substitution semantic."
5886    )]
5887    FonteCaminhoShellCommandSubstitution { nome: String, caminho: String },
5888    #[error(
5889        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5890         glob / pathname-expansion metacharacter 0x{byte:02x} `{ch}` (every POSIX shell — \
5891         sh / bash / zsh / dash / ksh / fish / nushell — lexes `*` and `?` as pathname-\
5892         expansion wildcards: `*` matches any sequence of characters in a path component \
5893         and `?` matches exactly one character, so a `:caminho \"../caixa-teia/*\"` is the \
5894         canonical paste-from-shell-listing footgun where an author copies a \
5895         `ls ../caixa-teia/*` listing without trimming the wildcard, and `:caminho \
5896         \"../foo?\"` is the symmetric single-char-wildcard paste shape; POSIX \
5897         `std::path::Path` treats both bytes as literal path-component bytes, so the \
5898         resolver folds the value through `Path::new(caminho).join(<file>)` looking for \
5899         a literal `./{caminho}` subdirectory and fails at resolve time with a non-self-\
5900         locating `No such file or directory` error far from the source caixa.lisp. The \
5901         lacre pipeline embeds the value verbatim in its per-dep content-address \
5902         `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the byte lands in the \
5903         BLAKE3 closure and rides into every shell-spawned subprocess (the resolver's \
5904         `git clone`, a future `feira tofu` shell-out, a future operator-side `nix` \
5905         spawn) as the canonical shell-metachar / glob-expansion surface every peer \
5906         single-token-shaped typed slot already closes. The peer `:entrada :paths` axis \
5907         rejects `*` and `?` via `is_gateway_api_http_path`'s eleven-byte RFC-3986-\
5908         reserved set. Express the path as a bare relative single-token like \
5909         \"../caixa-teia\" — the sibling-workspace directory name carries no shell-glob \
5910         / pathname-expansion semantic.",
5911        ch = *byte as char
5912    )]
5913    FonteCaminhoShellGlob {
5914        nome: String,
5915        caminho: String,
5916        byte: u8,
5917    },
5918    #[error(
5919        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5920         subshell-grouping metacharacter 0x{byte:02x} `{ch}` (every POSIX shell — sh / bash / \
5921         zsh / dash / ksh / fish / nushell — lexes `(` and `)` as the subshell-grouping \
5922         operator: `(<cmd>)` runs `<cmd>` in a child shell with a fresh environment scope \
5923         (the canonical `(cd <path> && <cmd>)` shell-history one-liner scopes a `cd` to one \
5924         subshell without disturbing the parent's working directory), and `$(<cmd>)` is the \
5925         modern Bourne command-substitution shape the leading-`$` `FonteCaminhoVarExpansion` \
5926         arm closes the leading byte of — together the two arms now structurally exclude the \
5927         entire `$(<cmd>)` substitution surface from the typed `:caminho` accepted set. \
5928         POSIX `std::path::Path` treats the byte as a literal path-component byte, so a \
5929         `:caminho \"../caixa-teia/$(date)/build\"` (the canonical paste-from-shell-history \
5930         modern-command-substitution footgun) or `:caminho \"../(cd foo && pwd)/caixa-teia\"` \
5931         (the symmetric subshell-grouping working-directory-probe paste idiom) silently passes \
5932         every prior arm and the resolver folds the value through `Path::new(caminho).join(\
5933         <file>)` looking for a literal subdirectory and fails at resolve time with a non-\
5934         self-locating `No such file or directory` error far from the source caixa.lisp. The \
5935         lacre pipeline embeds the value verbatim in its per-dep content-address `path:\
5936         {caminho}` at caixa-resolver/src/resolve.rs:189, so the byte lands in the BLAKE3 \
5937         closure and rides into every shell-spawned subprocess (the resolver's `git clone`, a \
5938         future `feira tofu` shell-out, a future operator-side `nix` spawn) as the canonical \
5939         shell-metachar / subshell-grouping surface every peer single-token-shaped typed slot \
5940         already closes. The peer `:fonte :repo` axis (3b99147) closes the same byte under the \
5941         same shell-subshell-grouping / RFC-3986-sub-delims banner on `is_git_repo_url`, \
5942         together with the leading-`$` `FonteCaminhoVarExpansion` arm closing the leading byte \
5943         of every `$(<cmd>)` shape. Express the path as a bare relative single-token \
5944         like \"../caixa-teia\" — the sibling-workspace directory name carries no shell-\
5945         subshell-grouping semantic.",
5946        ch = *byte as char
5947    )]
5948    FonteCaminhoShellSubshellGrouping {
5949        nome: String,
5950        caminho: String,
5951        byte: u8,
5952    },
5953    #[error(
5954        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5955         brace-expansion / URI-Template placeholder metacharacter 0x{byte:02x} `{ch}` \
5956         (every POSIX-derived brace-expanding shell — bash / zsh / ksh / fish — lexes `{{` / \
5957         `}}` as the brace-expansion operator: `{{a,b,c}}` expands to the cross-product of \
5958         comma-separated members and `{{1..10}}` expands to the integer range — the \
5959         canonical `mkdir -p ../{{caixa-teia,caixa-helm,caixa-flux}}` / `cp file{{,.bak}}` \
5960         idiom every shell-history block carries; RFC 6570 reserves the matched pair for \
5961         URI Template placeholders (the canonical `https://{{host}}/{{org}}/{{repo}}` \
5962         substitution shape every OpenAPI / Swagger / Postman / GitHub Octokit client \
5963         library / Helm chart-URL fragment carries) and the Mustache / Handlebars / \
5964         Tera / Jinja2 / Go html/template doubled-brace substitution form every IaC \
5965         templating engine (Helm, Kustomize, Terraform's `${{var}}` cousin) emits. POSIX \
5966         `std::path::Path` treats the byte as a literal path-component byte, so a \
5967         `:caminho \"../{{caixa-teia,caixa-helm}}/build\"` (the canonical paste-from-\
5968         shell-history brace-expansion fan-across-siblings footgun) or `:caminho \"../{{{{org}}}}/\
5969         caixa-teia\"` (the symmetric paste-from-templated-doc URI-Template placeholder \
5970         idiom every README quick-start / OpenAPI spec / Helm chart `home:` field carries) \
5971         silently passes every prior arm and the resolver folds the value through \
5972         `Path::new(caminho).join(<file>)` looking for a literal subdirectory and fails at \
5973         resolve time with a non-self-locating `No such file or directory` error far from \
5974         the source caixa.lisp. The lacre pipeline embeds the value verbatim in its \
5975         per-dep content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, \
5976         so the byte lands in the BLAKE3 closure and rides into every shell-spawned \
5977         subprocess (the resolver's `git clone`, a future `feira tofu` shell-out, a \
5978         future operator-side `nix` spawn) as the canonical shell-metachar / brace-\
5979         expansion / URI-Template-placeholder surface every peer single-token-shaped \
5980         typed slot already closes. The peer `:fonte :repo` axis (42d8f9d) closes the \
5981         same byte pair on `is_git_repo_url` under the same RFC-3986-'delims' / \
5982         RFC-6570-URI-Template / shell-brace-expansion banner. Express the path as a \
5983         bare relative single-token like \"../caixa-teia\" — the sibling-workspace \
5984         directory name carries no shell-brace-expansion / URI-Template-placeholder \
5985         semantic; if two siblings actually need pinning, author two separate `:deps` \
5986         entries rather than one brace-expanded `:caminho` value.",
5987        ch = *byte as char
5988    )]
5989    FonteCaminhoShellBraceExpansion {
5990        nome: String,
5991        caminho: String,
5992        byte: u8,
5993    },
5994    #[error(
5995        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
5996         bracket-expansion / POSIX glob-character-class / shell-`test`-builtin metacharacter \
5997         0x{byte:02x} `{ch}` (every POSIX shell — sh / bash / zsh / dash / ksh / fish / nushell \
5998         — lexes the bracket pair as the glob character-class operator: `[abc]` matches one of \
5999         `a` / `b` / `c`, `[a-z]` matches any lowercase ASCII letter, `[^x]` negates — the \
6000         canonical `ls *.[ch]` C-source-file glob and `cd ../caixa-[a-z]*` lowercase-sibling \
6001         glob every shell-history block carries; the bracket pair additionally carries the \
6002         POSIX `test` / `[` builtin command (`[ -d ../caixa-teia ] && cd ...` every shell-\
6003         script conditional uses) and bash's `[[ ... ]]` extended-test grammar; beyond shell \
6004         the pair is the TOML inline-array delimiter (`features = [\"a\", \"b\"]` — the \
6005         canonical paste-from-Cargo-manifest cross-idiom-leak vector), the YAML flow-sequence \
6006         delimiter (`paths: [/a, /b]` — the canonical paste-from-values.yaml cross-idiom \
6007         leak), the JSON array delimiter, and the POSIX-ERE / PCRE bracket-expression anchor. \
6008         POSIX `std::path::Path` treats the byte as a literal path-component byte, so a \
6009         `:caminho \"../caixa-[a-z]/build\"` (the canonical paste-from-shell-history glob-\
6010         character-class fan-across-siblings footgun) or `:caminho \"../[caixa-teia]/build\"` \
6011         (the symmetric paste-from-TOML-array / paste-from-YAML-flow-sequence cross-idiom \
6012         leak) silently passes every prior arm and the resolver folds the value through \
6013         `Path::new(caminho).join(<file>)` looking for a literal subdirectory and fails at \
6014         resolve time with a non-self-locating `No such file or directory` error far from \
6015         the source caixa.lisp. The lacre pipeline embeds the value verbatim in its per-dep \
6016         content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the byte \
6017         lands in the BLAKE3 closure and rides into every shell-spawned subprocess (the \
6018         resolver's `git clone`, a future `feira tofu` shell-out, a future operator-side \
6019         `nix` spawn) as the canonical shell-metachar / glob-character-class / TOML-array \
6020         surface every peer single-token-shaped typed slot already closes. Express the path \
6021         as a bare relative single-token like \"../caixa-teia\" — the sibling-workspace \
6022         directory name carries no shell-bracket-expansion / glob-character-class / array-\
6023         literal semantic; if a family of sibling caixas actually needs pinning, author \
6024         separate `:deps` entries rather than one character-class-expanded `:caminho` value.",
6025        ch = *byte as char
6026    )]
6027    FonteCaminhoShellBracketExpansion {
6028        nome: String,
6029        caminho: String,
6030        byte: u8,
6031    },
6032    #[error(
6033        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
6034         quote-grouping / cross-config-DSL string-literal-delimiter metacharacter \
6035         0x{byte:02x} `{ch}` (every POSIX shell — sh / bash / zsh / dash / ksh / fish / \
6036         nushell — lexes `'` as the strong string-literal delimiter (`'…'` — no expansion) \
6037         and `\"` as the weak string-literal delimiter (`\"…\"` — variable- / command-\
6038         substitution-preserving); the canonical `cd '../caixa-teia'` shell-history idiom \
6039         every path-with-embedded-whitespace paste block carries and the symmetric \
6040         `git clone \"$REPO\"` weak-quoted CI-manifest shape both leak the pair verbatim. \
6041         Beyond shell the pair is the JSON string-literal delimiter (`\"key\": \"value\"` — \
6042         the canonical paste-from-JSON-config cross-idiom-leak vector), the YAML double- \
6043         and single-quoted flow-scalar delimiter (`path: \"../caixa-teia\"` — the canonical \
6044         paste-from-values.yaml / paste-from-K8s-YAML-manifest cross-idiom leak), the TOML \
6045         basic and literal string delimiter (`path = \"../caixa-teia\"` — the canonical \
6046         paste-from-Cargo-manifest cross-idiom leak), the tatara-lisp string-literal \
6047         delimiter itself (`(:caminho \"../caixa-teia\")` — the canonical \"I copied the \
6048         entire `:caminho \"...\"` slot rather than just the string body\" author-surface \
6049         footgun), and RFC 3986 §2.2's `gen-delims` / `sub-delims` grammar which excludes \
6050         both bytes from the `pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\"` \
6051         production. POSIX `std::path::Path` treats the byte as a literal path-component \
6052         byte, so a `:caminho \"'../caixa-teia'\"` (the canonical paste-from-shell-history \
6053         strong-quoted sibling-workspace path footgun) or `:caminho \"\\\"../caixa-teia\\\"\"` \
6054         (the symmetric weak-quoted paste-from-JSON / paste-from-YAML flow-scalar / paste-\
6055         from-TOML basic-string / paste-from-tatara-lisp string-literal cross-idiom-leak \
6056         shape) silently passes every prior arm and the resolver folds the value through \
6057         `Path::new(caminho).join(<file>)` looking for a literal subdirectory and fails at \
6058         resolve time with a non-self-locating `No such file or directory` error far from \
6059         the source caixa.lisp. The lacre pipeline embeds the value verbatim in its per-dep \
6060         content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the byte \
6061         lands in the BLAKE3 closure and rides into every shell-spawned subprocess (the \
6062         resolver's `git clone`, a future `feira tofu` shell-out, a future operator-side \
6063         `nix` spawn) as the canonical shell-metachar / string-literal-delimiter surface \
6064         every peer single-token-shaped typed slot already closes. The peer `:fonte :repo` \
6065         axis closes both bytes under the same shell-quote-grouping / RFC-3986-sub-delims \
6066         banner (e7a109f `'` shell-single-quote + 4267d8b `\"` shell-double-quote on \
6067         `is_git_repo_url`). Express the path as a bare relative single-token like \
6068         \"../caixa-teia\" — the sibling-workspace directory name carries no shell-quote-\
6069         grouping / string-literal-delimiter semantic; strip the outer quote pair from the \
6070         paste (the tatara-lisp `:caminho \"...\"` slot already carries the string-literal \
6071         quoting on the outer syntactic layer, so an inner quote pair would nest and \
6072         desugar to a broken layer).",
6073        ch = *byte as char
6074    )]
6075    FonteCaminhoShellQuoteGrouping {
6076        nome: String,
6077        caminho: String,
6078        byte: u8,
6079    },
6080    #[error(
6081        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
6082         comment / URL-fragment-identifier / YAML-comment cross-config-DSL metacharacter \
6083         0x{byte:02x} `{ch}` (every POSIX shell — sh / bash / zsh / dash / ksh / fish / \
6084         nushell — lexes an unquoted `#` at the head of a word or after unquoted \
6085         whitespace as the comment-lead per POSIX.1-2017 §2.3 Token Recognition step 6, \
6086         discarding the byte and everything after it to the end of the physical line \
6087         before command parsing (`cd ../caixa-teia  # legacy sibling` — the canonical \
6088         paste-from-shell-history-with-trailing-annotation shape every operator-notebook \
6089         and CI-manifest carries); YAML 1.2 §6.6 makes `#` the comment-lead at any \
6090         position preceded by whitespace or at line-start (`path: ../caixa-teia  # pin` \
6091         — the canonical paste-from-values.yaml / paste-from-K8s-manifest cross-idiom-\
6092         leak); RFC 3986 §3.5 reserves `#` as the URL fragment-identifier delimiter (the \
6093         canonical paste-from-browser-address-bar `github.com/foo/bar#readme` / \
6094         `github.com/foo/bar#L42` permalink shape, and the symmetric Nix-flake-ref \
6095         cross-idiom leak `github:foo/bar#packageName` where `#` selects a flake \
6096         output); the same cross-config-DSL surface extends to HCL / Terraform / Nix \
6097         flake attributes / dotenv `.env` / gitconfig / .gitignore / ini / TOML where \
6098         `#` is likewise the comment-lead. POSIX `std::path::Path` treats the byte as a \
6099         literal path-component byte, so a `:caminho \"../caixa-teia # legacy sibling\"` \
6100         (the canonical paste-from-shell-history-with-trailing-annotation footgun), \
6101         `:caminho \"../caixa-teia  # pin\"` (the symmetric YAML flow-scalar paste-with-\
6102         trailing-comment shape), or `:caminho \"../caixa-teia#readme\"` (the URL \
6103         fragment paste-from-browser-address-bar shape) silently passes every prior arm \
6104         and the resolver folds the value through `Path::new(caminho).join(<file>)` \
6105         looking for a literal subdirectory named `../caixa-teia # legacy sibling` and \
6106         fails at resolve time with a non-self-locating `No such file or directory` \
6107         error far from the source caixa.lisp — while every downstream shell / YAML / \
6108         URL parser silently truncates the value at the `#` byte to `../caixa-teia`, so \
6109         a `feira tofu` shell-out and a `nix flake check` on an emitted YAML `path:` \
6110         scalar disagree with the resolver on which directory the value names. The \
6111         lacre pipeline embeds the value verbatim in its per-dep content-address \
6112         `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the byte lands in \
6113         the BLAKE3 closure and rides into every shell-spawned subprocess (the \
6114         resolver's `git clone`, a future `feira tofu` shell-out, a future operator-\
6115         side `nix` spawn) as the canonical shell-metachar / comment-lead / URL-\
6116         fragment-delimiter surface every peer single-token-shaped typed slot already \
6117         closes. The peer `:fonte :repo` axis closes the byte under the same URL-\
6118         fragment-identifier banner (a68f818 `#` on `is_git_repo_url`). Express the \
6119         path as a bare relative single-token like \"../caixa-teia\" — the sibling-\
6120         workspace directory name carries no shell-comment / URL-fragment / YAML-\
6121         comment semantic; move any trailing annotation to a tatara-lisp `;`-comment \
6122         on the surrounding form (`;; legacy sibling` above the `(:caminho ...)` slot) \
6123         and drop any `#fragment` tail entirely (fragment identifiers select \
6124         renderings, not directories, and `:caminho` names a directory).",
6125        ch = *byte as char
6126    )]
6127    FonteCaminhoShellComment {
6128        nome: String,
6129        caminho: String,
6130        byte: u8,
6131    },
6132    #[error(
6133        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains URL-\
6134         percent-encoding-escape / printf-format-specifier / bash-job-control-specifier \
6135         / YAML-directive-lead metacharacter 0x{byte:02x} `{ch}` (RFC 3986 §2.1 reserves \
6136         `%` as the URL percent-encoding-escape — `%HH` is the mandatory encoding \
6137         mechanism for every byte outside the `unreserved` alphanumeric / `-` / `.` / \
6138         `_` / `~` set, and `%` itself must be percent-encoded as `%25` to appear \
6139         literally inside a URL value. The canonical paste-from-browser-address-bar \
6140         percent-encoded-space footgun (an author copies `../caixa%20teia` out of a URL-\
6141         encoded README hyperlink / browser address bar / percent-encoded permalink \
6142         expecting `%20` to decode to a literal space at the filesystem layer) locks two \
6143         distinct BLAKE3 closures (`path:../caixa%20teia` vs `path:../caixa teia`) for \
6144         what the author intended as the byte-identical sibling-workspace dep. POSIX \
6145         `std::path::Path` treats the byte as a literal path-component byte, so \
6146         `Path::join` looks for a literal `./{caminho}` subdirectory and fails at \
6147         resolve time with a non-self-locating `No such file or directory` error far \
6148         from the source caixa.lisp — while every downstream URL parser / shell printf \
6149         builtin / YAML directive parser silently reinterprets the byte to a different \
6150         value than the resolver's `Path::join` sees. Beyond the URL-encoding hazard, \
6151         `%` is the C / POSIX printf format-directive lead-in (`%s`, `%d`, `%02x` — \
6152         wired into every POSIX shell's `printf` builtin, the canonical CWE-134 format-\
6153         string-injection vector); the bash / zsh / ksh job-control-specifier lead-in \
6154         (`%1` names \"job 1\", `%%` names \"the current job\", `%foo` names \"the most \
6155         recent job whose command started with `foo`\" — a future `kill %1` invocation \
6156         silently redirects the signal to a wrong target); the YAML 1.2 §6.8.1 \
6157         directive lead-in (`%YAML 1.2` / `%TAG` — the paste-from-top-of-doc YAML \
6158         directive block cross-idiom leak); and the Windows-shell env-var-reference \
6159         lead-in (`%PATH%` — the paste-from-`.bat` / paste-from-PowerShell-`%env:PATH%` \
6160         cross-idiom leak). The lacre pipeline embeds the value verbatim in its per-dep \
6161         content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, so the \
6162         byte lands in the BLAKE3 closure and rides into every shell-spawned subprocess \
6163         (the resolver's `git clone`, a future `feira tofu` shell-out, a future \
6164         operator-side `nix` spawn) as the canonical URL-percent-encoding-escape / \
6165         printf-format-specifier / job-control-specifier surface every peer single-\
6166         token-shaped typed slot already closes. The peer `:fonte :repo` axis closes \
6167         the byte under the same URL-percent-encoding-escape banner (a323db8 `%` on \
6168         `is_git_repo_url`). Express the path as a bare relative single-token like \
6169         \"../caixa-teia\" — the sibling-workspace directory name carries no URL-\
6170         percent-encoding-escape / format-specifier / job-control semantic; substitute \
6171         any `%20` percent-encoded-space with a literal space then reject the whole \
6172         value at the leading-whitespace / embedded-`?` arm on the same axis (a caixa \
6173         directory name never carries an embedded space in practice); drop any \
6174         `%2F`-encoded path separator in favor of a literal `/`; and drop any leading \
6175         `%YAML` / `%PATH%` cross-idiom-leak prefix entirely.",
6176        ch = *byte as char
6177    )]
6178    FonteCaminhoUrlPercentEncoding {
6179        nome: String,
6180        caminho: String,
6181        byte: u8,
6182    },
6183    #[error(
6184        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
6185         variable-expansion / command-substitution / arithmetic-expansion / cross-config-\
6186         DSL-interpolation metacharacter 0x{byte:02x} `{ch}` (every POSIX shell — sh / \
6187         bash / zsh / dash / ksh / busybox ash / fish / nushell — lexes `$` per \
6188         POSIX.1-2017 §2.6 as the variable-expansion `$<name>` / braced-form `${{<name>}}` \
6189         / command-substitution `$(<cmd>)` / arithmetic-expansion `$((<expr>))` operator; \
6190         Nix uses `${{var}}` as the string-interpolation lead, Make uses `$(var)` / `$@` \
6191         / `$<` for variables and automatic-variables, JavaScript / TypeScript template \
6192         literals use `${{expr}}` for interpolation, envsubst / Kubernetes / OpenShift \
6193         templates use `${{VAR}}` for env-var-reference, PHP uses `$_GET` / `$_ENV` for \
6194         superglobals, Perl uses `$foo` for scalars, SASS / SCSS uses `$primary-color` \
6195         for variables, and PostgreSQL / SQLite use `$1` / `$2` for bind parameters — \
6196         the byte is a first-class parser byte in nearly every config / templating / \
6197         build-system DSL the substrate's paste-idiom surface routinely crosses. POSIX \
6198         `std::path::Path` treats the byte as a literal path-component byte, so the \
6199         canonical paste-from-shell-one-liner `:caminho \"../foo$HOME/bar\"` / paste-\
6200         from-CI-manifest `:caminho \"../foo${{WORKSPACE}}/bar\"` / paste-from-shell-\
6201         prompt `:caminho \"../foo$(whoami)/bar\"` footguns silently pass every prior \
6202         cascade arm (`$` isn't `\\` / `<` / `>` / `|` / `;` / `&` / backtick / `*` / \
6203         `?` / `(` / `)` / `{{` / `}}` / `[` / `]` / `'` / `\"` / `#` / `%`) and route \
6204         through `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` \
6205         subdirectory that fails at resolve time with a non-self-locating `No such file \
6206         or directory` error far from the source caixa.lisp. The lacre pipeline embeds \
6207         the value verbatim in its per-dep content-address `path:{caminho}` at \
6208         caixa-resolver/src/resolve.rs:189, so byte-identical caixa.lisp values differing \
6209         only in whether the author substituted `$HOME` / `${{WORKSPACE}}` at author \
6210         time lock to two distinct BLAKE3 closures across two workstations whose \
6211         downstream envsubst / Nix / Make / K8s-template layers differ in `$VAR` \
6212         recognition — defeating the THEORY.md §V.2 render-determinism contract on the \
6213         same axis every prior `:caminho` arm protects. Beyond the determinism vector, \
6214         `$` at any position in a value flowing verbatim into a shell-spawned subprocess \
6215         is the canonical CWE-78 shell-command-injection surface every peer single-\
6216         token-shaped typed slot already closes: peer `:fonte :repo` axis rejects `$` \
6217         under the shell-variable-expansion / URL-sub-delim banner via `is_git_repo_url` \
6218         (b9d187c), peer `:fonte :tag` / `:fonte :branch` axes reject `$` as part of \
6219         `is_git_ref_name`'s printable-ASCII-restricted grammar (`git check-ref-format` \
6220         rejects the byte outright), and peer `:entrada :paths` axis rejects `$` via \
6221         `is_gateway_api_http_path`'s eleven-byte RFC-3986-reserved set. The leading-`$` \
6222         position on the same axis routes through `FonteCaminhoVarExpansion` at the \
6223         f4efe9c leading-byte arm; this arm closes the last positional gap on the byte \
6224         so every position — leading and embedded — is structurally rejected. Substitute \
6225         the `$VAR` / `${{VAR}}` / `$(cmd)` template with the literal value at author \
6226         time, or express the path as a bare relative single-token like \
6227         \"../caixa-teia\" — the sibling-workspace directory name carries no shell-\
6228         variable-expansion / command-substitution / arithmetic-expansion semantic.",
6229        ch = *byte as char
6230    )]
6231    FonteCaminhoShellVariableExpansion {
6232        nome: String,
6233        caminho: String,
6234        byte: u8,
6235    },
6236    #[error(
6237        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
6238         history-expansion / RFC-3986-sub-delims / bang-operator metacharacter 0x{byte:02x} \
6239         `{ch}` (every interactive POSIX shell with history enabled — bash / ksh / zsh's \
6240         `bashcompat` / csh / tcsh — lexes `!` as the history-expansion prefix per bash \
6241         reference §9.3: `!command` re-runs the most recent history entry beginning with \
6242         `command`, `!!` re-runs the prior command verbatim, `!$` substitutes the last \
6243         word of the prior command, `!:N` substitutes the Nth word of the prior command, \
6244         and the substitution fires at every history-expansion-enabled shell context — \
6245         `set -o histexpand` is bash's default for interactive sessions and the layer \
6246         every `feira tofu` / `git clone` / `nix flake check` subprocess-argument \
6247         invocation crosses when spawned under `bash -i`. Beyond shell history, RFC 3986 \
6248         §2.2 lists `!` in the `sub-delims` set (the URL grammar admits the byte inside \
6249         a path segment, but every WHATWG-conformant special-scheme URL parser percent-\
6250         encodes it inside a query component via the 'special-query percent-encode set' \
6251         the peer `is_git_repo_url` `*` / `(` / `)` / `'` arms close on); the byte is \
6252         also the C / C++ / Rust / JavaScript / Python bang-operator (logical-negation \
6253         prefix — the paste-from-source-code idiom where an author copies \
6254         `!path.exists()` out of a Rust snippet and the trailing punctuation crosses \
6255         the string-literal boundary); the canonical English-typography emphasis / \
6256         exclamation mark (the paste-from-prose enthusiasm-form idiom where an author \
6257         writes `:caminho \"../caixa-teia!\"` expecting the substrate to coerce it to a \
6258         kebab-case slug); and the Nix flake-ref attribute-selection operator surface. \
6259         POSIX `std::path::Path` treats `!` as a literal path-component byte, so the \
6260         canonical paste-from-shell-history footgun `:caminho \"../caixa-teia!sudo\"` \
6261         (an author copies a `cd ../caixa-teia && !sudo make install` one-liner from a \
6262         quick-start README and the trailing `!sudo` rides in verbatim as a history-\
6263         expansion reference), the symmetric `:caminho \"../foo!!/bar\"` (the `!!` \
6264         repeat-prior-command paste idiom), the English-typography `:caminho \
6265         \"../caixa-teia!\"` (paste-from-prose enthusiasm-form), and the last-word-\
6266         substitution `:caminho \"../foo!$\"` shape silently pass every prior cascade \
6267         arm (`!` isn't `\\` / `<` / `>` / `|` / `;` / `&` / backtick / `*` / `?` / `(` \
6268         / `)` / `{{` / `}}` / `[` / `]` / `'` / `\"` / `#` / `%` / `$`) and route \
6269         through `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` \
6270         subdirectory that fails at resolve time with a non-self-locating `No such file \
6271         or directory` error far from the source caixa.lisp. The lacre pipeline embeds \
6272         the value verbatim in its per-dep content-address `path:{caminho}` at \
6273         caixa-resolver/src/resolve.rs:189, so the byte lands in the BLAKE3 closure and \
6274         rides into every shell-spawned subprocess (the resolver's `git clone`, a \
6275         future `feira tofu` shell-out, a future operator-side `nix flake check` spawn) \
6276         as the canonical shell-history-expansion / RFC-3986-sub-delims surface every \
6277         peer single-token-shaped typed slot already closes. The peer `:fonte :repo` \
6278         axis closes the byte under the same shell-history-expansion / RFC-3986-sub-\
6279         delims banner (7d53c68 `!` on `is_git_repo_url`). Express the path as a bare \
6280         relative single-token like \"../caixa-teia\" — the sibling-workspace directory \
6281         name carries no shell-history-expansion / bang-operator semantic; drop any \
6282         `!sudo` / `!!` / `!$` history-expansion trailing paste-from-shell-history \
6283         idiom; and drop any trailing English-typography exclamation mark that pasted \
6284         from prose.",
6285        ch = *byte as char
6286    )]
6287    FonteCaminhoShellHistoryExpansion {
6288        nome: String,
6289        caminho: String,
6290        byte: u8,
6291    },
6292    #[error(
6293        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} contains shell-\
6294         history-substitution / RFC-3986-'unwise' / regex-negation metacharacter 0x{byte:02x} \
6295         `{ch}` (POSIX bash's `set -o histexpand` mode — the default for every interactive \
6296         session and every `bash -i` subprocess-argument context `feira tofu` / `git clone` / \
6297         `nix flake check` cross — lexes `^old^new^` per bash reference §9.3 as the 'quick \
6298         substitution' history operator that rewrites the prior command's `old` string to \
6299         `new` and re-executes it verbatim, the canonical typo-correction one-liner idiom \
6300         (`git clone <bad-url>` → `^bad^good` typo-fix-and-rerun the paste-from-shell-\
6301         history author trims only the leading `git clone` prefix from). RFC 3986 §2 lists \
6302         `^` in the 'unwise' set every URL parser is required to percent-encode-or-refuse at \
6303         the wire boundary, and the WHATWG URL spec's 'fragment percent-encode set' maps \
6304         `^` → `%5E` at the query / fragment component transition, so `Path::join` on the \
6305         literal value diverges from every downstream `feira tofu` curl-invocation / \
6306         artifact-registry-fetch that percent-encodes the byte before the wire. `^` is also \
6307         the regex character-class negation prefix (`[^abc]`), the bitwise XOR operator in \
6308         C / C++ / Rust / Python / JavaScript / Nix / Go, the Windows `cmd.exe` escape \
6309         metacharacter, and the LaTeX / Markdown / BibTeX superscript operator. POSIX \
6310         `std::path::Path` treats `^` as a literal path-component byte, so \
6311         `:caminho \"../foo^bar/baz\"` (embedded quick-substitution), `:caminho \
6312         \"../foo^\"` (trailing history-substitution-open shape), or `:caminho \"../x^y\"` \
6313         (XOR-expression paste-from-source) silently pass every prior cascade arm (`^` \
6314         isn't `\\` / `<` / `>` / `|` / `;` / `&` / backtick / `*` / `?` / `(` / `)` / `{{` \
6315         / `}}` / `[` / `]` / `'` / `\"` / `#` / `%` / `$` / `!`) and route through \
6316         `Path::new(caminho).join(<file>)` looking for a literal `./{caminho}` subdirectory \
6317         that fails at resolve time with a non-self-locating `No such file or directory` \
6318         error far from the source caixa.lisp. The lacre pipeline embeds the value verbatim \
6319         in its per-dep content-address `path:{caminho}` at caixa-resolver/src/resolve.rs:189, \
6320         so the byte lands in the BLAKE3 closure and rides into every shell-spawned \
6321         subprocess (the resolver's `git clone`, a future `feira tofu` shell-out, a future \
6322         operator-side `nix flake check` spawn) as the canonical shell-history-substitution \
6323         / RFC-3986-unwise surface every peer single-token-shaped typed slot already closes. \
6324         The peer `:fonte :repo` axis closes the byte under the same shell-history-\
6325         substitution / RFC-3986-unwise banner (49e142f `^` on `is_git_repo_url`). Together \
6326         with the immediate-predecessor `!` arm (6a04767) this arm closes the full `set -o \
6327         histexpand` operator surface on the `:caminho` axis — the `!command` / `!!` / `!$` \
6328         prefix form via `!`, the `^old^new^` quick-substitution form via `^`. Express the \
6329         path as a bare relative single-token like \"../caixa-teia\" — the sibling-workspace \
6330         directory name carries no shell-history-substitution / regex-negation / XOR-operator \
6331         semantic; drop any `^old^new` history-substitution paste-from-shell-history idiom; \
6332         drop any trailing `^` history-substitution-open fragment.",
6333        ch = *byte as char
6334    )]
6335    FonteCaminhoShellHistorySubstitution {
6336        nome: String,
6337        caminho: String,
6338        byte: u8,
6339    },
6340    #[error(
6341        ":deps entry {nome:?} :fonte (:tipo path …) :caminho {caminho:?} has a trailing \
6342         `/` (the resolver's `Path::join` resolves `\"../caixa-teia\"` and \
6343         `\"../caixa-teia/\"` to the same directory, but the lacre pipeline embeds the \
6344         value verbatim in its per-dep content-address `path:{caminho}` at \
6345         caixa-resolver/src/resolve.rs:189, so two authors whose only difference is \
6346         shell tab-completion emit byte-divergent BLAKE3 closures for the same caixa — \
6347         defeating the THEORY.md §V.2 render-determinism contract via the trailing-\
6348         separator vector (the canonical paste-from-shell-tab-completion + paste-from-\
6349         `pwd`-with-`/`-suffix footgun, and the canonical Cargo-style `path = \
6350         \"../caixa-teia/\"` paste-from-Cargo-manifest cross-idiom leak). Drop the \
6351         trailing `/`; every `:caminho` value names a sibling-workspace directory \
6352         already, so the trailing separator carries no information. Use \
6353         `\"../caixa-teia\"` rather than `\"../caixa-teia/\"`)"
6354    )]
6355    FonteCaminhoTrailingSlash { nome: String, caminho: String },
6356    #[error(
6357        "{list} carries duplicate entry :nome {nome:?} — every dep list keys its \
6358         entries by caixa name (Cargo's [dependencies] / [dev-dependencies] tables \
6359         apply the same set-not-multiset discipline; one package per table), and \
6360         two entries naming the same caixa carry two version constraints / source \
6361         pins / feature sets for one identity. The caixa-resolver's lacre pipeline \
6362         consumes the list as a `HashMap`-keyed-by-`:nome` lookup: the second entry \
6363         silently overwrites the first at the resolver-side `concrete_versao` step, \
6364         and the dropped entry's pin / features never reach the closure — far from \
6365         the source caixa.lisp, with no field naming which `:deps` entry was the \
6366         silent loser. If two version constraints are genuinely needed (the rare \
6367         multi-version closure case the lacre pipeline doesn't yet support), the \
6368         author surface is two distinct caixa names (e.g. a `caixa-teia-v01` / \
6369         `caixa-teia-v02` aliased pair); within one list, one entry per caixa name."
6370    )]
6371    DuplicateNome { nome: String, list: &'static str },
6372    #[error(
6373        ":deps entry {nome:?} has empty :caracteristicas entry — every feature flag must \
6374         name a non-empty identifier on the target caixa (Cargo's [dependencies.<dep>.features] \
6375         applies the same per-entry non-empty discipline). An empty feature flag reaches the \
6376         caixa-resolver's lacre pipeline as a no-op feature enable, silently dropping the \
6377         author's intent far from the source caixa.lisp; drop the empty entry, or replace it \
6378         with the canonical kebab-case feature name the target caixa declares."
6379    )]
6380    CaracteristicaEmpty { nome: String },
6381    #[error(
6382        ":deps entry {nome:?} :caracteristicas entry {caracteristica:?} is not a valid Cargo \
6383         feature name: {reason} (the value flows verbatim into Cargo's \
6384         [dependencies.<dep>.features] list and Cargo's `restricted_names::validate_feature_name` \
6385         parser enforces the same shape at `cargo metadata` time; use a single-token \
6386         identifier like `\"http\"`, `\"derive\"`, or `\"runtime-tokio\"` — kebab-case ASCII \
6387         alphanumeric with `-`, `_`, `+`, or `.` as continuation characters, starting with \
6388         an ASCII alphanumeric or `_`)"
6389    )]
6390    CaracteristicaInvalid {
6391        nome: String,
6392        caracteristica: String,
6393        reason: String,
6394    },
6395    #[error(
6396        ":deps entry {nome:?} :caracteristicas carries duplicate feature {caracteristica:?} — \
6397         every feature-flag list keys its entries by name (Cargo's \
6398         [dependencies.<dep>.features] applies the same set-not-multiset discipline; one entry \
6399         per feature per dep), and two entries naming the same feature are a redundant \
6400         set-membership declaration for one identity (the feature-toggle slot is set-shaped; \
6401         enabling a feature twice has no additional semantic). The caixa-resolver's lacre \
6402         pipeline consumes the list as a set-shaped feature toggle — the resolver enables the \
6403         feature once regardless of declaration count, so the duplicate's pin / position never \
6404         reaches the closure with no field naming the silent loser. One entry per feature per \
6405         dep; if two distinct features are intended, name each verbatim."
6406    )]
6407    CaracteristicaDuplicate {
6408        nome: String,
6409        caracteristica: String,
6410    },
6411    #[error(
6412        "{list} entry :nome {nome:?} names the caixa itself — a caixa cannot depend \
6413         on itself (the lacre closure's dep-graph traversal is rooted at the caixa's \
6414         :nome, and a self-dep would be a one-node cycle the caixa-resolver either \
6415         rejects mid-traversal far from the source caixa.lisp or recurses on until \
6416         it exhausts its stack). Every :nome is globally-unique substrate identity, \
6417         so a :deps / :deps-dev entry whose :nome equals the parent caixa's :nome \
6418         *is* the parent itself, not a coincidentally-named peer. Drop the \
6419         self-referential dep entry — to reference code from this caixa, use \
6420         :bibliotecas / :exe / :servicos (the substrate-blessed shape for \
6421         referencing the caixa's own code surface) instead."
6422    )]
6423    DepIsSelf { nome: String, list: &'static str },
6424}
6425
6426// Fold the eleven `DepError::FonteCaminho<Variant> { nome: nome.to_string(),
6427// caminho: caminho.to_string() }` two-slot struct-variant wire-up sites at
6428// [`DepSource::validate_caminho`] onto one substrate primitive per typed
6429// variant — the paired `{ nome: String, caminho: String }` two-slot family
6430// on [`DepError`], sibling of the peer
6431// [`crate::supervisor::supervisor_caixa_only_ctors!`] (db09650, 3 variants
6432// on `{ caixa: String }`) on the `SupervisorError` envelope, the peer
6433// [`crate::aplicacao::contrato_empty_pair_ctors!`] (8580068, 4 variants on
6434// `{ de, para }`), [`crate::aplicacao::aplicacao_field_reason_ctors!`]
6435// (981060b, 7 variants on `{ <field>: String, reason: String }`),
6436// [`crate::aplicacao::contrato_target_ctors!`] (14b81d5, 2 variants on
6437// `{ de, para, wit, expected }`), and
6438// [`crate::aplicacao::contrato_pair_value_reason_ctors!`] (14e13f1, 3
6439// variants on `{ de, para, <field>: String, reason: String }`) on the
6440// `AplicacaoError` envelopes, the peer
6441// [`crate::layout::layout_violation_ctors!`] (131ca0d, 16 variants on
6442// `{ caixa, issue }`), [`crate::layout::layout_slot_kind_ctors!`]
6443// (0419438, 4 variants on `{ caixa, kind, slots }`),
6444// [`crate::LayoutError::missing_entry`] (1b09f9d, one variant on
6445// `{ kind, path }`), and [`crate::layout::layout_nome_only_ctors!`]
6446// (3fe3dd7, 6 variants on `<Variant>(String)`) on the `LayoutError`
6447// envelopes, the peer three [`crate::limits::limits_codec_value_*_ctors!`]
6448// codec-family macros (81c856c, 12 wire-ups) on the `LimitsError`
6449// envelope, and the peer [`crate::upgrade::upgrade_from_script_ctors!`]
6450// (8e67041, 3 variants on `{ from: String, script: PathBuf }`) on the
6451// `UpgradeError` envelope. First fold family on this `DepError` envelope.
6452//
6453// Each of the eleven wire-up sites on this shape (the leading-byte cascade
6454// closing the seven `FonteCaminho{Absolute, TildeExpansion, VarExpansion,
6455// LeadingWhitespace, LeadingHyphen}` arms; the orthogonal single-metachar
6456// cascade closing `FonteCaminhoBackslash` on `\`; the shell-lexer-metachar
6457// cascade closing `FonteCaminhoShell{Pipe, Semicolon, Background,
6458// CommandSubstitution}` on the four single-byte shell operators; and the
6459// trailing-`/` reproducibility arm closing `FonteCaminhoTrailingSlash`)
6460// opened the identical `DepError::FonteCaminho<Variant> { nome:
6461// nome.to_string(), caminho: caminho.to_string() }` four-line
6462// struct-literal against the same `(nome: &str, caminho: &str)` local pair
6463// — the exact "same block re-inlined at every consumer" shape the PRIME
6464// DIRECTIVE names as a bug, on the same altitude the peer `LayoutError` /
6465// `AplicacaoError` / `SupervisorError` / `LimitsError` / `UpgradeError`
6466// families each closed on their sibling envelopes. The eleven variants
6467// share one `{ nome: String, caminho: String }` shape, so the fold routes
6468// each wire-up site through one dispatch per typed variant.
6469//
6470// The macro below generates one `#[must_use]` inherent constructor per
6471// variant of shape `fn <ctor>(nome: &str, caminho: &str) -> Self`, so every
6472// wire-up site collapses onto one dispatch:
6473// `DepError::<ctor>(nome, caminho)`, byte-equal to the pre-lift
6474// struct-literal on the same `(&str, &str)` fixture. The uniform two-field
6475// construction (`nome.to_string()` / `caminho.to_string()`) is spelled
6476// once — inside the macro — rather than at every wire-up site.
6477//
6478// The twelve `FonteCaminho<Variant> { nome, caminho, byte }` three-field
6479// shapes at the per-byte-classification arms — the
6480// `FonteCaminho{ControlChar,ShellRedirection,ShellGlob,
6481// ShellSubshellGrouping,ShellBraceExpansion,ShellBracketExpansion,
6482// ShellQuoteGrouping,ShellComment,UrlPercentEncoding,
6483// ShellVariableExpansion,ShellHistoryExpansion,ShellHistorySubstitution}`
6484// cluster — carry an additional `byte: u8` naming the offending byte and
6485// so would break the uniform-two-field routing this macro promises. They
6486// instead fold onto the sibling three-field envelope through
6487// [`fonte_caminho_byte_ctors!`] (this-commit-lift, 12 variants on the
6488// `{ nome, caminho, byte }` shape), whose sole additional axis over this
6489// two-slot family is the `byte: u8` classification the arms carry. The
6490// remaining `FonteCaminhoEmpty` one-field `{ nome }` shape at the empty-
6491// first arm folds instead onto the peer [`dep_nome_only_ctors!`]
6492// (792aa92, 5 variants on `{ nome: String }`) sibling family of this
6493// envelope.
6494//
6495// Every future consumer that wants to construct one of these eleven
6496// variants outside the current in-crate [`DepSource::validate_caminho`]
6497// wire-up sites (a deferred `caixa-resolver` per-`:caminho` re-validator
6498// at lacre-resolve time re-checking the same value-shape axes the resolver
6499// consumes, a future `feira validate --deps` per-caixa admission verb
6500// re-checking the `:fonte :caminho` axis, a per-lacre overlay resolver
6501// rejecting a `:caminho` value against a cluster-local snapshot) now
6502// reaches each variant through one call rather than re-inlining the
6503// four-line struct-literal in lockstep with the eleven in-crate wire-up
6504// sites.
6505macro_rules! fonte_caminho_ctors {
6506    ($($ctor:ident => $variant:ident),* $(,)?) => {
6507        impl DepError {
6508            $(
6509                #[doc = concat!(
6510                    "Construct a [`DepError::",
6511                    stringify!($variant),
6512                    "`] naming the offending `:deps :nome` + `:fonte ",
6513                    "(:tipo path …) :caminho` pair. Folds the uniform ",
6514                    "`Self::",
6515                    stringify!($variant),
6516                    " { nome: nome.to_string(), caminho: caminho.to_string() }` ",
6517                    "two-slot struct-literal onto one substrate primitive so ",
6518                    "every [`DepSource::validate_caminho`] wire-up on this ",
6519                    "variant reads through one dispatch rather than the ",
6520                    "pre-lift four-line open-coded block."
6521                )]
6522                #[must_use]
6523                pub fn $ctor(nome: &str, caminho: &str) -> Self {
6524                    Self::$variant {
6525                        nome: nome.to_string(),
6526                        caminho: caminho.to_string(),
6527                    }
6528                }
6529            )*
6530        }
6531    };
6532}
6533
6534fonte_caminho_ctors! {
6535    fonte_caminho_absolute => FonteCaminhoAbsolute,
6536    fonte_caminho_tilde_expansion => FonteCaminhoTildeExpansion,
6537    fonte_caminho_var_expansion => FonteCaminhoVarExpansion,
6538    fonte_caminho_leading_whitespace => FonteCaminhoLeadingWhitespace,
6539    fonte_caminho_leading_hyphen => FonteCaminhoLeadingHyphen,
6540    fonte_caminho_backslash => FonteCaminhoBackslash,
6541    fonte_caminho_shell_pipe => FonteCaminhoShellPipe,
6542    fonte_caminho_shell_semicolon => FonteCaminhoShellSemicolon,
6543    fonte_caminho_shell_background => FonteCaminhoShellBackground,
6544    fonte_caminho_shell_command_substitution => FonteCaminhoShellCommandSubstitution,
6545    fonte_caminho_trailing_slash => FonteCaminhoTrailingSlash,
6546}
6547
6548// Fold the twelve `DepError::FonteCaminho<Variant> { nome: nome.to_string(),
6549// caminho: caminho.to_string(), byte: b }` three-slot struct-variant wire-up
6550// sites at [`DepSource::validate_caminho`] onto one substrate primitive per
6551// typed variant — the paired `{ nome: String, caminho: String, byte: u8 }`
6552// three-slot family on [`DepError`], strict sibling of the peer
6553// [`fonte_caminho_ctors!`] (f85f145, 11 variants on the two-slot
6554// `{ nome: String, caminho: String }` envelope) of this envelope. Extends
6555// that fold onto the `byte`-classifying arms whose additional `byte: u8`
6556// axis broke its uniform-two-field routing — the exact "future compounding
6557// work" the pre-lift `fonte_caminho_ctors!` prose named as deferred, closed
6558// here. Third fold family on this `DepError` envelope, sibling of the peer
6559// two-slot [`fonte_caminho_ctors!`] and one-slot [`dep_nome_only_ctors!`]
6560// (792aa92, 5 variants on the `{ nome: String }` envelope) families on the
6561// same enum.
6562//
6563// Each of the twelve wire-up sites on this shape (the control-byte arm
6564// closing `FonteCaminhoControlChar` on the sub-`0x20` / `0x7F` cluster; the
6565// shell-lexer-metachar cascade closing `FonteCaminhoShellRedirection` on
6566// `< >`, `FonteCaminhoShellGlob` on `* ?`, `FonteCaminhoShellSubshellGrouping`
6567// on `( )`, `FonteCaminhoShellBraceExpansion` on `{ }`,
6568// `FonteCaminhoShellBracketExpansion` on `[ ]`, and
6569// `FonteCaminhoShellQuoteGrouping` on `' "`; the single-metachar arms
6570// closing `FonteCaminhoShellComment` on `#`, `FonteCaminhoUrlPercentEncoding`
6571// on `%`, `FonteCaminhoShellVariableExpansion` on `$`,
6572// `FonteCaminhoShellHistoryExpansion` on `!`, and
6573// `FonteCaminhoShellHistorySubstitution` on `^`) opened the identical
6574// `DepError::FonteCaminho<Variant> { nome: nome.to_string(),
6575// caminho: caminho.to_string(), byte: b }` five-line struct-literal against
6576// the same `(nome: &str, caminho: &str, b: u8)` local triple — the exact
6577// "same block re-inlined at every consumer" shape the PRIME DIRECTIVE names
6578// as a bug, on the same altitude the peer two-slot `fonte_caminho_ctors!`
6579// closed on the sibling two-field envelope of this same enum. The twelve
6580// variants share one `{ nome: String, caminho: String, byte: u8 }` shape, so
6581// the fold routes each wire-up site through one dispatch per typed variant.
6582//
6583// The macro below generates one `#[must_use]` inherent constructor per
6584// variant of shape `fn <ctor>(nome: &str, caminho: &str, byte: u8) -> Self`,
6585// so every wire-up site collapses onto one dispatch:
6586// `DepError::<ctor>(nome, caminho, b)`, byte-equal to the pre-lift
6587// struct-literal on the same `(&str, &str, u8)` fixture. The uniform
6588// three-field construction (`nome.to_string()` / `caminho.to_string()` /
6589// `byte`) is spelled once — inside the macro — rather than at every wire-up
6590// site.
6591//
6592// Every future consumer that wants to construct one of these twelve
6593// variants outside the current in-crate [`DepSource::validate_caminho`]
6594// wire-up sites (a deferred `caixa-resolver` per-`:caminho` re-validator
6595// at lacre-resolve time re-checking the same value-shape axes the resolver
6596// consumes, a future `feira validate --deps` per-caixa admission verb
6597// re-checking the `:fonte :caminho` axis against the shell-metachar
6598// classification bytes this cluster catches, a per-lacre overlay resolver
6599// rejecting a `:caminho` value against a cluster-local snapshot) now
6600// reaches each variant through one call rather than re-inlining the
6601// five-line struct-literal in lockstep with the twelve in-crate wire-up
6602// sites.
6603macro_rules! fonte_caminho_byte_ctors {
6604    ($($ctor:ident => $variant:ident),* $(,)?) => {
6605        impl DepError {
6606            $(
6607                #[doc = concat!(
6608                    "Construct a [`DepError::",
6609                    stringify!($variant),
6610                    "`] naming the offending `:deps :nome` + `:fonte ",
6611                    "(:tipo path …) :caminho` pair + the offending `byte: u8` ",
6612                    "classification. Folds the uniform `Self::",
6613                    stringify!($variant),
6614                    " { nome: nome.to_string(), caminho: caminho.to_string(), ",
6615                    "byte }` three-slot struct-literal onto one substrate ",
6616                    "primitive so every [`DepSource::validate_caminho`] wire-up ",
6617                    "on this variant reads through one dispatch rather than ",
6618                    "the pre-lift five-line open-coded block."
6619                )]
6620                #[must_use]
6621                pub fn $ctor(nome: &str, caminho: &str, byte: u8) -> Self {
6622                    Self::$variant {
6623                        nome: nome.to_string(),
6624                        caminho: caminho.to_string(),
6625                        byte,
6626                    }
6627                }
6628            )*
6629        }
6630    };
6631}
6632
6633fonte_caminho_byte_ctors! {
6634    fonte_caminho_control_char => FonteCaminhoControlChar,
6635    fonte_caminho_shell_redirection => FonteCaminhoShellRedirection,
6636    fonte_caminho_shell_glob => FonteCaminhoShellGlob,
6637    fonte_caminho_shell_subshell_grouping => FonteCaminhoShellSubshellGrouping,
6638    fonte_caminho_shell_brace_expansion => FonteCaminhoShellBraceExpansion,
6639    fonte_caminho_shell_bracket_expansion => FonteCaminhoShellBracketExpansion,
6640    fonte_caminho_shell_quote_grouping => FonteCaminhoShellQuoteGrouping,
6641    fonte_caminho_shell_comment => FonteCaminhoShellComment,
6642    fonte_caminho_url_percent_encoding => FonteCaminhoUrlPercentEncoding,
6643    fonte_caminho_shell_variable_expansion => FonteCaminhoShellVariableExpansion,
6644    fonte_caminho_shell_history_expansion => FonteCaminhoShellHistoryExpansion,
6645    fonte_caminho_shell_history_substitution => FonteCaminhoShellHistorySubstitution,
6646}
6647
6648// Fold the five `DepError::<Variant> { nome: <owner>.clone_or_to_string() }`
6649// single-slot struct-variant wire-up sites scattered across
6650// [`Dep::validate`] / [`Dep::validate_caracteristicas`] /
6651// [`DepSource::validate`] / [`DepSource::validate_caminho`] onto one
6652// substrate primitive per typed variant — the paired `{ nome: String }`
6653// single-slot family on [`DepError`], sibling of the peer
6654// [`fonte_caminho_ctors!`] (f85f145, 11 variants on
6655// `{ nome: String, caminho: String }`) on the sibling two-slot envelope of
6656// the same enum, and of the peer
6657// [`crate::supervisor::supervisor_caixa_only_ctors!`] (db09650, 3 variants
6658// on `{ caixa: String }`) on the `SupervisorError` envelope's single-slot
6659// axis. Second fold family on this `DepError` envelope, and the first on
6660// the single-`{ nome }` shape.
6661//
6662// The five wire-up sites this fold closes each opened the identical
6663// `DepError::<Variant> { nome: <owner>.to_string_or_clone() }` three-line
6664// struct-literal against the same `nome: &str` (or `self.nome: &String`)
6665// local — the exact "same block re-inlined at every consumer" shape the
6666// PRIME DIRECTIVE names as a bug. The five variants share one
6667// `{ nome: String }` shape, so the fold routes each wire-up site through
6668// one dispatch per typed variant.
6669//
6670// The macro below generates one `#[must_use]` inherent constructor per
6671// variant of shape `fn <ctor>(nome: &str) -> Self`, so every wire-up site
6672// collapses onto one dispatch: `DepError::<ctor>(nome)`, byte-equal to the
6673// pre-lift struct-literal on the same `&str` fixture. The uniform
6674// one-field construction (`nome.to_string()`) is spelled once — inside
6675// the macro — rather than at every wire-up site. Callers that hold a
6676// `String` (`self.nome`) pass `&self.nome`, which auto-derefs to `&str`
6677// and lets the macro-owned `.to_string()` produce the fresh owning copy
6678// the enum variant needs; the semantics collapse onto the same
6679// `.clone()`-equivalent one this fold replaces at every site.
6680//
6681// The sibling `NomeEmpty` unit-variant (`enum DepError { NomeEmpty, … }`)
6682// on the same envelope stays on its pre-lift open-coded wire-up shape —
6683// it carries no `nome` field (the offending `:nome` value *is* the empty
6684// string this variant catches) so the uniform `fn(nome: &str) -> Self`
6685// signature this macro promises does not apply. Every future consumer
6686// that wants to construct one of these five variants outside the current
6687// in-crate wire-up sites (a deferred `caixa-resolver` per-`:versao` /
6688// `:caracteristicas` / `:fonte :repo` / `:fonte :pin` / `:fonte :caminho`
6689// re-validator at lacre-resolve time, a future `feira validate --deps`
6690// per-caixa admission verb, a per-lacre overlay resolver rejecting one of
6691// these empty-value shapes against a cluster-local snapshot) now reaches
6692// each variant through one call rather than re-inlining the three-line
6693// struct-literal in lockstep with the five in-crate wire-up sites.
6694macro_rules! dep_nome_only_ctors {
6695    ($($ctor:ident => $variant:ident),* $(,)?) => {
6696        impl DepError {
6697            $(
6698                #[doc = concat!(
6699                    "Construct a [`DepError::",
6700                    stringify!($variant),
6701                    "`] naming the offending `:deps :nome`. Folds the ",
6702                    "uniform `Self::",
6703                    stringify!($variant),
6704                    " { nome: nome.to_string() }` one-field ",
6705                    "struct-literal onto one substrate primitive so every ",
6706                    "in-crate wire-up on this variant reads through one ",
6707                    "dispatch rather than the pre-lift three-line ",
6708                    "open-coded block."
6709                )]
6710                #[must_use]
6711                pub fn $ctor(nome: &str) -> Self {
6712                    Self::$variant { nome: nome.to_string() }
6713                }
6714            )*
6715        }
6716    };
6717}
6718
6719dep_nome_only_ctors! {
6720    versao_empty => VersaoEmpty,
6721    fonte_repo_empty => FonteRepoEmpty,
6722    fonte_pin_missing => FontePinMissing,
6723    fonte_caminho_empty => FonteCaminhoEmpty,
6724    caracteristica_empty => CaracteristicaEmpty,
6725}
6726
6727// Fold the four `DepError::{DuplicateNome, DepIsSelf}` struct-variant
6728// wire-up sites at [`crate::manifest::Caixa::push_dep`] +
6729// [`crate::manifest::Caixa::validate_deps`] +
6730// [`validate_no_self_dep`] onto one substrate-primitive family per
6731// typed variant — the `DepError`-side siblings of the peer
6732// [`crate::supervisor::supervisor_caixa_only_ctors!`] macro (db09650)
6733// on the `SupervisorError { caixa: String }` one-slot envelope and of
6734// the peer [`dep_nome_only_ctors!`] macro (792aa92) on the
6735// `DepError { nome: String }` one-slot envelope. The two variants
6736// carry the same `{ nome: String, list: &'static str }` two-slot
6737// shape: the `nome` field names the offending dep the diagnostic
6738// points the author back at, and the `list` field carries the
6739// `":deps"` / `":deps-dev"` author-surface tag verbatim (via
6740// [`crate::dep::DepList::as_str`] on the [`push_dep`] /
6741// [`validate_deps`] arms, and via the paired
6742// [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
6743// [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `&'static str`
6744// canonicals on the [`validate_no_self_dep`] arm) so the author can
6745// grep their caixa.lisp for the offending list block in one edit.
6746//
6747// Each of the four wire-up sites opened the same struct-literal
6748// `DepError::<Variant> { nome: <name>.to_string(), list: <tag> }`
6749// two-line block — the exact "same block re-inlined at every
6750// consumer" shape the PRIME DIRECTIVE names as a bug, on the same
6751// altitude the peer `DepError` / `SupervisorError` /
6752// `AplicacaoError` / `LayoutError` / `LimitsError` ctor families
6753// already closed on their sibling envelopes. The two `#[must_use]`
6754// inherent constructors below fold each wire-up onto one dispatch:
6755// `DepError::duplicate_nome(<nome>, <list>)` and
6756// `DepError::dep_is_self(<nome>, <list>)`, byte-equal to the
6757// pre-lift struct-literal on the same scalar fixtures. The `list:
6758// &'static str` parameter (not `impl Into<String>`) preserves the
6759// exact wire tag every consumer already passes verbatim — no
6760// downstream diagnostic reshaping at the lift, matching the peer
6761// `DepList::as_str` / `DEP_AUTHOR_KEY_DEPS*` `&'static str`
6762// contract each wire-up site already keys off.
6763macro_rules! dep_nome_list_ctors {
6764    ($($ctor:ident => $variant:ident),* $(,)?) => {
6765        impl DepError {
6766            $(
6767                #[doc = concat!(
6768                    "Construct a [`DepError::",
6769                    stringify!($variant),
6770                    "`] naming the offending `:deps :nome` and the ",
6771                    "author-surface list tag (`:deps` vs. `:deps-dev`) ",
6772                    "the diagnostic points the author back at. Folds ",
6773                    "the uniform `Self::",
6774                    stringify!($variant),
6775                    " { nome: nome.to_string(), list }` two-field ",
6776                    "struct-literal onto one substrate primitive so ",
6777                    "every in-crate wire-up on this variant reads ",
6778                    "through one dispatch rather than the pre-lift ",
6779                    "open-coded struct-literal block."
6780                )]
6781                #[must_use]
6782                pub fn $ctor(nome: &str, list: &'static str) -> Self {
6783                    Self::$variant { nome: nome.to_string(), list }
6784                }
6785            )*
6786        }
6787    };
6788}
6789
6790dep_nome_list_ctors! {
6791    duplicate_nome => DuplicateNome,
6792    dep_is_self => DepIsSelf,
6793}
6794
6795// Fold the three `DepError::{VersaoInvalid, FonteRepoShape,
6796// CaracteristicaInvalid} { nome: <nome>.to_string(), <axis>:
6797// <value>.to_string(), reason }` struct-variant wire-up sites at
6798// [`Dep::validate`]'s `:versao` requirement-shape gate + [`DepSource::validate`]'s
6799// `:fonte (:tipo git …) :repo` value-shape gate + [`Dep::validate_caracteristicas`]'s
6800// per-entry `:caracteristicas` feature-name-shape gate onto one substrate-
6801// primitive family per typed variant — the `DepError`-side siblings of the
6802// peer [`dep_nome_only_ctors!`] (792aa92) on the one-slot `{ nome }`
6803// envelope, [`dep_nome_list_ctors!`] (6f5e0cd) on the two-slot `{ nome,
6804// list: &'static str }` envelope, [`fonte_caminho_ctors!`] (f85f145) on
6805// the two-slot `{ nome, caminho }` envelope, and
6806// [`fonte_caminho_byte_ctors!`] (0e35793) on the three-slot `{ nome,
6807// caminho, byte }` envelope. The three variants share the same
6808// `{ nome: String, <axis>: String, reason: String }` three-slot shape —
6809// the `nome` field names the offending dep the diagnostic points the
6810// author back at, the middle `<axis>: String` field carries the offending
6811// axis value verbatim (`:versao` requirement scalar on `VersaoInvalid`,
6812// `:repo` URL scalar on `FonteRepoShape`, `:caracteristicas` per-entry
6813// feature-name scalar on `CaracteristicaInvalid`), and the `reason: String`
6814// field carries the parser-shaped rejection sentence the paired
6815// [`crate::render::require_valid_versao_requirement`] /
6816// [`crate::render::is_git_repo_url`] /
6817// [`crate::render::is_cargo_feature_name`] predicate returned. The middle
6818// axis-field name differs across variants (`versao` / `repo` /
6819// `caracteristica`) so the ctor family below takes the axis field name as
6820// a macro parameter (`$axis:ident`) alongside the ctor + variant names,
6821// generating one `pub fn $ctor(nome: &str, $axis: &str, reason: String)
6822// -> Self` inherent constructor per typed variant that spells the uniform
6823// three-field construction (`nome.to_string()` / `<axis>.to_string()` /
6824// `reason` forwarded owned) exactly once. Peer of the sibling
6825// [`crate::aplicacao::aplicacao_field_reason_ctors!`] (981060b) macro
6826// family on the `AplicacaoError` envelope's mirror-symmetric
6827// `{ <field>: String, reason: String }` two-slot shape — same
6828// `<axis>: <value>.to_string()` + `reason` owned-forward payload shape,
6829// one `nome`-axis added at the per-dep-owned altitude the `DepError`
6830// envelope keys off (every `DepError` variant carries the offending
6831// `:deps :nome` verbatim so the author can grep their caixa.lisp for the
6832// offending block in one edit).
6833//
6834// The three wire-up sites this fold closes are:
6835// - [`DepSource::validate`]'s `:repo` value-shape arm
6836//   (`Err(DepError::FonteRepoShape { nome: nome.to_string(), repo:
6837//   repo.clone(), reason })` after [`crate::render::is_git_repo_url`]
6838//   rejects the offending URL);
6839// - [`Dep::validate`]'s `:versao` requirement-shape arm
6840//   (`|reason| DepError::VersaoInvalid { nome: self.nome.clone(), versao:
6841//   self.versao_requirement().to_string(), reason }` inside the
6842//   [`crate::render::require_valid_versao_requirement`] callback pair);
6843// - [`Dep::validate_caracteristicas`]'s per-entry feature-name-shape arm
6844//   (`Err(DepError::CaracteristicaInvalid { nome: self.nome.clone(),
6845//   caracteristica: c.clone(), reason })` after
6846//   [`crate::render::is_cargo_feature_name`] rejects the offending
6847//   feature-name).
6848//
6849// Each opened the identical five-line struct-literal against the same
6850// `(nome, <axis>, reason)` local triple — the exact "same block re-inlined
6851// at every consumer" shape the PRIME DIRECTIVE names as a bug, on the
6852// same altitude the peer four already-lifted `DepError` ctor families
6853// closed on their sibling shape-envelopes. The three variant / axis-field
6854// discriminators are the only things that vary between them; the rest of
6855// the struct-literal is a byte-for-byte re-inline.
6856//
6857// Every future consumer wanting to raise one of these three diagnostics
6858// (a deferred `caixa-resolver` per-`:deps` re-validator at lacre-resolve
6859// time re-checking each declared dep against the same requirement +
6860// git-URL + feature-name value-shape cascade, a future `feira validate
6861// --deps` per-caixa admission verb re-running the shape gates on demand,
6862// a per-lacre overlay resolver rejecting an author-supplied dep against a
6863// cluster-local snapshot) now reaches one dispatch rather than re-inlining
6864// the five-line struct-literal in lockstep with the three in-crate
6865// wire-up sites.
6866macro_rules! dep_nome_axis_reason_ctors {
6867    ($($ctor:ident => $variant:ident { $axis:ident }),* $(,)?) => {
6868        impl DepError {
6869            $(
6870                #[doc = concat!(
6871                    "Construct a [`DepError::",
6872                    stringify!($variant),
6873                    "`] naming the offending `:deps :nome`, the offending ",
6874                    "`:", stringify!($axis), "` axis value, and the ",
6875                    "parser-shaped rejection `reason`. Folds the uniform ",
6876                    "`Self::",
6877                    stringify!($variant),
6878                    " { nome: nome.to_string(), ",
6879                    stringify!($axis),
6880                    ": ",
6881                    stringify!($axis),
6882                    ".to_string(), reason }` three-field struct-literal ",
6883                    "onto one substrate primitive so every in-crate ",
6884                    "wire-up on this variant reads through one dispatch ",
6885                    "rather than the pre-lift five-line open-coded block. ",
6886                    "The `nome: &str` and `",
6887                    stringify!($axis),
6888                    ": &str` parameters accept `&str` literals and ",
6889                    "`&String` (via Deref coercion) so every existing ",
6890                    "wire-up threads through the ctor without a ",
6891                    "pre-conversion; the `reason: String` parameter takes ",
6892                    "an owned `String` (not `impl Into<String>`) matching ",
6893                    "the paired `crate::render::*` predicate's ",
6894                    "`Result<(), String>` return shape every wire-up ",
6895                    "already holds owned at the call site."
6896                )]
6897                #[must_use]
6898                pub fn $ctor(nome: &str, $axis: &str, reason: String) -> Self {
6899                    Self::$variant {
6900                        nome: nome.to_string(),
6901                        $axis: $axis.to_string(),
6902                        reason,
6903                    }
6904                }
6905            )*
6906        }
6907    };
6908}
6909
6910dep_nome_axis_reason_ctors! {
6911    versao_invalid => VersaoInvalid { versao },
6912    fonte_repo_shape => FonteRepoShape { repo },
6913    caracteristica_invalid => CaracteristicaInvalid { caracteristica },
6914}
6915
6916// Fold the three `DepError::{FontePinEmpty, FontePinAmbiguous,
6917// CaracteristicaDuplicate} { nome: <nome>.to_string(), <axis>:
6918// <value>.to_string() }` struct-variant wire-up sites at
6919// [`DepSource::validate`]'s per-`:fonte` git-pin single-pin-empty +
6920// multi-pin-ambiguous cascade and [`Dep::validate_caracteristicas`]'s
6921// per-entry set-not-multiset dedup closure onto one substrate-primitive
6922// family per typed variant — the missing two-slot rung on the
6923// `DepError`-side four-family ladder ([`dep_nome_only_ctors!`] (792aa92)
6924// one-slot `{ nome }` → this two-slot `{ nome, <axis>: String }` →
6925// [`dep_nome_list_ctors!`] (6f5e0cd) two-slot `{ nome, list: &'static
6926// str }` → [`dep_nome_axis_reason_ctors!`] (5621f8a) three-slot
6927// `{ nome, <axis>: String, reason: String }` → [`fonte_pin_shape`]
6928// (86e2a17) four-slot `{ nome, pin, value, reason }`), and mirror-
6929// symmetric sibling of the peer
6930// [`crate::aplicacao::aplicacao_field_reason_ctors!`] (981060b) two-slot
6931// `{ <field>: String, reason: String }` fold on the `AplicacaoError`
6932// envelope — same `<axis>: <value>.to_string()` owned-forward payload
6933// shape, `reason` axis removed and `nome`-axis added at the per-dep-
6934// owned altitude the `DepError` envelope keys off (every `DepError`
6935// variant carries the offending `:deps :nome` verbatim so the author
6936// can grep their caixa.lisp for the offending block in one edit). The
6937// three variants share the same `{ nome: String, <axis>: String }`
6938// two-slot shape: the `nome` field names the offending dep the
6939// diagnostic points the author back at, and the middle `<axis>:
6940// String` field carries the offending per-envelope axis value verbatim
6941// (`:fonte` per-pin author-surface tag on `FontePinEmpty`, the
6942// comma-joined multi-pin ambiguity report on `FontePinAmbiguous`, the
6943// duplicate `:caracteristicas` entry on `CaracteristicaDuplicate`).
6944// The middle axis-field name differs across variants (`pin` / `pins` /
6945// `caracteristica`) so the ctor family below takes the axis field name
6946// as a macro parameter (`$axis:ident`) alongside the ctor + variant
6947// names, generating one `pub fn $ctor(nome: &str, $axis: &str) ->
6948// Self` inherent constructor per typed variant that spells the
6949// uniform two-field construction (`nome.to_string()` /
6950// `<axis>.to_string()`) exactly once.
6951//
6952// The three wire-up sites this fold closes are:
6953// - [`DepSource::validate`]'s per-`:fonte` set-of-one empty-pin arm
6954//   (`return Err(DepError::FontePinEmpty { nome: nome.to_string(), pin:
6955//   pin.to_string() });` inside the `set.len() == 1` branch after the
6956//   `is_some_and(String::is_empty)` iterator);
6957// - [`DepSource::validate`]'s per-`:fonte` set-of-two-or-more
6958//   ambiguity arm (`return Err(DepError::FontePinAmbiguous { nome:
6959//   nome.to_string(), pins: set.join(", ") });` inside the `_` branch);
6960// - [`Dep::validate_caracteristicas`]'s per-entry
6961//   set-not-multiset-dedup closure (`|| DepError::CaracteristicaDuplicate
6962//   { nome: self.nome.clone(), caracteristica: c.clone() }` passed to
6963//   [`crate::render::insert_first_seen`]).
6964//
6965// Each opened the identical four-line struct-literal against the same
6966// `(nome, <axis>)` local pair — the exact "same block re-inlined at
6967// every consumer" shape the PRIME DIRECTIVE names as a bug, on the
6968// same altitude the peer four already-lifted `DepError` ctor families
6969// closed on their sibling shape-envelopes. The three variant / axis-
6970// field discriminators are the only things that vary between them;
6971// the rest of the struct-literal is a byte-for-byte re-inline.
6972//
6973// Every future consumer wanting to raise one of these three
6974// diagnostics (a deferred `caixa-resolver` per-`:deps` re-validator
6975// at lacre-resolve time re-checking each declared dep against the
6976// same `:fonte` set-of-one / set-of-many + `:caracteristicas`
6977// set-not-multiset cascade, a future `feira validate --deps` per-
6978// caixa admission verb re-running the shape gates on demand, a
6979// per-lacre overlay resolver rejecting an author-supplied dep against
6980// a cluster-local snapshot the M4 CR materializer projects) now
6981// reaches one dispatch rather than re-inlining the four-line struct-
6982// literal in lockstep with the three in-crate wire-up sites.
6983macro_rules! dep_nome_axis_ctors {
6984    ($($ctor:ident => $variant:ident { $axis:ident }),* $(,)?) => {
6985        impl DepError {
6986            $(
6987                #[doc = concat!(
6988                    "Construct a [`DepError::",
6989                    stringify!($variant),
6990                    "`] naming the offending `:deps :nome` and the ",
6991                    "offending `:", stringify!($axis), "` axis value. ",
6992                    "Folds the uniform `Self::",
6993                    stringify!($variant),
6994                    " { nome: nome.to_string(), ",
6995                    stringify!($axis),
6996                    ": ",
6997                    stringify!($axis),
6998                    ".to_string() }` two-field struct-literal onto one ",
6999                    "substrate primitive so every in-crate wire-up on ",
7000                    "this variant reads through one dispatch rather than ",
7001                    "the pre-lift four-line open-coded block. Both `nome: ",
7002                    "&str` and `",
7003                    stringify!($axis),
7004                    ": &str` parameters accept `&str` literals and ",
7005                    "`&String` (via Deref coercion) so every existing ",
7006                    "wire-up threads through the ctor without a pre-",
7007                    "conversion."
7008                )]
7009                #[must_use]
7010                pub fn $ctor(nome: &str, $axis: &str) -> Self {
7011                    Self::$variant {
7012                        nome: nome.to_string(),
7013                        $axis: $axis.to_string(),
7014                    }
7015                }
7016            )*
7017        }
7018    };
7019}
7020
7021dep_nome_axis_ctors! {
7022    fonte_pin_empty => FontePinEmpty { pin },
7023    fonte_pin_ambiguous => FontePinAmbiguous { pins },
7024    caracteristica_duplicate => CaracteristicaDuplicate { caracteristica },
7025}
7026
7027// Fold the two `DepError::FontePinShape { nome: nome.to_string(),
7028// pin: <pin>.to_string(), value: v.clone(), reason }` four-slot
7029// struct-variant wire-up sites at [`DepSource::validate`]'s
7030// per-`:fonte` git-pin value-shape gate onto one substrate primitive on
7031// the `DepError` envelope — the last open-coded ctor site remaining on
7032// the `:fonte (:tipo git …)` value-shape trajectory this envelope
7033// carries, and the single-variant sibling of the peer four already-
7034// lifted [`DepError`] ctor families ([`fonte_caminho_ctors!`] f85f145
7035// on the two-slot `{ nome, caminho }` envelope,
7036// [`fonte_caminho_byte_ctors!`] 0e35793 on the three-slot
7037// `{ nome, caminho, byte }` envelope, [`dep_nome_only_ctors!`] 792aa92
7038// on the one-slot `{ nome }` envelope, and [`dep_nome_list_ctors!`]
7039// 6f5e0cd on the two-slot `{ nome, list }` envelope). Peer of the
7040// sibling [`crate::aplicacao::contrato_pair_value_reason_ctors!`]
7041// (14e13f1) four-slot fold on the `AplicacaoError` envelope — same
7042// `{ …, value: String, reason: String }` payload shape, one axis
7043// removed at the `nome`-only-owner altitude the `DepError` envelope
7044// keys off (no `edge_pair()` de/para pair).
7045//
7046// The two wire-up sites this fold closes are the paired refname-pin
7047// arm (`|| DepError::FontePinShape { nome: nome.to_string(),
7048// pin: pin.to_string(), value: v.clone(), reason }` inside the
7049// `[(":tag", tag), (":branch", branch)]` iterator against
7050// [`crate::render::is_git_ref_name`]) and the hex-OID-pin arm
7051// (`|| DepError::FontePinShape { nome: nome.to_string(),
7052// pin: ":rev".to_string(), value: v.clone(), reason }` against
7053// [`crate::render::is_git_oid`]) — each opened the identical
7054// `DepError::FontePinShape { … }` six-line struct-literal against the
7055// same `(nome: &str, pin: &str, v: &String, reason: String)` local
7056// tuple, the exact "same block re-inlined at every consumer" shape
7057// the PRIME DIRECTIVE names as a bug. The `pin` axis discriminator is
7058// the only thing that varies between them (`":tag"`/`":branch"` on
7059// the refname arm, `":rev"` on the hex-OID arm); the rest of the
7060// struct-literal is a byte-for-byte re-inline. Refname/hex-OID both
7061// route through the same ctor because their `pin` field carries the
7062// author-surface tag verbatim (matching the `FontePinEmpty` /
7063// `FontePinAmbiguous` sibling variants' `pin: String` axis
7064// convention), so the offending author can grep their caixa.lisp for
7065// the offending `:tag "<value>"` / `:branch "<value>"` /
7066// `:rev "<value>"` literal in one edit.
7067//
7068// The single ctor below folds each wire-up onto one dispatch:
7069// `DepError::fonte_pin_shape(nome, pin, v, reason)`, byte-equal to
7070// the pre-lift struct-literal on the same `(&str, &str, &str,
7071// String)` fixture. The uniform four-field construction
7072// (`nome.to_string()` / `pin.to_string()` / `value.to_string()` /
7073// `reason` forwarded owned) is spelled once here rather than at every
7074// wire-up site. The `reason: String` field takes an owned `String`
7075// (not `impl Into<String>`) matching the two call sites' pre-existing
7076// `let Err(reason) = crate::render::is_git_ref_name(v)` /
7077// `let Err(reason) = crate::render::is_git_oid(v)` shape — both
7078// predicates return `Result<(), String>`, so the caller always holds
7079// an owned `String` at the wire-up site and threading it through the
7080// ctor without a `.into()` shim keeps the routing shape byte-equal to
7081// the pre-lift block. The `value: &str` parameter accepts both `&str`
7082// literals (unused today) and `&String` (from the caller-held
7083// `v: &String` on each arm, via Deref coercion), so every existing
7084// wire-up threads through the ctor without a pre-conversion.
7085//
7086// Every future consumer that wants to construct this variant outside
7087// the two in-crate [`DepSource::validate`] wire-up sites (a deferred
7088// `caixa-resolver` per-`:fonte` re-validator at lacre-resolve time
7089// re-checking the same value-shape axes the resolver consumes, a
7090// future `feira validate --deps` per-caixa admission verb re-checking
7091// the `:fonte :tag`/`:branch`/`:rev` axes, a per-lacre overlay
7092// resolver rejecting a git-pin value against a cluster-local
7093// snapshot) now reaches this variant through one call rather than
7094// re-inlining the six-line struct-literal in lockstep with the two
7095// in-crate wire-up sites.
7096impl DepError {
7097    /// Construct a [`DepError::FontePinShape`] naming the offending
7098    /// `:deps :nome`, the offending `:fonte (:tipo git …) :<pin>`
7099    /// axis tag, the offending value, and the parser-shaped `reason`.
7100    /// Folds the uniform
7101    /// `Self::FontePinShape { nome: nome.to_string(),
7102    /// pin: pin.to_string(), value: value.to_string(), reason }`
7103    /// four-field struct-literal onto one substrate primitive so
7104    /// every [`DepSource::validate`] wire-up on this variant reads
7105    /// through one dispatch rather than the pre-lift six-line
7106    /// open-coded block. The `nome` string threads verbatim from
7107    /// [`Dep::nome`] at the call site; the `pin` string carries the
7108    /// author-surface `:tag` / `:branch` / `:rev` tag verbatim; the
7109    /// `value` string carries the offending refname / hex-OID
7110    /// verbatim; and `reason` forwards the owned `String` returned
7111    /// by [`crate::render::is_git_ref_name`] /
7112    /// [`crate::render::is_git_oid`] without a `.into()` shim.
7113    #[must_use]
7114    pub fn fonte_pin_shape(nome: &str, pin: &str, value: &str, reason: String) -> Self {
7115        Self::FontePinShape {
7116            nome: nome.to_string(),
7117            pin: pin.to_string(),
7118            value: value.to_string(),
7119            reason,
7120        }
7121    }
7122
7123    /// Construct a [`DepError::NomeInvalid`] naming the offending
7124    /// `:deps :nome` byte-string and the parser-shaped rejection
7125    /// `reason` returned by [`crate::render::is_dns_1123_label`].
7126    ///
7127    /// Folds the uniform
7128    /// `Self::NomeInvalid { nome: nome.to_string(), reason }` two-field
7129    /// struct-literal onto one substrate primitive so every wire-up on
7130    /// this variant reads through one dispatch rather than the pre-lift
7131    /// four-line open-coded `DepError::NomeInvalid { nome:
7132    /// self.nome.clone(), reason }` block inside [`Dep::validate`]. The
7133    /// missing two-slot `{ nome, reason }` rung on the `DepError`-side
7134    /// ctor-family ladder (`{ nome }` one-slot →
7135    /// [`dep_nome_only_ctors!`] (792aa92); `{ nome, <axis>: String }`
7136    /// two-slot → [`dep_nome_axis_ctors!`] (7f7c950); `{ nome, list:
7137    /// &'static str }` two-slot → [`dep_nome_list_ctors!`] (6f5e0cd);
7138    /// `{ nome, <axis>: String, reason: String }` three-slot →
7139    /// [`dep_nome_axis_reason_ctors!`] (5621f8a); `{ nome, pin, value,
7140    /// reason }` four-slot → [`DepError::fonte_pin_shape`] (86e2a17))
7141    /// — the sole variant on the envelope carrying the
7142    /// `{ nome: String, reason: String }` two-slot shape without a
7143    /// middle axis, matching the peer
7144    /// [`crate::manifest::ManifestError::NomeInvalid`] +
7145    /// [`crate::aplicacao::AplicacaoError::MembroCaixaInvalid`] +
7146    /// [`crate::supervisor::SupervisorError::ChildCaixaInvalid`]
7147    /// four-axis DNS-1123 caixa-identifier diagnostic family the
7148    /// existing `nome_invalid_diagnostic_carries_offending_name` test
7149    /// pins on this envelope.
7150    ///
7151    /// The `nome: &str` parameter accepts `&str` literals and `&String`
7152    /// (via Deref coercion) so the sole in-crate wire-up threads through
7153    /// the ctor without a pre-conversion; the `reason: String`
7154    /// parameter takes an owned `String` (not `impl Into<String>`)
7155    /// matching the [`crate::render::is_dns_1123_label`] predicate's
7156    /// `Result<(), String>` return shape the sole wire-up site already
7157    /// holds owned at the call site, keeping the routing byte-equal to
7158    /// the pre-lift block. Same owned-`String`-forward `reason` payload
7159    /// discipline as the sibling three-slot family
7160    /// [`dep_nome_axis_reason_ctors!`] on `{ nome, <axis>, reason }`
7161    /// and the four-slot [`DepError::fonte_pin_shape`] on
7162    /// `{ nome, pin, value, reason }`.
7163    ///
7164    /// Every future consumer that raises the same diagnostic outside
7165    /// [`Dep::validate`] — a deferred `caixa-resolver` per-`:deps`
7166    /// re-validator at lacre-resolve time re-checking each declared
7167    /// dep's `:nome` against the same DNS-1123 predicate the apiserver-
7168    /// side schema uses (the `:nome` value flows verbatim as the target
7169    /// caixa's `:nome`, the rendered `lareira-<nome>` Helm chart name
7170    /// segment, the `LABEL_PROGRAM` label value, and the resolver's
7171    /// checkout-directory leaf), a future `feira validate --deps`
7172    /// per-caixa admission verb re-running the shape gate on demand, a
7173    /// per-lacre overlay resolver rejecting an author-supplied dep's
7174    /// `:nome` against a cluster-local snapshot the M4 CR materializer
7175    /// projects, a future authoring-surface widening the field into a
7176    /// `(String, Vec<Suggestion>)` pair carrying a
7177    /// "did-you-mean-<nearest-valid-label>" hint — now reaches this
7178    /// variant through one call rather than re-inlining the four-line
7179    /// struct-literal in lockstep with the one in-crate wire-up site.
7180    #[must_use]
7181    pub fn nome_invalid(nome: &str, reason: String) -> Self {
7182        Self::NomeInvalid {
7183            nome: nome.to_string(),
7184            reason,
7185        }
7186    }
7187}
7188
7189#[allow(clippy::trivially_copy_pass_by_ref)]
7190fn is_false(b: &bool) -> bool {
7191    !*b
7192}
7193
7194#[cfg(test)]
7195mod tests {
7196    use super::*;
7197
7198    #[test]
7199    fn registry_dep_is_minimal() {
7200        let d = Dep::simple("caixa-teia", "^0.1");
7201        assert_eq!(d.nome, "caixa-teia");
7202        assert_eq!(d.versao, "^0.1");
7203        assert!(d.fonte.is_none());
7204        assert!(!d.opcional());
7205        assert!(d.caracteristicas().is_empty());
7206    }
7207
7208    #[test]
7209    fn dep_string_scalar_accessor_pair_is_const_fn() {
7210        // Fail-before-pass-after pin on [`Dep::nome`] +
7211        // [`Dep::versao_requirement`]'s `const`-eval-surface posture.
7212        // Each accessor projects the per-`:deps` / per-`:deps-dev`
7213        // entry's [`String`] storage through the `pub const fn`
7214        // [`String::as_str`] (const-stable since Rust 1.87, well
7215        // within the workspace MSRV) — any future accidental
7216        // downgrade to non-`const` fails the corresponding
7217        // `<name>_via_const_fn` wrapper at caixa-core build time with
7218        // E0015 (`cannot call non-const method`), strictly stronger
7219        // than a runtime `assert!`. Sibling of the peer
7220        // per-M2/M3/universal-axis `String → &str` scalar-accessor
7221        // family pins on the sibling `const`-eval-surface passes
7222        // ([`crate::Caixa::nome`] / [`crate::Caixa::versao`] at the
7223        // top-level manifest, [`crate::CaixaVersion::as_str`] at the
7224        // typed-newtype wrapper, [`crate::aplicacao::Membro::nome`] /
7225        // [`crate::aplicacao::Membro::versao_requirement`] at the M3
7226        // membership axis, [`crate::aplicacao::Entrada::hostname`] /
7227        // [`crate::aplicacao::Entrada::destination`] at the M3
7228        // ingress axis, [`crate::supervisor::ChildSpec::nome`] /
7229        // [`crate::supervisor::ChildSpec::versao_requirement`] at the
7230        // M2 supervisor-tree axis,
7231        // [`crate::upgrade::UpgradeFromEntry::prior_versao`] at the
7232        // M2 upgrade axis, and the per-`:contratos`
7233        // [`crate::aplicacao::WitContract::source`] /
7234        // [`crate::aplicacao::WitContract::destination`] /
7235        // [`crate::aplicacao::WitContract::world_ref`] trio the
7236        // sibling pin at 279823b already anchors).
7237        const fn nome_via_const_fn(d: &Dep) -> &str {
7238            d.nome()
7239        }
7240        const fn versao_via_const_fn(d: &Dep) -> &str {
7241            d.versao_requirement()
7242        }
7243        for (nome, versao) in [
7244            ("caixa-teia", "^0.1"),
7245            ("caixa-mesh", "~0.2.3"),
7246            ("caixa-helm", "*"),
7247        ] {
7248            let d = Dep::simple(nome, versao);
7249            assert_eq!(nome_via_const_fn(&d), d.nome());
7250            assert_eq!(versao_via_const_fn(&d), d.versao_requirement());
7251            assert_eq!(d.nome(), nome);
7252            assert_eq!(d.versao_requirement(), versao);
7253        }
7254    }
7255
7256    #[test]
7257    fn dep_outer_accessor_family_is_const_fn() {
7258        // Fail-before-pass-after pin on [`Dep::fonte`] +
7259        // [`Dep::caracteristicas`]'s `const`-eval-surface posture.
7260        // Each accessor projects the per-`:deps` / per-`:deps-dev`
7261        // entry's composite / list storage through a `pub const fn`
7262        // stdlib method (`Option::<DepSource>::as_ref` /
7263        // `Vec::<String>::as_slice`, both const-stable since Rust
7264        // 1.83, well within the workspace MSRV). Any future
7265        // accidental downgrade to non-`const` fails the corresponding
7266        // `<name>_via_const_fn` wrapper at caixa-core build time with
7267        // E0015 (`cannot call non-const method`), strictly stronger
7268        // than a runtime `assert!` and side-stepping the destructor-
7269        // in-const restriction the `Dep` fixture's `String` /
7270        // `Option<DepSource>` / `Vec<String>` carriers rule out on the
7271        // direct-`const _: () = assert!(...)` residence.
7272        //
7273        // Peer of the sibling per-`Dep` scalar-accessor pair pin
7274        // [`dep_string_scalar_accessor_pair_is_const_fn`] on the same
7275        // outer per-dep-list-entry [`Dep`] altitude — this pin extends
7276        // the `const`-eval-surface discipline onto the composite-
7277        // reference and slice-return arms of the outer-`Dep` accessor
7278        // family, closing the four-slot outer surface (`:nome` +
7279        // `:versao` + `:fonte` + `:caracteristicas`) on the `const`-fn
7280        // posture. The `:opcional` `bool` arm already carries the
7281        // posture through [`Dep::opcional`]'s prior `pub const fn`
7282        // declaration, so this pin lands the last two unlifted
7283        // outer-`Dep` accessors and closes the family.
7284        const fn fonte_via_const_fn(d: &Dep) -> Option<&DepSource> {
7285            d.fonte()
7286        }
7287        const fn caracteristicas_via_const_fn(d: &Dep) -> &[String] {
7288            d.caracteristicas()
7289        }
7290        // `Dep::simple` — no `:fonte`, empty `:caracteristicas`.
7291        let empty = Dep::simple("caixa-teia", "^0.1");
7292        assert!(fonte_via_const_fn(&empty).is_none());
7293        assert_eq!(fonte_via_const_fn(&empty), empty.fonte());
7294        assert!(caracteristicas_via_const_fn(&empty).is_empty());
7295        assert_eq!(
7296            caracteristicas_via_const_fn(&empty),
7297            empty.caracteristicas()
7298        );
7299        // `Dep::git` — `:fonte` is `Some(Git{…})`, `:caracteristicas`
7300        // still empty.
7301        let git = Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0");
7302        assert!(fonte_via_const_fn(&git).is_some());
7303        assert_eq!(fonte_via_const_fn(&git), git.fonte());
7304        assert_eq!(caracteristicas_via_const_fn(&git), git.caracteristicas());
7305        // Populated `:caracteristicas` — exercise the non-empty
7306        // slice-view arm to pin the accessor's borrow shape against
7307        // both a `Vec::new()` empty backing buffer and a populated one.
7308        let mut with_features = Dep::simple("caixa-teia", "^0.1");
7309        with_features.caracteristicas = vec!["feat-a".into(), "feat-b".into()];
7310        assert_eq!(caracteristicas_via_const_fn(&with_features).len(), 2);
7311        assert_eq!(
7312            caracteristicas_via_const_fn(&with_features),
7313            with_features.caracteristicas()
7314        );
7315    }
7316
7317    #[test]
7318    fn git_dep_carries_tag() {
7319        let d = Dep::git("t", "*", "github:o/r", "v1");
7320        match d.fonte {
7321            Some(DepSource::Git {
7322                ref repo, ref tag, ..
7323            }) => {
7324                assert_eq!(repo, "github:o/r");
7325                assert_eq!(tag.as_deref(), Some("v1"));
7326            }
7327            _ => panic!("expected Git source"),
7328        }
7329    }
7330
7331    #[test]
7332    fn validate_accepts_simple_dep() {
7333        Dep::simple("caixa-teia", "^0.1").validate().unwrap();
7334    }
7335
7336    #[test]
7337    fn validate_rejects_empty_nome() {
7338        // The fail-before-pass-after pin for `:nome ""`: the empty-name
7339        // arm fires first so the per-entry parse-side diagnostic doesn't
7340        // emit a useless `nome: ""` reference.
7341        let mut d = Dep::simple("placeholder", "^0.1");
7342        d.nome = String::new();
7343        assert_eq!(d.validate().unwrap_err(), DepError::NomeEmpty);
7344    }
7345
7346    #[test]
7347    fn validate_rejects_empty_versao() {
7348        // `parse_requirement("")` returns `Ok(VersionReq::STAR)` (the
7349        // semver crate accepts the empty string as a wildcard match),
7350        // so the empty-`:versao` arm is structurally necessary even
7351        // with the parse arm in place — mirrors `MembroVersaoEmpty` /
7352        // `EmptyChildVersion` ordering on the other two `:versao` axes.
7353        let mut d = Dep::simple("caixa-teia", "ignored");
7354        d.versao = String::new();
7355        let err = d.validate().unwrap_err();
7356        assert!(
7357            matches!(err, DepError::VersaoEmpty { ref nome } if nome == "caixa-teia"),
7358            "got {err:?}"
7359        );
7360    }
7361
7362    // ── value-shape: DNS-1123 label on :deps :nome ────────────────────────
7363
7364    #[test]
7365    fn validate_rejects_nome_with_uppercase() {
7366        // The fail-before-pass-after pin: a non-empty but uppercase
7367        // `:nome` silently passed `validate()` on every pre-gate
7368        // codebase because the prior shape only refused the empty
7369        // string. The DNS-1123 violation surfaced far downstream at
7370        // lacre-resolve time when the *target* caixa's `:nome` failed
7371        // its own gate — far from the `:deps` entry, with a diagnostic
7372        // naming the target rather than the dep entry that referenced
7373        // it. Same fail-before-pass-after fixture pinned for
7374        // `:membros :caixa` (3f9d7a0), `:children :caixa` (31bfa43),
7375        // and Caixa `:nome` (6c992f8).
7376        let d = Dep::simple("Caixa-Teia", "^0.1");
7377        let err = d.validate().unwrap_err();
7378        assert!(
7379            matches!(
7380                err,
7381                DepError::NomeInvalid { ref nome, ref reason }
7382                    if nome == "Caixa-Teia" && reason.contains("uppercase")
7383            ),
7384            "got {err:?}"
7385        );
7386    }
7387
7388    #[test]
7389    fn validate_rejects_nome_with_underscore() {
7390        // RFC 1123 allows `[a-z0-9-]` only; underscore is the canonical
7391        // "I'm thinking of Go module names / Python identifiers" leak.
7392        // Same fixture pinned for the peer caixa-identifier axes.
7393        let d = Dep::simple("caixa_teia", "^0.1");
7394        let err = d.validate().unwrap_err();
7395        assert!(
7396            matches!(
7397                err,
7398                DepError::NomeInvalid { ref nome, ref reason }
7399                    if nome == "caixa_teia" && reason.contains('_')
7400            ),
7401            "got {err:?}"
7402        );
7403    }
7404
7405    #[test]
7406    fn validate_rejects_nome_with_dot() {
7407        // A `:deps :nome` is a single DNS-1123 *label*, not a
7408        // subdomain — dots are rejected. The `"caixa.teia"` shape is
7409        // the canonical "I confused the dep name with the FQDN /
7410        // namespace" footgun, distinct from the legitimate
7411        // `:fonte :repo "github:org/caixa-teia"` axis.
7412        let d = Dep::simple("caixa.teia", "^0.1");
7413        let err = d.validate().unwrap_err();
7414        assert!(
7415            matches!(
7416                err,
7417                DepError::NomeInvalid { ref nome, ref reason }
7418                    if nome == "caixa.teia" && reason.contains('.')
7419            ),
7420            "got {err:?}"
7421        );
7422    }
7423
7424    #[test]
7425    fn validate_rejects_nome_with_leading_hyphen() {
7426        // RFC 1123 requires alphanumeric at both label boundaries.
7427        // Pinned in parity with the peer DNS-1123 fixtures.
7428        let d = Dep::simple("-caixa-teia", "^0.1");
7429        let err = d.validate().unwrap_err();
7430        assert!(
7431            matches!(
7432                err,
7433                DepError::NomeInvalid { ref nome, ref reason }
7434                    if nome == "-caixa-teia" && reason.contains("alphanumeric")
7435            ),
7436            "got {err:?}"
7437        );
7438    }
7439
7440    #[test]
7441    fn validate_rejects_nome_with_trailing_hyphen() {
7442        let d = Dep::simple("caixa-teia-", "^0.1");
7443        let err = d.validate().unwrap_err();
7444        assert!(
7445            matches!(
7446                err,
7447                DepError::NomeInvalid { ref nome, ref reason }
7448                    if nome == "caixa-teia-" && reason.contains("alphanumeric")
7449            ),
7450            "got {err:?}"
7451        );
7452    }
7453
7454    #[test]
7455    fn validate_rejects_nome_with_slash() {
7456        // The canonical "I copied the GitHub repo path into `:nome`
7457        // instead of `:fonte :repo`" typo. A `/` in the name leaks the
7458        // lacre-side `:repositorio` shape (`pleme-io/caixa-teia`) into
7459        // the local-name slot. Same fixture pinned for `:membros
7460        // :caixa` (3f9d7a0).
7461        let d = Dep::simple("pleme-io/caixa-teia", "^0.1");
7462        let err = d.validate().unwrap_err();
7463        assert!(
7464            matches!(
7465                err,
7466                DepError::NomeInvalid { ref nome, ref reason }
7467                    if nome == "pleme-io/caixa-teia" && reason.contains('/')
7468            ),
7469            "got {err:?}"
7470        );
7471    }
7472
7473    #[test]
7474    fn validate_rejects_nome_too_long() {
7475        // 64-byte label — one over the RFC 1035 / RFC 1123 label cap.
7476        // Built from a valid character set so the length-bound
7477        // diagnostic surfaces before any per-character check (the
7478        // order pin parallel to the per-character predicates inside
7479        // [`crate::render::is_dns_1123_label`]).
7480        let long = "a".repeat(64);
7481        let d = Dep::simple(&long, "^0.1");
7482        let err = d.validate().unwrap_err();
7483        assert!(
7484            matches!(
7485                err,
7486                DepError::NomeInvalid { ref nome, ref reason }
7487                    if nome.len() == 64 && reason.contains("max length of 63")
7488            ),
7489            "got {err:?}"
7490        );
7491    }
7492
7493    #[test]
7494    fn validate_accepts_canonical_nome_labels() {
7495        // Positive-control sweep — every form the K8s apiserver
7496        // accepts as a DNS-1123 label must round-trip through
7497        // validate. Covers a hyphen-bearing label, a numeric-suffix
7498        // label, a leading-digit label, a single-character label, and
7499        // a 63-byte (exactly the cap) label — the same fixture set
7500        // the peer `:membros :caixa` / `:children :caixa` positive
7501        // controls pin.
7502        for nome in [
7503            "caixa-teia",
7504            "caixa-resolver2",
7505            "2nd-tier-cache",
7506            "x",
7507            "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0",
7508        ] {
7509            Dep::simple(nome, "^0.1")
7510                .validate()
7511                .unwrap_or_else(|e| panic!("canonical label {nome:?} must validate, got {e:?}"));
7512        }
7513    }
7514
7515    #[test]
7516    fn nome_empty_takes_precedence_over_nome_invalid() {
7517        // Ordering pin: `NomeEmpty` is the more self-locating
7518        // diagnostic on `""` and must lead — `is_dns_1123_label` is
7519        // only reached after the empty-check fires at the call site.
7520        // Mirrors `membro_caixa_empty_takes_precedence_over_invalid`
7521        // (3f9d7a0) on the peer caixa-identifier axis.
7522        let mut d = Dep::simple("placeholder", "^0.1");
7523        d.nome = String::new();
7524        assert_eq!(d.validate().unwrap_err(), DepError::NomeEmpty);
7525    }
7526
7527    #[test]
7528    fn nome_invalid_fires_before_versao_empty() {
7529        // Ordering pin: a malformed `:nome` fires before any `:versao`
7530        // axis check on the *same* entry — the per-entry shape gates
7531        // run top-to-bottom (nome empty → nome shape → versao empty →
7532        // versao parse → fonte shape), so a one-entry caixa.lisp with
7533        // both wrong sees the name-side diagnostic first (the name is
7534        // the self-locating axis — without a valid name, the parse
7535        // diagnostic can't quote `:nome "<bad>"`). Same ordering
7536        // discipline as `membro_caixa_invalid_fires_before_versao_check`
7537        // (3f9d7a0).
7538        let mut d = Dep::simple("Caixa-Teia", "^0.1");
7539        d.versao = String::new();
7540        let err = d.validate().unwrap_err();
7541        assert!(
7542            matches!(err, DepError::NomeInvalid { ref nome, .. } if nome == "Caixa-Teia"),
7543            "got {err:?}"
7544        );
7545    }
7546
7547    #[test]
7548    fn nome_invalid_fires_before_versao_invalid() {
7549        // Ordering pin: a malformed `:nome` fires before the `:versao`
7550        // parse-side check on the *same* entry. Pin separately from
7551        // the empty-versao ordering so a future re-ordering surfaces
7552        // here, parallel to the b0c8389 / c4213a4 trajectory.
7553        let d = Dep::simple("Caixa-Teia", "^^0.1");
7554        let err = d.validate().unwrap_err();
7555        assert!(
7556            matches!(err, DepError::NomeInvalid { ref nome, .. } if nome == "Caixa-Teia"),
7557            "got {err:?}"
7558        );
7559    }
7560
7561    #[test]
7562    fn nome_invalid_fires_before_fonte_invalid() {
7563        // Ordering pin: a malformed `:nome` fires before the `:fonte`
7564        // shape check on the *same* entry. The `:fonte` diagnostic
7565        // names the offending dep's `:nome` verbatim (via
7566        // `DepSource::validate(&self.nome)`), so a non-self-locating
7567        // name would taint the downstream diagnostic too — the gate
7568        // ordering keeps both diagnostics individually self-locating.
7569        let mut d = Dep::simple("Caixa-Teia", "^0.1");
7570        d.fonte = Some(DepSource::Git {
7571            repo: String::new(),
7572            tag: None,
7573            rev: None,
7574            branch: None,
7575        });
7576        let err = d.validate().unwrap_err();
7577        assert!(
7578            matches!(err, DepError::NomeInvalid { ref nome, .. } if nome == "Caixa-Teia"),
7579            "got {err:?}"
7580        );
7581    }
7582
7583    #[test]
7584    fn nome_invalid_diagnostic_carries_offending_name() {
7585        // The diagnostic-shape pin: the error names the offending
7586        // `:nome` value verbatim so the author can grep their
7587        // caixa.lisp without re-running the build, and carries a
7588        // non-empty `reason` from `is_dns_1123_label` so the
7589        // predicate's own wording flows through to the diagnostic.
7590        // Same shape as `MembroCaixaInvalid` (3f9d7a0),
7591        // `ChildCaixaInvalid` (31bfa43), `ManifestError::NomeInvalid`
7592        // (6c992f8) — the four DNS-1123 caixa-identifier axes now
7593        // share a structurally-equivalent diagnostic family.
7594        let d = Dep::simple("Caixa_Teia", "^0.1");
7595        let err = d.validate().unwrap_err();
7596        let DepError::NomeInvalid { nome, reason } = err else {
7597            panic!("expected NomeInvalid, got other variant");
7598        };
7599        assert_eq!(nome, "Caixa_Teia");
7600        assert!(
7601            !reason.is_empty(),
7602            "NomeInvalid `reason` must carry the predicate's wording verbatim"
7603        );
7604    }
7605
7606    #[test]
7607    fn validate_rejects_invalid_versao_requirement() {
7608        // The fail-before-pass-after pin: a non-empty but malformed
7609        // requirement (`"^bad-version"`) silently passed every pre-gate
7610        // codebase because `:deps :versao` wasn't validated. The parse
7611        // failure surfaced far downstream at lacre-resolve time with a
7612        // `semver::Error` that didn't name which `:deps` entry carried
7613        // the typo. The new gate moves the check to caixa-build time
7614        // at the source caixa.lisp.
7615        let d = Dep::simple("caixa-teia", "^bad-version");
7616        let err = d.validate().unwrap_err();
7617        assert!(
7618            matches!(
7619                err,
7620                DepError::VersaoInvalid { ref nome, ref versao, .. }
7621                    if nome == "caixa-teia" && versao == "^bad-version"
7622            ),
7623            "got {err:?}"
7624        );
7625    }
7626
7627    #[test]
7628    fn validate_rejects_versao_with_double_caret_typo() {
7629        // `"^^0.1"` is the canonical doubled-caret typo — looks like a
7630        // Cargo-shaped requirement on first glance but fails the parser
7631        // because semver doesn't accept stacked operators. Pin this
7632        // adjacent-shape footgun explicitly so a future relaxation that
7633        // accepts "looks-canonical-but-isn't" forms surfaces here, in
7634        // parity with the `:membros` / `:children` fixtures.
7635        let d = Dep::simple("caixa-teia", "^^0.1");
7636        let err = d.validate().unwrap_err();
7637        assert!(
7638            matches!(
7639                err,
7640                DepError::VersaoInvalid { ref nome, ref versao, .. }
7641                    if nome == "caixa-teia" && versao == "^^0.1"
7642            ),
7643            "got {err:?}"
7644        );
7645    }
7646
7647    #[test]
7648    fn validate_rejects_versao_with_v_prefixed_tag() {
7649        // `"v0.1"` is the canonical "git-tag-shape leaking into the
7650        // semver requirement slot" typo — an author copies the
7651        // publish-side git-tag string verbatim into `:versao`, but
7652        // Cargo's semver parser rejects the leading `v`. Same fixture
7653        // pinned for `:membros :versao` (9888b13) and `:children
7654        // :versao` (b38ff3a). (Bare `x`-glob shorthands like `^0.1.x`
7655        // are *accepted* by the semver crate as an `*` wildcard on the
7656        // patch axis — they're a Cargo-side valid shape, not a typo.)
7657        let d = Dep::simple("caixa-teia", "v0.1");
7658        let err = d.validate().unwrap_err();
7659        assert!(
7660            matches!(
7661                err,
7662                DepError::VersaoInvalid { ref nome, ref versao, .. }
7663                    if nome == "caixa-teia" && versao == "v0.1"
7664            ),
7665            "got {err:?}"
7666        );
7667    }
7668
7669    #[test]
7670    fn validate_accepts_canonical_versao_forms() {
7671        // The five Cargo-shaped requirement forms `:membros :versao`
7672        // and `:children :versao` already accept via
7673        // `crate::parse_requirement` must pass the deps gate without
7674        // re-validating at the resolver layer. Pin every leg so a
7675        // future tightening of the canonical set surfaces here as a
7676        // test failure.
7677        for form in [
7678            "^0.1",      // caret — minor-range pin (the most common shape)
7679            "~0.1.2",    // tilde — patch-range pin
7680            "0.1.0",     // exact — single-version pin
7681            "*",         // wildcard — explicitly any-version
7682            ">=0.1, <2", // multi-range — comma-separated comparators
7683        ] {
7684            Dep::simple("caixa-teia", form)
7685                .validate()
7686                .unwrap_or_else(|e| panic!("canonical form {form:?} must validate, got {e:?}"));
7687        }
7688    }
7689
7690    #[test]
7691    fn versao_empty_takes_precedence_over_invalid() {
7692        // Order pin: the existing `VersaoEmpty` diagnostic (which
7693        // doesn't try to parse) fires before the new `VersaoInvalid`
7694        // parse-side diagnostic, so an empty `:versao` keeps its
7695        // narrower error message — `parse_requirement("")` would
7696        // otherwise return `Ok(STAR)` and silently pass, but the empty
7697        // arm catches it first.
7698        let mut d = Dep::simple("caixa-teia", "ignored");
7699        d.versao = String::new();
7700        let err = d.validate().unwrap_err();
7701        assert!(
7702            matches!(err, DepError::VersaoEmpty { ref nome } if nome == "caixa-teia"),
7703            "got {err:?}"
7704        );
7705    }
7706
7707    #[test]
7708    fn nome_empty_takes_precedence_over_versao_invalid() {
7709        // Order pin: even when `:versao` is malformed and would raise
7710        // its own diagnostic, `:nome ""` fires first because the
7711        // per-entry parse diagnostic needs a non-empty name to be
7712        // self-locating. Mirrors the
7713        // `membros_validation_runs_before_contratos_membership_check`
7714        // ordering on the typed-graph layer.
7715        let mut d = Dep::simple("placeholder", "^bad");
7716        d.nome = String::new();
7717        let err = d.validate().unwrap_err();
7718        assert_eq!(err, DepError::NomeEmpty);
7719    }
7720
7721    #[test]
7722    fn versao_invalid_diagnostic_carries_offending_versao() {
7723        // The diagnostic-shape pin: the error names the offending
7724        // `:versao` value verbatim so the author can grep their
7725        // caixa.lisp without re-running the build, and carries a
7726        // non-empty `reason` from `semver::VersionReq::parse` so the
7727        // parser's own wording flows through to the diagnostic.
7728        let d = Dep::simple("caixa-teia", "not-a-req");
7729        let err = d.validate().unwrap_err();
7730        let DepError::VersaoInvalid {
7731            nome,
7732            versao,
7733            reason,
7734        } = err
7735        else {
7736            panic!("expected VersaoInvalid, got other variant");
7737        };
7738        assert_eq!(nome, "caixa-teia");
7739        assert_eq!(versao, "not-a-req");
7740        assert!(
7741            !reason.is_empty(),
7742            "VersaoInvalid `reason` must carry the parser's wording verbatim"
7743        );
7744    }
7745
7746    // -- :fonte value-shape gate ------------------------------------------
7747
7748    fn dep_with_fonte(fonte: DepSource) -> Dep {
7749        let mut d = Dep::simple("caixa-teia", "^0.1");
7750        d.fonte = Some(fonte);
7751        d
7752    }
7753
7754    #[test]
7755    fn validate_accepts_git_fonte_with_tag() {
7756        // The positive-control pin on the canonical git source — exactly
7757        // one of :tag/:rev/:branch set, non-empty :repo. Mirrors the
7758        // shape every existing caixa-resolver integration test uses.
7759        let d = dep_with_fonte(DepSource::Git {
7760            repo: "github:pleme-io/caixa-teia".into(),
7761            tag: Some("v0.1.0".into()),
7762            rev: None,
7763            branch: None,
7764        });
7765        d.validate().unwrap();
7766    }
7767
7768    #[test]
7769    fn validate_accepts_git_fonte_with_rev() {
7770        // Each of the three pin axes is independently a valid single-pin
7771        // shape; pin the :rev arm so a future relaxation that only
7772        // accepts :tag surfaces here. The value is a full 40-hex SHA-1
7773        // OID — the canonical `git rev-parse HEAD` emission shape the
7774        // `crate::render::is_git_oid` value-shape gate now requires;
7775        // abbreviated OIDs are ambiguous across repo history and
7776        // rejected at this gate (pinned separately by
7777        // `validate_rejects_git_fonte_with_rev_abbreviated_prefix`).
7778        let d = dep_with_fonte(DepSource::Git {
7779            repo: "github:pleme-io/caixa-teia".into(),
7780            tag: None,
7781            rev: Some("c0ffee0123abcdef0123456789abcdef01234567".into()),
7782            branch: None,
7783        });
7784        d.validate().unwrap();
7785    }
7786
7787    #[test]
7788    fn validate_accepts_git_fonte_with_branch() {
7789        // The :branch arm is the third valid single-pin shape — pinned
7790        // separately so the gate-accepts-all-three-pin-axes contract is
7791        // a build-error to relax.
7792        let d = dep_with_fonte(DepSource::Git {
7793            repo: "github:pleme-io/caixa-teia".into(),
7794            tag: None,
7795            rev: None,
7796            branch: Some("main".into()),
7797        });
7798        d.validate().unwrap();
7799    }
7800
7801    #[test]
7802    fn validate_accepts_path_fonte() {
7803        // The positive-control pin on the path source — non-empty
7804        // :caminho, no pin axes (paths have no commit identity). Pinned
7805        // so a future "paths must also pin a rev" tightening surfaces
7806        // here as a structural decision, not a silent break.
7807        let d = dep_with_fonte(DepSource::Path {
7808            caminho: "../caixa-teia".into(),
7809        });
7810        d.validate().unwrap();
7811    }
7812
7813    #[test]
7814    fn validate_rejects_git_fonte_with_empty_repo() {
7815        // The fail-before-pass-after pin for `(:tipo git :repo "" :tag
7816        // "v1")`: the empty-repo shape silently passed every pre-gate
7817        // codebase because `:fonte` wasn't validated. The git-clone
7818        // failure surfaced far downstream at lacre-resolve time with no
7819        // field naming which `:deps` entry carried the typo. The new
7820        // gate moves the check to caixa-build time at the source
7821        // caixa.lisp.
7822        let d = dep_with_fonte(DepSource::Git {
7823            repo: String::new(),
7824            tag: Some("v0.1.0".into()),
7825            rev: None,
7826            branch: None,
7827        });
7828        let err = d.validate().unwrap_err();
7829        assert!(
7830            matches!(err, DepError::FonteRepoEmpty { ref nome } if nome == "caixa-teia"),
7831            "got {err:?}"
7832        );
7833    }
7834
7835    // -- :repo value-shape gate -------------------------------------------
7836    //
7837    // The `:fonte (:tipo git :repo …)` value flows verbatim into the
7838    // caixa-resolver's `git clone <repo>` subprocess. The pre-gate
7839    // codebase admitted any non-empty string; the new
7840    // [`crate::render::is_git_repo_url`] predicate gates the git-porcelain
7841    // URL intersection-floor at validate time, peer with the three pin
7842    // axes (`:tag` + `:branch` via `is_git_ref_name`, `:rev` via
7843    // `is_git_oid`). Every test in this section is a fail-before /
7844    // pass-after pin on a specific authoring footgun.
7845
7846    #[test]
7847    fn validate_rejects_git_fonte_with_repo_carrying_trailing_space() {
7848        // The canonical paste-from-doc footgun on `:repo` — an author
7849        // copies `"github:pleme-io/caixa-teia "` (trailing space) out of
7850        // a doc paragraph. Until this gate landed the empty-repo arm
7851        // passed (the string isn't empty), the resolver issued
7852        // `git clone 'github:pleme-io/caixa-teia '`, and the failure
7853        // surfaced at clone time with a quoting-confused error far from
7854        // the source caixa.lisp. Same paste-from-doc footgun the
7855        // `:tag "v0.1.0 "` gate (e70d213) closes on the peer refname
7856        // axis — now closed on the `:repo` URL axis too.
7857        let d = dep_with_fonte(DepSource::Git {
7858            repo: "github:pleme-io/caixa-teia ".into(),
7859            tag: Some("v0.1.0".into()),
7860            rev: None,
7861            branch: None,
7862        });
7863        let err = d.validate().unwrap_err();
7864        let DepError::FonteRepoShape { nome, repo, reason } = err else {
7865            panic!("expected FonteRepoShape, got other variant");
7866        };
7867        assert_eq!(nome, "caixa-teia");
7868        assert_eq!(repo, "github:pleme-io/caixa-teia ");
7869        assert!(
7870            reason.contains("whitespace"),
7871            "reason must surface the whitespace arm, got {reason:?}"
7872        );
7873    }
7874
7875    #[test]
7876    fn validate_rejects_git_fonte_with_repo_starting_with_dash() {
7877        // The canonical CLI-argument-injection footgun at the `git clone`
7878        // subprocess boundary — `:repo "-upload-pack=evil"` makes git's
7879        // argv parser read the value as a CLI flag, escaping the
7880        // subprocess argument boundary. The `--` separator workaround
7881        // does not fix the typed slot's accepted set; the gate rejects
7882        // the shape upstream at validate time so the resolver never
7883        // invokes a `git clone -…` subprocess.
7884        let d = dep_with_fonte(DepSource::Git {
7885            repo: "-upload-pack=evil".into(),
7886            tag: Some("v0.1.0".into()),
7887            rev: None,
7888            branch: None,
7889        });
7890        let err = d.validate().unwrap_err();
7891        let DepError::FonteRepoShape { repo, reason, .. } = err else {
7892            panic!("expected FonteRepoShape, got other variant");
7893        };
7894        assert_eq!(repo, "-upload-pack=evil");
7895        assert!(
7896            reason.contains("must not start with `-`"),
7897            "reason must surface the leading-`-` arm, got {reason:?}"
7898        );
7899    }
7900
7901    #[test]
7902    fn validate_rejects_git_fonte_with_repo_carrying_embedded_newline() {
7903        // The canonical paste-from-multiline-doc footgun — a `:repo`
7904        // string with an embedded `\n` silently breaks git's URL parser
7905        // and is a class of CRLF-injection at the subprocess-argument
7906        // boundary. Caught by the control-char arm (0x0A < 0x20).
7907        let d = dep_with_fonte(DepSource::Git {
7908            repo: "github:pleme-io/caixa-teia\nrm -rf /".into(),
7909            tag: Some("v0.1.0".into()),
7910            rev: None,
7911            branch: None,
7912        });
7913        let err = d.validate().unwrap_err();
7914        let DepError::FonteRepoShape { reason, .. } = err else {
7915            panic!("expected FonteRepoShape, got other variant");
7916        };
7917        assert!(
7918            reason.contains("control character"),
7919            "reason must surface the control-char arm, got {reason:?}"
7920        );
7921    }
7922
7923    #[test]
7924    fn validate_rejects_git_fonte_with_repo_carrying_tab() {
7925        // Tab is the sibling whitespace footgun (the canonical
7926        // copy-from-aligned-table paste); pinned separately from the
7927        // space arm so a future relaxation that only catches one
7928        // surfaces here.
7929        let d = dep_with_fonte(DepSource::Git {
7930            repo: "github:pleme-io/caixa-teia\t".into(),
7931            tag: Some("v0.1.0".into()),
7932            rev: None,
7933            branch: None,
7934        });
7935        let err = d.validate().unwrap_err();
7936        assert!(
7937            matches!(
7938                err,
7939                DepError::FonteRepoShape { ref reason, .. }
7940                    if reason.contains("whitespace")
7941            ),
7942            "got {err:?}"
7943        );
7944    }
7945
7946    #[test]
7947    fn validate_rejects_git_fonte_with_repo_carrying_non_ascii() {
7948        // IDN hosts must be pre-encoded as Punycode (`xn--…`) — raw
7949        // non-ASCII silently breaks at git's URL parser and round-trips
7950        // inconsistently across NFC/NFD normalization on APFS /
7951        // case-folding filesystems. Same intersection-floor
7952        // [`is_git_ref_name`] enforces on the refname axes.
7953        let d = dep_with_fonte(DepSource::Git {
7954            repo: "https://github.com/pleme-io/café".into(),
7955            tag: Some("v0.1.0".into()),
7956            rev: None,
7957            branch: None,
7958        });
7959        let err = d.validate().unwrap_err();
7960        assert!(
7961            matches!(
7962                err,
7963                DepError::FonteRepoShape { ref reason, .. }
7964                    if reason.contains("non-ASCII")
7965            ),
7966            "got {err:?}"
7967        );
7968    }
7969
7970    #[test]
7971    fn validate_rejects_git_fonte_with_repo_carrying_fragment_anchor() {
7972        // The fail-before-pass-after pin for the canonical paste-from-
7973        // browser-address-bar footgun on `:repo`: an author copies a
7974        // GitHub permalink to a README anchor / line-permalink and
7975        // forgets to trim the `#fragment` tail. Until this arm landed
7976        // `:repo "https://github.com/pleme-io/caixa-teia#readme"`
7977        // silently passed every prior arm (no whitespace, no control
7978        // chars, no non-ASCII, contains a `:`, doesn't start with `-`
7979        // or `:`), libcurl's URL parser stripped the `#readme` tail
7980        // before opening the HTTPS transport, and the lacre embedded
7981        // the value verbatim in its per-dep BLAKE3 closure — two
7982        // authors whose values differ only in their fragment anchor
7983        // (`#readme` vs `#L42`) resolve to the byte-identical upstream
7984        // `git clone` but lock to two distinct lacres, defeating the
7985        // THEORY.md §V.2 render-determinism contract. Same value-shape
7986        // axis-floor every peer typed surface enforces; peer `:fonte
7987        // :tag` / `:fonte :branch` already reject the byte-class through
7988        // `is_git_ref_name`'s alphabet (refs are leaf identifiers, no
7989        // URL grammar admitted) and `:entrada :paths` rejects `#` as
7990        // part of `is_gateway_api_http_path`'s RFC-3986-reserved set.
7991        let d = dep_with_fonte(DepSource::Git {
7992            repo: "https://github.com/pleme-io/caixa-teia#readme".into(),
7993            tag: Some("v0.1.0".into()),
7994            rev: None,
7995            branch: None,
7996        });
7997        let err = d.validate().unwrap_err();
7998        let DepError::FonteRepoShape { nome, repo, reason } = err else {
7999            panic!("expected FonteRepoShape, got other variant");
8000        };
8001        assert_eq!(nome, "caixa-teia");
8002        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia#readme");
8003        assert!(
8004            reason.contains("must not contain `#`"),
8005            "reason must surface the fragment-`#` arm, got {reason:?}"
8006        );
8007        assert!(
8008            reason.contains("fragment"),
8009            "reason must name the URL fragment grammar, got {reason:?}"
8010        );
8011    }
8012
8013    #[test]
8014    fn validate_rejects_git_fonte_with_repo_carrying_flake_ref_fragment() {
8015        // The symmetric paste-from-Nix-flake-ref footgun — an author
8016        // confuses the Nix flake-reference idiom (`github:foo/
8017        // bar#packageName`, where `#packageName` selects a flake
8018        // output) with the bare git `:repo` shape. The pleme-io
8019        // substrate authors compose flakes downstream of caixa
8020        // (caixa-flake renders a flake.nix), so the cross-idiom leak
8021        // is the canonical near-miss: the author writes the
8022        // flake-ref shape into a git `:repo` slot. Pinned separately
8023        // from the HTTPS-anchor arm so a future relaxation that
8024        // narrows to one URL scheme surfaces here.
8025        let d = dep_with_fonte(DepSource::Git {
8026            repo: "github:pleme-io/caixa-teia#caixa-teia".into(),
8027            tag: Some("v0.1.0".into()),
8028            rev: None,
8029            branch: None,
8030        });
8031        let err = d.validate().unwrap_err();
8032        let DepError::FonteRepoShape { reason, .. } = err else {
8033            panic!("expected FonteRepoShape, got other variant");
8034        };
8035        assert!(
8036            reason.contains("must not contain `#`"),
8037            "reason must surface the fragment-`#` arm, got {reason:?}"
8038        );
8039        assert!(
8040            reason.contains("Nix flake"),
8041            "reason must name the Nix-flake-ref cross-idiom footgun, got {reason:?}"
8042        );
8043    }
8044
8045    #[test]
8046    fn validate_rejects_git_fonte_with_repo_carrying_query_string() {
8047        // The fail-before-pass-after pin for the canonical paste-from-
8048        // browser-address-bar footgun on `:repo` (peer with the
8049        // a68f818 fragment-`#` arm on the same axis). An author
8050        // copies a GitHub tab deep-link out of the address bar and
8051        // forgets to trim the `?tab=…` query tail. Until this arm
8052        // landed `:repo "https://github.com/pleme-io/caixa-teia?tab=readme-ov-file"`
8053        // silently passed every prior arm (no whitespace, no control
8054        // chars, no non-ASCII, no `#` fragment, contains a `:`,
8055        // doesn't start with `-` or `:`); GitHub silently ignored
8056        // the `?query` tail and served the same repo regardless;
8057        // the lacre embedded the value verbatim in its per-dep
8058        // BLAKE3 closure — two authors whose values differ only in
8059        // their query tail (`?tab=readme-ov-file` vs `?ref=main` vs
8060        // `?utm_source=twitter`) resolve to the byte-identical
8061        // upstream `git clone` but lock to two distinct lacres,
8062        // defeating the THEORY.md §V.2 render-determinism contract
8063        // on the same axis the `#` fragment arm closes. Same value-
8064        // shape axis-floor every peer typed surface enforces; peer
8065        // `:fonte :tag` / `:fonte :branch` already reject the byte-
8066        // class through `is_git_ref_name`'s alphabet (refspec glob
8067        // wildcards, caixa-core/src/render.rs:1426) and `:entrada
8068        // :paths` rejects `?` as the query separator in
8069        // `is_gateway_api_http_path` (caixa-core/src/render.rs:473).
8070        let d = dep_with_fonte(DepSource::Git {
8071            repo: "https://github.com/pleme-io/caixa-teia?tab=readme-ov-file".into(),
8072            tag: Some("v0.1.0".into()),
8073            rev: None,
8074            branch: None,
8075        });
8076        let err = d.validate().unwrap_err();
8077        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8078            panic!("expected FonteRepoShape, got other variant");
8079        };
8080        assert_eq!(nome, "caixa-teia");
8081        assert_eq!(
8082            repo,
8083            "https://github.com/pleme-io/caixa-teia?tab=readme-ov-file"
8084        );
8085        assert!(
8086            reason.contains("must not contain `?`"),
8087            "reason must surface the query-`?` arm, got {reason:?}"
8088        );
8089        assert!(
8090            reason.contains("query"),
8091            "reason must name the URL query grammar, got {reason:?}"
8092        );
8093    }
8094
8095    #[test]
8096    fn validate_rejects_git_fonte_with_repo_carrying_utm_tracker() {
8097        // The symmetric paste-from-social-share footgun — an author
8098        // copies a repo URL out of a Slack unfurl / Twitter share /
8099        // newsletter link / Discord embed and forgets to trim the
8100        // `?utm_source=…` / `?utm_medium=…` / `?utm_campaign=…`
8101        // campaign-tracker tail. Every major social-share / unfurl /
8102        // newsletter platform appends these UTM parameters; the
8103        // canonical near-miss on the `:repo` axis. Pinned separately
8104        // from the GitHub-tab-deep-link arm so a future relaxation
8105        // that narrows to one query-parameter class surfaces here.
8106        let d = dep_with_fonte(DepSource::Git {
8107            repo: "https://github.com/pleme-io/caixa-teia?utm_source=twitter&utm_campaign=launch"
8108                .into(),
8109            tag: Some("v0.1.0".into()),
8110            rev: None,
8111            branch: None,
8112        });
8113        let err = d.validate().unwrap_err();
8114        let DepError::FonteRepoShape { reason, .. } = err else {
8115            panic!("expected FonteRepoShape, got other variant");
8116        };
8117        assert!(
8118            reason.contains("must not contain `?`"),
8119            "reason must surface the query-`?` arm, got {reason:?}"
8120        );
8121        assert!(
8122            reason.contains("campaign-tracker"),
8123            "reason must name the campaign-tracker paste footgun, got {reason:?}"
8124        );
8125    }
8126
8127    #[test]
8128    fn fonte_repo_fragment_fires_before_query_when_fragment_first() {
8129        // Cascade pin: the fragment-`#` arm and the query-`?` arm are
8130        // both per-byte arms inside the same `for &b in s.as_bytes()`
8131        // loop, so the byte that appears first in the value's byte
8132        // order wins. A `:repo "https://github.com/p/x#readme?ref=main"`
8133        // (fragment before query — unusual URL-grammar but value-
8134        // disjoint at byte level) carries both `#` and `?`; the `#`
8135        // byte appears first, so the fragment-`#` arm fires, surfacing
8136        // the more self-locating diagnostic on the byte the author
8137        // pasted earliest in the URL. Mirrors the peer cascade
8138        // discipline `fonte_repo_control_char_fires_before_fragment`
8139        // pins on the prior `:repo` byte-class arm.
8140        let d = dep_with_fonte(DepSource::Git {
8141            repo: "https://github.com/pleme-io/caixa-teia#readme?ref=main".into(),
8142            tag: Some("v0.1.0".into()),
8143            rev: None,
8144            branch: None,
8145        });
8146        let err = d.validate().unwrap_err();
8147        let DepError::FonteRepoShape { reason, .. } = err else {
8148            panic!("expected FonteRepoShape, got other variant");
8149        };
8150        assert!(
8151            reason.contains("must not contain `#`"),
8152            "reason must surface the fragment-`#` arm (fires before query-`?` when \
8153             `#` byte appears first in value), got {reason:?}"
8154        );
8155    }
8156
8157    #[test]
8158    fn fonte_repo_control_char_fires_before_fragment() {
8159        // Cascade pin: the control-char arm structurally precedes the
8160        // fragment-`#` arm. A value like `"github:p/x\n#readme"` probes
8161        // positive on both arms (contains LF and `#`), but the narrower
8162        // POSIX-syscall-rejected / CRLF-injection-class diagnostic
8163        // (`control character`) wins so the author sees the more
8164        // self-locating arm first. Mirrors the peer cascade discipline
8165        // every prior `:repo` byte-class arm establishes.
8166        let d = dep_with_fonte(DepSource::Git {
8167            repo: "github:pleme-io/caixa-teia\n#readme".into(),
8168            tag: Some("v0.1.0".into()),
8169            rev: None,
8170            branch: None,
8171        });
8172        let err = d.validate().unwrap_err();
8173        let DepError::FonteRepoShape { reason, .. } = err else {
8174            panic!("expected FonteRepoShape, got other variant");
8175        };
8176        assert!(
8177            reason.contains("control character"),
8178            "reason must surface the control-char arm, got {reason:?}"
8179        );
8180    }
8181
8182    #[test]
8183    fn validate_rejects_git_fonte_with_repo_carrying_embedded_backslash() {
8184        // The fail-before-pass-after pin for the canonical Windows-
8185        // file-path-confusion footgun on `:repo` (peer with the 3a4e1d7
8186        // backslash arm on the sibling `:caminho` path-fonte axis).
8187        // An author pastes a Windows Explorer address-bar / PowerShell
8188        // `Get-Location` output into a `file://` URL slot, producing
8189        // `file:///C:\Users\me\caixa-teia`. Until this arm landed the
8190        // value silently passed every prior arm (no whitespace, no
8191        // control chars, no non-ASCII, no `#`, no `?`, doesn't start
8192        // with `-` or `:`); libcurl's URL parser silently translates
8193        // `\` → `/` on some platforms and refuses it on others, so
8194        // the byte rides verbatim into the lacre's per-dep content-
8195        // address but is silently rewritten / rejected at the wire —
8196        // two authors whose `:repo` values differ only in backslash-
8197        // vs-forward-slash (`file:///C:\path` vs `file:///C:/path`)
8198        // resolve to the byte-identical local clone but lock to two
8199        // distinct BLAKE3 closures, defeating the THEORY.md §V.2
8200        // render-determinism contract on the same axis the `#`
8201        // fragment and `?` query arms close. Same value-shape axis-
8202        // floor every peer typed surface enforces; the `:caminho`
8203        // 3a4e1d7 arm closes the same byte on the path-fonte axis.
8204        let d = dep_with_fonte(DepSource::Git {
8205            repo: "file:///C:\\Users\\me\\caixa-teia".into(),
8206            tag: Some("v0.1.0".into()),
8207            rev: None,
8208            branch: None,
8209        });
8210        let err = d.validate().unwrap_err();
8211        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8212            panic!("expected FonteRepoShape, got other variant");
8213        };
8214        assert_eq!(nome, "caixa-teia");
8215        assert_eq!(repo, "file:///C:\\Users\\me\\caixa-teia");
8216        assert!(
8217            reason.contains("must not contain `\\`"),
8218            "reason must surface the backslash-`\\` arm, got {reason:?}"
8219        );
8220        assert!(
8221            reason.contains("Windows"),
8222            "reason must name the Windows-path-confusion footgun, got {reason:?}"
8223        );
8224    }
8225
8226    #[test]
8227    fn validate_rejects_git_fonte_with_repo_carrying_mangled_https_backslashes() {
8228        // The symmetric Win32-shell-mangled-slashes footgun — an author
8229        // copies `https://github.com/foo/bar` into a Win32 shell that
8230        // rewrites every `/` to `\` (the canonical `cmd.exe` path-
8231        // separator-coercion bug), pastes the result into a `:repo`
8232        // slot, and produces `https:\\github.com\foo\bar`. Pinned
8233        // separately from the `file://` Explorer-paste arm so a future
8234        // relaxation that narrows to one URL scheme surfaces here.
8235        let d = dep_with_fonte(DepSource::Git {
8236            repo: "https:\\\\github.com\\pleme-io\\caixa-teia".into(),
8237            tag: Some("v0.1.0".into()),
8238            rev: None,
8239            branch: None,
8240        });
8241        let err = d.validate().unwrap_err();
8242        let DepError::FonteRepoShape { reason, .. } = err else {
8243            panic!("expected FonteRepoShape, got other variant");
8244        };
8245        assert!(
8246            reason.contains("must not contain `\\`"),
8247            "reason must surface the backslash-`\\` arm, got {reason:?}"
8248        );
8249        assert!(
8250            reason.contains("path separator") || reason.contains("path-segment separator"),
8251            "reason must name the URL path-segment separator grammar, got {reason:?}"
8252        );
8253    }
8254
8255    #[test]
8256    fn fonte_repo_fragment_fires_before_backslash_when_fragment_first() {
8257        // Cascade pin: the fragment-`#` arm and the backslash-`\` arm
8258        // are both per-byte arms inside the same `for &b in s.as_bytes()`
8259        // loop, so the byte that appears first in the value's byte order
8260        // wins. A `:repo "https://github.com/p/x#readme\\foo"` carries
8261        // both `#` and `\`; the `#` byte appears first, so the fragment-
8262        // `#` arm fires, surfacing the more self-locating diagnostic on
8263        // the byte the author pasted earliest in the URL. Mirrors the
8264        // peer cascade discipline `fonte_repo_fragment_fires_before_query_when_fragment_first`
8265        // pins on the prior `:repo` byte-class arm.
8266        let d = dep_with_fonte(DepSource::Git {
8267            repo: "https://github.com/pleme-io/caixa-teia#readme\\foo".into(),
8268            tag: Some("v0.1.0".into()),
8269            rev: None,
8270            branch: None,
8271        });
8272        let err = d.validate().unwrap_err();
8273        let DepError::FonteRepoShape { reason, .. } = err else {
8274            panic!("expected FonteRepoShape, got other variant");
8275        };
8276        assert!(
8277            reason.contains("must not contain `#`"),
8278            "reason must surface the fragment-`#` arm (fires before backslash-`\\` when \
8279             `#` byte appears first in value), got {reason:?}"
8280        );
8281    }
8282
8283    #[test]
8284    fn validate_rejects_git_fonte_with_repo_carrying_uri_template_placeholder() {
8285        // The fail-before-pass-after pin for the canonical URI Template
8286        // (RFC 6570) placeholder footgun on `:repo`. An author copies a
8287        // README quick-start snippet / OpenAPI `servers:` URL / Helm
8288        // chart `home:` template that carries unresolved
8289        // `{org}` / `{repo}` placeholders and pastes the raw template
8290        // into the `:repo` slot, expecting the substrate to resolve the
8291        // placeholder downstream. Until this arm landed the value
8292        // silently passed every prior arm (no whitespace, no control
8293        // chars, no non-ASCII, no `#`, no `?`, no `\`, doesn't start
8294        // with `-` or `:`); libcurl percent-encodes `{` / `}` to `%7B`
8295        // / `%7D` on the wire, so the byte rides verbatim into the
8296        // lacre's per-dep content-address but round-trips inconsistently
8297        // between the lacre's per-dep content-address and the
8298        // resolver's `git clone <repo>` invocation, defeating the
8299        // THEORY.md §V.2 render-determinism contract on the same axis
8300        // the `#` fragment, `?` query, and `\` backslash arms close;
8301        // every git porcelain entry-point additionally fetches a
8302        // nonexistent literal-`{placeholder}`-named path far from the
8303        // source caixa.lisp.
8304        let d = dep_with_fonte(DepSource::Git {
8305            repo: "https://github.com/{org}/caixa-teia".into(),
8306            tag: Some("v0.1.0".into()),
8307            rev: None,
8308            branch: None,
8309        });
8310        let err = d.validate().unwrap_err();
8311        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8312            panic!("expected FonteRepoShape, got other variant");
8313        };
8314        assert_eq!(nome, "caixa-teia");
8315        assert_eq!(repo, "https://github.com/{org}/caixa-teia");
8316        assert!(
8317            reason.contains("must not contain `{`"),
8318            "reason must surface the open-brace `{{` arm, got {reason:?}"
8319        );
8320        assert!(
8321            reason.contains("URI Template") || reason.contains("RFC 6570"),
8322            "reason must name the RFC 6570 URI Template grammar, got {reason:?}"
8323        );
8324    }
8325
8326    #[test]
8327    fn validate_rejects_git_fonte_with_repo_carrying_handlebars_doubled_brace() {
8328        // The symmetric Mustache / Handlebars doubled-brace
8329        // substitution-form footgun every CI / IaC templating engine
8330        // (Argo Workflows, Jinja2, Liquid, Vue / Angular interpolation,
8331        // GitHub Actions `${{ … }}` even though Actions uses `${{`) /
8332        // chart README quick-start snippet emits. Pinned separately
8333        // from the single-`{` `{org}` arm so a future relaxation that
8334        // narrows to one substitution-form surfaces here.
8335        let d = dep_with_fonte(DepSource::Git {
8336            repo: "https://github.com/{{org}}/caixa-teia".into(),
8337            tag: Some("v0.1.0".into()),
8338            rev: None,
8339            branch: None,
8340        });
8341        let err = d.validate().unwrap_err();
8342        let DepError::FonteRepoShape { reason, .. } = err else {
8343            panic!("expected FonteRepoShape, got other variant");
8344        };
8345        assert!(
8346            reason.contains("must not contain `{`"),
8347            "reason must surface the open-brace `{{` arm, got {reason:?}"
8348        );
8349    }
8350
8351    #[test]
8352    fn validate_rejects_git_fonte_with_repo_carrying_closing_brace_only() {
8353        // Asymmetric `}`-only shape — covers the closing-brace-by-
8354        // itself footgun (an author truncated `{org}/{repo}` mid-edit
8355        // and left a trailing `}` from the prior template fragment,
8356        // or pasted a value that included a closing brace from a
8357        // surrounding shell context). Pinned to ensure the predicate
8358        // refuses each brace independently rather than only when both
8359        // appear — a future regression that ANDs the two byte tests
8360        // surfaces here.
8361        let d = dep_with_fonte(DepSource::Git {
8362            repo: "https://github.com/pleme-io/caixa-teia}".into(),
8363            tag: Some("v0.1.0".into()),
8364            rev: None,
8365            branch: None,
8366        });
8367        let err = d.validate().unwrap_err();
8368        let DepError::FonteRepoShape { reason, .. } = err else {
8369            panic!("expected FonteRepoShape, got other variant");
8370        };
8371        assert!(
8372            reason.contains("must not contain `}`"),
8373            "reason must surface the close-brace `}}` arm, got {reason:?}"
8374        );
8375    }
8376
8377    #[test]
8378    fn fonte_repo_fragment_fires_before_template_placeholder_when_fragment_first() {
8379        // Cascade pin: the fragment-`#` arm and the template-`{` /
8380        // `}` arm are both per-byte arms inside the same
8381        // `for &b in s.as_bytes()` loop, so the byte that appears
8382        // first in the value's byte order wins. A `:repo
8383        // "https://github.com/p/x#readme{org}"` carries both `#` and
8384        // `{`; the `#` byte appears first, so the fragment-`#` arm
8385        // fires, surfacing the more self-locating diagnostic on the
8386        // byte the author pasted earliest in the URL. Mirrors the
8387        // peer cascade discipline `fonte_repo_fragment_fires_before_backslash_when_fragment_first`
8388        // pins on the prior `:repo` byte-class arm.
8389        let d = dep_with_fonte(DepSource::Git {
8390            repo: "https://github.com/pleme-io/caixa-teia#readme{org}".into(),
8391            tag: Some("v0.1.0".into()),
8392            rev: None,
8393            branch: None,
8394        });
8395        let err = d.validate().unwrap_err();
8396        let DepError::FonteRepoShape { reason, .. } = err else {
8397            panic!("expected FonteRepoShape, got other variant");
8398        };
8399        assert!(
8400            reason.contains("must not contain `#`"),
8401            "reason must surface the fragment-`#` arm (fires before template-`{{` when \
8402             `#` byte appears first in value), got {reason:?}"
8403        );
8404    }
8405
8406    #[test]
8407    fn validate_rejects_git_fonte_with_repo_carrying_output_redirection() {
8408        // The fail-before-pass-after pin for the canonical
8409        // shell-output-redirection footgun on `:repo`: an author
8410        // pastes a shell-pipeline tail (`git clone <repo> > build.log`
8411        // / `… >output.txt`) into the `:repo` slot without trimming
8412        // the redirect. Until this arm landed the value silently
8413        // passed every prior arm (no whitespace, no control chars,
8414        // no non-ASCII, no `#`, no `?`, no `\`, no `{`/`}`, doesn't
8415        // start with `-` or `:`); RFC 3986 §2 lists `<` / `>` in the
8416        // 'delims' / 'unwise' set and the WHATWG URL spec's fragment
8417        // percent-encode set maps `>` → `%3E` on the wire, so the
8418        // byte rides verbatim into the lacre's per-dep BLAKE3 closure
8419        // but is silently rewritten or rejected at libcurl's URL-
8420        // parser layer — two authors whose values differ only in
8421        // their redirect tail (`>build.log` vs nothing) resolve to
8422        // the byte-identical upstream `git clone` but lock to two
8423        // distinct lacres, defeating the THEORY.md §V.2 render-
8424        // determinism contract. Peer with the `:caminho` axis's
8425        // `FonteCaminhoShellRedirection` arm (e457141) on the sibling
8426        // path-fonte axis, and `is_gateway_api_http_path`'s eleven-
8427        // byte RFC-3986-reserved set on `:entrada :paths`.
8428        let d = dep_with_fonte(DepSource::Git {
8429            repo: "https://github.com/pleme-io/caixa-teia>build.log".into(),
8430            tag: Some("v0.1.0".into()),
8431            rev: None,
8432            branch: None,
8433        });
8434        let err = d.validate().unwrap_err();
8435        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8436            panic!("expected FonteRepoShape, got other variant");
8437        };
8438        assert_eq!(nome, "caixa-teia");
8439        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia>build.log");
8440        assert!(
8441            reason.contains("must not contain `>`"),
8442            "reason must surface the output-redirection `>` arm, got {reason:?}"
8443        );
8444        assert!(
8445            reason.contains("redirection") || reason.contains("'delims'"),
8446            "reason must name the shell-redirection / RFC-3986-unwise rationale, got {reason:?}"
8447        );
8448    }
8449
8450    #[test]
8451    fn validate_rejects_git_fonte_with_repo_carrying_input_redirection() {
8452        // The symmetric shell-input-redirection footgun — an author
8453        // pastes a shell-pipeline head (`git clone <input.url` /
8454        // `cat <README.md`) into the `:repo` slot. Pinned separately
8455        // from the `>`-output arm so a future relaxation that only
8456        // catches one of the two redirect bytes surfaces here. Peer
8457        // with the `:caminho` axis's `FonteCaminhoShellRedirection`
8458        // arm which closes both `<` and `>` under the same banner.
8459        let d = dep_with_fonte(DepSource::Git {
8460            repo: "https://github.com/pleme-io/caixa-teia<input.url".into(),
8461            tag: Some("v0.1.0".into()),
8462            rev: None,
8463            branch: None,
8464        });
8465        let err = d.validate().unwrap_err();
8466        let DepError::FonteRepoShape { reason, .. } = err else {
8467            panic!("expected FonteRepoShape, got other variant");
8468        };
8469        assert!(
8470            reason.contains("must not contain `<`"),
8471            "reason must surface the input-redirection `<` arm, got {reason:?}"
8472        );
8473        assert!(
8474            reason.contains("RFC 3986") || reason.contains("'unwise'"),
8475            "reason must name the RFC 3986 'unwise' grammar, got {reason:?}"
8476        );
8477    }
8478
8479    #[test]
8480    fn validate_rejects_git_fonte_with_repo_carrying_backtick_command_substitution() {
8481        // The fail-before-pass-after pin for the canonical
8482        // paste-from-shell-prompt-with-backticked-substitution footgun
8483        // on `:repo` (peer with the c4d62b3 backtick arm on the sibling
8484        // `:caminho` path-fonte axis). An author pastes a URL whose
8485        // segment carries a backticked command-substitution wrapper
8486        // (`` `whoami` ``, `` `git config user.name` ``, `` `pwd` ``)
8487        // from a doc / README quick-start snippet that expected the
8488        // substrate to substitute the value downstream. Until this arm
8489        // landed the value silently passed every prior arm (no
8490        // whitespace, no control chars, no non-ASCII, no `#`, no `?`,
8491        // no `\`, no `{`/`}`, no `<`/`>`, doesn't start with `-` or
8492        // `:`); RFC 3986 §2 lists the backtick byte in the 'delims' /
8493        // 'unwise' set and the WHATWG URL spec's fragment percent-
8494        // encode set maps `` ` `` → `%60` on the wire, so the byte
8495        // rides verbatim into the lacre's per-dep BLAKE3 closure but
8496        // is silently rewritten or rejected at libcurl's URL-parser
8497        // layer — two authors whose values differ only in their
8498        // backtick wrapper (`` `whoami` `` vs nothing) resolve to the
8499        // byte-identical upstream `git clone` but lock to two distinct
8500        // lacres, defeating the THEORY.md §V.2 render-determinism
8501        // contract. Peer with the `:caminho` axis's
8502        // `FonteCaminhoShellCommandSubstitution` arm (c4d62b3) on the
8503        // sibling path-fonte axis, and `is_gateway_api_http_path`'s
8504        // eleven-byte RFC-3986-reserved set on `:entrada :paths`.
8505        let d = dep_with_fonte(DepSource::Git {
8506            repo: "https://github.com/pleme-io/`whoami`/caixa-teia".into(),
8507            tag: Some("v0.1.0".into()),
8508            rev: None,
8509            branch: None,
8510        });
8511        let err = d.validate().unwrap_err();
8512        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8513            panic!("expected FonteRepoShape, got other variant");
8514        };
8515        assert_eq!(nome, "caixa-teia");
8516        assert_eq!(repo, "https://github.com/pleme-io/`whoami`/caixa-teia");
8517        assert!(
8518            reason.contains("must not contain `` ` ``"),
8519            "reason must surface the backtick command-substitution arm, got {reason:?}"
8520        );
8521        assert!(
8522            reason.contains("command-substitution") || reason.contains("'unwise'"),
8523            "reason must name the shell-command-substitution / RFC-3986-unwise rationale, \
8524             got {reason:?}"
8525        );
8526    }
8527
8528    #[test]
8529    fn fonte_repo_fragment_fires_before_backtick_when_fragment_first() {
8530        // Cascade pin: the fragment-`#` arm and the backtick command-
8531        // substitution arm are both per-byte arms inside the same
8532        // `for &b in s.as_bytes()` loop, so the byte that appears first
8533        // in the value's byte order wins. A `:repo
8534        // "https://github.com/p/x#readme/`whoami`"` carries both `#`
8535        // and backtick; the `#` byte appears first, so the fragment-
8536        // `#` arm fires, surfacing the more self-locating diagnostic
8537        // on the byte the author pasted earliest in the URL. Mirrors
8538        // the peer cascade discipline
8539        // `fonte_repo_fragment_fires_before_shell_redirection_when_fragment_first`
8540        // pins on the prior `:repo` byte-class arm.
8541        let d = dep_with_fonte(DepSource::Git {
8542            repo: "https://github.com/pleme-io/caixa-teia#readme/`whoami`".into(),
8543            tag: Some("v0.1.0".into()),
8544            rev: None,
8545            branch: None,
8546        });
8547        let err = d.validate().unwrap_err();
8548        let DepError::FonteRepoShape { reason, .. } = err else {
8549            panic!("expected FonteRepoShape, got other variant");
8550        };
8551        assert!(
8552            reason.contains("must not contain `#`"),
8553            "reason must surface the fragment-`#` arm (fires before backtick when `#` byte \
8554             appears first in value), got {reason:?}"
8555        );
8556    }
8557
8558    #[test]
8559    fn fonte_repo_shell_redirection_fires_before_backtick_when_redirection_first() {
8560        // Cascade pin: the shell-redirection `<` / `>` arm and the
8561        // backtick command-substitution arm are both per-byte arms
8562        // inside the same `for &b in s.as_bytes()` loop, so the byte
8563        // that appears first in the value's byte order wins. A `:repo
8564        // "https://github.com/p/x>build.log/`whoami`"` carries both
8565        // `>` and backtick; the `>` byte appears first, so the
8566        // shell-redirection arm fires, surfacing the more self-
8567        // locating diagnostic on the byte the author pasted earliest
8568        // in the URL. Pins the natural-order cascade so a future
8569        // reorder of the per-byte arms surfaces here.
8570        let d = dep_with_fonte(DepSource::Git {
8571            repo: "https://github.com/pleme-io/caixa-teia>build.log/`whoami`".into(),
8572            tag: Some("v0.1.0".into()),
8573            rev: None,
8574            branch: None,
8575        });
8576        let err = d.validate().unwrap_err();
8577        let DepError::FonteRepoShape { reason, .. } = err else {
8578            panic!("expected FonteRepoShape, got other variant");
8579        };
8580        assert!(
8581            reason.contains("must not contain `>`"),
8582            "reason must surface the shell-redirection `>` arm (fires before backtick when \
8583             `>` byte appears first in value), got {reason:?}"
8584        );
8585    }
8586
8587    #[test]
8588    fn fonte_repo_fragment_fires_before_shell_redirection_when_fragment_first() {
8589        // Cascade pin: the fragment-`#` arm and the shell-redirection
8590        // `<` / `>` arm are both per-byte arms inside the same
8591        // `for &b in s.as_bytes()` loop, so the byte that appears
8592        // first in the value's byte order wins. A `:repo
8593        // "https://github.com/p/x#readme>build.log"` carries both
8594        // `#` and `>`; the `#` byte appears first, so the fragment-
8595        // `#` arm fires, surfacing the more self-locating diagnostic
8596        // on the byte the author pasted earliest in the URL. Mirrors
8597        // the peer cascade discipline
8598        // `fonte_repo_fragment_fires_before_template_placeholder_when_fragment_first`
8599        // pins on the prior `:repo` byte-class arm.
8600        let d = dep_with_fonte(DepSource::Git {
8601            repo: "https://github.com/pleme-io/caixa-teia#readme>build.log".into(),
8602            tag: Some("v0.1.0".into()),
8603            rev: None,
8604            branch: None,
8605        });
8606        let err = d.validate().unwrap_err();
8607        let DepError::FonteRepoShape { reason, .. } = err else {
8608            panic!("expected FonteRepoShape, got other variant");
8609        };
8610        assert!(
8611            reason.contains("must not contain `#`"),
8612            "reason must surface the fragment-`#` arm (fires before shell-redirection `>` when \
8613             `#` byte appears first in value), got {reason:?}"
8614        );
8615    }
8616
8617    #[test]
8618    fn validate_rejects_git_fonte_with_repo_carrying_shell_pipe() {
8619        // The fail-before-pass-after pin for the canonical
8620        // paste-from-shell-prompt-with-piped-pipeline footgun on
8621        // `:repo` (peer with the 124106f pipe arm on the sibling
8622        // `:caminho` path-fonte axis). An author pastes a shell
8623        // pipeline (`git clone <url> | tee build.log`,
8624        // `git ls-remote <url> | head`) into the `:repo` slot,
8625        // forgetting to trim the `| <consumer>` tail. Until this arm
8626        // landed the value silently passed every prior arm (no
8627        // whitespace, no control chars, no non-ASCII, no `#`, no `?`,
8628        // no `\`, no `{`/`}`, no `<`/`>`, no `` ` ``, doesn't start
8629        // with `-` or `:`); RFC 3986 §2 lists the pipe byte in the
8630        // 'unwise' set and the WHATWG URL spec's fragment percent-
8631        // encode set maps `|` → `%7C` on the wire, so the byte rides
8632        // verbatim into the lacre's per-dep BLAKE3 closure but is
8633        // silently rewritten or rejected at libcurl's URL-parser
8634        // layer — two authors whose values differ only in their pipe
8635        // tail (`|tee build.log` vs nothing) resolve to the byte-
8636        // identical upstream `git clone` but lock to two distinct
8637        // lacres, defeating the THEORY.md §V.2 render-determinism
8638        // contract. Peer with the `:caminho` axis's
8639        // `FonteCaminhoShellPipe` arm (124106f) on the sibling path-
8640        // fonte axis, and `is_gateway_api_http_path`'s eleven-byte
8641        // RFC-3986-reserved set on `:entrada :paths`.
8642        let d = dep_with_fonte(DepSource::Git {
8643            repo: "https://github.com/pleme-io/caixa-teia|tee build.log".into(),
8644            tag: Some("v0.1.0".into()),
8645            rev: None,
8646            branch: None,
8647        });
8648        let err = d.validate().unwrap_err();
8649        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8650            panic!("expected FonteRepoShape, got other variant");
8651        };
8652        assert_eq!(nome, "caixa-teia");
8653        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia|tee build.log");
8654        assert!(
8655            reason.contains("must not contain `|`"),
8656            "reason must surface the shell-pipe arm, got {reason:?}"
8657        );
8658        assert!(
8659            reason.contains("pipe") || reason.contains("'unwise'"),
8660            "reason must name the shell-pipe / RFC-3986-unwise rationale, got {reason:?}"
8661        );
8662    }
8663
8664    #[test]
8665    fn fonte_repo_fragment_fires_before_pipe_when_fragment_first() {
8666        // Cascade pin: the fragment-`#` arm and the pipe arm are both
8667        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
8668        // so the byte that appears first in the value's byte order
8669        // wins. A `:repo "https://github.com/p/x#readme|tee"` carries
8670        // both `#` and `|`; the `#` byte appears first, so the
8671        // fragment-`#` arm fires, surfacing the more self-locating
8672        // diagnostic on the byte the author pasted earliest in the
8673        // URL. Mirrors the peer cascade discipline
8674        // `fonte_repo_fragment_fires_before_backtick_when_fragment_first`
8675        // pins on the prior `:repo` byte-class arm.
8676        let d = dep_with_fonte(DepSource::Git {
8677            repo: "https://github.com/pleme-io/caixa-teia#readme|tee".into(),
8678            tag: Some("v0.1.0".into()),
8679            rev: None,
8680            branch: None,
8681        });
8682        let err = d.validate().unwrap_err();
8683        let DepError::FonteRepoShape { reason, .. } = err else {
8684            panic!("expected FonteRepoShape, got other variant");
8685        };
8686        assert!(
8687            reason.contains("must not contain `#`"),
8688            "reason must surface the fragment-`#` arm (fires before pipe when `#` byte \
8689             appears first in value), got {reason:?}"
8690        );
8691    }
8692
8693    #[test]
8694    fn fonte_repo_backtick_fires_before_pipe_when_backtick_first() {
8695        // Cascade pin: the backtick arm and the pipe arm are both per-
8696        // byte arms inside the same `for &b in s.as_bytes()` loop, so
8697        // the byte that appears first in the value's byte order wins.
8698        // A `:repo "https://github.com/p/x/`whoami`|tee"` carries both
8699        // `` ` `` and `|`; the backtick byte appears first, so the
8700        // backtick arm fires, surfacing the more self-locating
8701        // diagnostic on the byte the author pasted earliest in the
8702        // URL. Pins the natural-order cascade so a future reorder of
8703        // the per-byte arms surfaces here.
8704        let d = dep_with_fonte(DepSource::Git {
8705            repo: "https://github.com/pleme-io/caixa-teia/`whoami`|tee".into(),
8706            tag: Some("v0.1.0".into()),
8707            rev: None,
8708            branch: None,
8709        });
8710        let err = d.validate().unwrap_err();
8711        let DepError::FonteRepoShape { reason, .. } = err else {
8712            panic!("expected FonteRepoShape, got other variant");
8713        };
8714        assert!(
8715            reason.contains("must not contain `` ` ``"),
8716            "reason must surface the backtick arm (fires before pipe when `` ` `` byte \
8717             appears first in value), got {reason:?}"
8718        );
8719    }
8720
8721    #[test]
8722    fn validate_rejects_git_fonte_with_repo_carrying_shell_command_separator() {
8723        // The fail-before-pass-after pin for the canonical
8724        // paste-from-shell-prompt-with-sequential-command-tail footgun
8725        // on `:repo` (peer with the 05c358e `;` arm on the sibling
8726        // `:caminho` path-fonte axis). An author pastes a shell
8727        // one-liner that chained a cleanup tail after the URL
8728        // (`git clone <url>; rm -rf build`, `git ls-remote <url>;
8729        // echo done`) into the `:repo` slot, forgetting to trim the
8730        // `; <cmd>` tail. Until this arm landed the value silently
8731        // passed every prior `is_git_repo_url` arm (no whitespace, no
8732        // control chars, no non-ASCII, no `#`, no `?`, no `\`, no
8733        // `{`/`}`, no `<`/`>`, no `` ` ``, no `|`, doesn't start with
8734        // `-` or `:`); RFC 3986 §2 lists `;` in the 'sub-delims' /
8735        // reserved set and the WHATWG URL spec's fragment percent-
8736        // encode set maps `;` → `%3B` on the wire, so the byte rides
8737        // verbatim into the lacre's per-dep BLAKE3 closure but is
8738        // silently rewritten at libcurl's URL-parser layer — two
8739        // authors whose values differ only in their sequential-command
8740        // tail (`; rm -rf build` vs nothing) resolve to the byte-
8741        // identical upstream `git clone` but lock to two distinct
8742        // lacres, defeating the THEORY.md §V.2 render-determinism
8743        // contract. Peer with the `:caminho` axis's
8744        // `FonteCaminhoShellSemicolon` arm (05c358e) on the sibling
8745        // path-fonte axis, and `is_gateway_api_http_path`'s eleven-
8746        // byte RFC-3986-reserved set on `:entrada :paths`.
8747        let d = dep_with_fonte(DepSource::Git {
8748            repo: "https://github.com/pleme-io/caixa-teia; rm -rf build".into(),
8749            tag: Some("v0.1.0".into()),
8750            rev: None,
8751            branch: None,
8752        });
8753        let err = d.validate().unwrap_err();
8754        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8755            panic!("expected FonteRepoShape, got other variant");
8756        };
8757        assert_eq!(nome, "caixa-teia");
8758        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia; rm -rf build");
8759        assert!(
8760            reason.contains("must not contain `;`"),
8761            "reason must surface the shell-command-separator arm, got {reason:?}"
8762        );
8763        assert!(
8764            reason.contains("sequential-command") || reason.contains("'sub-delims'"),
8765            "reason must name the shell-command-separator / RFC-3986-sub-delims \
8766             rationale, got {reason:?}"
8767        );
8768    }
8769
8770    #[test]
8771    fn fonte_repo_fragment_fires_before_semicolon_when_fragment_first() {
8772        // Cascade pin: the fragment-`#` arm and the semicolon arm are
8773        // both per-byte arms inside the same `for &b in s.as_bytes()`
8774        // loop, so the byte that appears first in the value's byte
8775        // order wins. A `:repo "https://github.com/p/x#readme; rm"`
8776        // carries both `#` and `;`; the `#` byte appears first, so the
8777        // fragment-`#` arm fires, surfacing the more self-locating
8778        // diagnostic on the byte the author pasted earliest in the URL.
8779        // Mirrors the peer cascade discipline
8780        // `fonte_repo_fragment_fires_before_pipe_when_fragment_first`
8781        // pins on the prior `:repo` byte-class arm.
8782        let d = dep_with_fonte(DepSource::Git {
8783            repo: "https://github.com/pleme-io/caixa-teia#readme; rm".into(),
8784            tag: Some("v0.1.0".into()),
8785            rev: None,
8786            branch: None,
8787        });
8788        let err = d.validate().unwrap_err();
8789        let DepError::FonteRepoShape { reason, .. } = err else {
8790            panic!("expected FonteRepoShape, got other variant");
8791        };
8792        assert!(
8793            reason.contains("must not contain `#`"),
8794            "reason must surface the fragment-`#` arm (fires before semicolon when `#` \
8795             byte appears first in value), got {reason:?}"
8796        );
8797    }
8798
8799    #[test]
8800    fn fonte_repo_pipe_fires_before_semicolon_when_pipe_first() {
8801        // Cascade pin: the pipe arm and the semicolon arm are both
8802        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
8803        // so the byte that appears first in the value's byte order
8804        // wins. A `:repo "https://github.com/p/x|tee; rm"` carries
8805        // both `|` and `;`; the `|` byte appears first, so the
8806        // pipe arm fires, surfacing the more self-locating diagnostic
8807        // on the byte the author pasted earliest in the URL. Pins the
8808        // natural-order cascade so a future reorder of the per-byte
8809        // arms surfaces here.
8810        let d = dep_with_fonte(DepSource::Git {
8811            repo: "https://github.com/pleme-io/caixa-teia|tee; rm".into(),
8812            tag: Some("v0.1.0".into()),
8813            rev: None,
8814            branch: None,
8815        });
8816        let err = d.validate().unwrap_err();
8817        let DepError::FonteRepoShape { reason, .. } = err else {
8818            panic!("expected FonteRepoShape, got other variant");
8819        };
8820        assert!(
8821            reason.contains("must not contain `|`"),
8822            "reason must surface the pipe arm (fires before semicolon when `|` byte \
8823             appears first in value), got {reason:?}"
8824        );
8825    }
8826
8827    #[test]
8828    fn validate_rejects_git_fonte_with_repo_carrying_shell_background() {
8829        // The fail-before-pass-after pin for the canonical
8830        // paste-from-shell-prompt-with-background-launch-tail footgun
8831        // on `:repo` (peer with the e12e4f3 `&` arm on the sibling
8832        // `:caminho` path-fonte axis). An author pastes a shell one-
8833        // liner that detached the clone into the background
8834        // (`git clone <url> & sleep 1`, `git clone <url> && cd …`)
8835        // into the `:repo` slot, forgetting to trim the `& <cmd>` /
8836        // `&& <cmd>` tail. Until this arm landed the value silently
8837        // passed every prior `is_git_repo_url` arm (no whitespace,
8838        // no control chars, no non-ASCII, no `#`, no `?`, no `\`,
8839        // no `{`/`}`, no `<`/`>`, no `` ` ``, no `|`, no `;`,
8840        // doesn't start with `-` or `:`); RFC 3986 §2 lists `&` in
8841        // the 'sub-delims' / reserved set and the WHATWG URL spec's
8842        // fragment percent-encode set maps `&` → `%26` on the wire,
8843        // so the byte rides verbatim into the lacre's per-dep
8844        // BLAKE3 closure but is silently rewritten at libcurl's
8845        // URL-parser layer — two authors whose values differ only
8846        // in their background-launch tail (`& sleep 1` vs nothing)
8847        // resolve to the byte-identical upstream `git clone` but
8848        // lock to two distinct lacres, defeating the THEORY.md
8849        // §V.2 render-determinism contract. Peer with the
8850        // `:caminho` axis's `FonteCaminhoShellBackground` arm
8851        // (e12e4f3) on the sibling path-fonte axis, and
8852        // `is_gateway_api_http_path`'s eleven-byte RFC-3986-
8853        // reserved set on `:entrada :paths`.
8854        let d = dep_with_fonte(DepSource::Git {
8855            repo: "https://github.com/pleme-io/caixa-teia&sleep".into(),
8856            tag: Some("v0.1.0".into()),
8857            rev: None,
8858            branch: None,
8859        });
8860        let err = d.validate().unwrap_err();
8861        let DepError::FonteRepoShape { nome, repo, reason } = err else {
8862            panic!("expected FonteRepoShape, got other variant");
8863        };
8864        assert_eq!(nome, "caixa-teia");
8865        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia&sleep");
8866        assert!(
8867            reason.contains("must not contain `&`"),
8868            "reason must surface the shell-background / logical-AND arm, got {reason:?}"
8869        );
8870        assert!(
8871            reason.contains("background-task") || reason.contains("'sub-delims'"),
8872            "reason must name the shell-background / RFC-3986-sub-delims rationale, \
8873             got {reason:?}"
8874        );
8875    }
8876
8877    #[test]
8878    fn validate_rejects_git_fonte_with_repo_carrying_logical_and() {
8879        // The fail-before-pass-after pin for the symmetric `&&`
8880        // logical-AND build-chain paste footgun: an author pastes
8881        // a `git clone <url> && cd <repo>` build-chain one-liner
8882        // and forgets to trim the `&& <cmd>` tail. The `&&` shape
8883        // is the same `&` byte twice in a row; the per-byte arm
8884        // fires on the first `&` it sees. Pinned separately from
8885        // the single-`&` background-launch shape so a future
8886        // diagnostic-surface change that special-cased the
8887        // doubled-byte form surfaces here.
8888        let d = dep_with_fonte(DepSource::Git {
8889            repo: "github:pleme-io/caixa-teia&&echo".into(),
8890            tag: Some("v0.1.0".into()),
8891            rev: None,
8892            branch: None,
8893        });
8894        let err = d.validate().unwrap_err();
8895        let DepError::FonteRepoShape { reason, .. } = err else {
8896            panic!("expected FonteRepoShape, got other variant");
8897        };
8898        assert!(
8899            reason.contains("must not contain `&`"),
8900            "reason must surface the shell-background / logical-AND arm on the doubled-`&&` \
8901             shape too, got {reason:?}"
8902        );
8903    }
8904
8905    #[test]
8906    fn fonte_repo_fragment_fires_before_background_when_fragment_first() {
8907        // Cascade pin: the fragment-`#` arm and the background-`&`
8908        // arm are both per-byte arms inside the same `for &b in
8909        // s.as_bytes()` loop, so the byte that appears first in the
8910        // value's byte order wins. A `:repo
8911        // "https://github.com/p/x#readme & sleep"` carries both `#`
8912        // and `&`; the `#` byte appears first, so the fragment-`#`
8913        // arm fires, surfacing the more self-locating diagnostic on
8914        // the byte the author pasted earliest in the URL. Mirrors
8915        // the peer cascade discipline
8916        // `fonte_repo_fragment_fires_before_semicolon_when_fragment_first`
8917        // on the prior `:repo` byte-class arm.
8918        let d = dep_with_fonte(DepSource::Git {
8919            repo: "https://github.com/pleme-io/caixa-teia#readme&sleep".into(),
8920            tag: Some("v0.1.0".into()),
8921            rev: None,
8922            branch: None,
8923        });
8924        let err = d.validate().unwrap_err();
8925        let DepError::FonteRepoShape { reason, .. } = err else {
8926            panic!("expected FonteRepoShape, got other variant");
8927        };
8928        assert!(
8929            reason.contains("must not contain `#`"),
8930            "reason must surface the fragment-`#` arm (fires before background-`&` when `#` \
8931             byte appears first in value), got {reason:?}"
8932        );
8933    }
8934
8935    #[test]
8936    fn fonte_repo_semicolon_fires_before_background_when_semicolon_first() {
8937        // Cascade pin: the semicolon arm and the background-`&` arm
8938        // are both per-byte arms inside the same `for &b in
8939        // s.as_bytes()` loop, so the byte that appears first in the
8940        // value's byte order wins. A `:repo
8941        // "https://github.com/p/x; rm & sleep"` carries both `;` and
8942        // `&`; the `;` byte appears first, so the semicolon arm
8943        // fires, surfacing the more self-locating diagnostic on the
8944        // byte the author pasted earliest in the URL. Pins the
8945        // natural-order cascade so a future reorder of the per-byte
8946        // arms surfaces here.
8947        let d = dep_with_fonte(DepSource::Git {
8948            repo: "https://github.com/pleme-io/caixa-teia;rm&sleep".into(),
8949            tag: Some("v0.1.0".into()),
8950            rev: None,
8951            branch: None,
8952        });
8953        let err = d.validate().unwrap_err();
8954        let DepError::FonteRepoShape { reason, .. } = err else {
8955            panic!("expected FonteRepoShape, got other variant");
8956        };
8957        assert!(
8958            reason.contains("must not contain `;`"),
8959            "reason must surface the semicolon arm (fires before background-`&` when `;` \
8960             byte appears first in value), got {reason:?}"
8961        );
8962    }
8963
8964    #[test]
8965    fn validate_rejects_git_fonte_with_repo_carrying_shell_variable_expansion() {
8966        // The fail-before-pass-after pin for the canonical
8967        // paste-from-shell-prompt-with-unsubstituted-variable footgun
8968        // on `:repo` (peer with the f4efe9c `$` arm on the sibling
8969        // `:caminho` path-fonte axis). An author pastes a shell one-
8970        // liner that referenced an environment variable
8971        // (`git clone https://github.com/$ORG/x`, `git clone
8972        // github:$USER/repo`) into the `:repo` slot, forgetting to
8973        // substitute the literal value at author time. Until this arm
8974        // landed the value silently passed every prior
8975        // `is_git_repo_url` arm (no whitespace, no control chars, no
8976        // non-ASCII, no `#`, no `?`, no `\`, no `{`/`}`, no `<`/`>`,
8977        // no `` ` ``, no `|`, no `;`, no `&`, doesn't start with `-`
8978        // or `:`); RFC 3986 §2 lists `$` in the 'sub-delims' /
8979        // reserved set and the WHATWG URL spec's fragment percent-
8980        // encode set maps `$` → `%24` on the wire, so the byte rides
8981        // verbatim into the lacre's per-dep BLAKE3 closure but is
8982        // silently rewritten at libcurl's URL-parser layer — two
8983        // authors whose values differ only in their `$VAR` /
8984        // `${VAR}` / `$(cmd)` expansion tail resolve to the byte-
8985        // identical upstream `git clone` but lock to two distinct
8986        // lacres, defeating the THEORY.md §V.2 render-determinism
8987        // contract. Beyond determinism, the value is a structural
8988        // host-layout leak: two authors with the same `:repo` slot
8989        // but different `$ORG` / `$HOME` / `$WORKSPACE` resolve
8990        // different upstreams. Peer with the `:caminho` axis's
8991        // `FonteCaminhoVarExpansion` arm (f4efe9c) on the sibling
8992        // path-fonte axis, and `is_gateway_api_http_path`'s eleven-
8993        // byte RFC-3986-reserved set on `:entrada :paths`.
8994        let d = dep_with_fonte(DepSource::Git {
8995            repo: "https://github.com/$ORG/caixa-teia".into(),
8996            tag: Some("v0.1.0".into()),
8997            rev: None,
8998            branch: None,
8999        });
9000        let err = d.validate().unwrap_err();
9001        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9002            panic!("expected FonteRepoShape, got other variant");
9003        };
9004        assert_eq!(nome, "caixa-teia");
9005        assert_eq!(repo, "https://github.com/$ORG/caixa-teia");
9006        assert!(
9007            reason.contains("must not contain `$`"),
9008            "reason must surface the shell-variable-expansion arm, got {reason:?}"
9009        );
9010        assert!(
9011            reason.contains("variable-expansion") || reason.contains("'sub-delims'"),
9012            "reason must name the shell-variable-expansion / RFC-3986-sub-delims \
9013             rationale, got {reason:?}"
9014        );
9015    }
9016
9017    #[test]
9018    fn validate_rejects_git_fonte_with_repo_carrying_braced_variable_expansion() {
9019        // The fail-before-pass-after pin for the symmetric POSIX-
9020        // shell braced `${VAR}` expansion paste footgun: an author
9021        // pastes a CI-manifest line `git clone
9022        // https://github.com/${WORKSPACE}/x` (the canonical GitHub
9023        // Actions / GitLab CI / Drone shape) and forgets to
9024        // substitute the literal value. The `${...}` shape is the
9025        // same `$` byte at the leading position of the expansion;
9026        // the per-byte arm fires on the `$`. Pinned separately from
9027        // the bare-`$VAR` shape so a future diagnostic-surface
9028        // change that special-cased the braced form surfaces here.
9029        let d = dep_with_fonte(DepSource::Git {
9030            repo: "https://github.com/${WORKSPACE}/caixa-teia".into(),
9031            tag: Some("v0.1.0".into()),
9032            rev: None,
9033            branch: None,
9034        });
9035        let err = d.validate().unwrap_err();
9036        let DepError::FonteRepoShape { reason, .. } = err else {
9037            panic!("expected FonteRepoShape, got other variant");
9038        };
9039        assert!(
9040            reason.contains("must not contain `$`"),
9041            "reason must surface the shell-variable-expansion arm on the braced `${{...}}` \
9042             shape too, got {reason:?}"
9043        );
9044    }
9045
9046    #[test]
9047    fn fonte_repo_fragment_fires_before_var_expansion_when_fragment_first() {
9048        // Cascade pin: the fragment-`#` arm and the var-expansion-`$`
9049        // arm are both per-byte arms inside the same `for &b in
9050        // s.as_bytes()` loop, so the byte that appears first in the
9051        // value's byte order wins. A `:repo
9052        // "https://github.com/p/x#readme$HOME"` carries both `#` and
9053        // `$`; the `#` byte appears first, so the fragment-`#` arm
9054        // fires, surfacing the more self-locating diagnostic on the
9055        // byte the author pasted earliest in the URL. Mirrors the
9056        // peer cascade discipline
9057        // `fonte_repo_fragment_fires_before_background_when_fragment_first`
9058        // on the prior `:repo` byte-class arm.
9059        let d = dep_with_fonte(DepSource::Git {
9060            repo: "https://github.com/pleme-io/caixa-teia#readme$HOME".into(),
9061            tag: Some("v0.1.0".into()),
9062            rev: None,
9063            branch: None,
9064        });
9065        let err = d.validate().unwrap_err();
9066        let DepError::FonteRepoShape { reason, .. } = err else {
9067            panic!("expected FonteRepoShape, got other variant");
9068        };
9069        assert!(
9070            reason.contains("must not contain `#`"),
9071            "reason must surface the fragment-`#` arm (fires before var-expansion-`$` when \
9072             `#` byte appears first in value), got {reason:?}"
9073        );
9074    }
9075
9076    #[test]
9077    fn fonte_repo_background_fires_before_var_expansion_when_background_first() {
9078        // Cascade pin: the background-`&` arm and the
9079        // var-expansion-`$` arm are both per-byte arms inside the
9080        // same `for &b in s.as_bytes()` loop, so the byte that
9081        // appears first in the value's byte order wins. A `:repo
9082        // "https://github.com/p/x&sleep$HOME"` carries both `&` and
9083        // `$`; the `&` byte appears first, so the background arm
9084        // fires, surfacing the more self-locating diagnostic on the
9085        // byte the author pasted earliest in the URL. Pins the
9086        // natural-order cascade so a future reorder of the per-byte
9087        // arms surfaces here — `$` is the most recent byte-class arm,
9088        // so the cascade-pin sweep extends to cover every immediately
9089        // prior byte arm (`#`, `&`) firing first when ordered ahead
9090        // of `$` in the value.
9091        let d = dep_with_fonte(DepSource::Git {
9092            repo: "https://github.com/pleme-io/caixa-teia&sleep$HOME".into(),
9093            tag: Some("v0.1.0".into()),
9094            rev: None,
9095            branch: None,
9096        });
9097        let err = d.validate().unwrap_err();
9098        let DepError::FonteRepoShape { reason, .. } = err else {
9099            panic!("expected FonteRepoShape, got other variant");
9100        };
9101        assert!(
9102            reason.contains("must not contain `&`"),
9103            "reason must surface the background-`&` arm (fires before var-expansion-`$` when \
9104             `&` byte appears first in value), got {reason:?}"
9105        );
9106    }
9107
9108    #[test]
9109    fn validate_rejects_git_fonte_with_repo_carrying_shell_glob_wildcard() {
9110        // The fail-before-pass-after pin for the canonical
9111        // paste-from-shell-prompt glob footgun on `:repo` (peer with
9112        // the cf9034b `*` / `?` arm on the sibling `:caminho`
9113        // path-fonte axis). An author pastes a shell one-liner that
9114        // referenced a glob expansion (`ls
9115        // github.com/pleme-io/caixa-*`, `git clone
9116        // github:pleme-io/caixa-*`) into the `:repo` slot, forgetting
9117        // to substitute the literal repo name. Until this arm landed
9118        // the `*` byte silently passed every prior `is_git_repo_url`
9119        // arm (no whitespace, no control chars, no non-ASCII, no `#`,
9120        // no `?`, no `\`, no `{`/`}`, no `<`/`>`, no `` ` ``, no `|`,
9121        // no `;`, no `&`, no `$`, doesn't start with `-` or `:`); RFC
9122        // 3986 §2 lists `*` in the 'sub-delims' / reserved set and
9123        // the WHATWG URL spec's special-query percent-encode set maps
9124        // `*` → `%2A` on the wire, so the byte rides verbatim into
9125        // the lacre's per-dep BLAKE3 closure but is silently
9126        // rewritten at libcurl's URL-parser layer — two authors
9127        // whose values differ only in their asterisk presence
9128        // resolve to the byte-identical upstream `git clone` but
9129        // lock to two distinct lacres, defeating the THEORY.md §V.2
9130        // render-determinism contract. Peer with the `:caminho`
9131        // axis's `FonteCaminhoShellGlob` arm (cf9034b) on the
9132        // sibling path-fonte axis, and the `is_git_ref_name`
9133        // refspec-wildcard cascade on the `:fonte :tag` / `:branch`
9134        // axes.
9135        let d = dep_with_fonte(DepSource::Git {
9136            repo: "https://github.com/pleme-io/caixa-*".into(),
9137            tag: Some("v0.1.0".into()),
9138            rev: None,
9139            branch: None,
9140        });
9141        let err = d.validate().unwrap_err();
9142        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9143            panic!("expected FonteRepoShape, got other variant");
9144        };
9145        assert_eq!(nome, "caixa-teia");
9146        assert_eq!(repo, "https://github.com/pleme-io/caixa-*");
9147        assert!(
9148            reason.contains("must not contain `*`"),
9149            "reason must surface the shell-glob arm, got {reason:?}"
9150        );
9151        assert!(
9152            reason.contains("pathname-expansion") || reason.contains("'sub-delims'"),
9153            "reason must name the shell-glob / pathname-expansion / \
9154             RFC-3986-sub-delims rationale, got {reason:?}"
9155        );
9156    }
9157
9158    #[test]
9159    fn validate_rejects_git_fonte_with_repo_carrying_recursive_shell_glob() {
9160        // The fail-before-pass-after pin for the symmetric bash
9161        // `globstar` recursive-glob paste footgun: an author pastes
9162        // a `ls github.com/pleme-io/**/x` (the canonical
9163        // `globstar`-shopt-enabled recursive-listing tail) into the
9164        // `:repo` slot. The `**` shape is two `*` bytes adjacent;
9165        // the per-byte arm fires on the first `*`. Pinned
9166        // separately from the single-`*` shape so a future
9167        // diagnostic-surface change that special-cased the
9168        // double-`*` form surfaces here.
9169        let d = dep_with_fonte(DepSource::Git {
9170            repo: "https://github.com/pleme-io/**/caixa-teia".into(),
9171            tag: Some("v0.1.0".into()),
9172            rev: None,
9173            branch: None,
9174        });
9175        let err = d.validate().unwrap_err();
9176        let DepError::FonteRepoShape { reason, .. } = err else {
9177            panic!("expected FonteRepoShape, got other variant");
9178        };
9179        assert!(
9180            reason.contains("must not contain `*`"),
9181            "reason must surface the shell-glob arm on the `**` recursive-glob shape too, \
9182             got {reason:?}"
9183        );
9184    }
9185
9186    #[test]
9187    fn fonte_repo_fragment_fires_before_glob_when_fragment_first() {
9188        // Cascade pin: the fragment-`#` arm and the glob-`*` arm are
9189        // both per-byte arms inside the same `for &b in s.as_bytes()`
9190        // loop, so the byte that appears first in the value's byte
9191        // order wins. A `:repo
9192        // "https://github.com/p/x#readme*tail"` carries both `#` and
9193        // `*`; the `#` byte appears first, so the fragment-`#` arm
9194        // fires, surfacing the more self-locating diagnostic on the
9195        // byte the author pasted earliest in the URL. Mirrors the
9196        // peer cascade discipline
9197        // `fonte_repo_fragment_fires_before_var_expansion_when_fragment_first`
9198        // on the prior `:repo` byte-class arm.
9199        let d = dep_with_fonte(DepSource::Git {
9200            repo: "https://github.com/pleme-io/caixa-teia#readme*tail".into(),
9201            tag: Some("v0.1.0".into()),
9202            rev: None,
9203            branch: None,
9204        });
9205        let err = d.validate().unwrap_err();
9206        let DepError::FonteRepoShape { reason, .. } = err else {
9207            panic!("expected FonteRepoShape, got other variant");
9208        };
9209        assert!(
9210            reason.contains("must not contain `#`"),
9211            "reason must surface the fragment-`#` arm (fires before glob-`*` when `#` byte \
9212             appears first in value), got {reason:?}"
9213        );
9214    }
9215
9216    #[test]
9217    fn fonte_repo_var_expansion_fires_before_glob_when_var_expansion_first() {
9218        // Cascade pin: the var-expansion-`$` arm and the glob-`*`
9219        // arm are both per-byte arms inside the same `for &b in
9220        // s.as_bytes()` loop, so the byte that appears first in the
9221        // value's byte order wins. A `:repo
9222        // "https://github.com/p/$ORG-*"` carries both `$` and `*`;
9223        // the `$` byte appears first, so the var-expansion arm
9224        // fires, surfacing the more self-locating diagnostic on the
9225        // byte the author pasted earliest in the URL. Pins the
9226        // natural-order cascade so a future reorder of the per-byte
9227        // arms surfaces here — `*` is the most recent byte-class
9228        // arm, so the cascade-pin sweep extends to cover the
9229        // immediately prior `$` byte arm firing first when ordered
9230        // ahead of `*` in the value.
9231        let d = dep_with_fonte(DepSource::Git {
9232            repo: "https://github.com/pleme-io/$ORG-caixa-*".into(),
9233            tag: Some("v0.1.0".into()),
9234            rev: None,
9235            branch: None,
9236        });
9237        let err = d.validate().unwrap_err();
9238        let DepError::FonteRepoShape { reason, .. } = err else {
9239            panic!("expected FonteRepoShape, got other variant");
9240        };
9241        assert!(
9242            reason.contains("must not contain `$`"),
9243            "reason must surface the var-expansion-`$` arm (fires before glob-`*` when `$` \
9244             byte appears first in value), got {reason:?}"
9245        );
9246    }
9247
9248    #[test]
9249    fn validate_rejects_git_fonte_with_repo_carrying_subshell_open_paren() {
9250        // The fail-before-pass-after pin for the canonical paste-from-
9251        // shell-prompt subshell-grouping footgun on `:repo`. An author
9252        // pastes a doc / README snippet carrying a regex-alternation
9253        // grouping shape (`https://github.com/(foo|bar)/repo`) or a
9254        // dynamic-config-substitution wrapper (`$(<cmd>)`) into the
9255        // `:repo` slot, forgetting to substitute one literal org name.
9256        // Until this arm landed the `(` byte silently passed every
9257        // prior `is_git_repo_url` arm (no whitespace, no control
9258        // chars, no non-ASCII, no `#`, no `?`, no `\`, no `{`/`}`, no
9259        // `<`/`>`, no `` ` ``, no `|`, no `;`, no `&`, no `$`, no
9260        // `*`, doesn't start with `-` or `:`); RFC 3986 §2 lists `(`
9261        // / `)` in the 'sub-delims' / reserved set, and the WHATWG
9262        // URL spec's special-query percent-encode set maps `(` →
9263        // `%28` and `)` → `%29` on the wire, so the byte rides
9264        // verbatim into the lacre's per-dep BLAKE3 closure but is
9265        // silently rewritten at libcurl's URL-parser layer —
9266        // defeating the THEORY.md §V.2 render-determinism contract on
9267        // the same axis the prior twelve byte-class arms close.
9268        let d = dep_with_fonte(DepSource::Git {
9269            repo: "https://github.com/(foo|bar)/caixa-teia".into(),
9270            tag: Some("v0.1.0".into()),
9271            rev: None,
9272            branch: None,
9273        });
9274        let err = d.validate().unwrap_err();
9275        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9276            panic!("expected FonteRepoShape, got other variant");
9277        };
9278        assert_eq!(nome, "caixa-teia");
9279        assert_eq!(repo, "https://github.com/(foo|bar)/caixa-teia");
9280        assert!(
9281            reason.contains("must not contain `(`"),
9282            "reason must surface the subshell-open-paren arm, got {reason:?}"
9283        );
9284        assert!(
9285            reason.contains("subshell-grouping") || reason.contains("'sub-delims'"),
9286            "reason must name the shell-subshell-grouping / RFC-3986-sub-delims rationale, \
9287             got {reason:?}"
9288        );
9289    }
9290
9291    #[test]
9292    fn validate_rejects_git_fonte_with_repo_carrying_subshell_close_paren() {
9293        // The symmetric arm pin on the closing `)` byte: an author
9294        // pastes a `$(date)` command-substitution wrapper or a
9295        // regex-alternation `(foo|bar)` tail into the `:repo` slot.
9296        // Pinned separately from the opening `(` shape so a future
9297        // diagnostic-surface change that only checked one boundary
9298        // surfaces here. The `(` byte appears earlier in the
9299        // canonical regex / subshell wrapper so the per-byte loop
9300        // fires on `(` first; this test exercises a `:repo` value
9301        // carrying only the closing `)` byte (no opening paren) so
9302        // the `)` arm fires directly — pinning the byte-class arm
9303        // independent of order.
9304        let d = dep_with_fonte(DepSource::Git {
9305            repo: "github:pleme-io/caixa-teia)tail".into(),
9306            tag: Some("v0.1.0".into()),
9307            rev: None,
9308            branch: None,
9309        });
9310        let err = d.validate().unwrap_err();
9311        let DepError::FonteRepoShape { reason, .. } = err else {
9312            panic!("expected FonteRepoShape, got other variant");
9313        };
9314        assert!(
9315            reason.contains("must not contain `)`"),
9316            "reason must surface the subshell-close-paren arm on the bare `)` shape, \
9317             got {reason:?}"
9318        );
9319    }
9320
9321    #[test]
9322    fn fonte_repo_fragment_fires_before_subshell_when_fragment_first() {
9323        // Cascade pin: the fragment-`#` arm and the subshell-`(` arm
9324        // are both per-byte arms inside the same `for &b in
9325        // s.as_bytes()` loop, so the byte that appears first in the
9326        // value's byte order wins. A `:repo
9327        // "https://github.com/p/x#readme(tail)"` carries both `#` and
9328        // `(`; the `#` byte appears first, so the fragment-`#` arm
9329        // fires, surfacing the more self-locating diagnostic on the
9330        // byte the author pasted earliest in the URL. Mirrors the
9331        // peer cascade discipline
9332        // `fonte_repo_fragment_fires_before_glob_when_fragment_first`
9333        // on the prior `:repo` byte-class arm.
9334        let d = dep_with_fonte(DepSource::Git {
9335            repo: "https://github.com/pleme-io/caixa-teia#readme(tail)".into(),
9336            tag: Some("v0.1.0".into()),
9337            rev: None,
9338            branch: None,
9339        });
9340        let err = d.validate().unwrap_err();
9341        let DepError::FonteRepoShape { reason, .. } = err else {
9342            panic!("expected FonteRepoShape, got other variant");
9343        };
9344        assert!(
9345            reason.contains("must not contain `#`"),
9346            "reason must surface the fragment-`#` arm (fires before subshell-`(` when `#` \
9347             byte appears first in value), got {reason:?}"
9348        );
9349    }
9350
9351    #[test]
9352    fn fonte_repo_glob_fires_before_subshell_when_glob_first() {
9353        // Cascade pin: the glob-`*` arm (the immediate-predecessor
9354        // byte-class arm, 3902a9a) and the subshell-`(` arm are both
9355        // per-byte arms inside the same `for &b in s.as_bytes()`
9356        // loop, so the byte that appears first in the value's byte
9357        // order wins. A `:repo
9358        // "https://github.com/p/x-*-(date)"` carries both `*` and
9359        // `(`; the `*` byte appears first, so the glob arm fires,
9360        // surfacing the more self-locating diagnostic on the byte
9361        // the author pasted earliest in the URL. Pins the natural-
9362        // order cascade so a future reorder of the per-byte arms
9363        // surfaces here — `(` is the most recent byte-class arm,
9364        // so the cascade-pin sweep extends to cover the immediately
9365        // prior `*` byte arm firing first when ordered ahead of `(`
9366        // in the value.
9367        let d = dep_with_fonte(DepSource::Git {
9368            repo: "https://github.com/pleme-io/caixa-teia-*-(date)".into(),
9369            tag: Some("v0.1.0".into()),
9370            rev: None,
9371            branch: None,
9372        });
9373        let err = d.validate().unwrap_err();
9374        let DepError::FonteRepoShape { reason, .. } = err else {
9375            panic!("expected FonteRepoShape, got other variant");
9376        };
9377        assert!(
9378            reason.contains("must not contain `*`"),
9379            "reason must surface the glob-`*` arm (fires before subshell-`(` when `*` byte \
9380             appears first in value), got {reason:?}"
9381        );
9382    }
9383
9384    #[test]
9385    fn validate_rejects_git_fonte_with_repo_carrying_shell_double_quote() {
9386        // The fail-before-pass-after pin for the canonical paste-from-
9387        // doc-shell-quoting footgun on `:repo`. An author copies a
9388        // README quick-start snippet (`$ git clone "https://github.com/
9389        // foo/bar"`) and keeps the surrounding double-quote bytes when
9390        // pasting into the `:repo` slot — the doc wraps the URL in
9391        // double quotes so the shell doesn't re-lex metachars inside,
9392        // but the typed slot is itself a byte-level string parser, not
9393        // a shell context, so the quote bytes ride into the value
9394        // verbatim. Until this arm landed the `"` byte silently passed
9395        // every prior `is_git_repo_url` arm (no whitespace, no control
9396        // chars, no non-ASCII, no `#`, no `?`, no `\`, no `{`/`}`, no
9397        // `<`/`>`, no `` ` ``, no `|`, no `;`, no `&`, no `$`, no `*`,
9398        // no `(`/`)`, doesn't start with `-` or `:`); RFC 3986 §2 lists
9399        // `"` in the strict four-byte 'delims' subset (with `<`, `>`,
9400        // `` ` ``) every URL parser is required to refuse or percent-
9401        // encode, and the WHATWG URL spec's 'C0 control percent-encode
9402        // set' maps `"` → `%22` on the wire, so the byte rides verbatim
9403        // into the lacre's per-dep BLAKE3 closure but is silently
9404        // rewritten at libcurl's URL-parser layer, defeating the
9405        // THEORY.md §V.2 render-determinism contract.
9406        let d = dep_with_fonte(DepSource::Git {
9407            repo: "\"https://github.com/pleme-io/caixa-teia\"".into(),
9408            tag: Some("v0.1.0".into()),
9409            rev: None,
9410            branch: None,
9411        });
9412        let err = d.validate().unwrap_err();
9413        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9414            panic!("expected FonteRepoShape, got other variant");
9415        };
9416        assert_eq!(nome, "caixa-teia");
9417        assert_eq!(repo, "\"https://github.com/pleme-io/caixa-teia\"");
9418        assert!(
9419            reason.contains("must not contain `\"`"),
9420            "reason must surface the shell-double-quote arm, got {reason:?}"
9421        );
9422        assert!(
9423            reason.contains("double-quote") || reason.contains("'delims'"),
9424            "reason must name the shell-double-quote / RFC-3986-delims rationale, \
9425             got {reason:?}"
9426        );
9427    }
9428
9429    #[test]
9430    fn validate_rejects_git_fonte_with_repo_carrying_stray_trailing_double_quote() {
9431        // The symmetric stray-quote tail pin: an author pastes only a
9432        // closing `"` from a shell-history line like `git clone
9433        // "https://github.com/foo/bar" && cd …` (the trim went too
9434        // far in one direction but not the other) into the `:repo`
9435        // slot. Pinned separately from the wrapped-quote shape so a
9436        // future diagnostic-surface change that only checked one
9437        // boundary (only leading, only trailing, only paired) surfaces
9438        // here — the per-byte arm fires anywhere `"` appears.
9439        let d = dep_with_fonte(DepSource::Git {
9440            repo: "github:pleme-io/caixa-teia\"".into(),
9441            tag: Some("v0.1.0".into()),
9442            rev: None,
9443            branch: None,
9444        });
9445        let err = d.validate().unwrap_err();
9446        let DepError::FonteRepoShape { reason, .. } = err else {
9447            panic!("expected FonteRepoShape, got other variant");
9448        };
9449        assert!(
9450            reason.contains("must not contain `\"`"),
9451            "reason must surface the shell-double-quote arm on the trailing-`\"` shape, \
9452             got {reason:?}"
9453        );
9454    }
9455
9456    #[test]
9457    fn fonte_repo_fragment_fires_before_double_quote_when_fragment_first() {
9458        // Cascade pin: the fragment-`#` arm and the double-quote arm
9459        // are both per-byte arms inside the same `for &b in
9460        // s.as_bytes()` loop, so the byte that appears first in the
9461        // value's byte order wins. A `:repo
9462        // "https://github.com/p/x#readme\"tail"` carries both `#` and
9463        // `"`; the `#` byte appears first, so the fragment-`#` arm
9464        // fires, surfacing the more self-locating diagnostic on the
9465        // byte the author pasted earliest in the URL.
9466        let d = dep_with_fonte(DepSource::Git {
9467            repo: "https://github.com/pleme-io/caixa-teia#readme\"tail".into(),
9468            tag: Some("v0.1.0".into()),
9469            rev: None,
9470            branch: None,
9471        });
9472        let err = d.validate().unwrap_err();
9473        let DepError::FonteRepoShape { reason, .. } = err else {
9474            panic!("expected FonteRepoShape, got other variant");
9475        };
9476        assert!(
9477            reason.contains("must not contain `#`"),
9478            "reason must surface the fragment-`#` arm (fires before double-quote when `#` \
9479             byte appears first in value), got {reason:?}"
9480        );
9481    }
9482
9483    #[test]
9484    fn fonte_repo_subshell_fires_before_double_quote_when_subshell_first() {
9485        // Cascade pin: the subshell-`(` arm (the immediate-predecessor
9486        // byte-class arm, 3b99147) and the double-quote arm are both
9487        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
9488        // so the byte that appears first in the value's byte order
9489        // wins. A `:repo "github:p/x(date)\"tail"` carries both `(`
9490        // and `"`; the `(` byte appears first, so the subshell arm
9491        // fires, surfacing the more self-locating diagnostic on the
9492        // byte the author pasted earliest in the URL. Pins the natural-
9493        // order cascade so a future reorder of the per-byte arms
9494        // surfaces here — `"` is the most recent byte-class arm, so
9495        // the cascade-pin sweep extends to cover the immediately prior
9496        // `(` byte arm firing first when ordered ahead of `"` in the
9497        // value.
9498        let d = dep_with_fonte(DepSource::Git {
9499            repo: "github:pleme-io/caixa-teia(date)\"tail".into(),
9500            tag: Some("v0.1.0".into()),
9501            rev: None,
9502            branch: None,
9503        });
9504        let err = d.validate().unwrap_err();
9505        let DepError::FonteRepoShape { reason, .. } = err else {
9506            panic!("expected FonteRepoShape, got other variant");
9507        };
9508        assert!(
9509            reason.contains("must not contain `(`"),
9510            "reason must surface the subshell-`(` arm (fires before double-quote when `(` \
9511             byte appears first in value), got {reason:?}"
9512        );
9513    }
9514
9515    #[test]
9516    fn validate_rejects_git_fonte_with_repo_carrying_shell_single_quote() {
9517        // The fail-before-pass-after pin for the canonical paste-from-
9518        // doc-strong-quoting footgun on `:repo`. An author copies a
9519        // security-conscious README quick-start snippet (`$ git clone
9520        // 'https://github.com/foo/bar'`) and keeps the surrounding
9521        // single-quote bytes when pasting into the `:repo` slot — the
9522        // doc strong-quotes the URL so the shell suppresses every form
9523        // of expansion on the bytes inside (no `$`, no backtick, no
9524        // glob, no word-splitting), but the typed slot is itself a
9525        // byte-level string parser, not a shell context, so the quote
9526        // bytes ride into the value verbatim. Until this arm landed the
9527        // `'` byte silently passed every prior `is_git_repo_url` arm
9528        // (no whitespace, no control chars, no non-ASCII, no `#`, no
9529        // `?`, no `\`, no `{`/`}`, no `<`/`>`, no `` ` ``, no `|`, no
9530        // `;`, no `&`, no `$`, no `*`, no `(`/`)`, no `"`, doesn't start
9531        // with `-` or `:`); RFC 3986 §2.2 lists `'` in the 'sub-delims'
9532        // set, peer with the `\"` 'delims' double-quote arm and the
9533        // partner ASCII shell-string-delimiter byte every byte-level
9534        // string parser sharing a value-shape with a shell argument
9535        // must refuse on a URL-shaped slot.
9536        let d = dep_with_fonte(DepSource::Git {
9537            repo: "'https://github.com/pleme-io/caixa-teia'".into(),
9538            tag: Some("v0.1.0".into()),
9539            rev: None,
9540            branch: None,
9541        });
9542        let err = d.validate().unwrap_err();
9543        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9544            panic!("expected FonteRepoShape, got other variant");
9545        };
9546        assert_eq!(nome, "caixa-teia");
9547        assert_eq!(repo, "'https://github.com/pleme-io/caixa-teia'");
9548        assert!(
9549            reason.contains("must not contain `'`"),
9550            "reason must surface the shell-single-quote arm, got {reason:?}"
9551        );
9552        assert!(
9553            reason.contains("single-quote") || reason.contains("strong-quote"),
9554            "reason must name the shell-single-quote / strong-quote rationale, \
9555             got {reason:?}"
9556        );
9557    }
9558
9559    #[test]
9560    fn validate_rejects_git_fonte_with_repo_carrying_english_apostrophe() {
9561        // The symmetric English-typography pin: an author writes
9562        // `:repo "github:p/repo's-fork"` (the possessive-form paste-
9563        // from-prose idiom every README / commit-message / chat-thread
9564        // reference to a repo carries) expecting the substrate to
9565        // coerce it to a kebab-case slug — but the byte rides into the
9566        // lacre verbatim. Pinned separately from the wrapped-quote
9567        // shape so a future diagnostic-surface change that only checked
9568        // the boundary positions (only leading, only trailing, only
9569        // paired) surfaces here — the per-byte arm fires anywhere `'`
9570        // appears in the value.
9571        let d = dep_with_fonte(DepSource::Git {
9572            repo: "github:pleme-io/repo's-fork".into(),
9573            tag: Some("v0.1.0".into()),
9574            rev: None,
9575            branch: None,
9576        });
9577        let err = d.validate().unwrap_err();
9578        let DepError::FonteRepoShape { reason, .. } = err else {
9579            panic!("expected FonteRepoShape, got other variant");
9580        };
9581        assert!(
9582            reason.contains("must not contain `'`"),
9583            "reason must surface the shell-single-quote arm on the mid-string \
9584             apostrophe shape, got {reason:?}"
9585        );
9586    }
9587
9588    #[test]
9589    fn fonte_repo_fragment_fires_before_single_quote_when_fragment_first() {
9590        // Cascade pin: the fragment-`#` arm and the single-quote arm
9591        // are both per-byte arms inside the same `for &b in
9592        // s.as_bytes()` loop, so the byte that appears first in the
9593        // value's byte order wins. A `:repo
9594        // "https://github.com/p/x#readme'tail"` carries both `#` and
9595        // `'`; the `#` byte appears first, so the fragment-`#` arm
9596        // fires, surfacing the more self-locating diagnostic on the
9597        // byte the author pasted earliest in the URL.
9598        let d = dep_with_fonte(DepSource::Git {
9599            repo: "https://github.com/pleme-io/caixa-teia#readme'tail".into(),
9600            tag: Some("v0.1.0".into()),
9601            rev: None,
9602            branch: None,
9603        });
9604        let err = d.validate().unwrap_err();
9605        let DepError::FonteRepoShape { reason, .. } = err else {
9606            panic!("expected FonteRepoShape, got other variant");
9607        };
9608        assert!(
9609            reason.contains("must not contain `#`"),
9610            "reason must surface the fragment-`#` arm (fires before single-quote when `#` \
9611             byte appears first in value), got {reason:?}"
9612        );
9613    }
9614
9615    #[test]
9616    fn fonte_repo_double_quote_fires_before_single_quote_when_double_quote_first() {
9617        // Cascade pin: the double-quote-`"` arm (the immediate-predecessor
9618        // byte-class arm, 4267d8b) and the single-quote arm are both
9619        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
9620        // so the byte that appears first in the value's byte order
9621        // wins. A `:repo "github:p/x\"mid'tail"` carries both `"` and
9622        // `'`; the `"` byte appears first, so the double-quote arm
9623        // fires, surfacing the more self-locating diagnostic on the
9624        // byte the author pasted earliest in the URL. Pins the natural-
9625        // order cascade so a future reorder of the per-byte arms
9626        // surfaces here — `'` is the most recent byte-class arm, so
9627        // the cascade-pin sweep extends to cover the immediately prior
9628        // `"` byte arm firing first when ordered ahead of `'` in the
9629        // value.
9630        let d = dep_with_fonte(DepSource::Git {
9631            repo: "github:pleme-io/caixa-teia\"mid'tail".into(),
9632            tag: Some("v0.1.0".into()),
9633            rev: None,
9634            branch: None,
9635        });
9636        let err = d.validate().unwrap_err();
9637        let DepError::FonteRepoShape { reason, .. } = err else {
9638            panic!("expected FonteRepoShape, got other variant");
9639        };
9640        assert!(
9641            reason.contains("must not contain `\"`"),
9642            "reason must surface the double-quote arm (fires before single-quote when `\"` \
9643             byte appears first in value), got {reason:?}"
9644        );
9645    }
9646
9647    #[test]
9648    fn validate_rejects_git_fonte_with_repo_carrying_shell_history_expansion() {
9649        // The fail-before-pass-after pin for the canonical paste-from-
9650        // shell-history footgun on `:repo`. An author copies a `git
9651        // clone <url>!sudo make install` one-liner from a README's
9652        // quick-start snippet, intending the trailing `!sudo` as a
9653        // shell-history-expansion reference but the typed slot is itself
9654        // a byte-level string parser, not a shell context, so the byte
9655        // rides into the value verbatim. Until this arm landed the `!`
9656        // byte silently passed every prior `is_git_repo_url` arm (no
9657        // whitespace, no control chars, no non-ASCII, no `#`, no `?`,
9658        // no `\`, no `{`/`}`, no `<`/`>`, no `` ` ``, no `|`, no `;`,
9659        // no `&`, no `$`, no `*`, no `(`/`)`, no `"`, no `'`, doesn't
9660        // start with `-` or `:`); bash with the default `histexpand`
9661        // mode rewrites `!command` to the most recent history entry
9662        // beginning with `command`, the canonical RCE-class injection
9663        // vector when the byte rides into a shell argument.
9664        let d = dep_with_fonte(DepSource::Git {
9665            repo: "https://github.com/pleme-io/caixa-teia!sudo".into(),
9666            tag: Some("v0.1.0".into()),
9667            rev: None,
9668            branch: None,
9669        });
9670        let err = d.validate().unwrap_err();
9671        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9672            panic!("expected FonteRepoShape, got other variant");
9673        };
9674        assert_eq!(nome, "caixa-teia");
9675        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia!sudo");
9676        assert!(
9677            reason.contains("must not contain `!`"),
9678            "reason must surface the shell-history-expansion arm, got {reason:?}"
9679        );
9680        assert!(
9681            reason.contains("history-expansion") || reason.contains("bang"),
9682            "reason must name the shell-history-expansion / bang rationale, got {reason:?}"
9683        );
9684    }
9685
9686    #[test]
9687    fn validate_rejects_git_fonte_with_repo_carrying_double_bang_history_reference() {
9688        // The symmetric `!!` repeat-prior-command pin: an author paste-
9689        // trims a `git clone <url>` retry idiom from shell history that
9690        // expands to the previous command via `!!`. Pinned separately
9691        // from the wrapped `!command` shape so a future diagnostic-
9692        // surface change that only checked the leading or paired-bang
9693        // position surfaces here — the per-byte arm fires anywhere `!`
9694        // appears in the value.
9695        let d = dep_with_fonte(DepSource::Git {
9696            repo: "github:pleme-io/caixa-teia!!".into(),
9697            tag: Some("v0.1.0".into()),
9698            rev: None,
9699            branch: None,
9700        });
9701        let err = d.validate().unwrap_err();
9702        let DepError::FonteRepoShape { reason, .. } = err else {
9703            panic!("expected FonteRepoShape, got other variant");
9704        };
9705        assert!(
9706            reason.contains("must not contain `!`"),
9707            "reason must surface the shell-history-expansion arm on the trailing-`!!` shape, \
9708             got {reason:?}"
9709        );
9710    }
9711
9712    #[test]
9713    fn fonte_repo_fragment_fires_before_bang_when_fragment_first() {
9714        // Cascade pin: the fragment-`#` arm and the bang arm are both
9715        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
9716        // so the byte that appears first in the value's byte order
9717        // wins. A `:repo "https://github.com/p/x#readme!tail"` carries
9718        // both `#` and `!`; the `#` byte appears first, so the
9719        // fragment-`#` arm fires, surfacing the more self-locating
9720        // diagnostic on the byte the author pasted earliest in the URL.
9721        let d = dep_with_fonte(DepSource::Git {
9722            repo: "https://github.com/pleme-io/caixa-teia#readme!tail".into(),
9723            tag: Some("v0.1.0".into()),
9724            rev: None,
9725            branch: None,
9726        });
9727        let err = d.validate().unwrap_err();
9728        let DepError::FonteRepoShape { reason, .. } = err else {
9729            panic!("expected FonteRepoShape, got other variant");
9730        };
9731        assert!(
9732            reason.contains("must not contain `#`"),
9733            "reason must surface the fragment-`#` arm (fires before bang when `#` byte \
9734             appears first in value), got {reason:?}"
9735        );
9736    }
9737
9738    #[test]
9739    fn fonte_repo_single_quote_fires_before_bang_when_single_quote_first() {
9740        // Cascade pin: the single-quote-`'` arm (the immediate-predecessor
9741        // byte-class arm, e7a109f) and the bang arm are both per-byte
9742        // arms inside the same `for &b in s.as_bytes()` loop, so the
9743        // byte that appears first in the value's byte order wins. A
9744        // `:repo "github:p/x'mid!tail"` carries both `'` and `!`; the
9745        // `'` byte appears first, so the single-quote arm fires,
9746        // surfacing the more self-locating diagnostic on the byte the
9747        // author pasted earliest in the URL. Pins the natural-order
9748        // cascade so a future reorder of the per-byte arms surfaces
9749        // here — `!` is the most recent byte-class arm, so the
9750        // cascade-pin sweep extends to cover the immediately prior `'`
9751        // byte arm firing first when ordered ahead of `!` in the value.
9752        let d = dep_with_fonte(DepSource::Git {
9753            repo: "github:pleme-io/caixa-teia'mid!tail".into(),
9754            tag: Some("v0.1.0".into()),
9755            rev: None,
9756            branch: None,
9757        });
9758        let err = d.validate().unwrap_err();
9759        let DepError::FonteRepoShape { reason, .. } = err else {
9760            panic!("expected FonteRepoShape, got other variant");
9761        };
9762        assert!(
9763            reason.contains("must not contain `'`"),
9764            "reason must surface the single-quote arm (fires before bang when `'` byte \
9765             appears first in value), got {reason:?}"
9766        );
9767    }
9768
9769    #[test]
9770    fn validate_rejects_git_fonte_with_repo_carrying_list_separator_comma() {
9771        // The fail-before-pass-after pin for the canonical
9772        // list-separator-belongs-to-list-grammar footgun on `:repo`.
9773        // An author copies a `git clone <a>, <b>, <c>` paste-from-CSV
9774        // one-liner from a multi-repo bootstrap doc, intending the
9775        // comma to separate multiple repo entries but the typed
9776        // `:repo` slot names *one* repo (the list-separator belongs
9777        // to the `:deps` list grammar, not to the value). Until this
9778        // arm landed the `,` byte silently passed every prior
9779        // `is_git_repo_url` arm (no whitespace, no control chars, no
9780        // non-ASCII, no `#`, no `?`, no `\`, no `{`/`}`, no `<`/`>`,
9781        // no `` ` ``, no `|`, no `;`, no `&`, no `$`, no `*`, no
9782        // `(`/`)`, no `"`, no `'`, no `!`, doesn't start with `-` or
9783        // `:`); the byte rode into the lacre's per-dep content-
9784        // address and the resolver's `git clone <repo>` subprocess
9785        // invocation, where no host's repo registry resolved the
9786        // comma-bearing slug.
9787        let d = dep_with_fonte(DepSource::Git {
9788            repo: "github:pleme-io/caixa-teia,github:pleme-io/caixa-feira".into(),
9789            tag: Some("v0.1.0".into()),
9790            rev: None,
9791            branch: None,
9792        });
9793        let err = d.validate().unwrap_err();
9794        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9795            panic!("expected FonteRepoShape, got other variant");
9796        };
9797        assert_eq!(nome, "caixa-teia");
9798        assert_eq!(
9799            repo,
9800            "github:pleme-io/caixa-teia,github:pleme-io/caixa-feira"
9801        );
9802        assert!(
9803            reason.contains("must not contain `,`"),
9804            "reason must surface the list-separator-comma arm, got {reason:?}"
9805        );
9806        assert!(
9807            reason.contains("list-separator") || reason.contains("sub-delims"),
9808            "reason must name the list-separator / RFC-3986-sub-delims rationale, \
9809             got {reason:?}"
9810        );
9811    }
9812
9813    #[test]
9814    fn validate_rejects_git_fonte_with_repo_carrying_trailing_comma() {
9815        // The symmetric trailing-`,` paste-from-prose pin: an author
9816        // writes `:repo "github:pleme-io/caixa-feira,"` (the trailing
9817        // comma every README-prose list-of-projects sentence carries,
9818        // mistakenly retained when the slug is pasted mid-sentence)
9819        // expecting the substrate to coerce it to a kebab-case slug.
9820        // Pinned separately from the wrapped mid-token shape so a
9821        // future diagnostic-surface change that only checked the
9822        // leading or paired-comma position surfaces here — the
9823        // per-byte arm fires anywhere `,` appears in the value.
9824        let d = dep_with_fonte(DepSource::Git {
9825            repo: "github:pleme-io/caixa-feira,".into(),
9826            tag: Some("v0.1.0".into()),
9827            rev: None,
9828            branch: None,
9829        });
9830        let err = d.validate().unwrap_err();
9831        let DepError::FonteRepoShape { reason, .. } = err else {
9832            panic!("expected FonteRepoShape, got other variant");
9833        };
9834        assert!(
9835            reason.contains("must not contain `,`"),
9836            "reason must surface the list-separator-comma arm on the trailing-`,` shape, \
9837             got {reason:?}"
9838        );
9839    }
9840
9841    #[test]
9842    fn fonte_repo_fragment_fires_before_comma_when_fragment_first() {
9843        // Cascade pin: the fragment-`#` arm and the comma arm are
9844        // both per-byte arms inside the same `for &b in s.as_bytes()`
9845        // loop, so the byte that appears first in the value's byte
9846        // order wins. A `:repo "https://github.com/p/x#readme,tail"`
9847        // carries both `#` and `,`; the `#` byte appears first, so
9848        // the fragment-`#` arm fires, surfacing the more self-
9849        // locating diagnostic on the byte the author pasted earliest
9850        // in the URL.
9851        let d = dep_with_fonte(DepSource::Git {
9852            repo: "https://github.com/pleme-io/caixa-teia#readme,tail".into(),
9853            tag: Some("v0.1.0".into()),
9854            rev: None,
9855            branch: None,
9856        });
9857        let err = d.validate().unwrap_err();
9858        let DepError::FonteRepoShape { reason, .. } = err else {
9859            panic!("expected FonteRepoShape, got other variant");
9860        };
9861        assert!(
9862            reason.contains("must not contain `#`"),
9863            "reason must surface the fragment-`#` arm (fires before comma when `#` byte \
9864             appears first in value), got {reason:?}"
9865        );
9866    }
9867
9868    #[test]
9869    fn fonte_repo_bang_fires_before_comma_when_bang_first() {
9870        // Cascade pin: the bang-`!` arm (the immediate-predecessor
9871        // byte-class arm, 7d53c68) and the comma arm are both
9872        // per-byte arms inside the same `for &b in s.as_bytes()`
9873        // loop, so the byte that appears first in the value's byte
9874        // order wins. A `:repo "github:p/x!mid,tail"` carries both
9875        // `!` and `,`; the `!` byte appears first, so the bang arm
9876        // fires, surfacing the more self-locating diagnostic on the
9877        // byte the author pasted earliest in the URL. Pins the
9878        // natural-order cascade so a future reorder of the per-byte
9879        // arms surfaces here — `,` is the most recent byte-class
9880        // arm, so the cascade-pin sweep extends to cover the
9881        // immediately prior `!` byte arm firing first when ordered
9882        // ahead of `,` in the value.
9883        let d = dep_with_fonte(DepSource::Git {
9884            repo: "github:pleme-io/caixa-teia!mid,tail".into(),
9885            tag: Some("v0.1.0".into()),
9886            rev: None,
9887            branch: None,
9888        });
9889        let err = d.validate().unwrap_err();
9890        let DepError::FonteRepoShape { reason, .. } = err else {
9891            panic!("expected FonteRepoShape, got other variant");
9892        };
9893        assert!(
9894            reason.contains("must not contain `!`"),
9895            "reason must surface the bang arm (fires before comma when `!` byte \
9896             appears first in value), got {reason:?}"
9897        );
9898    }
9899
9900    #[test]
9901    fn validate_rejects_git_fonte_with_repo_carrying_shell_env_var_assignment() {
9902        // The fail-before-pass-after pin for the canonical
9903        // shell-env-var-assignment-belongs-to-shell-grammar footgun
9904        // on `:repo`. An author copies
9905        // `GIT_TERMINAL_PROMPT=0 git clone <url>` (or
9906        // `GIT_SSL_NO_VERIFY=1 git clone <url>`, `HTTPS_PROXY=…
9907        // git clone <url>`, etc. — the canonical
9908        // git-troubleshooting README idiom for a one-shot env-var
9909        // scoped to the `git clone` invocation) from a shell-prompt
9910        // one-liner, intending the `KEY=VALUE` prefix as a shell-
9911        // grammar env-var assignment but the typed `:repo` slot is
9912        // a value parser, not a shell context, so the bytes ride
9913        // into the value verbatim. Until this arm landed the `=`
9914        // byte silently passed every prior `is_git_repo_url` arm
9915        // (no whitespace, no control chars, no non-ASCII, no `#`,
9916        // no `?`, no `\`, no `{`/`}`, no `<`/`>`, no `` ` ``, no
9917        // `|`, no `;`, no `&`, no `$`, no `*`, no `(`/`)`, no `"`,
9918        // no `'`, no `!`, no `,`, doesn't start with `-` or `:`);
9919        // the byte rode into the lacre's per-dep content-address
9920        // and the resolver's `git clone <repo>` subprocess
9921        // invocation, where the upstream host's git porcelain
9922        // fetched a literal `GIT_TERMINAL_PROMPT=0 https://…`-shaped
9923        // path that no host's repo registry resolves.
9924        let d = dep_with_fonte(DepSource::Git {
9925            repo: "GIT_TERMINAL_PROMPT=0 https://github.com/pleme-io/caixa-teia".into(),
9926            tag: Some("v0.1.0".into()),
9927            rev: None,
9928            branch: None,
9929        });
9930        let err = d.validate().unwrap_err();
9931        let DepError::FonteRepoShape { nome, repo, reason } = err else {
9932            panic!("expected FonteRepoShape, got other variant");
9933        };
9934        assert_eq!(nome, "caixa-teia");
9935        assert_eq!(
9936            repo,
9937            "GIT_TERMINAL_PROMPT=0 https://github.com/pleme-io/caixa-teia"
9938        );
9939        // The `=` byte at position 19 of `GIT_TERMINAL_PROMPT=0 …`
9940        // appears before the ` ` byte at position 21, so the `=`
9941        // arm fires (not the whitespace arm) — both arms guard
9942        // the slot, but the per-byte for-loop scans left-to-right
9943        // and the first matching byte wins.
9944        assert!(
9945            reason.contains("must not contain `=`"),
9946            "reason must surface the equals-`=` arm on the env-var-assignment \
9947             paste shape, got {reason:?}"
9948        );
9949        assert!(
9950            reason.contains("env-var-assignment") || reason.contains("KEY=VALUE"),
9951            "reason must name the shell-env-var-assignment rationale, got {reason:?}"
9952        );
9953    }
9954
9955    #[test]
9956    fn validate_rejects_git_fonte_with_repo_carrying_gitconfig_url_key_prefix() {
9957        // The symmetric paste-from-gitconfig pin: an author copies
9958        // `url=https://github.com/p/x` from `git config --get-all
9959        // remote.origin.url` output, a `.gitconfig` `[remote
9960        // "origin"] url = https://…` ini-stanza paste, or a
9961        // `git config remote.origin.url <value>` doc snippet,
9962        // intending the `url=` prefix as the ini-key but the typed
9963        // `:repo` slot is a URL value parser, not a gitconfig
9964        // grammar. With no leading whitespace and no earlier-arm
9965        // bytes in the value, the `=` arm itself fires (rather
9966        // than cascading to the whitespace arm as in the env-var
9967        // paste shape). Pinned separately so a future diagnostic-
9968        // surface change that only checked the whitespace-leading
9969        // shape surfaces here — the per-byte arm fires anywhere
9970        // `=` appears in the value.
9971        let d = dep_with_fonte(DepSource::Git {
9972            repo: "url=https://github.com/pleme-io/caixa-feira".into(),
9973            tag: Some("v0.1.0".into()),
9974            rev: None,
9975            branch: None,
9976        });
9977        let err = d.validate().unwrap_err();
9978        let DepError::FonteRepoShape { reason, .. } = err else {
9979            panic!("expected FonteRepoShape, got other variant");
9980        };
9981        assert!(
9982            reason.contains("must not contain `=`"),
9983            "reason must surface the equals-`=` arm on the `url=…` gitconfig \
9984             paste shape, got {reason:?}"
9985        );
9986        assert!(
9987            reason.contains("key-value-separator") || reason.contains("sub-delims"),
9988            "reason must name the key-value-separator / RFC-3986-sub-delims \
9989             rationale, got {reason:?}"
9990        );
9991    }
9992
9993    #[test]
9994    fn fonte_repo_fragment_fires_before_equals_when_fragment_first() {
9995        // Cascade pin: the fragment-`#` arm and the `=` arm are
9996        // both per-byte arms inside the same `for &b in s.as_bytes()`
9997        // loop, so the byte that appears first in the value's byte
9998        // order wins. A `:repo "https://github.com/p/x#readme=tail"`
9999        // carries both `#` and `=`; the `#` byte appears first, so
10000        // the fragment-`#` arm fires, surfacing the more self-
10001        // locating diagnostic on the byte the author pasted earliest
10002        // in the URL.
10003        let d = dep_with_fonte(DepSource::Git {
10004            repo: "https://github.com/pleme-io/caixa-teia#readme=tail".into(),
10005            tag: Some("v0.1.0".into()),
10006            rev: None,
10007            branch: None,
10008        });
10009        let err = d.validate().unwrap_err();
10010        let DepError::FonteRepoShape { reason, .. } = err else {
10011            panic!("expected FonteRepoShape, got other variant");
10012        };
10013        assert!(
10014            reason.contains("must not contain `#`"),
10015            "reason must surface the fragment-`#` arm (fires before equals when \
10016             `#` byte appears first in value), got {reason:?}"
10017        );
10018    }
10019
10020    #[test]
10021    fn fonte_repo_comma_fires_before_equals_when_comma_first() {
10022        // Cascade pin: the comma-`,` arm (the immediate-predecessor
10023        // byte-class arm, 775b80e) and the `=` arm are both per-byte
10024        // arms inside the same `for &b in s.as_bytes()` loop, so
10025        // the byte that appears first in the value's byte order
10026        // wins. A `:repo "github:p/x,mid=tail"` carries both `,`
10027        // and `=`; the `,` byte appears first, so the comma arm
10028        // fires, surfacing the more self-locating diagnostic on
10029        // the byte the author pasted earliest in the URL. Pins the
10030        // natural-order cascade so a future reorder of the per-byte
10031        // arms surfaces here — `=` is the most recent byte-class
10032        // arm, so the cascade-pin sweep extends to cover the
10033        // immediately prior `,` byte arm firing first when ordered
10034        // ahead of `=` in the value.
10035        let d = dep_with_fonte(DepSource::Git {
10036            repo: "github:pleme-io/caixa-teia,mid=tail".into(),
10037            tag: Some("v0.1.0".into()),
10038            rev: None,
10039            branch: None,
10040        });
10041        let err = d.validate().unwrap_err();
10042        let DepError::FonteRepoShape { reason, .. } = err else {
10043            panic!("expected FonteRepoShape, got other variant");
10044        };
10045        assert!(
10046            reason.contains("must not contain `,`"),
10047            "reason must surface the comma arm (fires before equals when `,` byte \
10048             appears first in value), got {reason:?}"
10049        );
10050    }
10051
10052    #[test]
10053    fn validate_rejects_git_fonte_with_repo_carrying_percent_encoded_space() {
10054        // The fail-before-pass-after pin for the canonical paste-from-
10055        // browser-address-bar percent-encoded-space footgun on `:repo`.
10056        // An author copies `https://github.com/p/x%20test` from a
10057        // browser address bar (or a percent-encoded README hyperlink,
10058        // or a `curl --data-urlencode` shell-pipeline output)
10059        // intending `%20` as the URL encoding of a literal space; the
10060        // typed `:repo` slot already rejects the literal space byte
10061        // (the whitespace arm at the top of `is_git_repo_url`), so an
10062        // author trying to express "I really meant a space" reaches
10063        // for percent-encoding. Until this arm landed the `%` byte
10064        // silently passed every prior `is_git_repo_url` arm and rode
10065        // verbatim into the lacre's per-dep content-address — but
10066        // libcurl re-percent-encodes `%` to `%25` on the wire (since
10067        // `%` is reserved as the escape-sequence lead-in), so the
10068        // wire request becomes `https://github.com/p/x%2520test`, a
10069        // path the lacre's content-address never names. The classic
10070        // render-determinism violation on the encoding-mechanism axis
10071        // itself.
10072        let d = dep_with_fonte(DepSource::Git {
10073            repo: "https://github.com/pleme-io/caixa-teia%20test".into(),
10074            tag: Some("v0.1.0".into()),
10075            rev: None,
10076            branch: None,
10077        });
10078        let err = d.validate().unwrap_err();
10079        let DepError::FonteRepoShape { nome, repo, reason } = err else {
10080            panic!("expected FonteRepoShape, got other variant");
10081        };
10082        assert_eq!(nome, "caixa-teia");
10083        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia%20test");
10084        assert!(
10085            reason.contains("must not contain `%`"),
10086            "reason must surface the percent-`%` arm on the percent-encoded-space \
10087             paste shape, got {reason:?}"
10088        );
10089        assert!(
10090            reason.contains("percent-encoding") || reason.contains("%25"),
10091            "reason must name the percent-encoding / `%25` re-encoding rationale, \
10092             got {reason:?}"
10093        );
10094    }
10095
10096    #[test]
10097    fn validate_rejects_git_fonte_with_repo_carrying_percent_encoded_slash() {
10098        // The symmetric over-encoded-path-separator pin: an author
10099        // writes `:repo "https://github.com/p%2Fx"` intending the
10100        // `%2F` as the URL encoding of `/` (the canonical
10101        // paste-from-OpenAPI-spec / paste-from-percent-encoded-template
10102        // footgun every API client library and OAuth redirect-URI
10103        // documentation surfaces — the `/` is the URL-path-separator
10104        // and some templates percent-encode it to escape interpretation
10105        // as a path separator). The GitHub Smart-HTTP transport
10106        // resolves the URL's path-segment grammar before the
10107        // percent-decoding pass, so the value identifies a different
10108        // resource on the wire than the literal-`/` form the lacre's
10109        // content-address must agree with — two authors whose `:repo`
10110        // values differ only in their `/` vs `%2F` presence lock to
10111        // two distinct BLAKE3 closures for the byte-identical upstream
10112        // `git clone`. Pinned separately so a future diagnostic
10113        // surface that only catches the `%20` shape surfaces here too.
10114        let d = dep_with_fonte(DepSource::Git {
10115            repo: "https://github.com/pleme-io%2Fcaixa-teia".into(),
10116            tag: Some("v0.1.0".into()),
10117            rev: None,
10118            branch: None,
10119        });
10120        let err = d.validate().unwrap_err();
10121        let DepError::FonteRepoShape { reason, .. } = err else {
10122            panic!("expected FonteRepoShape, got other variant");
10123        };
10124        assert!(
10125            reason.contains("must not contain `%`"),
10126            "reason must surface the percent-`%` arm on the over-encoded-path \
10127             shape, got {reason:?}"
10128        );
10129        assert!(
10130            reason.contains("render-determinism") || reason.contains("BLAKE3"),
10131            "reason must name the render-determinism / BLAKE3-closure rationale, \
10132             got {reason:?}"
10133        );
10134    }
10135
10136    #[test]
10137    fn fonte_repo_fragment_fires_before_percent_when_fragment_first() {
10138        // Cascade pin: the fragment-`#` arm and the `%` arm are both
10139        // per-byte arms inside the same `for &b in s.as_bytes()` loop,
10140        // so the byte that appears first in the value's byte order
10141        // wins. A `:repo "https://github.com/p/x#sec%20tail"` carries
10142        // both `#` and `%`; the `#` byte appears first, so the
10143        // fragment-`#` arm fires, surfacing the more self-locating
10144        // diagnostic on the byte the author pasted earliest in the URL.
10145        let d = dep_with_fonte(DepSource::Git {
10146            repo: "https://github.com/pleme-io/caixa-teia#sec%20tail".into(),
10147            tag: Some("v0.1.0".into()),
10148            rev: None,
10149            branch: None,
10150        });
10151        let err = d.validate().unwrap_err();
10152        let DepError::FonteRepoShape { reason, .. } = err else {
10153            panic!("expected FonteRepoShape, got other variant");
10154        };
10155        assert!(
10156            reason.contains("must not contain `#`"),
10157            "reason must surface the fragment-`#` arm (fires before percent when \
10158             `#` byte appears first in value), got {reason:?}"
10159        );
10160    }
10161
10162    #[test]
10163    fn fonte_repo_equals_fires_before_percent_when_equals_first() {
10164        // Cascade pin: the equals-`=` arm (the immediate-predecessor
10165        // byte-class arm, acf99af) and the `%` arm are both per-byte
10166        // arms inside the same `for &b in s.as_bytes()` loop, so the
10167        // byte that appears first in the value's byte order wins.
10168        // A `:repo "github:p/x=mid%20tail"` carries both `=` and `%`;
10169        // the `=` byte appears first, so the equals arm fires,
10170        // surfacing the more self-locating diagnostic on the byte the
10171        // author pasted earliest in the URL. Pins the natural-order
10172        // cascade so a future reorder of the per-byte arms surfaces
10173        // here — `%` is the most recent byte-class arm, so the
10174        // cascade-pin sweep extends to cover the immediately prior
10175        // `=` byte arm firing first when ordered ahead of `%` in the
10176        // value.
10177        let d = dep_with_fonte(DepSource::Git {
10178            repo: "github:pleme-io/caixa-teia=mid%20tail".into(),
10179            tag: Some("v0.1.0".into()),
10180            rev: None,
10181            branch: None,
10182        });
10183        let err = d.validate().unwrap_err();
10184        let DepError::FonteRepoShape { reason, .. } = err else {
10185            panic!("expected FonteRepoShape, got other variant");
10186        };
10187        assert!(
10188            reason.contains("must not contain `=`"),
10189            "reason must surface the equals arm (fires before percent when `=` byte \
10190             appears first in value), got {reason:?}"
10191        );
10192    }
10193
10194    #[test]
10195    fn validate_rejects_git_fonte_with_repo_carrying_caret_history_substitution() {
10196        // The fail-before-pass-after pin for the canonical paste-from-
10197        // shell-history footgun on `:repo`. An author copies a
10198        // `git clone <url>` line from their terminal followed by a
10199        // bash / ksh / zsh `^typo^fix^` quick-edit-and-rerun shell-
10200        // history shorthand (the `^old^new^` form re-runs the prior
10201        // history entry with the first `old` substituted by `new`,
10202        // bash's default behavior on interactive sessions with
10203        // `set -o histexpand`), forgetting to trim the trailing
10204        // `^...^...` shell-history fragment from the URL value. The
10205        // `^` byte sits in the RFC 3986 §2 'unwise' set (peer with
10206        // `{`, `}`, `|`, `\\` — the strictest of the §2 reserved
10207        // classes), the WHATWG URL spec's 'fragment percent-encode
10208        // set' maps `^` → `%5E` on the wire, so the byte rides
10209        // verbatim into the lacre's per-dep content-address but
10210        // libcurl re-encodes it to `%5E` at `git clone` time — the
10211        // classic render-determinism violation on the same axis the
10212        // peer `%`, `=`, `,`, `!`, `'`, `"`, `(`, `)`, `*`, `$`,
10213        // `&`, `;`, `|`, backtick, `<`, `>`, `{`, `}`, `\\`, `?`,
10214        // `#` arms close.
10215        let d = dep_with_fonte(DepSource::Git {
10216            repo: "https://github.com/pleme-io/caixa-teia^typo^fix".into(),
10217            tag: Some("v0.1.0".into()),
10218            rev: None,
10219            branch: None,
10220        });
10221        let err = d.validate().unwrap_err();
10222        let DepError::FonteRepoShape { nome, repo, reason } = err else {
10223            panic!("expected FonteRepoShape, got other variant");
10224        };
10225        assert_eq!(nome, "caixa-teia");
10226        assert_eq!(repo, "https://github.com/pleme-io/caixa-teia^typo^fix");
10227        assert!(
10228            reason.contains("must not contain `^`"),
10229            "reason must surface the caret-`^` arm on the paste-from-shell-history \
10230             shape, got {reason:?}"
10231        );
10232        assert!(
10233            reason.contains("history-substitution") || reason.contains("%5E"),
10234            "reason must name the shell-history-substitution / `%5E` wire-encoding \
10235             rationale, got {reason:?}"
10236        );
10237    }
10238
10239    #[test]
10240    fn validate_rejects_git_fonte_with_repo_carrying_caret_regex_anchor() {
10241        // The symmetric paste-from-doc-grep-pipeline footgun: an
10242        // author writes `:repo "github:p/^archived"` after copying a
10243        // `grep '^archived'` regex-anchor / negation idiom from a
10244        // doc / README quick-listing snippet, expecting the substrate
10245        // to coerce it to a literal repo name. The byte rides
10246        // verbatim into the lacre's per-dep content-address and
10247        // diverges from the byte-identical literal `archived` form
10248        // every other author authored — the canonical render-
10249        // determinism violation pin on the second footgun shape the
10250        // caret-`^` arm closes.
10251        let d = dep_with_fonte(DepSource::Git {
10252            repo: "github:pleme-io/^archived".into(),
10253            tag: Some("v0.1.0".into()),
10254            rev: None,
10255            branch: None,
10256        });
10257        let err = d.validate().unwrap_err();
10258        let DepError::FonteRepoShape { reason, .. } = err else {
10259            panic!("expected FonteRepoShape, got other variant");
10260        };
10261        assert!(
10262            reason.contains("must not contain `^`"),
10263            "reason must surface the caret-`^` arm on the regex-anchor shape, \
10264             got {reason:?}"
10265        );
10266        assert!(
10267            reason.contains("render-determinism") || reason.contains("BLAKE3"),
10268            "reason must name the render-determinism / BLAKE3-closure rationale, \
10269             got {reason:?}"
10270        );
10271    }
10272
10273    #[test]
10274    fn fonte_repo_percent_fires_before_caret_when_percent_first() {
10275        // Cascade pin: the `%` arm (the immediate-predecessor byte-
10276        // class arm, a323db8) and the `^` arm are both per-byte arms
10277        // inside the same `for &b in s.as_bytes()` loop, so the byte
10278        // that appears first in the value's byte order wins. A
10279        // `:repo "https://github.com/p/x%20mid^tail"` carries both
10280        // `%` and `^`; the `%` byte appears first, so the percent
10281        // arm fires, surfacing the more self-locating diagnostic on
10282        // the byte the author pasted earliest in the URL. Pins the
10283        // natural-order cascade so a future reorder of the per-byte
10284        // arms surfaces here — `^` is the most recent byte-class arm,
10285        // so the cascade-pin sweep extends to cover the immediately
10286        // prior `%` byte arm firing first when ordered ahead of `^`
10287        // in the value.
10288        let d = dep_with_fonte(DepSource::Git {
10289            repo: "https://github.com/pleme-io/caixa-teia%20mid^tail".into(),
10290            tag: Some("v0.1.0".into()),
10291            rev: None,
10292            branch: None,
10293        });
10294        let err = d.validate().unwrap_err();
10295        let DepError::FonteRepoShape { reason, .. } = err else {
10296            panic!("expected FonteRepoShape, got other variant");
10297        };
10298        assert!(
10299            reason.contains("must not contain `%`"),
10300            "reason must surface the percent arm (fires before caret when `%` byte \
10301             appears first in value), got {reason:?}"
10302        );
10303    }
10304
10305    #[test]
10306    fn validate_rejects_git_fonte_with_repo_missing_colon_separator() {
10307        // The "I dropped the scheme" footgun — `:repo "pleme-io/caixa-teia"`
10308        // (no `github:` prefix, no scheme). Every documented form
10309        // carries a `:` (`github:`, `https://`, `ssh://`, `git://`,
10310        // `file://`, or `git@host:path`); a bare `org/repo` is
10311        // ambiguous (`git clone` reads as a relative filesystem path
10312        // rather than the GitHub-shorthand expansion the author
10313        // probably intended) and the gate rejects the shape upstream.
10314        let d = dep_with_fonte(DepSource::Git {
10315            repo: "pleme-io/caixa-teia".into(),
10316            tag: Some("v0.1.0".into()),
10317            rev: None,
10318            branch: None,
10319        });
10320        let err = d.validate().unwrap_err();
10321        let DepError::FonteRepoShape { reason, .. } = err else {
10322            panic!("expected FonteRepoShape, got other variant");
10323        };
10324        assert!(
10325            reason.contains("must contain a `:`"),
10326            "reason must surface the missing-`:` arm, got {reason:?}"
10327        );
10328        assert!(
10329            reason.contains("github:"),
10330            "reason must name the canonical `github:` shorthand prefix, got {reason:?}"
10331        );
10332    }
10333
10334    #[test]
10335    fn validate_rejects_git_fonte_with_repo_leading_colon() {
10336        // The "empty scheme" footgun — `:repo ":foo"` has a zero-length
10337        // scheme that no git porcelain entry-point accepts. Pinned
10338        // separately from the missing-`:` arm because a value with a
10339        // leading `:` does technically contain a `:` separator; the
10340        // shape gate rejects on a dedicated arm so the diagnostic
10341        // names the specific footgun.
10342        let d = dep_with_fonte(DepSource::Git {
10343            repo: ":pleme-io/caixa-teia".into(),
10344            tag: Some("v0.1.0".into()),
10345            rev: None,
10346            branch: None,
10347        });
10348        let err = d.validate().unwrap_err();
10349        let DepError::FonteRepoShape { reason, .. } = err else {
10350            panic!("expected FonteRepoShape, got other variant");
10351        };
10352        assert!(
10353            reason.contains("must not start with `:`"),
10354            "reason must surface the leading-`:` arm, got {reason:?}"
10355        );
10356    }
10357
10358    #[test]
10359    fn validate_rejects_git_fonte_with_repo_too_long() {
10360        // The cap arm — a `:repo` value longer than
10361        // [`crate::render::GIT_REPO_URL_MAX_LEN`] (2048) bytes is
10362        // structurally untenable on every realistic landing site (the
10363        // resolver's `git clone` invocation, the future M4 CR
10364        // materializer's per-dep `repo:` axis); a value of that length
10365        // is almost certainly a paste-from-binary slug.
10366        let too_long = format!(
10367            "github:pleme-io/{}",
10368            "x".repeat(crate::render::GIT_REPO_URL_MAX_LEN)
10369        );
10370        let d = dep_with_fonte(DepSource::Git {
10371            repo: too_long.clone(),
10372            tag: Some("v0.1.0".into()),
10373            rev: None,
10374            branch: None,
10375        });
10376        let err = d.validate().unwrap_err();
10377        let DepError::FonteRepoShape { reason, .. } = err else {
10378            panic!("expected FonteRepoShape, got other variant");
10379        };
10380        assert!(
10381            reason.contains("2048"),
10382            "reason must name the cap, got {reason:?}"
10383        );
10384    }
10385
10386    #[test]
10387    fn validate_accepts_canonical_git_fonte_repo_shapes() {
10388        // The positive-control sweep: every documented author shape on
10389        // the `:fonte :repo` axis ([`crate::DepSource::Git`] doc comment)
10390        // must pass the value-shape gate. Pinned so a future tightening
10391        // (e.g. forbidding `http://` in favor of `https://`-only) surfaces
10392        // here as a structural decision. Each form is exercised with the
10393        // same canonical `:tag` pin so only the `:repo` axis varies.
10394        for repo in [
10395            // The pleme-io registry-shorthand convention — `github:org/repo`.
10396            "github:pleme-io/caixa-teia",
10397            // Other host-aliased shorthands (the resolver's pluggable
10398            // host-prefix table).
10399            "gitlab:pleme-io/caixa-teia",
10400            "codeberg:pleme-io/caixa-teia",
10401            "sourcehut:~pleme-io/caixa-teia",
10402            // Full HTTPS URL with and without `.git` suffix.
10403            "https://github.com/pleme-io/caixa-teia",
10404            "https://github.com/pleme-io/caixa-teia.git",
10405            // HTTP (rare; dev / mirror).
10406            "http://example.com/pleme-io/caixa-teia.git",
10407            // SSH URL.
10408            "ssh://git@github.com/pleme-io/caixa-teia.git",
10409            "ssh://git@git.example.com:2222/pleme-io/caixa-teia.git",
10410            // Scp-style SSH — the canonical `git@host:path` short form.
10411            "git@github.com:pleme-io/caixa-teia.git",
10412            "git@git.example.com:team/private.git",
10413            // Anonymous git protocol.
10414            "git://git.example.com/pleme-io/caixa-teia.git",
10415            // Local file URL (dev path).
10416            "file:///tmp/caixa-teia",
10417        ] {
10418            let d = dep_with_fonte(DepSource::Git {
10419                repo: repo.into(),
10420                tag: Some("v0.1.0".into()),
10421                rev: None,
10422                branch: None,
10423            });
10424            d.validate()
10425                .unwrap_or_else(|e| panic!("canonical repo {repo:?} must validate, got {e:?}"));
10426        }
10427    }
10428
10429    #[test]
10430    fn fonte_repo_empty_takes_precedence_over_shape() {
10431        // Order pin: the existing `FonteRepoEmpty` diagnostic (narrower
10432        // diagnostic; doesn't try to parse the URL shape) fires before
10433        // the new `FonteRepoShape` per-axis gate, so an empty `:repo`
10434        // keeps its narrower error message. Mirrors
10435        // `fonte_repo_empty_fires_before_pin_missing` (already pinned)
10436        // on the ordering layer.
10437        let d = dep_with_fonte(DepSource::Git {
10438            repo: String::new(),
10439            tag: Some("v0.1.0".into()),
10440            rev: None,
10441            branch: None,
10442        });
10443        let err = d.validate().unwrap_err();
10444        assert!(
10445            matches!(err, DepError::FonteRepoEmpty { .. }),
10446            "got {err:?}"
10447        );
10448    }
10449
10450    #[test]
10451    fn fonte_repo_shape_fires_before_pin_missing() {
10452        // Order pin: a malformed `:repo` value on a dep with no pin set
10453        // surfaces the `:repo` shape diagnostic (the more self-locating
10454        // axis — the `:repo` is the load-bearing identity of the source;
10455        // a missing pin is downstream from "do we even know the repo")
10456        // rather than collapsing onto the pin-missing diagnostic. The
10457        // shape gate runs inline before the pin enumeration in
10458        // `DepSource::validate`.
10459        let d = dep_with_fonte(DepSource::Git {
10460            repo: "pleme-io/caixa-teia".into(), // missing `:` separator
10461            tag: None,
10462            rev: None,
10463            branch: None,
10464        });
10465        let err = d.validate().unwrap_err();
10466        assert!(
10467            matches!(err, DepError::FonteRepoShape { .. }),
10468            "got {err:?}"
10469        );
10470    }
10471
10472    #[test]
10473    fn fonte_repo_shape_diagnostic_carries_offending_repo_verbatim() {
10474        // The diagnostic-shape pin: the error names the offending
10475        // `:repo` value verbatim plus a non-empty parser-shaped `reason`
10476        // so the author can grep their caixa.lisp without re-running
10477        // the build. Mirrors the diagnostic-shape sweep on every prior
10478        // value-shape gate (3f9d7a0, 6cbb900, c7d05ec, e70d213, be07fd5).
10479        let d = dep_with_fonte(DepSource::Git {
10480            repo: "pleme-io/caixa-teia".into(),
10481            tag: Some("v0.1.0".into()),
10482            rev: None,
10483            branch: None,
10484        });
10485        let err = d.validate().unwrap_err();
10486        let DepError::FonteRepoShape { nome, repo, reason } = err else {
10487            panic!("expected FonteRepoShape, got other variant");
10488        };
10489        assert_eq!(nome, "caixa-teia");
10490        assert_eq!(repo, "pleme-io/caixa-teia");
10491        assert!(
10492            !reason.is_empty(),
10493            "FonteRepoShape `reason` must carry the predicate's wording verbatim"
10494        );
10495    }
10496
10497    #[test]
10498    fn validate_rejects_git_fonte_with_no_pin() {
10499        // The fail-before-pass-after pin for the canonical
10500        // `(:tipo git :repo "github:pleme-io/x")` shape with no
10501        // :tag/:rev/:branch — until this gate landed the resolver's
10502        // ResolveError::MissingPin surfaced at fetch time, far from the
10503        // source caixa.lisp. The new gate moves the check to validate
10504        // time and names the offending dep.
10505        let d = dep_with_fonte(DepSource::Git {
10506            repo: "github:pleme-io/caixa-teia".into(),
10507            tag: None,
10508            rev: None,
10509            branch: None,
10510        });
10511        let err = d.validate().unwrap_err();
10512        assert!(
10513            matches!(err, DepError::FontePinMissing { ref nome } if nome == "caixa-teia"),
10514            "got {err:?}"
10515        );
10516    }
10517
10518    #[test]
10519    fn validate_rejects_git_fonte_with_ambiguous_tag_and_branch() {
10520        // The canonical "pin drift" footgun: an author writes
10521        // `:tag "v1"` and later adds `:branch "main"` without removing
10522        // the :tag, and the resolver silently picks :tag (precedence
10523        // :rev > :tag > :branch). The :branch was dropped with no
10524        // diagnostic. The gate now rejects multi-pin shapes so the
10525        // author makes the precedence explicit at the source.
10526        let d = dep_with_fonte(DepSource::Git {
10527            repo: "github:pleme-io/caixa-teia".into(),
10528            tag: Some("v0.1.0".into()),
10529            rev: None,
10530            branch: Some("main".into()),
10531        });
10532        let err = d.validate().unwrap_err();
10533        let DepError::FontePinAmbiguous { nome, pins } = err else {
10534            panic!("expected FontePinAmbiguous");
10535        };
10536        assert_eq!(nome, "caixa-teia");
10537        assert!(pins.contains(":tag"));
10538        assert!(pins.contains(":branch"));
10539        assert!(!pins.contains(":rev"));
10540    }
10541
10542    #[test]
10543    fn validate_rejects_git_fonte_with_ambiguous_tag_and_rev() {
10544        // Sibling arm of the pin-drift footgun: :tag + :rev set
10545        // simultaneously. Pinned separately so a future relaxation
10546        // that only catches the (:tag, :branch) pair surfaces here.
10547        let d = dep_with_fonte(DepSource::Git {
10548            repo: "github:pleme-io/caixa-teia".into(),
10549            tag: Some("v0.1.0".into()),
10550            rev: Some("c0ffee".into()),
10551            branch: None,
10552        });
10553        let err = d.validate().unwrap_err();
10554        let DepError::FontePinAmbiguous { nome, pins } = err else {
10555            panic!("expected FontePinAmbiguous");
10556        };
10557        assert_eq!(nome, "caixa-teia");
10558        assert!(pins.contains(":tag"));
10559        assert!(pins.contains(":rev"));
10560    }
10561
10562    #[test]
10563    fn validate_rejects_git_fonte_with_all_three_pins() {
10564        // The maximal ambiguity case — every pin axis set. Pinned so a
10565        // future relaxation that only catches pairs surfaces here. The
10566        // diagnostic must enumerate every offending axis so the author
10567        // sees the full set, not just the first match.
10568        let d = dep_with_fonte(DepSource::Git {
10569            repo: "github:pleme-io/caixa-teia".into(),
10570            tag: Some("v0.1.0".into()),
10571            rev: Some("c0ffee".into()),
10572            branch: Some("main".into()),
10573        });
10574        let err = d.validate().unwrap_err();
10575        let DepError::FontePinAmbiguous { nome, pins } = err else {
10576            panic!("expected FontePinAmbiguous");
10577        };
10578        assert_eq!(nome, "caixa-teia");
10579        assert!(pins.contains(":tag"));
10580        assert!(pins.contains(":rev"));
10581        assert!(pins.contains(":branch"));
10582    }
10583
10584    #[test]
10585    fn validate_rejects_git_fonte_with_empty_tag_pin() {
10586        // The empty-pin arm: exactly one pin axis is `Some(_)`, but its
10587        // inner string is empty. Distinct from FontePinMissing (where
10588        // every axis is None) — pinned separately so a future
10589        // tightening collapsing them surfaces here as a structural
10590        // decision.
10591        let d = dep_with_fonte(DepSource::Git {
10592            repo: "github:pleme-io/caixa-teia".into(),
10593            tag: Some(String::new()),
10594            rev: None,
10595            branch: None,
10596        });
10597        let err = d.validate().unwrap_err();
10598        let DepError::FontePinEmpty { nome, pin } = err else {
10599            panic!("expected FontePinEmpty");
10600        };
10601        assert_eq!(nome, "caixa-teia");
10602        assert_eq!(pin, ":tag");
10603    }
10604
10605    #[test]
10606    fn validate_rejects_git_fonte_with_empty_rev_pin() {
10607        // Sibling arm — the empty-pin diagnostic names which axis
10608        // carries the empty value, so the author's grep target is
10609        // unambiguous.
10610        let d = dep_with_fonte(DepSource::Git {
10611            repo: "github:pleme-io/caixa-teia".into(),
10612            tag: None,
10613            rev: Some(String::new()),
10614            branch: None,
10615        });
10616        let err = d.validate().unwrap_err();
10617        let DepError::FontePinEmpty { nome, pin } = err else {
10618            panic!("expected FontePinEmpty");
10619        };
10620        assert_eq!(nome, "caixa-teia");
10621        assert_eq!(pin, ":rev");
10622    }
10623
10624    #[test]
10625    fn validate_rejects_path_fonte_with_empty_caminho() {
10626        // The fail-before-pass-after pin for `(:tipo path :caminho "")`:
10627        // until this gate landed the resolver's
10628        // ResolveError::MissingPath surfaced with `path: PathBuf("")` at
10629        // fetch time — not actionable. The new gate moves the check to
10630        // validate time and names the offending dep.
10631        let d = dep_with_fonte(DepSource::Path {
10632            caminho: String::new(),
10633        });
10634        let err = d.validate().unwrap_err();
10635        assert!(
10636            matches!(err, DepError::FonteCaminhoEmpty { ref nome } if nome == "caixa-teia"),
10637            "got {err:?}"
10638        );
10639    }
10640
10641    #[test]
10642    fn validate_rejects_path_fonte_with_absolute_caminho() {
10643        // The fail-before-pass-after pin for the absolute-`:caminho`
10644        // shape: `(:tipo path :caminho "/home/me/work/caixa-teia")`.
10645        // Until this gate landed an absolute `:caminho` silently
10646        // passed validate; the lacre pipeline embedded the
10647        // host-specific filesystem path verbatim in its
10648        // content-address (`conteudo: format!("path:{caminho}")`,
10649        // caixa-resolver/src/resolve.rs:189), so the BLAKE3 closure
10650        // differed per machine — the build succeeded but two CI
10651        // runners with different `${HOME}` layouts emitted two
10652        // distinct lacres for the byte-identical caixa, silently
10653        // breaking the THEORY.md §V.2 render-determinism contract
10654        // far from the source caixa.lisp. The new gate moves the
10655        // check to validate time and names the offending dep +
10656        // caminho verbatim.
10657        let d = dep_with_fonte(DepSource::Path {
10658            caminho: "/home/me/work/caixa-teia".into(),
10659        });
10660        let err = d.validate().unwrap_err();
10661        let DepError::FonteCaminhoAbsolute { nome, caminho } = err else {
10662            panic!("expected FonteCaminhoAbsolute, got other variant");
10663        };
10664        assert_eq!(nome, "caixa-teia");
10665        assert_eq!(caminho, "/home/me/work/caixa-teia");
10666    }
10667
10668    #[test]
10669    fn validate_accepts_path_fonte_with_parent_escape_caminho() {
10670        // The canonical sibling-workspace dep form
10671        // (`:caminho "../caixa-teia"`) remains accepted. The
10672        // absolute-path gate above is specifically narrower than the
10673        // shared [`crate::render::is_sandboxed_relative_path`]
10674        // predicate (which additionally forbids `..` traversal): a
10675        // local-path dep's canonical author surface is the in-tree
10676        // sibling-workspace path, so a full sandboxed-relative-path
10677        // lift would structurally reject every legitimate path-fonte
10678        // dep. Pinned so a future tightening to the full predicate
10679        // surfaces here as a structural decision, not a silent break.
10680        let d = dep_with_fonte(DepSource::Path {
10681            caminho: "../caixa-teia".into(),
10682        });
10683        d.validate().unwrap();
10684    }
10685
10686    #[test]
10687    fn validate_accepts_path_fonte_with_deeply_nested_relative_caminho() {
10688        // A multi-segment relative `:caminho`
10689        // (`"vendor/forks/caixa-teia"`) remains accepted — the
10690        // absolute-path gate brackets the host-layout-leaking shape
10691        // at the leading-`/` boundary only; every relative shape past
10692        // the empty arm continues to pass. Pinned alongside the
10693        // `..`-traversal positive control so a future tightening
10694        // surfaces the full set of legitimate relative forms here
10695        // rather than at a downstream consumer.
10696        let d = dep_with_fonte(DepSource::Path {
10697            caminho: "vendor/forks/caixa-teia".into(),
10698        });
10699        d.validate().unwrap();
10700    }
10701
10702    #[test]
10703    fn validate_rejects_path_fonte_with_tilde_prefix_caminho() {
10704        // The fail-before-pass-after pin for the tilde-expansion
10705        // `:caminho` shape: `(:tipo path :caminho "~/work/caixa-teia")`.
10706        // Until this gate landed the b94fd83 absolute arm let `~/foo`
10707        // through (`Path::is_absolute` returns false on a leading `~`
10708        // — the tilde is a shell-expansion convention, not a POSIX
10709        // path component), so the lacre embedded the value verbatim
10710        // and the resolver folded it through `Path::join` without
10711        // expansion, looking for a literal `./~/work/caixa-teia`
10712        // subdirectory and failing at resolve time with a
10713        // `No such file or directory` error far from the source
10714        // caixa.lisp. The new gate moves the check to validate time
10715        // and names the offending dep + caminho verbatim.
10716        let d = dep_with_fonte(DepSource::Path {
10717            caminho: "~/work/caixa-teia".into(),
10718        });
10719        let err = d.validate().unwrap_err();
10720        let DepError::FonteCaminhoTildeExpansion { nome, caminho } = err else {
10721            panic!("expected FonteCaminhoTildeExpansion, got {err:?}");
10722        };
10723        assert_eq!(nome, "caixa-teia");
10724        assert_eq!(caminho, "~/work/caixa-teia");
10725    }
10726
10727    #[test]
10728    fn validate_rejects_path_fonte_with_bare_tilde_caminho() {
10729        // The bare `~` form (canonical "I meant `$HOME` and forgot
10730        // the rest"): both the leading-tilde arm catches it and the
10731        // canonical-user-tilde shell idiom (`~alice/dev/caixa-teia`)
10732        // sweeps through the same arm. Pinned both to ensure the
10733        // gate doesn't narrow to `~/` only.
10734        for s in ["~", "~alice/dev/caixa-teia", "~/", "~root/work"] {
10735            let d = dep_with_fonte(DepSource::Path { caminho: s.into() });
10736            let err = d.validate().unwrap_err();
10737            assert!(
10738                matches!(err, DepError::FonteCaminhoTildeExpansion { .. }),
10739                "{s:?} → {err:?}",
10740            );
10741        }
10742    }
10743
10744    #[test]
10745    fn validate_accepts_path_fonte_with_mid_path_tilde_caminho() {
10746        // The leading-`~` is the canonical shell-expansion footgun —
10747        // a tilde mid-path (`"../foo~bar/caixa-teia"` — the canonical
10748        // backup-file-suffix idiom) is a legitimate POSIX path byte
10749        // with no shell-expansion semantic at the leading position.
10750        // Pinned so the gate doesn't widen to a full no-tilde-anywhere
10751        // sweep that would break every legitimate-shape backup-file
10752        // path.
10753        let d = dep_with_fonte(DepSource::Path {
10754            caminho: "../foo~bar/caixa-teia".into(),
10755        });
10756        d.validate().unwrap();
10757    }
10758
10759    #[test]
10760    fn fonte_caminho_empty_fires_before_tilde_expansion() {
10761        // Cascade pin: the empty arm structurally precedes the
10762        // tilde arm (the bytes `""` and `"~"` don't overlap), but the
10763        // pin establishes the precedence at the diagnostic-shape
10764        // level should a future codec round-trip ever produce a
10765        // probe-as-both value. Mirrors the peer
10766        // `fonte_repo_empty_fires_before_pin_missing` cascade
10767        // discipline.
10768        let d = dep_with_fonte(DepSource::Path {
10769            caminho: String::new(),
10770        });
10771        let err = d.validate().unwrap_err();
10772        assert!(
10773            matches!(err, DepError::FonteCaminhoEmpty { .. }),
10774            "got {err:?}",
10775        );
10776    }
10777
10778    #[test]
10779    fn fonte_caminho_tilde_diagnostic_carries_offending_dep_and_caminho() {
10780        // Diagnostic-shape pin (peer with
10781        // `validate_rejects_path_fonte_with_absolute_caminho`'s
10782        // payload assertion): the error's Display surfaces both the
10783        // offending `:nome` and the offending `:caminho` verbatim
10784        // so a `feira lint` run can render the diagnostic without
10785        // re-parsing.
10786        let d = dep_with_fonte(DepSource::Path {
10787            caminho: "~alice/dev/caixa-teia".into(),
10788        });
10789        let rendered = d.validate().unwrap_err().to_string();
10790        assert!(
10791            rendered.contains("caixa-teia"),
10792            "diagnostic must name the offending dep: {rendered}",
10793        );
10794        assert!(
10795            rendered.contains("~alice/dev/caixa-teia"),
10796            "diagnostic must quote the offending caminho: {rendered}",
10797        );
10798        assert!(
10799            rendered.contains('~'),
10800            "diagnostic must reference the tilde footgun: {rendered}",
10801        );
10802    }
10803
10804    #[test]
10805    fn validate_rejects_path_fonte_with_dollar_prefix_caminho() {
10806        // The fail-before-pass-after pin for the shell-variable-
10807        // expansion `:caminho` shape: `(:tipo path :caminho
10808        // "$HOME/work/caixa-teia")`. Until this gate landed the
10809        // b94fd83 absolute arm + the a5c248e tilde arm both let
10810        // `$HOME/foo` through (`Path::is_absolute` returns false on
10811        // a leading `$` — the `$` is a shell convention, not a POSIX
10812        // path component; `starts_with('~')` returns false too), so
10813        // the lacre embedded the value verbatim and the resolver
10814        // folded it through `Path::join` without `$`-expansion,
10815        // looking for a literal `./$HOME/work/caixa-teia`
10816        // subdirectory and failing at resolve time with a
10817        // `No such file or directory` error far from the source
10818        // caixa.lisp. The new gate moves the check to validate time
10819        // and names the offending dep + caminho verbatim.
10820        let d = dep_with_fonte(DepSource::Path {
10821            caminho: "$HOME/work/caixa-teia".into(),
10822        });
10823        let err = d.validate().unwrap_err();
10824        let DepError::FonteCaminhoVarExpansion { nome, caminho } = err else {
10825            panic!("expected FonteCaminhoVarExpansion, got {err:?}");
10826        };
10827        assert_eq!(nome, "caixa-teia");
10828        assert_eq!(caminho, "$HOME/work/caixa-teia");
10829    }
10830
10831    #[test]
10832    fn validate_rejects_path_fonte_with_dollar_brace_prefix_caminho() {
10833        // Sweep over every leading-`$` shape: the `${VAR}`-braced
10834        // form (canonical "paste-from-CI-manifest" footgun every
10835        // GitHub Actions / GitLab CI / Drone manifest carries on
10836        // `${WORKSPACE}`), the XDG idiom (`$XDG_CONFIG_HOME/caixa`,
10837        // canonical "I'm referencing a per-user config dir"),
10838        // and the bare `$` (canonical "I meant `$HOME` and forgot
10839        // the rest"). All shapes route through the same gate's
10840        // byte check. Pinned so the gate doesn't narrow to a
10841        // single shape (e.g. `$HOME/` only).
10842        for s in [
10843            "${HOME}/work/caixa-teia",
10844            "${WORKSPACE}/caixa-teia",
10845            "$XDG_CONFIG_HOME/caixa",
10846            "$",
10847        ] {
10848            let d = dep_with_fonte(DepSource::Path { caminho: s.into() });
10849            let err = d.validate().unwrap_err();
10850            assert!(
10851                matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
10852                "{s:?} → {err:?}",
10853            );
10854        }
10855    }
10856
10857    #[test]
10858    fn validate_rejects_path_fonte_with_mid_path_dollar_caminho() {
10859        // The `$` byte is the canonical shell-variable-expansion /
10860        // command-substitution / arithmetic-expansion sentinel and
10861        // is rejected at *every* position on the `:caminho` axis: the
10862        // leading arm surfaces `FonteCaminhoVarExpansion`, the
10863        // embedded arm surfaces `FonteCaminhoShellVariableExpansion`
10864        // (6620f39). Pinned so a future arm doesn't narrow the gate
10865        // back to the leading position and re-open the paste-from-
10866        // shell-one-liner `"../foo$HOME/bar"` / paste-from-CI-
10867        // manifest `"../foo${WORKSPACE}/bar"` / paste-from-shell-
10868        // prompt `"../foo$(whoami)/bar"` cross-idiom-leak surface on
10869        // the lacre content-address (`path:{caminho}`,
10870        // caixa-resolver/src/resolve.rs:189).
10871        let d = dep_with_fonte(DepSource::Path {
10872            caminho: "../foo$bar/caixa-teia".into(),
10873        });
10874        let err = d.validate().unwrap_err();
10875        assert!(
10876            matches!(
10877                err,
10878                DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
10879            ),
10880            "got {err:?}",
10881        );
10882    }
10883
10884    #[test]
10885    fn fonte_caminho_tilde_fires_before_var_expansion() {
10886        // Cascade pin: the tilde arm structurally precedes the var
10887        // arm (the bytes `~` and `$` don't overlap at the leading
10888        // position), but the pin establishes the precedence at the
10889        // diagnostic-shape level should a future codec round-trip
10890        // ever produce a probe-as-both value. Mirrors the peer
10891        // `fonte_caminho_empty_fires_before_tilde_expansion` cascade
10892        // discipline on the immediate-predecessor arm.
10893        let d = dep_with_fonte(DepSource::Path {
10894            caminho: "~/work/caixa-teia".into(),
10895        });
10896        let err = d.validate().unwrap_err();
10897        assert!(
10898            matches!(err, DepError::FonteCaminhoTildeExpansion { .. }),
10899            "got {err:?}",
10900        );
10901    }
10902
10903    #[test]
10904    fn fonte_caminho_var_diagnostic_carries_offending_dep_and_caminho() {
10905        // Diagnostic-shape pin (peer with
10906        // `fonte_caminho_tilde_diagnostic_carries_offending_dep_and_caminho`'s
10907        // payload assertion on the immediate-predecessor arm): the
10908        // error's Display surfaces both the offending `:nome` and
10909        // the offending `:caminho` verbatim plus the `$` footgun
10910        // character itself so a `feira lint` run can render the
10911        // diagnostic without re-parsing.
10912        let d = dep_with_fonte(DepSource::Path {
10913            caminho: "${WORKSPACE}/caixa-teia".into(),
10914        });
10915        let rendered = d.validate().unwrap_err().to_string();
10916        assert!(
10917            rendered.contains("caixa-teia"),
10918            "diagnostic must name the offending dep: {rendered}",
10919        );
10920        assert!(
10921            rendered.contains("${WORKSPACE}/caixa-teia"),
10922            "diagnostic must quote the offending caminho: {rendered}",
10923        );
10924        assert!(
10925            rendered.contains('$'),
10926            "diagnostic must reference the dollar footgun: {rendered}",
10927        );
10928    }
10929
10930    #[test]
10931    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_nul() {
10932        // The fail-before-pass-after pin for the load-bearing NUL byte:
10933        // POSIX paths cannot contain `0x00` (every `std::fs` syscall
10934        // routes the path through `CString::new` which fails with
10935        // `NulError`); until this gate landed a `:caminho
10936        // "../caixa\0teia"` silently passed validate, the lacre
10937        // pipeline embedded the value verbatim, and the failure
10938        // surfaced at the resolver's `Path::join` → `CString::new`
10939        // boundary with a non-self-locating `NulError` far from the
10940        // source caixa.lisp. The new gate moves the check to validate
10941        // time and names the offending dep + caminho + offending byte
10942        // verbatim.
10943        let d = dep_with_fonte(DepSource::Path {
10944            caminho: "../caixa\0teia".into(),
10945        });
10946        let err = d.validate().unwrap_err();
10947        let DepError::FonteCaminhoControlChar {
10948            nome,
10949            caminho,
10950            byte,
10951        } = err
10952        else {
10953            panic!("expected FonteCaminhoControlChar, got {err:?}");
10954        };
10955        assert_eq!(nome, "caixa-teia");
10956        assert_eq!(caminho, "../caixa\0teia");
10957        assert_eq!(byte, 0x00);
10958    }
10959
10960    #[test]
10961    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_newline() {
10962        // The canonical paste-from-multiline-doc footgun on `:caminho`
10963        // — author copies `"../caixa-teia\n"` (trailing newline) out
10964        // of a multi-line code-fence or, worse, a `:caminho
10965        // "../caixa-teia\nrm -rf /"` value (CRLF-at-subprocess-argument
10966        // injection sibling on the path axis the `is_git_repo_url`
10967        // control-char arm already closes on `:repo`). Pinned
10968        // separately from the NUL arm so a future relaxation that
10969        // catches one but not the other surfaces here.
10970        let d = dep_with_fonte(DepSource::Path {
10971            caminho: "../caixa-teia\n".into(),
10972        });
10973        let err = d.validate().unwrap_err();
10974        let DepError::FonteCaminhoControlChar { byte, .. } = err else {
10975            panic!("expected FonteCaminhoControlChar, got {err:?}");
10976        };
10977        assert_eq!(byte, 0x0A);
10978    }
10979
10980    #[test]
10981    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_carriage_return() {
10982        // The CRLF sibling of the LF arm — Windows-line-ending
10983        // paste-from-multiline-doc on a `\r\n`-terminated buffer
10984        // leaves a stray `\r` mid-string after the LF strip. Pinned
10985        // separately from the LF arm so a future relaxation that
10986        // only catches LF surfaces here.
10987        let d = dep_with_fonte(DepSource::Path {
10988            caminho: "../caixa-teia\r".into(),
10989        });
10990        let err = d.validate().unwrap_err();
10991        let DepError::FonteCaminhoControlChar { byte, .. } = err else {
10992            panic!("expected FonteCaminhoControlChar, got {err:?}");
10993        };
10994        assert_eq!(byte, 0x0D);
10995    }
10996
10997    #[test]
10998    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_tab() {
10999        // The canonical paste-from-aligned-table footgun — a `\t`
11000        // mid-`:caminho` is invisible in most editors but rides
11001        // through the lacre's content-address verbatim, so two
11002        // paste-from-distinct-tables (one editor strips tabs, one
11003        // preserves them) yield divergent lacres for the byte-
11004        // identical-looking caixa. Pinned separately from the
11005        // whitespace-shaped LF/CR arms so a future relaxation that
11006        // narrows to line-terminator-only surfaces here.
11007        let d = dep_with_fonte(DepSource::Path {
11008            caminho: "../caixa\tteia".into(),
11009        });
11010        let err = d.validate().unwrap_err();
11011        let DepError::FonteCaminhoControlChar { byte, .. } = err else {
11012            panic!("expected FonteCaminhoControlChar, got {err:?}");
11013        };
11014        assert_eq!(byte, 0x09);
11015    }
11016
11017    #[test]
11018    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_del() {
11019        // The DEL byte (`0x7F`) closes the upper-end paste-from-
11020        // binary-blob footgun — the gate's contract is `b < 0x20 ||
11021        // b == 0x7F`, matching the `is_git_repo_url` /
11022        // `is_git_ref_name` predicates' control-char arms. Pinned
11023        // separately from the lower-range arms so a future narrowing
11024        // to `< 0x20` only surfaces here.
11025        let d = dep_with_fonte(DepSource::Path {
11026            caminho: "../caixa\x7fteia".into(),
11027        });
11028        let err = d.validate().unwrap_err();
11029        let DepError::FonteCaminhoControlChar { byte, .. } = err else {
11030            panic!("expected FonteCaminhoControlChar, got {err:?}");
11031        };
11032        assert_eq!(byte, 0x7F);
11033    }
11034
11035    #[test]
11036    fn validate_accepts_path_fonte_with_caminho_carrying_high_bit_utf8() {
11037        // The control-byte arm targets `0x00..=0x1F` + `0x7F` only —
11038        // high-bit / non-ASCII UTF-8 bytes are not gated. POSIX paths
11039        // are opaque byte sequences and UTF-8 multi-byte sequences
11040        // are a legitimate filename shape (the `café-teia/foo` idiom).
11041        // Pinned so the gate doesn't widen to a full ASCII-only sweep
11042        // that would break every legitimate-shape UTF-8 path.
11043        let d = dep_with_fonte(DepSource::Path {
11044            caminho: "../café-teia/foo".into(),
11045        });
11046        d.validate().unwrap();
11047    }
11048
11049    #[test]
11050    fn fonte_caminho_var_fires_before_control_char() {
11051        // Cascade pin: the var-expansion arm structurally precedes the
11052        // control-char arm. A value like `"$\n"` probes positive on
11053        // both arms (`starts_with('$')` and contains LF), but the
11054        // narrower leading-byte diagnostic (`FonteCaminhoVarExpansion`)
11055        // wins so the author sees the more self-locating shell-
11056        // expansion arm first. Mirrors the
11057        // `fonte_caminho_tilde_fires_before_var_expansion` cascade
11058        // discipline on the immediate-predecessor arm.
11059        let d = dep_with_fonte(DepSource::Path {
11060            caminho: "$HOME\n".into(),
11061        });
11062        let err = d.validate().unwrap_err();
11063        assert!(
11064            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
11065            "got {err:?}",
11066        );
11067    }
11068
11069    #[test]
11070    fn validate_rejects_path_fonte_with_leading_space_caminho() {
11071        // The fail-before-pass-after pin for the leading ASCII space
11072        // `:caminho` shape: `(:tipo path :caminho " ../caixa-teia")`.
11073        // Until this gate landed the b94fd83 absolute arm + the a5c248e
11074        // tilde arm + the f4efe9c var arm + the d624c8d control-byte arm
11075        // all let `" ../caixa-teia"` through: `Path::is_absolute` returns
11076        // false on a leading space (the leading byte is `0x20`, not `0x2F`),
11077        // `starts_with('~')` / `starts_with('$')` return false, and `0x20`
11078        // is not in the `0x00..=0x1F` plus `0x7F` control-byte set (the
11079        // four ASCII whitespace bytes `0x09` tab, `0x0A` LF, `0x0D` CR
11080        // are caught, but the most common whitespace `0x20` space is
11081        // not). The lacre embedded the value verbatim and the resolver
11082        // folded it through `Path::join` looking for a literal `./ ../
11083        // caixa-teia` subdirectory and failing at resolve time with a
11084        // non-self-locating `No such file or directory` error far from
11085        // the source caixa.lisp. The new gate moves the check to
11086        // validate time and names the offending dep + caminho verbatim.
11087        let d = dep_with_fonte(DepSource::Path {
11088            caminho: " ../caixa-teia".into(),
11089        });
11090        let err = d.validate().unwrap_err();
11091        let DepError::FonteCaminhoLeadingWhitespace { nome, caminho } = err else {
11092            panic!("expected FonteCaminhoLeadingWhitespace, got {err:?}");
11093        };
11094        assert_eq!(nome, "caixa-teia");
11095        assert_eq!(caminho, " ../caixa-teia");
11096    }
11097
11098    #[test]
11099    fn validate_rejects_path_fonte_with_multiple_leading_spaces_caminho() {
11100        // The aligned-doc paste footgun sweep: more than one leading
11101        // space (`"   ../caixa-teia"` — the canonical "I selected the
11102        // aligned column from a four-`:fonte`-entry `:deps` block"
11103        // paste) routes through the same gate's `starts_with(' ')`
11104        // byte check. Pinned so the gate doesn't narrow to a
11105        // single-space prefix.
11106        let d = dep_with_fonte(DepSource::Path {
11107            caminho: "   ../caixa-teia".into(),
11108        });
11109        let err = d.validate().unwrap_err();
11110        assert!(
11111            matches!(err, DepError::FonteCaminhoLeadingWhitespace { .. }),
11112            "got {err:?}",
11113        );
11114    }
11115
11116    #[test]
11117    fn validate_accepts_path_fonte_with_mid_path_space_caminho() {
11118        // The leading-space is the canonical paste-from-aligned-doc
11119        // footgun — a space mid-path (`"../my dir/caixa-teia"` — the
11120        // canonical "I have a directory with a space in its name"
11121        // idiom; ASCII `0x20` is a valid POSIX filename byte) is a
11122        // legitimate path with no whitespace-leak semantic at the
11123        // non-leading position. Pinned so the gate doesn't widen to a
11124        // full no-space-anywhere sweep that would break every
11125        // legitimate-shape space-in-filename path.
11126        let d = dep_with_fonte(DepSource::Path {
11127            caminho: "../my dir/caixa-teia".into(),
11128        });
11129        d.validate().unwrap();
11130    }
11131
11132    #[test]
11133    fn fonte_caminho_var_fires_before_leading_whitespace() {
11134        // Cascade pin: the var-expansion arm structurally precedes the
11135        // leading-whitespace arm. A value like `"$ "` would probe positive
11136        // on var (`starts_with('$')`) but the leading-byte arms walk
11137        // left-to-right so the var arm fires on the leading `$` before
11138        // the leading-whitespace arm probes. Mirrors the
11139        // `fonte_caminho_tilde_fires_before_var_expansion` cascade
11140        // discipline on the immediate-predecessor arms.
11141        let d = dep_with_fonte(DepSource::Path {
11142            caminho: "$VAR".into(),
11143        });
11144        let err = d.validate().unwrap_err();
11145        assert!(
11146            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
11147            "got {err:?}",
11148        );
11149    }
11150
11151    #[test]
11152    fn fonte_caminho_leading_whitespace_fires_before_control_char() {
11153        // Cascade pin: the leading-whitespace arm structurally precedes
11154        // the control-char arm. A value like `" ../foo\n"` probes
11155        // positive on both (starts with space AND contains LF), but
11156        // the narrower leading-byte diagnostic
11157        // (`FonteCaminhoLeadingWhitespace`) wins so the author sees the
11158        // more self-locating paste-from-aligned-doc arm first. Mirrors
11159        // the `fonte_caminho_var_fires_before_control_char` cascade
11160        // discipline on the immediate-predecessor arm.
11161        let d = dep_with_fonte(DepSource::Path {
11162            caminho: " ../foo\n".into(),
11163        });
11164        let err = d.validate().unwrap_err();
11165        assert!(
11166            matches!(err, DepError::FonteCaminhoLeadingWhitespace { .. }),
11167            "got {err:?}",
11168        );
11169    }
11170
11171    #[test]
11172    fn fonte_caminho_leading_whitespace_diagnostic_carries_offending_dep_and_caminho() {
11173        // Diagnostic-shape pin (peer with
11174        // `fonte_caminho_var_diagnostic_carries_offending_dep_and_caminho`'s
11175        // payload assertion on the immediate-predecessor arm): the
11176        // error's Display surfaces both the offending `:nome` and the
11177        // offending `:caminho` verbatim, so a `feira lint` run can
11178        // render the diagnostic without re-parsing and the author can
11179        // grep their caixa.lisp for `:caminho "<value>"` and fix it in
11180        // one edit.
11181        let d = dep_with_fonte(DepSource::Path {
11182            caminho: " ../caixa-teia".into(),
11183        });
11184        let rendered = d.validate().unwrap_err().to_string();
11185        assert!(
11186            rendered.contains("caixa-teia"),
11187            "diagnostic must name the offending dep: {rendered}",
11188        );
11189        assert!(
11190            rendered.contains(" ../caixa-teia"),
11191            "diagnostic must quote the offending caminho: {rendered}",
11192        );
11193        assert!(
11194            rendered.contains("space"),
11195            "diagnostic must name the space footgun: {rendered}",
11196        );
11197    }
11198
11199    #[test]
11200    fn fonte_caminho_absolute_fires_before_control_char() {
11201        // Cascade pin on the sibling leading-byte arm: a leading `/`
11202        // value with embedded control byte (`"/etc/passwd\n"`) routes
11203        // through `FonteCaminhoAbsolute` not `FonteCaminhoControlChar`
11204        // — the host-layout-leak diagnostic is the load-bearing axis,
11205        // the control byte is the secondary observation. Same precedence
11206        // logic on every prior leading-byte arm.
11207        let d = dep_with_fonte(DepSource::Path {
11208            caminho: "/etc/passwd\n".into(),
11209        });
11210        let err = d.validate().unwrap_err();
11211        assert!(
11212            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
11213            "got {err:?}",
11214        );
11215    }
11216
11217    #[test]
11218    fn validate_rejects_path_fonte_with_leading_hyphen_caminho() {
11219        // The fail-before-pass-after pin for the leading-`-` CLI-arg-
11220        // injection `:caminho` shape sweep. Until this gate landed
11221        // every prior leading-byte arm passed a leading-`-` value
11222        // through: `Path::is_absolute` returns false on `-` (the
11223        // leading byte is `0x2D`, not `0x2F`), `starts_with('~')` /
11224        // `starts_with('$')` / `starts_with(' ')` all return false,
11225        // and `0x2D` sits outside the control-byte set. The lacre
11226        // embedded the value verbatim and the resolver folded it
11227        // through `Path::join` looking for a literal `./-rf` /
11228        // `./-C` / `./--upload-pack=…` subdirectory; the failure at
11229        // `Path::join` time is non-self-locating but harmless, while
11230        // the failure at every downstream `git -C {caminho}` /
11231        // `terraform -chdir={caminho}` / `find {caminho}` shell-out
11232        // is arbitrary-CLI-arg-injection because none of those
11233        // porcelains carry a `--` argument-list terminator between
11234        // the flag block and the path argument. The new arm moves the
11235        // rejection to `Caixa::from_lisp` boundary time and names
11236        // the offending dep + caminho verbatim.
11237        //
11238        // Sweep spans the canonical CLI-arg-injection shapes matching
11239        // the peer sweep on the sibling `is_git_ref_name` /
11240        // `is_git_repo_url` axes: short-flag `-rf` (the `rm -rf` /
11241        // `find -rf` reinterpretation vector), `-C` (the `git -C`
11242        // change-directory-config-injection paste), long-flag
11243        // `--upload-pack=cat /etc/passwd` (the canonical
11244        // arbitrary-command-execution vector on every git porcelain
11245        // entry point), git-config-injection `--config=core.merge=ours`,
11246        // and the degenerate single-byte `-` value.
11247        for caminho in [
11248            "-rf",
11249            "-C",
11250            "--upload-pack=cat /etc/passwd",
11251            "--config=core.merge=ours",
11252            "-",
11253        ] {
11254            let d = dep_with_fonte(DepSource::Path {
11255                caminho: caminho.into(),
11256            });
11257            let err = d.validate().unwrap_err();
11258            let DepError::FonteCaminhoLeadingHyphen { nome, caminho: got } = err else {
11259                panic!("expected FonteCaminhoLeadingHyphen for {caminho:?}, got {err:?}");
11260            };
11261            assert_eq!(nome, "caixa-teia");
11262            assert_eq!(got, caminho);
11263        }
11264    }
11265
11266    #[test]
11267    fn validate_accepts_path_fonte_with_mid_path_hyphen_caminho() {
11268        // The leading-`-` is the canonical CLI-arg-injection footgun
11269        // — a `-` anywhere else in the path (`"../caixa-teia"` — the
11270        // canonical kebab-separator-between-alphanumeric-segments
11271        // shape every DNS-1123-shaped caixa name carries; `"../-hidden"`
11272        // — a mid-path segment starting with `-`, still a legitimate
11273        // POSIX filename byte at that non-leading position because the
11274        // subprocess reads the whole `{caminho}` value as one positional
11275        // argument, so only the very first byte of the composite path
11276        // string is at the CLI-arg-injection boundary) is a legitimate
11277        // path with no CLI-flag-reinterpretation semantic at the non-
11278        // leading position of the top-level value. Pinned so the gate
11279        // doesn't widen to a full no-`-`-anywhere sweep that would
11280        // break every legitimate-shape kebab-in-filename path (i.e.
11281        // essentially every sibling-workspace caixa dep).
11282        for caminho in [
11283            "../caixa-teia",
11284            "../caixa-teia/-hidden",
11285            "./my-lib",
11286            "../foo-bar/baz",
11287        ] {
11288            let d = dep_with_fonte(DepSource::Path {
11289                caminho: caminho.into(),
11290            });
11291            d.validate()
11292                .unwrap_or_else(|e| panic!("mid-path `-` caminho {caminho:?} must pass: {e:?}"));
11293        }
11294    }
11295
11296    #[test]
11297    fn fonte_caminho_leading_whitespace_fires_before_leading_hyphen() {
11298        // Cascade pin: the leading-whitespace arm structurally precedes
11299        // the leading-hyphen arm. A value like `" -rf"` probes positive
11300        // on both (leading space AND, one byte in, a `-` — though the
11301        // leading-hyphen arm probes only the very first byte so it
11302        // wouldn't fire on this value; the pin instead documents the
11303        // arm order on the more common "leading space then a hyphen"
11304        // paste-from-aligned-doc paste-flag-shell-one-liner idiom).
11305        // The narrower leading-space diagnostic (the paste-from-aligned-
11306        // doc footgun) wins so the author sees the more self-locating
11307        // whitespace arm first. Mirrors the
11308        // `fonte_caminho_var_fires_before_leading_whitespace` cascade
11309        // discipline on the immediate-predecessor arm.
11310        let d = dep_with_fonte(DepSource::Path {
11311            caminho: " -rf".into(),
11312        });
11313        let err = d.validate().unwrap_err();
11314        assert!(
11315            matches!(err, DepError::FonteCaminhoLeadingWhitespace { .. }),
11316            "got {err:?}",
11317        );
11318    }
11319
11320    #[test]
11321    fn fonte_caminho_leading_hyphen_fires_before_control_char() {
11322        // Cascade pin: the leading-hyphen arm structurally precedes
11323        // the control-char arm. A value like `"-rf\n"` probes positive
11324        // on both (starts with `-` AND contains LF), but the narrower
11325        // leading-byte diagnostic (`FonteCaminhoLeadingHyphen`) wins so
11326        // the author sees the more self-locating CLI-arg-injection arm
11327        // first. Mirrors the
11328        // `fonte_caminho_leading_whitespace_fires_before_control_char`
11329        // cascade discipline on the immediate-predecessor arm.
11330        let d = dep_with_fonte(DepSource::Path {
11331            caminho: "-rf\n".into(),
11332        });
11333        let err = d.validate().unwrap_err();
11334        assert!(
11335            matches!(err, DepError::FonteCaminhoLeadingHyphen { .. }),
11336            "got {err:?}",
11337        );
11338    }
11339
11340    #[test]
11341    fn fonte_caminho_leading_hyphen_diagnostic_carries_offending_dep_and_caminho() {
11342        // Diagnostic-shape pin (peer with
11343        // `fonte_caminho_leading_whitespace_diagnostic_carries_offending_dep_and_caminho`'s
11344        // payload assertion on the immediate-predecessor arm): the
11345        // error's Display surfaces both the offending `:nome` and the
11346        // offending `:caminho` verbatim plus the CLI-argument-injection
11347        // vocabulary, so a `feira lint` run can render the diagnostic
11348        // without re-parsing and the author can grep their caixa.lisp
11349        // for `:caminho "<value>"` and fix it in one edit.
11350        let d = dep_with_fonte(DepSource::Path {
11351            caminho: "--upload-pack=cat /etc/passwd".into(),
11352        });
11353        let rendered = d.validate().unwrap_err().to_string();
11354        assert!(
11355            rendered.contains("caixa-teia"),
11356            "diagnostic must name the offending dep: {rendered}",
11357        );
11358        assert!(
11359            rendered.contains("--upload-pack=cat /etc/passwd"),
11360            "diagnostic must quote the offending caminho: {rendered}",
11361        );
11362        assert!(
11363            rendered.contains("CLI-argument-injection"),
11364            "diagnostic must name the CLI-argument-injection vector: {rendered}",
11365        );
11366        assert!(
11367            rendered.contains("`-`"),
11368            "diagnostic must name the offending byte: {rendered}",
11369        );
11370    }
11371
11372    #[test]
11373    fn fonte_caminho_control_diagnostic_carries_offending_dep_caminho_byte() {
11374        // Diagnostic-shape pin (peer with
11375        // `fonte_caminho_var_diagnostic_carries_offending_dep_and_caminho`'s
11376        // payload assertion on the immediate-predecessor arm): the
11377        // error's Display surfaces the offending `:nome`, the
11378        // offending `:caminho` verbatim, and the offending byte in
11379        // hex form (`0x09` for tab) so a `feira lint` run can render
11380        // the diagnostic without re-parsing.
11381        let d = dep_with_fonte(DepSource::Path {
11382            caminho: "../caixa\tteia".into(),
11383        });
11384        let rendered = d.validate().unwrap_err().to_string();
11385        assert!(
11386            rendered.contains("caixa-teia"),
11387            "diagnostic must name the offending dep: {rendered}",
11388        );
11389        assert!(
11390            rendered.contains("../caixa\tteia"),
11391            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
11392        );
11393        assert!(
11394            rendered.contains("0x09"),
11395            "diagnostic must name the offending byte in hex: {rendered:?}",
11396        );
11397    }
11398
11399    #[test]
11400    fn validate_rejects_path_fonte_with_caminho_carrying_backslash() {
11401        // The fail-before-pass-after pin for the canonical Windows-
11402        // path-separator paste footgun: an author who pastes a path
11403        // from Windows-Explorer's `Copy as path`, PowerShell's
11404        // `Get-Location`, or any CMD/Cygwin/MSYS shell prompt
11405        // produces `..\caixa-teia`-shape values that silently passed
11406        // every prior arm (`Path::is_absolute("..\\caixa-teia")` is
11407        // false; `\` is neither a leading-byte sentinel nor a
11408        // control byte). On POSIX resolvers the value rides through
11409        // `Path::join` as a literal directory name and fails at
11410        // resolve time with `No such file or directory`; on Windows
11411        // resolvers the value resolves to the parent's sibling — two
11412        // distinct directories for the byte-identical caixa.lisp.
11413        // The new arm moves the rejection to validate time and names
11414        // the offending dep + caminho verbatim.
11415        let d = dep_with_fonte(DepSource::Path {
11416            caminho: "..\\caixa-teia".into(),
11417        });
11418        let err = d.validate().unwrap_err();
11419        let DepError::FonteCaminhoBackslash { nome, caminho } = err else {
11420            panic!("expected FonteCaminhoBackslash, got {err:?}");
11421        };
11422        assert_eq!(nome, "caixa-teia");
11423        assert_eq!(caminho, "..\\caixa-teia");
11424    }
11425
11426    #[test]
11427    fn validate_rejects_path_fonte_with_caminho_carrying_windows_drive_letter() {
11428        // The Windows drive-letter paste shape (`C:\work\caixa-teia`
11429        // out of Explorer / `cd`-and-`pwd`-on-Windows). On POSIX
11430        // hosts `Path::is_absolute("C:\\work\\caixa-teia")` returns
11431        // false (POSIX absolute paths start with `/`, drive letters
11432        // are not a POSIX concept), so the b94fd83 absolute arm
11433        // doesn't fire; the value contains `\` bytes that this arm
11434        // now catches with the more self-locating Windows-path-
11435        // separator diagnostic. Pinned separately from the bare
11436        // `..\caixa-teia` shape so a future arm that targets only
11437        // leading-`..\` doesn't regress the drive-letter coverage.
11438        let d = dep_with_fonte(DepSource::Path {
11439            caminho: "C:\\work\\caixa-teia".into(),
11440        });
11441        let err = d.validate().unwrap_err();
11442        assert!(
11443            matches!(err, DepError::FonteCaminhoBackslash { .. }),
11444            "got {err:?}",
11445        );
11446    }
11447
11448    #[test]
11449    fn validate_rejects_path_fonte_with_caminho_carrying_trailing_backslash() {
11450        // The trailing-`\` shape (`..\caixa-teia\` — the canonical
11451        // PowerShell tab-completion-on-a-directory append). Pinned
11452        // separately from the embedded-`\` shape so the gate's
11453        // contract is "any `\` anywhere", not "any `\` not at end".
11454        let d = dep_with_fonte(DepSource::Path {
11455            caminho: "..\\caixa-teia\\".into(),
11456        });
11457        let err = d.validate().unwrap_err();
11458        assert!(
11459            matches!(err, DepError::FonteCaminhoBackslash { .. }),
11460            "got {err:?}",
11461        );
11462    }
11463
11464    #[test]
11465    fn validate_accepts_path_fonte_with_caminho_carrying_legitimate_forward_slash() {
11466        // The positive-control pin: the gate targets `\` only,
11467        // never `/`. The canonical relative POSIX path
11468        // (`../caixa-teia/foo/bar`) must continue to validate cleanly
11469        // so legitimate nested-directory deps aren't broken. Pinned
11470        // so the gate doesn't accidentally widen to a "no path
11471        // separators at all" sweep.
11472        let d = dep_with_fonte(DepSource::Path {
11473            caminho: "../caixa-teia/foo/bar".into(),
11474        });
11475        d.validate().unwrap();
11476    }
11477
11478    #[test]
11479    fn fonte_caminho_control_char_fires_before_backslash() {
11480        // Cascade pin: the control-char arm structurally precedes the
11481        // backslash arm. A value like `"..\caixa\0teia"` probes
11482        // positive on both (`\` byte + NUL byte), but the control-
11483        // char diagnostic wins so the author sees the more self-
11484        // locating POSIX-syscall-rejected-byte diagnostic first
11485        // (NUL outright breaks `CString::new` at every `std::fs`
11486        // syscall boundary; the `\` divergence is the cross-OS-
11487        // separator axis). Mirrors the
11488        // `fonte_caminho_var_fires_before_control_char` cascade
11489        // discipline on the immediate-predecessor arm.
11490        let d = dep_with_fonte(DepSource::Path {
11491            caminho: "..\\caixa\0teia".into(),
11492        });
11493        let err = d.validate().unwrap_err();
11494        assert!(
11495            matches!(err, DepError::FonteCaminhoControlChar { .. }),
11496            "got {err:?}",
11497        );
11498    }
11499
11500    #[test]
11501    fn fonte_caminho_absolute_fires_before_backslash() {
11502        // Cascade pin on the load-bearing leading-byte arm: a leading
11503        // `/` value with embedded `\` (`/etc/passwd\foo`) routes
11504        // through `FonteCaminhoAbsolute` not `FonteCaminhoBackslash`
11505        // — the host-layout-leak diagnostic is the load-bearing
11506        // axis, the `\` byte is the secondary observation. Same
11507        // precedence logic as every prior leading-byte arm.
11508        let d = dep_with_fonte(DepSource::Path {
11509            caminho: "/etc/passwd\\foo".into(),
11510        });
11511        let err = d.validate().unwrap_err();
11512        assert!(
11513            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
11514            "got {err:?}",
11515        );
11516    }
11517
11518    #[test]
11519    fn fonte_caminho_var_fires_before_backslash() {
11520        // Cascade pin on the var-expansion arm: a leading-`$` value
11521        // with embedded `\` (`$WORKSPACE\caixa-teia` — the canonical
11522        // PowerShell-env-var paste-from-CI-manifest footgun) routes
11523        // through `FonteCaminhoVarExpansion` not `FonteCaminhoBackslash`.
11524        // The shell-expansion diagnostic is the more self-locating
11525        // axis since both the leading `$` and the embedded `\`
11526        // are Windows-shell artifacts but the `$` is the root-cause
11527        // surface (an author who removes the `$` is likely to leave
11528        // the `\` too).
11529        let d = dep_with_fonte(DepSource::Path {
11530            caminho: "$WORKSPACE\\caixa-teia".into(),
11531        });
11532        let err = d.validate().unwrap_err();
11533        assert!(
11534            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
11535            "got {err:?}",
11536        );
11537    }
11538
11539    #[test]
11540    fn fonte_caminho_backslash_diagnostic_carries_offending_dep_and_caminho() {
11541        // Diagnostic-shape pin (peer with the prior
11542        // `fonte_caminho_*_diagnostic_carries_*` payload assertions
11543        // on every preceding arm): the error's Display surfaces the
11544        // offending `:nome` and the offending `:caminho` verbatim
11545        // so a `feira lint` run can render the diagnostic without
11546        // re-parsing.
11547        let d = dep_with_fonte(DepSource::Path {
11548            caminho: "..\\caixa-teia".into(),
11549        });
11550        let rendered = d.validate().unwrap_err().to_string();
11551        assert!(
11552            rendered.contains("caixa-teia"),
11553            "diagnostic must name the offending dep: {rendered}",
11554        );
11555        assert!(
11556            rendered.contains("..\\caixa-teia"),
11557            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
11558        );
11559        assert!(
11560            rendered.contains('\\'),
11561            "diagnostic must reference the backslash footgun: {rendered:?}",
11562        );
11563    }
11564
11565    #[test]
11566    fn validate_rejects_path_fonte_with_caminho_carrying_trailing_slash() {
11567        // The fail-before-pass-after pin for the canonical trailing-`/`
11568        // paste footgun: an author who shell-tab-completes a sibling
11569        // directory (every interactive shell — bash/zsh/fish/nushell —
11570        // appends `/` on tab-completing a directory) produces
11571        // `"../caixa-teia/"`-shape values that silently passed every
11572        // prior arm (the leading byte is `.`, no control bytes, no
11573        // backslash). `Path::join` resolves both shapes to the same
11574        // directory at the resolver, but the lacre embeds the value
11575        // verbatim and the BLAKE3 closures diverge across two
11576        // workstations whose authors differ only in tab-completion
11577        // habits.
11578        let d = dep_with_fonte(DepSource::Path {
11579            caminho: "../caixa-teia/".into(),
11580        });
11581        let err = d.validate().unwrap_err();
11582        let DepError::FonteCaminhoTrailingSlash { nome, caminho } = err else {
11583            panic!("expected FonteCaminhoTrailingSlash, got {err:?}");
11584        };
11585        assert_eq!(nome, "caixa-teia");
11586        assert_eq!(caminho, "../caixa-teia/");
11587    }
11588
11589    #[test]
11590    fn validate_rejects_path_fonte_with_caminho_carrying_bare_dot_slash() {
11591        // The `"./"` shape (the canonical "I meant the caixa.lisp's own
11592        // directory and tab-completed it" footgun). Pinned separately
11593        // from the canonical `"../caixa-teia/"` shape so the gate's
11594        // contract is "any trailing `/`", not "trailing `/` after a leaf
11595        // name".
11596        let d = dep_with_fonte(DepSource::Path {
11597            caminho: "./".into(),
11598        });
11599        let err = d.validate().unwrap_err();
11600        assert!(
11601            matches!(err, DepError::FonteCaminhoTrailingSlash { .. }),
11602            "got {err:?}",
11603        );
11604    }
11605
11606    #[test]
11607    fn validate_rejects_path_fonte_with_caminho_carrying_consecutive_trailing_slashes() {
11608        // The `"foo//"` shape (the canonical "I pasted from a CI manifest
11609        // that double-templated `${VAR}/` over an already-`/`-suffixed
11610        // path" footgun). The gate fires on the last byte being `/`
11611        // regardless of how many `/` precede it; the arm contract is
11612        // "the value ends with `/`", structurally.
11613        let d = dep_with_fonte(DepSource::Path {
11614            caminho: "../caixa-teia//".into(),
11615        });
11616        let err = d.validate().unwrap_err();
11617        assert!(
11618            matches!(err, DepError::FonteCaminhoTrailingSlash { .. }),
11619            "got {err:?}",
11620        );
11621    }
11622
11623    #[test]
11624    fn validate_rejects_path_fonte_with_caminho_carrying_dotdot_trailing_slash() {
11625        // The `"../"` shape (the canonical "I want the parent" tab-
11626        // completion footgun on a bare `..` path). Pinned separately so
11627        // the gate doesn't accidentally narrow to "trailing `/` only on
11628        // multi-segment paths".
11629        let d = dep_with_fonte(DepSource::Path {
11630            caminho: "../".into(),
11631        });
11632        let err = d.validate().unwrap_err();
11633        assert!(
11634            matches!(err, DepError::FonteCaminhoTrailingSlash { .. }),
11635            "got {err:?}",
11636        );
11637    }
11638
11639    #[test]
11640    fn validate_accepts_path_fonte_with_caminho_carrying_internal_slashes() {
11641        // The positive-control pin: the gate targets the trailing byte
11642        // only, never internal `/` separators. The canonical nested
11643        // relative POSIX path (`"../caixa-teia/foo/bar"`) must continue
11644        // to validate cleanly so legitimate deeply-nested deps aren't
11645        // broken. Pinned so the gate doesn't accidentally widen to a
11646        // "no `/` separators anywhere" sweep that would defeat the
11647        // entire path-fonte author surface.
11648        let d = dep_with_fonte(DepSource::Path {
11649            caminho: "../caixa-teia/foo/bar".into(),
11650        });
11651        d.validate().unwrap();
11652    }
11653
11654    #[test]
11655    fn validate_accepts_path_fonte_with_caminho_carrying_bare_dot() {
11656        // The positive-control pin on the degenerate single-`.` shape
11657        // (the canonical "the caixa.lisp's own directory" idiom). The
11658        // gate fires on the trailing byte being `/`, not on the path
11659        // being short, so `"."` (one byte, not `/`) must continue to
11660        // validate cleanly.
11661        let d = dep_with_fonte(DepSource::Path {
11662            caminho: ".".into(),
11663        });
11664        d.validate().unwrap();
11665    }
11666
11667    #[test]
11668    fn fonte_caminho_control_char_fires_before_trailing_slash() {
11669        // Cascade pin: the control-char arm structurally precedes the
11670        // trailing-slash arm. A value like `"../foo\n/"` ends in `/`
11671        // but the embedded LF (`0x0A`) is the load-bearing diagnostic
11672        // (control bytes are the paste-from-multiline-doc footgun the
11673        // d624c8d arm already closes). Mirrors the
11674        // `fonte_caminho_control_char_fires_before_backslash` cascade
11675        // discipline on the immediate-predecessor arm.
11676        let d = dep_with_fonte(DepSource::Path {
11677            caminho: "../foo\n/".into(),
11678        });
11679        let err = d.validate().unwrap_err();
11680        assert!(
11681            matches!(err, DepError::FonteCaminhoControlChar { .. }),
11682            "got {err:?}",
11683        );
11684    }
11685
11686    #[test]
11687    fn fonte_caminho_backslash_fires_before_trailing_slash() {
11688        // Cascade pin on the backslash arm: a value like `"..\foo/"`
11689        // ends in `/` but the embedded `\` is the load-bearing
11690        // diagnostic (the cross-host-OS-separator divergence vector
11691        // the 3a4e1d7 arm closes). Same precedence logic as the prior
11692        // narrower-diagnostic-first cascade.
11693        let d = dep_with_fonte(DepSource::Path {
11694            caminho: "..\\caixa-teia/".into(),
11695        });
11696        let err = d.validate().unwrap_err();
11697        assert!(
11698            matches!(err, DepError::FonteCaminhoBackslash { .. }),
11699            "got {err:?}",
11700        );
11701    }
11702
11703    #[test]
11704    fn fonte_caminho_absolute_fires_before_trailing_slash() {
11705        // Cascade pin on the load-bearing leading-byte arm: a leading
11706        // `/` value with a trailing `/` (`"/etc/passwd/"`) routes
11707        // through `FonteCaminhoAbsolute` not `FonteCaminhoTrailingSlash`
11708        // — the host-layout-leak diagnostic is the load-bearing axis,
11709        // the trailing `/` is the secondary observation. Same
11710        // precedence logic as every prior leading-byte arm.
11711        let d = dep_with_fonte(DepSource::Path {
11712            caminho: "/etc/passwd/".into(),
11713        });
11714        let err = d.validate().unwrap_err();
11715        assert!(
11716            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
11717            "got {err:?}",
11718        );
11719    }
11720
11721    #[test]
11722    fn fonte_caminho_trailing_slash_diagnostic_carries_offending_dep_and_caminho() {
11723        // Diagnostic-shape pin (peer with the prior
11724        // `fonte_caminho_*_diagnostic_carries_*` payload assertions on
11725        // every preceding arm): the error's Display surfaces the
11726        // offending `:nome` and the offending `:caminho` verbatim so a
11727        // `feira lint` run can render the diagnostic without re-parsing.
11728        let d = dep_with_fonte(DepSource::Path {
11729            caminho: "../caixa-teia/".into(),
11730        });
11731        let rendered = d.validate().unwrap_err().to_string();
11732        assert!(
11733            rendered.contains("caixa-teia"),
11734            "diagnostic must name the offending dep: {rendered}",
11735        );
11736        assert!(
11737            rendered.contains("../caixa-teia/"),
11738            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
11739        );
11740        assert!(
11741            rendered.contains("trailing"),
11742            "diagnostic must reference the trailing-slash footgun: {rendered:?}",
11743        );
11744    }
11745
11746    // -- :caminho shell-redirection metacharacter arm -----------------------
11747
11748    #[test]
11749    fn validate_rejects_path_fonte_with_caminho_carrying_gt_redirection() {
11750        // The fail-before-pass-after pin for the canonical output-redirection
11751        // paste footgun: an author copies a shell pipeline tail
11752        // (`"../caixa-teia>build.log"` — the canonical "I selected the whole
11753        // line including the `> build.log` redirect" idiom) and silently
11754        // passed every prior arm (`Path::is_absolute` false on `..`, no
11755        // control bytes, no backslash, doesn't end in `/`). The lacre
11756        // embedded the value verbatim, the resolver folded it through
11757        // `Path::join` looking for a literal `./../caixa-teia>build.log`
11758        // subdirectory, and the failure surfaced at resolve time with a
11759        // non-self-locating `No such file or directory` error. The new arm
11760        // moves the rejection to validate time and names the offending dep
11761        // + caminho + byte verbatim.
11762        let d = dep_with_fonte(DepSource::Path {
11763            caminho: "../caixa-teia>build.log".into(),
11764        });
11765        let err = d.validate().unwrap_err();
11766        let DepError::FonteCaminhoShellRedirection {
11767            nome,
11768            caminho,
11769            byte,
11770        } = err
11771        else {
11772            panic!("expected FonteCaminhoShellRedirection, got {err:?}");
11773        };
11774        assert_eq!(nome, "caixa-teia");
11775        assert_eq!(caminho, "../caixa-teia>build.log");
11776        assert_eq!(byte, b'>');
11777    }
11778
11779    #[test]
11780    fn validate_rejects_path_fonte_with_caminho_carrying_lt_redirection() {
11781        // The symmetric input-redirection paste shape
11782        // (`"../caixa-teia<input.lisp"` — the canonical "I copied a
11783        // `command < input.lisp` line from a tatara-lisp REPL log"
11784        // idiom). Pinned separately from the `>` shape so the gate's
11785        // contract is "any `<` or `>` anywhere", not single-byte coverage.
11786        let d = dep_with_fonte(DepSource::Path {
11787            caminho: "../caixa-teia<input.lisp".into(),
11788        });
11789        let err = d.validate().unwrap_err();
11790        let DepError::FonteCaminhoShellRedirection { byte, .. } = err else {
11791            panic!("expected FonteCaminhoShellRedirection, got {err:?}");
11792        };
11793        assert_eq!(byte, b'<');
11794    }
11795
11796    #[test]
11797    fn validate_rejects_path_fonte_with_caminho_carrying_leading_gt_redirection() {
11798        // Leading-position `>` shape (`">../caixa-teia"` — the degenerate
11799        // "I forgot the source side of the redirect" idiom). Pinned
11800        // separately from the embedded-byte shapes so the gate covers
11801        // every position, not only mid-path.
11802        let d = dep_with_fonte(DepSource::Path {
11803            caminho: ">../caixa-teia".into(),
11804        });
11805        let err = d.validate().unwrap_err();
11806        assert!(
11807            matches!(
11808                err,
11809                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
11810            ),
11811            "got {err:?}",
11812        );
11813    }
11814
11815    #[test]
11816    fn validate_rejects_path_fonte_with_caminho_carrying_double_gt_append() {
11817        // The bash append-redirection shape (`"../caixa-teia>>build.log"` —
11818        // the canonical "I copied a `>>` append redirect" idiom). The arm
11819        // fires on the first `>` encountered; pinned so a future arm that
11820        // tries to distinguish `>` from `>>` doesn't break the broader
11821        // contract.
11822        let d = dep_with_fonte(DepSource::Path {
11823            caminho: "../caixa-teia>>build.log".into(),
11824        });
11825        let err = d.validate().unwrap_err();
11826        assert!(
11827            matches!(
11828                err,
11829                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
11830            ),
11831            "got {err:?}",
11832        );
11833    }
11834
11835    #[test]
11836    fn validate_accepts_path_fonte_with_caminho_carrying_no_redirection() {
11837        // The positive-control pin: the gate targets only `<` / `>`,
11838        // never adjacent printable ASCII or POSIX-valid bytes. The
11839        // canonical relative POSIX path (`"../caixa-teia"`) and a
11840        // nested deeply-pathed variant (`"../caixa-teia/foo/bar"`) must
11841        // continue to validate cleanly so the gate doesn't widen to a
11842        // "no printable punctuation anywhere" sweep that would defeat
11843        // the entire path-fonte author surface.
11844        let d = dep_with_fonte(DepSource::Path {
11845            caminho: "../caixa-teia/foo/bar".into(),
11846        });
11847        d.validate().unwrap();
11848    }
11849
11850    #[test]
11851    fn fonte_caminho_backslash_fires_before_shell_redirection() {
11852        // Cascade pin on the immediate-predecessor arm: a value carrying
11853        // both `\` and `<` / `>` (`"..\caixa-teia>build.log"` — the
11854        // canonical "I pasted a Windows-shell command with output
11855        // redirect" footgun) routes through `FonteCaminhoBackslash` not
11856        // `FonteCaminhoShellRedirection`. The cross-host-OS-separator
11857        // divergence is the load-bearing axis (an author who removes
11858        // the `\` is the root-cause edit; the `>` falls away in the
11859        // same edit since it's downstream of the Windows-shell
11860        // convention).
11861        let d = dep_with_fonte(DepSource::Path {
11862            caminho: "..\\caixa-teia>build.log".into(),
11863        });
11864        let err = d.validate().unwrap_err();
11865        assert!(
11866            matches!(err, DepError::FonteCaminhoBackslash { .. }),
11867            "got {err:?}",
11868        );
11869    }
11870
11871    #[test]
11872    fn fonte_caminho_control_char_fires_before_shell_redirection() {
11873        // Cascade pin on the embedded-control-byte arm: a value carrying
11874        // both a control byte and `<` / `>` (`"../foo\n>bar"` — the
11875        // canonical paste-from-multiline-doc footgun where a newline
11876        // landed mid-caminho) routes through `FonteCaminhoControlChar`
11877        // not `FonteCaminhoShellRedirection`. The POSIX-syscall-
11878        // rejected-byte / NUL-`CString::new`-fail diagnostic is the
11879        // load-bearing axis on every value that probes positive for
11880        // both — mirrors the cascade discipline on every prior arm.
11881        let d = dep_with_fonte(DepSource::Path {
11882            caminho: "../foo\n>bar".into(),
11883        });
11884        let err = d.validate().unwrap_err();
11885        assert!(
11886            matches!(err, DepError::FonteCaminhoControlChar { .. }),
11887            "got {err:?}",
11888        );
11889    }
11890
11891    #[test]
11892    fn fonte_caminho_absolute_fires_before_shell_redirection() {
11893        // Cascade pin on the load-bearing leading-byte arm: a leading
11894        // `/` value with embedded `<` / `>` (`"/etc/passwd>out"`)
11895        // routes through `FonteCaminhoAbsolute` not
11896        // `FonteCaminhoShellRedirection` — the host-layout-leak
11897        // diagnostic is the load-bearing axis, the `>` byte is the
11898        // secondary observation. Same precedence logic as every prior
11899        // leading-byte arm.
11900        let d = dep_with_fonte(DepSource::Path {
11901            caminho: "/etc/passwd>out".into(),
11902        });
11903        let err = d.validate().unwrap_err();
11904        assert!(
11905            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
11906            "got {err:?}",
11907        );
11908    }
11909
11910    #[test]
11911    fn fonte_caminho_shell_redirection_fires_before_trailing_slash() {
11912        // Cascade pin on the immediate-successor arm: a value carrying
11913        // both `<` / `>` and a trailing `/` (`"../foo></"` — the
11914        // canonical "I tab-completed a path that already had a
11915        // redirect" footgun) routes through `FonteCaminhoShellRedirection`
11916        // not `FonteCaminhoTrailingSlash`. The embedded shell-metachar is
11917        // the more semantic-locating axis (an author who removes the
11918        // `<` / `>` typically also drops the trailing separator since
11919        // both are paste-from-shell artifacts).
11920        let d = dep_with_fonte(DepSource::Path {
11921            caminho: "../foo></".into(),
11922        });
11923        let err = d.validate().unwrap_err();
11924        assert!(
11925            matches!(
11926                err,
11927                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
11928            ),
11929            "got {err:?}",
11930        );
11931    }
11932
11933    #[test]
11934    fn fonte_caminho_shell_redirection_diagnostic_carries_offending_dep_caminho_byte() {
11935        // Diagnostic-shape pin (peer with
11936        // `fonte_caminho_control_diagnostic_carries_offending_dep_caminho_byte`'s
11937        // payload assertion on the closest peer arm that also carries a
11938        // `byte` field): the error's Display surfaces the offending
11939        // `:nome`, the offending `:caminho` verbatim, and the offending
11940        // byte in hex (`0x3c` for `<`, `0x3e` for `>`) so a `feira lint`
11941        // run can render the diagnostic without re-parsing.
11942        let d = dep_with_fonte(DepSource::Path {
11943            caminho: "../caixa-teia>build.log".into(),
11944        });
11945        let rendered = d.validate().unwrap_err().to_string();
11946        assert!(
11947            rendered.contains("caixa-teia"),
11948            "diagnostic must name the offending dep: {rendered}",
11949        );
11950        assert!(
11951            rendered.contains("../caixa-teia>build.log"),
11952            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
11953        );
11954        assert!(
11955            rendered.contains("0x3e"),
11956            "diagnostic must name the offending byte in hex: {rendered:?}",
11957        );
11958        assert!(
11959            rendered.contains("redirection"),
11960            "diagnostic must name the shell-redirection footgun: {rendered:?}",
11961        );
11962    }
11963
11964    // -- :caminho shell-pipe metacharacter arm ----------------------------
11965
11966    #[test]
11967    fn validate_rejects_path_fonte_with_caminho_carrying_pipe() {
11968        // The fail-before-pass-after pin for the canonical shell-pipe
11969        // paste footgun: an author copies a shell-history line
11970        // (`"../caixa-teia | grep foo"` — the canonical "I selected
11971        // the whole `ls dir | grep` line out of zsh history") and
11972        // silently passed every prior arm (`Path::is_absolute` false
11973        // on `..`, no control bytes, no backslash, no `<` / `>`,
11974        // doesn't end in `/`). The lacre embedded the value verbatim,
11975        // the resolver folded it through `Path::join` looking for a
11976        // literal `./../caixa-teia | grep foo` subdirectory, and the
11977        // failure surfaced at resolve time with a non-self-locating
11978        // `No such file or directory` error. The new arm moves the
11979        // rejection to validate time and names the offending dep +
11980        // caminho verbatim.
11981        let d = dep_with_fonte(DepSource::Path {
11982            caminho: "../caixa-teia | grep foo".into(),
11983        });
11984        let err = d.validate().unwrap_err();
11985        let DepError::FonteCaminhoShellPipe { nome, caminho } = err else {
11986            panic!("expected FonteCaminhoShellPipe, got {err:?}");
11987        };
11988        assert_eq!(nome, "caixa-teia");
11989        assert_eq!(caminho, "../caixa-teia | grep foo");
11990    }
11991
11992    #[test]
11993    fn validate_rejects_path_fonte_with_caminho_carrying_leading_pipe() {
11994        // Leading-position `|` shape (`"|../caixa-teia"` — the
11995        // degenerate "I forgot the source side of the pipe" idiom).
11996        // Pinned separately from the embedded-byte shape so the gate
11997        // covers every position, not only mid-path.
11998        let d = dep_with_fonte(DepSource::Path {
11999            caminho: "|../caixa-teia".into(),
12000        });
12001        let err = d.validate().unwrap_err();
12002        assert!(
12003            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12004            "got {err:?}",
12005        );
12006    }
12007
12008    #[test]
12009    fn validate_rejects_path_fonte_with_caminho_carrying_double_pipe_or() {
12010        // The bash short-circuit-OR shape (`"../caixa-teia||fallback"`
12011        // — the canonical "I copied a `cmd-a || cmd-b` fallback line"
12012        // idiom). The arm fires on the first `|` encountered; pinned
12013        // so a future arm that tries to distinguish `|` from `||`
12014        // doesn't break the broader contract.
12015        let d = dep_with_fonte(DepSource::Path {
12016            caminho: "../caixa-teia||fallback".into(),
12017        });
12018        let err = d.validate().unwrap_err();
12019        assert!(
12020            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12021            "got {err:?}",
12022        );
12023    }
12024
12025    #[test]
12026    fn validate_accepts_path_fonte_with_caminho_carrying_no_pipe() {
12027        // The positive-control pin: the gate targets only `|`, never
12028        // adjacent printable ASCII or POSIX-valid bytes. The canonical
12029        // relative POSIX path (`"../caixa-teia"`) and a nested deeply-
12030        // pathed variant with adjacent printable punctuation
12031        // (`"../caixa-teia/sub-dir.v2"`) must continue to validate
12032        // cleanly so the gate doesn't widen to a "no printable
12033        // punctuation anywhere" sweep that would defeat the entire
12034        // path-fonte author surface.
12035        let d = dep_with_fonte(DepSource::Path {
12036            caminho: "../caixa-teia/sub-dir.v2".into(),
12037        });
12038        d.validate().unwrap();
12039    }
12040
12041    #[test]
12042    fn fonte_caminho_shell_redirection_fires_before_shell_pipe() {
12043        // Cascade pin on the immediate-predecessor arm: a value carrying
12044        // both `<` / `>` and `|` (`"../caixa-teia<input|tee"` — the
12045        // canonical "I pasted a `cmd < input | tee` pipeline tail"
12046        // footgun) routes through `FonteCaminhoShellRedirection` not
12047        // `FonteCaminhoShellPipe`. The input/output redirection
12048        // metachar carries the more self-locating `byte: u8` payload
12049        // (it names which of `<` or `>` triggered), so the prior arm
12050        // wins on every probe-as-both value — same cascade discipline
12051        // every prior `:caminho` arm establishes.
12052        let d = dep_with_fonte(DepSource::Path {
12053            caminho: "../caixa-teia<input|tee".into(),
12054        });
12055        let err = d.validate().unwrap_err();
12056        assert!(
12057            matches!(
12058                err,
12059                DepError::FonteCaminhoShellRedirection { byte: b'<', .. }
12060            ),
12061            "got {err:?}",
12062        );
12063    }
12064
12065    #[test]
12066    fn fonte_caminho_backslash_fires_before_shell_pipe() {
12067        // Cascade pin on the upstream backslash arm: a value carrying
12068        // both `\` and `|` (`"..\caixa-teia|tee"` — the canonical
12069        // "I pasted a Windows-shell command with pipe to tee"
12070        // footgun) routes through `FonteCaminhoBackslash` not
12071        // `FonteCaminhoShellPipe`. The cross-host-OS-separator
12072        // divergence is the load-bearing axis on every probe-as-both
12073        // value (an author who removes the `\` is the root-cause edit;
12074        // the `|` falls away in the same edit since it's downstream of
12075        // the Windows-shell convention).
12076        let d = dep_with_fonte(DepSource::Path {
12077            caminho: "..\\caixa-teia|tee".into(),
12078        });
12079        let err = d.validate().unwrap_err();
12080        assert!(
12081            matches!(err, DepError::FonteCaminhoBackslash { .. }),
12082            "got {err:?}",
12083        );
12084    }
12085
12086    #[test]
12087    fn fonte_caminho_control_char_fires_before_shell_pipe() {
12088        // Cascade pin on the embedded-control-byte arm: a value
12089        // carrying both a control byte and `|` (`"../foo\n|bar"` —
12090        // the canonical paste-from-multiline-doc footgun where a
12091        // newline landed mid-caminho) routes through
12092        // `FonteCaminhoControlChar` not `FonteCaminhoShellPipe`. The
12093        // POSIX-syscall-rejected-byte / NUL-`CString::new`-fail
12094        // diagnostic is the load-bearing axis on every value that
12095        // probes positive for both — mirrors the cascade discipline
12096        // on every prior arm.
12097        let d = dep_with_fonte(DepSource::Path {
12098            caminho: "../foo\n|bar".into(),
12099        });
12100        let err = d.validate().unwrap_err();
12101        assert!(
12102            matches!(err, DepError::FonteCaminhoControlChar { .. }),
12103            "got {err:?}",
12104        );
12105    }
12106
12107    #[test]
12108    fn fonte_caminho_absolute_fires_before_shell_pipe() {
12109        // Cascade pin on the load-bearing leading-byte arm: a leading
12110        // `/` value with embedded `|` (`"/etc/passwd|tee"`) routes
12111        // through `FonteCaminhoAbsolute` not `FonteCaminhoShellPipe`
12112        // — the host-layout-leak diagnostic is the load-bearing axis,
12113        // the `|` byte is the secondary observation. Same precedence
12114        // logic as every prior leading-byte arm.
12115        let d = dep_with_fonte(DepSource::Path {
12116            caminho: "/etc/passwd|tee".into(),
12117        });
12118        let err = d.validate().unwrap_err();
12119        assert!(
12120            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
12121            "got {err:?}",
12122        );
12123    }
12124
12125    #[test]
12126    fn fonte_caminho_shell_pipe_fires_before_trailing_slash() {
12127        // Cascade pin on the immediate-successor arm: a value carrying
12128        // both `|` and a trailing `/` (`"../foo|tee/"` — the canonical
12129        // "I tab-completed a path that already had a pipeline tail"
12130        // footgun) routes through `FonteCaminhoShellPipe` not
12131        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar is
12132        // the more semantic-locating axis (an author who removes the
12133        // `|` typically also drops the trailing separator since both
12134        // are paste-from-shell artifacts).
12135        let d = dep_with_fonte(DepSource::Path {
12136            caminho: "../foo|tee/".into(),
12137        });
12138        let err = d.validate().unwrap_err();
12139        assert!(
12140            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12141            "got {err:?}",
12142        );
12143    }
12144
12145    #[test]
12146    fn fonte_caminho_shell_pipe_diagnostic_carries_offending_dep_and_caminho() {
12147        // Diagnostic-shape pin (peer with
12148        // `fonte_caminho_backslash_diagnostic_carries_offending_dep_and_caminho`
12149        // on the closest single-byte peer arm): the error's Display
12150        // surfaces the offending `:nome` and the offending `:caminho`
12151        // verbatim, and names the shell-pipe footgun explicitly so a
12152        // `feira lint` run can render the diagnostic without
12153        // re-parsing.
12154        let d = dep_with_fonte(DepSource::Path {
12155            caminho: "../caixa-teia | grep foo".into(),
12156        });
12157        let rendered = d.validate().unwrap_err().to_string();
12158        assert!(
12159            rendered.contains("caixa-teia"),
12160            "diagnostic must name the offending dep: {rendered}",
12161        );
12162        assert!(
12163            rendered.contains("../caixa-teia | grep foo"),
12164            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
12165        );
12166        assert!(
12167            rendered.contains('|'),
12168            "diagnostic must reference the pipe footgun: {rendered:?}",
12169        );
12170        assert!(
12171            rendered.contains("pipe"),
12172            "diagnostic must name the shell-pipe footgun: {rendered:?}",
12173        );
12174    }
12175
12176    // -- :caminho shell-command-separator metacharacter arm ---------------
12177
12178    #[test]
12179    fn validate_rejects_path_fonte_with_caminho_carrying_semicolon() {
12180        // The fail-before-pass-after pin for the canonical shell-command-
12181        // separator paste footgun: an author copies a shell one-liner
12182        // (`"../caixa-teia; rm -rf build"` — the canonical "I selected the
12183        // whole `cd path; do-thing` chain out of a shell-history block")
12184        // and silently passed every prior arm (`Path::is_absolute` false
12185        // on `..`, no control bytes, no backslash, no `<` / `>`, no `|`,
12186        // doesn't end in `/`). The lacre embedded the value verbatim, the
12187        // resolver folded it through `Path::join` looking for a literal
12188        // `./../caixa-teia; rm -rf build` subdirectory, and the failure
12189        // surfaced at resolve time with a non-self-locating `No such file
12190        // or directory` error. The new arm moves the rejection to validate
12191        // time and names the offending dep + caminho verbatim.
12192        let d = dep_with_fonte(DepSource::Path {
12193            caminho: "../caixa-teia; rm -rf build".into(),
12194        });
12195        let err = d.validate().unwrap_err();
12196        let DepError::FonteCaminhoShellSemicolon { nome, caminho } = err else {
12197            panic!("expected FonteCaminhoShellSemicolon, got {err:?}");
12198        };
12199        assert_eq!(nome, "caixa-teia");
12200        assert_eq!(caminho, "../caixa-teia; rm -rf build");
12201    }
12202
12203    #[test]
12204    fn validate_rejects_path_fonte_with_caminho_carrying_leading_semicolon() {
12205        // Leading-position `;` shape (`";../caixa-teia"` — the degenerate
12206        // "I forgot the prior command side of the separator" idiom).
12207        // Pinned separately from the embedded-byte shape so the gate
12208        // covers every position, not only mid-path.
12209        let d = dep_with_fonte(DepSource::Path {
12210            caminho: ";../caixa-teia".into(),
12211        });
12212        let err = d.validate().unwrap_err();
12213        assert!(
12214            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
12215            "got {err:?}",
12216        );
12217    }
12218
12219    #[test]
12220    fn validate_rejects_path_fonte_with_caminho_carrying_double_semicolon() {
12221        // The POSIX `case` arm `;;` terminator shape
12222        // (`"../caixa-teia;;next"` — the canonical "I copied a `case`
12223        // arm tail" idiom). The arm fires on the first `;` encountered;
12224        // pinned so a future arm that tries to distinguish `;` from `;;`
12225        // doesn't break the broader contract.
12226        let d = dep_with_fonte(DepSource::Path {
12227            caminho: "../caixa-teia;;next".into(),
12228        });
12229        let err = d.validate().unwrap_err();
12230        assert!(
12231            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
12232            "got {err:?}",
12233        );
12234    }
12235
12236    #[test]
12237    fn validate_accepts_path_fonte_with_caminho_carrying_no_semicolon() {
12238        // The positive-control pin: the gate targets only `;`, never
12239        // adjacent printable ASCII or POSIX-valid bytes. The canonical
12240        // relative POSIX path (`"../caixa-teia"`) and a nested deeply-
12241        // pathed variant with adjacent printable punctuation
12242        // (`"../caixa-teia/sub-dir.v2"`) must continue to validate
12243        // cleanly so the gate doesn't widen to a "no printable
12244        // punctuation anywhere" sweep that would defeat the entire
12245        // path-fonte author surface.
12246        let d = dep_with_fonte(DepSource::Path {
12247            caminho: "../caixa-teia/sub-dir.v2".into(),
12248        });
12249        d.validate().unwrap();
12250    }
12251
12252    #[test]
12253    fn fonte_caminho_shell_pipe_fires_before_shell_semicolon() {
12254        // Cascade pin on the immediate-predecessor arm: a value carrying
12255        // both `|` and `;` (`"../caixa-teia | tee; rm"` — the canonical
12256        // "I pasted a `cmd | tee; cleanup` chain" footgun) routes through
12257        // `FonteCaminhoShellPipe` not `FonteCaminhoShellSemicolon`. The
12258        // pipeline-tail paste is the load-bearing root-cause edit on
12259        // every probe-as-both value (an author who removes the `|`
12260        // typically also drops the trailing `; cleanup` since both are
12261        // the same paste-from-shell-history artifact) — same cascade
12262        // discipline every prior `:caminho` arm establishes.
12263        let d = dep_with_fonte(DepSource::Path {
12264            caminho: "../caixa-teia | tee; rm".into(),
12265        });
12266        let err = d.validate().unwrap_err();
12267        assert!(
12268            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12269            "got {err:?}",
12270        );
12271    }
12272
12273    #[test]
12274    fn fonte_caminho_shell_redirection_fires_before_shell_semicolon() {
12275        // Cascade pin on the upstream shell-redirection arm: a value
12276        // carrying both `<` / `>` and `;` (`"../caixa-teia>log; rm"` —
12277        // the canonical "I pasted a `cmd > log; cleanup` chain"
12278        // footgun) routes through `FonteCaminhoShellRedirection` not
12279        // `FonteCaminhoShellSemicolon`. The input/output redirection
12280        // metachar carries the more self-locating `byte: u8` payload
12281        // (it names which of `<` or `>` triggered), so the prior arm
12282        // wins on every probe-as-both value.
12283        let d = dep_with_fonte(DepSource::Path {
12284            caminho: "../caixa-teia>log; rm".into(),
12285        });
12286        let err = d.validate().unwrap_err();
12287        assert!(
12288            matches!(
12289                err,
12290                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
12291            ),
12292            "got {err:?}",
12293        );
12294    }
12295
12296    #[test]
12297    fn fonte_caminho_backslash_fires_before_shell_semicolon() {
12298        // Cascade pin on the upstream backslash arm: a value carrying
12299        // both `\` and `;` (`"..\caixa-teia;rm"` — the canonical "I
12300        // pasted a Windows-shell `cd ..\path; cleanup` chain") routes
12301        // through `FonteCaminhoBackslash` not `FonteCaminhoShellSemicolon`.
12302        // The cross-host-OS-separator divergence is the load-bearing axis
12303        // on every probe-as-both value (an author who removes the `\` is
12304        // the root-cause edit; the `;` falls away in the same edit since
12305        // it's downstream of the Windows-shell convention).
12306        let d = dep_with_fonte(DepSource::Path {
12307            caminho: "..\\caixa-teia;rm".into(),
12308        });
12309        let err = d.validate().unwrap_err();
12310        assert!(
12311            matches!(err, DepError::FonteCaminhoBackslash { .. }),
12312            "got {err:?}",
12313        );
12314    }
12315
12316    #[test]
12317    fn fonte_caminho_control_char_fires_before_shell_semicolon() {
12318        // Cascade pin on the embedded-control-byte arm: a value carrying
12319        // both a control byte and `;` (`"../foo\n;bar"` — the canonical
12320        // paste-from-multiline-doc footgun where a newline landed mid-
12321        // caminho) routes through `FonteCaminhoControlChar` not
12322        // `FonteCaminhoShellSemicolon`. The POSIX-syscall-rejected-byte
12323        // / NUL-`CString::new`-fail diagnostic is the load-bearing axis
12324        // on every value that probes positive for both — mirrors the
12325        // cascade discipline on every prior arm.
12326        let d = dep_with_fonte(DepSource::Path {
12327            caminho: "../foo\n;bar".into(),
12328        });
12329        let err = d.validate().unwrap_err();
12330        assert!(
12331            matches!(err, DepError::FonteCaminhoControlChar { .. }),
12332            "got {err:?}",
12333        );
12334    }
12335
12336    #[test]
12337    fn fonte_caminho_absolute_fires_before_shell_semicolon() {
12338        // Cascade pin on the load-bearing leading-byte arm: a leading
12339        // `/` value with embedded `;` (`"/etc/passwd;rm"`) routes
12340        // through `FonteCaminhoAbsolute` not `FonteCaminhoShellSemicolon`
12341        // — the host-layout-leak diagnostic is the load-bearing axis,
12342        // the `;` byte is the secondary observation. Same precedence
12343        // logic as every prior leading-byte arm.
12344        let d = dep_with_fonte(DepSource::Path {
12345            caminho: "/etc/passwd;rm".into(),
12346        });
12347        let err = d.validate().unwrap_err();
12348        assert!(
12349            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
12350            "got {err:?}",
12351        );
12352    }
12353
12354    #[test]
12355    fn fonte_caminho_shell_semicolon_fires_before_trailing_slash() {
12356        // Cascade pin on the immediate-successor arm: a value carrying
12357        // both `;` and a trailing `/` (`"../foo;rm/"` — the canonical
12358        // "I tab-completed a path that already had a `; cleanup` tail"
12359        // footgun) routes through `FonteCaminhoShellSemicolon` not
12360        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar is
12361        // the more semantic-locating axis (an author who removes the
12362        // `;` typically also drops the trailing separator since both
12363        // are paste-from-shell artifacts).
12364        let d = dep_with_fonte(DepSource::Path {
12365            caminho: "../foo;rm/".into(),
12366        });
12367        let err = d.validate().unwrap_err();
12368        assert!(
12369            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
12370            "got {err:?}",
12371        );
12372    }
12373
12374    #[test]
12375    fn fonte_caminho_shell_semicolon_diagnostic_carries_offending_dep_and_caminho() {
12376        // Diagnostic-shape pin (peer with
12377        // `fonte_caminho_shell_pipe_diagnostic_carries_offending_dep_and_caminho`
12378        // on the closest single-byte peer arm): the error's Display
12379        // surfaces the offending `:nome` and the offending `:caminho`
12380        // verbatim, and names the shell-command-separator footgun
12381        // explicitly so a `feira lint` run can render the diagnostic
12382        // without re-parsing.
12383        let d = dep_with_fonte(DepSource::Path {
12384            caminho: "../caixa-teia; rm -rf build".into(),
12385        });
12386        let rendered = d.validate().unwrap_err().to_string();
12387        assert!(
12388            rendered.contains("caixa-teia"),
12389            "diagnostic must name the offending dep: {rendered}",
12390        );
12391        assert!(
12392            rendered.contains("../caixa-teia; rm -rf build"),
12393            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
12394        );
12395        assert!(
12396            rendered.contains(';'),
12397            "diagnostic must reference the semicolon footgun: {rendered:?}",
12398        );
12399        assert!(
12400            rendered.contains("command-separator"),
12401            "diagnostic must name the shell-command-separator footgun: {rendered:?}",
12402        );
12403    }
12404
12405    #[test]
12406    fn validate_rejects_path_fonte_with_caminho_carrying_ampersand() {
12407        // The fail-before-pass-after pin for the canonical shell-
12408        // background-task paste footgun: an author copies a shell one-
12409        // liner (`"../caixa-teia & sleep 1"` — the canonical "I selected
12410        // the whole `cd path & sleep 1` background-launch out of a
12411        // shell-history block") and silently passed every prior arm
12412        // (`Path::is_absolute` false on `..`, no control bytes, no
12413        // backslash, no `<` / `>`, no `|`, no `;`, doesn't end in `/`).
12414        // The lacre embedded the value verbatim, the resolver folded it
12415        // through `Path::join` looking for a literal `./../caixa-teia &
12416        // sleep 1` subdirectory, and the failure surfaced at resolve
12417        // time with a non-self-locating `No such file or directory`
12418        // error. The new arm moves the rejection to validate time and
12419        // names the offending dep + caminho verbatim.
12420        let d = dep_with_fonte(DepSource::Path {
12421            caminho: "../caixa-teia & sleep 1".into(),
12422        });
12423        let err = d.validate().unwrap_err();
12424        let DepError::FonteCaminhoShellBackground { nome, caminho } = err else {
12425            panic!("expected FonteCaminhoShellBackground, got {err:?}");
12426        };
12427        assert_eq!(nome, "caixa-teia");
12428        assert_eq!(caminho, "../caixa-teia & sleep 1");
12429    }
12430
12431    #[test]
12432    fn validate_rejects_path_fonte_with_caminho_carrying_leading_ampersand() {
12433        // Leading-position `&` shape (`"&../caixa-teia"` — the
12434        // degenerate "I forgot the prior command side of the
12435        // background terminator" idiom). Pinned separately from the
12436        // embedded-byte shape so the gate covers every position, not
12437        // only mid-path.
12438        let d = dep_with_fonte(DepSource::Path {
12439            caminho: "&../caixa-teia".into(),
12440        });
12441        let err = d.validate().unwrap_err();
12442        assert!(
12443            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
12444            "got {err:?}",
12445        );
12446    }
12447
12448    #[test]
12449    fn validate_rejects_path_fonte_with_caminho_carrying_double_ampersand() {
12450        // The logical-AND `&&` shape (`"../caixa-teia && make"` — the
12451        // canonical "I copied a `cd path && make` build chain" idiom
12452        // every Makefile / shell-script wraps). The arm fires on the
12453        // first `&` encountered; pinned so a future arm that tries to
12454        // distinguish `&` from `&&` doesn't break the broader contract.
12455        let d = dep_with_fonte(DepSource::Path {
12456            caminho: "../caixa-teia && make".into(),
12457        });
12458        let err = d.validate().unwrap_err();
12459        assert!(
12460            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
12461            "got {err:?}",
12462        );
12463    }
12464
12465    #[test]
12466    fn validate_accepts_path_fonte_with_caminho_carrying_no_ampersand() {
12467        // The positive-control pin: the gate targets only `&`, never
12468        // adjacent printable ASCII or POSIX-valid bytes. The canonical
12469        // relative POSIX path (`"../caixa-teia"`) and a nested deeply-
12470        // pathed variant with adjacent printable punctuation
12471        // (`"../caixa-teia/sub-dir.v2"`) must continue to validate
12472        // cleanly so the gate doesn't widen to a "no printable
12473        // punctuation anywhere" sweep that would defeat the entire
12474        // path-fonte author surface.
12475        let d = dep_with_fonte(DepSource::Path {
12476            caminho: "../caixa-teia/sub-dir.v2".into(),
12477        });
12478        d.validate().unwrap();
12479    }
12480
12481    #[test]
12482    fn fonte_caminho_shell_semicolon_fires_before_shell_background() {
12483        // Cascade pin on the immediate-predecessor arm: a value carrying
12484        // both `;` and `&` (`"../caixa-teia; rm & sleep"` — the
12485        // canonical "I pasted a `cmd; cleanup & sleep` chain" footgun)
12486        // routes through `FonteCaminhoShellSemicolon` not
12487        // `FonteCaminhoShellBackground`. The sequential-command-
12488        // separator paste is the more common shell-history paste idiom
12489        // on every probe-as-both value (an author who removes the `;`
12490        // typically also drops the trailing `& sleep` since both are
12491        // paste-from-shell-history artifacts) — same cascade discipline
12492        // every prior `:caminho` arm establishes.
12493        let d = dep_with_fonte(DepSource::Path {
12494            caminho: "../caixa-teia; rm & sleep".into(),
12495        });
12496        let err = d.validate().unwrap_err();
12497        assert!(
12498            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
12499            "got {err:?}",
12500        );
12501    }
12502
12503    #[test]
12504    fn fonte_caminho_shell_pipe_fires_before_shell_background() {
12505        // Cascade pin on the upstream shell-pipe arm: a value carrying
12506        // both `|` and `&` (`"../caixa-teia | tee & sleep"` — the
12507        // canonical "I pasted a `cmd | tee & sleep` background-pipeline
12508        // chain" footgun) routes through `FonteCaminhoShellPipe` not
12509        // `FonteCaminhoShellBackground`. The pipeline-tail paste is the
12510        // load-bearing root-cause edit on every probe-as-both value.
12511        let d = dep_with_fonte(DepSource::Path {
12512            caminho: "../caixa-teia | tee & sleep".into(),
12513        });
12514        let err = d.validate().unwrap_err();
12515        assert!(
12516            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12517            "got {err:?}",
12518        );
12519    }
12520
12521    #[test]
12522    fn fonte_caminho_shell_redirection_fires_before_shell_background() {
12523        // Cascade pin on the upstream shell-redirection arm: a value
12524        // carrying both `>` and `&` (`"../caixa-teia>log & sleep"` —
12525        // the canonical "I pasted a `cmd > log & sleep` background-
12526        // redirect chain" footgun) routes through
12527        // `FonteCaminhoShellRedirection` not
12528        // `FonteCaminhoShellBackground`. The input/output redirection
12529        // metachar carries the more self-locating `byte: u8` payload
12530        // (it names which of `<` or `>` triggered), so the prior arm
12531        // wins on every probe-as-both value.
12532        let d = dep_with_fonte(DepSource::Path {
12533            caminho: "../caixa-teia>log & sleep".into(),
12534        });
12535        let err = d.validate().unwrap_err();
12536        assert!(
12537            matches!(
12538                err,
12539                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
12540            ),
12541            "got {err:?}",
12542        );
12543    }
12544
12545    #[test]
12546    fn fonte_caminho_backslash_fires_before_shell_background() {
12547        // Cascade pin on the upstream backslash arm: a value carrying
12548        // both `\` and `&` (`"..\caixa-teia & sleep"` — the canonical
12549        // "I pasted a Windows-shell `cd ..\path & sleep` background-
12550        // launch chain") routes through `FonteCaminhoBackslash` not
12551        // `FonteCaminhoShellBackground`. The cross-host-OS-separator
12552        // divergence is the load-bearing axis on every probe-as-both
12553        // value (an author who removes the `\` is the root-cause edit;
12554        // the `&` falls away in the same edit since it's downstream of
12555        // the Windows-shell convention).
12556        let d = dep_with_fonte(DepSource::Path {
12557            caminho: "..\\caixa-teia & sleep".into(),
12558        });
12559        let err = d.validate().unwrap_err();
12560        assert!(
12561            matches!(err, DepError::FonteCaminhoBackslash { .. }),
12562            "got {err:?}",
12563        );
12564    }
12565
12566    #[test]
12567    fn fonte_caminho_control_char_fires_before_shell_background() {
12568        // Cascade pin on the embedded-control-byte arm: a value
12569        // carrying both a control byte and `&` (`"../foo\n&sleep"` —
12570        // the canonical paste-from-multiline-doc footgun where a
12571        // newline landed mid-caminho) routes through
12572        // `FonteCaminhoControlChar` not `FonteCaminhoShellBackground`.
12573        // The POSIX-syscall-rejected-byte / NUL-`CString::new`-fail
12574        // diagnostic is the load-bearing axis on every value that
12575        // probes positive for both — mirrors the cascade discipline on
12576        // every prior arm.
12577        let d = dep_with_fonte(DepSource::Path {
12578            caminho: "../foo\n&sleep".into(),
12579        });
12580        let err = d.validate().unwrap_err();
12581        assert!(
12582            matches!(err, DepError::FonteCaminhoControlChar { .. }),
12583            "got {err:?}",
12584        );
12585    }
12586
12587    #[test]
12588    fn fonte_caminho_absolute_fires_before_shell_background() {
12589        // Cascade pin on the load-bearing leading-byte arm: a leading
12590        // `/` value with embedded `&` (`"/etc/passwd & sleep"`) routes
12591        // through `FonteCaminhoAbsolute` not
12592        // `FonteCaminhoShellBackground` — the host-layout-leak
12593        // diagnostic is the load-bearing axis, the `&` byte is the
12594        // secondary observation. Same precedence logic as every prior
12595        // leading-byte arm.
12596        let d = dep_with_fonte(DepSource::Path {
12597            caminho: "/etc/passwd & sleep".into(),
12598        });
12599        let err = d.validate().unwrap_err();
12600        assert!(
12601            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
12602            "got {err:?}",
12603        );
12604    }
12605
12606    #[test]
12607    fn fonte_caminho_shell_background_fires_before_trailing_slash() {
12608        // Cascade pin on the immediate-successor arm: a value carrying
12609        // both `&` and a trailing `/` (`"../foo&sleep/"` — the
12610        // canonical "I tab-completed a path that already had a `&
12611        // sleep` background-launch tail" footgun) routes through
12612        // `FonteCaminhoShellBackground` not `FonteCaminhoTrailingSlash`.
12613        // The embedded shell-metachar is the more semantic-locating
12614        // axis (an author who removes the `&` typically also drops
12615        // the trailing separator since both are paste-from-shell
12616        // artifacts).
12617        let d = dep_with_fonte(DepSource::Path {
12618            caminho: "../foo&sleep/".into(),
12619        });
12620        let err = d.validate().unwrap_err();
12621        assert!(
12622            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
12623            "got {err:?}",
12624        );
12625    }
12626
12627    #[test]
12628    fn fonte_caminho_shell_background_diagnostic_carries_offending_dep_and_caminho() {
12629        // Diagnostic-shape pin (peer with
12630        // `fonte_caminho_shell_semicolon_diagnostic_carries_offending_dep_and_caminho`
12631        // on the closest single-byte peer arm): the error's Display
12632        // surfaces the offending `:nome` and the offending `:caminho`
12633        // verbatim, and names the shell-background / logical-AND
12634        // footgun explicitly so a `feira lint` run can render the
12635        // diagnostic without re-parsing.
12636        let d = dep_with_fonte(DepSource::Path {
12637            caminho: "../caixa-teia & sleep 1".into(),
12638        });
12639        let rendered = d.validate().unwrap_err().to_string();
12640        assert!(
12641            rendered.contains("caixa-teia"),
12642            "diagnostic must name the offending dep: {rendered}",
12643        );
12644        assert!(
12645            rendered.contains("../caixa-teia & sleep 1"),
12646            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
12647        );
12648        assert!(
12649            rendered.contains('&'),
12650            "diagnostic must reference the ampersand footgun: {rendered:?}",
12651        );
12652        assert!(
12653            rendered.contains("background") || rendered.contains("list-AND"),
12654            "diagnostic must name the shell-background / logical-AND footgun: {rendered:?}",
12655        );
12656    }
12657
12658    #[test]
12659    fn validate_rejects_path_fonte_with_caminho_carrying_backtick() {
12660        // The fail-before-pass-after pin for the canonical shell-
12661        // command-substitution paste footgun: an author copies a
12662        // POSIX legacy backticked one-liner (`"../caixa-teia/`whoami`"`
12663        // — the canonical "I pasted a path that included a `pwd`
12664        // / `whoami` / `date` legacy command-substitution expansion
12665        // out of a shell-history block") and silently passed every
12666        // prior arm (`Path::is_absolute` false on `..`, no control
12667        // bytes, no `\`, no `<` / `>`, no `|`, no `;`, no `&`, doesn't
12668        // end in `/`). The lacre embedded the value verbatim, the
12669        // resolver folded it through `Path::join` looking for a
12670        // literal `./../caixa-teia/`whoami`` subdirectory, and the
12671        // failure surfaced at resolve time with a non-self-locating
12672        // `No such file or directory` error. The new arm moves the
12673        // rejection to validate time and names the offending dep +
12674        // caminho verbatim.
12675        let d = dep_with_fonte(DepSource::Path {
12676            caminho: "../caixa-teia/`whoami`".into(),
12677        });
12678        let err = d.validate().unwrap_err();
12679        let DepError::FonteCaminhoShellCommandSubstitution { nome, caminho } = err else {
12680            panic!("expected FonteCaminhoShellCommandSubstitution, got {err:?}");
12681        };
12682        assert_eq!(nome, "caixa-teia");
12683        assert_eq!(caminho, "../caixa-teia/`whoami`");
12684    }
12685
12686    #[test]
12687    fn validate_rejects_path_fonte_with_caminho_carrying_leading_backtick() {
12688        // Leading-position backtick shape (``"`pwd`/caixa-teia"`` —
12689        // the canonical `<backtick>pwd<backtick>/path` working-
12690        // directory expansion shape every shell-side path-composition
12691        // idiom carries). Pinned separately from the embedded-byte
12692        // shape so the gate covers every position, not only mid-path.
12693        let d = dep_with_fonte(DepSource::Path {
12694            caminho: "`pwd`/caixa-teia".into(),
12695        });
12696        let err = d.validate().unwrap_err();
12697        assert!(
12698            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
12699            "got {err:?}",
12700        );
12701    }
12702
12703    #[test]
12704    fn validate_rejects_path_fonte_with_caminho_carrying_trailing_backtick() {
12705        // Trailing-position backtick shape (`"../caixa-teia`"` — the
12706        // degenerate "I selected an unbalanced backtick out of a
12707        // shell-history block" idiom that probes for the cascade's
12708        // last-byte handling). The trailing-`/` arm fires only on
12709        // last-byte `/`; an unbalanced trailing backtick must route
12710        // through this arm regardless of position.
12711        let d = dep_with_fonte(DepSource::Path {
12712            caminho: "../caixa-teia`".into(),
12713        });
12714        let err = d.validate().unwrap_err();
12715        assert!(
12716            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
12717            "got {err:?}",
12718        );
12719    }
12720
12721    #[test]
12722    fn validate_rejects_path_fonte_with_caminho_carrying_balanced_backtick_pair() {
12723        // The canonical balanced-pair shape (``"../<backtick>cat
12724        // /etc/passwd<backtick>"`` — the canonical CWE-78 shell-
12725        // command-injection paste idiom every shell-side hardening
12726        // guide enumerates first). The arm fires on the first
12727        // backtick encountered; pinned so a future arm that tries to
12728        // distinguish the opening from the closing byte doesn't break
12729        // the broader contract.
12730        let d = dep_with_fonte(DepSource::Path {
12731            caminho: "../`cat /etc/passwd`".into(),
12732        });
12733        let err = d.validate().unwrap_err();
12734        assert!(
12735            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
12736            "got {err:?}",
12737        );
12738    }
12739
12740    #[test]
12741    fn validate_accepts_path_fonte_with_caminho_carrying_no_backtick() {
12742        // The positive-control pin: the gate targets only the
12743        // backtick byte, never adjacent printable ASCII or POSIX-
12744        // valid bytes. The canonical relative POSIX path
12745        // (`"../caixa-teia"`) and a nested deeply-pathed variant with
12746        // adjacent printable punctuation
12747        // (`"../caixa-teia/sub-dir.v2"`) must continue to validate
12748        // cleanly so the gate doesn't widen to a "no printable
12749        // punctuation anywhere" sweep that would defeat the entire
12750        // path-fonte author surface.
12751        let d = dep_with_fonte(DepSource::Path {
12752            caminho: "../caixa-teia/sub-dir.v2".into(),
12753        });
12754        d.validate().unwrap();
12755    }
12756
12757    #[test]
12758    fn fonte_caminho_shell_background_fires_before_shell_command_substitution() {
12759        // Cascade pin on the immediate-predecessor arm: a value
12760        // carrying both `&` and a backtick (``"../caixa-teia &
12761        // <backtick>sleep 1<backtick>"`` — the canonical "I pasted a
12762        // `cmd & <backtick>sleep N<backtick>` background-launch +
12763        // command-substitution chain" footgun) routes through
12764        // `FonteCaminhoShellBackground` not
12765        // `FonteCaminhoShellCommandSubstitution`. The background-
12766        // launch tail is the more common shell-history paste idiom
12767        // on every probe-as-both value — same cascade discipline
12768        // every prior `:caminho` arm establishes.
12769        let d = dep_with_fonte(DepSource::Path {
12770            caminho: "../caixa-teia & `sleep 1`".into(),
12771        });
12772        let err = d.validate().unwrap_err();
12773        assert!(
12774            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
12775            "got {err:?}",
12776        );
12777    }
12778
12779    #[test]
12780    fn fonte_caminho_shell_semicolon_fires_before_shell_command_substitution() {
12781        // Cascade pin on the upstream shell-semicolon arm: a value
12782        // carrying both `;` and a backtick (``"../caixa-teia;
12783        // <backtick>whoami<backtick>"`` — the canonical "I pasted a
12784        // `cmd; <backtick>follow-up<backtick>` sequential-chain
12785        // footgun) routes through `FonteCaminhoShellSemicolon` not
12786        // `FonteCaminhoShellCommandSubstitution`. The sequential-
12787        // command-separator paste is the load-bearing root-cause
12788        // edit on every probe-as-both value.
12789        let d = dep_with_fonte(DepSource::Path {
12790            caminho: "../caixa-teia; `whoami`".into(),
12791        });
12792        let err = d.validate().unwrap_err();
12793        assert!(
12794            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
12795            "got {err:?}",
12796        );
12797    }
12798
12799    #[test]
12800    fn fonte_caminho_shell_pipe_fires_before_shell_command_substitution() {
12801        // Cascade pin on the upstream shell-pipe arm: a value
12802        // carrying both `|` and a backtick (``"../caixa-teia |
12803        // <backtick>tee log<backtick>"`` — the canonical pipeline-to-
12804        // command-substitution paste idiom) routes through
12805        // `FonteCaminhoShellPipe` not
12806        // `FonteCaminhoShellCommandSubstitution`. The pipeline-tail
12807        // paste is the load-bearing root-cause edit on every
12808        // probe-as-both value.
12809        let d = dep_with_fonte(DepSource::Path {
12810            caminho: "../caixa-teia | `tee log`".into(),
12811        });
12812        let err = d.validate().unwrap_err();
12813        assert!(
12814            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
12815            "got {err:?}",
12816        );
12817    }
12818
12819    #[test]
12820    fn fonte_caminho_shell_redirection_fires_before_shell_command_substitution() {
12821        // Cascade pin on the upstream shell-redirection arm: a value
12822        // carrying both `>` and a backtick (``"../caixa-teia>log
12823        // <backtick>date<backtick>"`` — the canonical "I pasted a
12824        // `cmd > log <backtick>date<backtick>` redirect-plus-
12825        // substitution chain" footgun) routes through
12826        // `FonteCaminhoShellRedirection` not
12827        // `FonteCaminhoShellCommandSubstitution`. The input/output
12828        // redirection metachar carries the more self-locating `byte`
12829        // payload (it names which of `<` or `>` triggered), so the
12830        // prior arm wins on every probe-as-both value.
12831        let d = dep_with_fonte(DepSource::Path {
12832            caminho: "../caixa-teia>log `date`".into(),
12833        });
12834        let err = d.validate().unwrap_err();
12835        assert!(
12836            matches!(
12837                err,
12838                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
12839            ),
12840            "got {err:?}",
12841        );
12842    }
12843
12844    #[test]
12845    fn fonte_caminho_backslash_fires_before_shell_command_substitution() {
12846        // Cascade pin on the upstream backslash arm: a value
12847        // carrying both `\` and a backtick (``"..\caixa-teia
12848        // <backtick>whoami<backtick>"`` — the canonical "I pasted a
12849        // Windows-shell `cd ..\path <backtick>whoami<backtick>`
12850        // chain") routes through `FonteCaminhoBackslash` not
12851        // `FonteCaminhoShellCommandSubstitution`. The cross-host-OS-
12852        // separator divergence is the load-bearing axis on every
12853        // probe-as-both value (an author who removes the `\` is the
12854        // root-cause edit; the backtick falls away in the same edit
12855        // since it's downstream of the Windows-shell convention).
12856        let d = dep_with_fonte(DepSource::Path {
12857            caminho: "..\\caixa-teia `whoami`".into(),
12858        });
12859        let err = d.validate().unwrap_err();
12860        assert!(
12861            matches!(err, DepError::FonteCaminhoBackslash { .. }),
12862            "got {err:?}",
12863        );
12864    }
12865
12866    #[test]
12867    fn fonte_caminho_control_char_fires_before_shell_command_substitution() {
12868        // Cascade pin on the embedded-control-byte arm: a value
12869        // carrying both a control byte and a backtick (`"../foo\n
12870        // `whoami`"` — the canonical paste-from-multiline-doc
12871        // footgun where a newline landed mid-caminho between two
12872        // paste fragments) routes through `FonteCaminhoControlChar`
12873        // not `FonteCaminhoShellCommandSubstitution`. The POSIX-
12874        // syscall-rejected-byte / NUL-`CString::new`-fail diagnostic
12875        // is the load-bearing axis on every value that probes
12876        // positive for both — mirrors the cascade discipline on
12877        // every prior arm.
12878        let d = dep_with_fonte(DepSource::Path {
12879            caminho: "../foo\n`whoami`".into(),
12880        });
12881        let err = d.validate().unwrap_err();
12882        assert!(
12883            matches!(err, DepError::FonteCaminhoControlChar { .. }),
12884            "got {err:?}",
12885        );
12886    }
12887
12888    #[test]
12889    fn fonte_caminho_absolute_fires_before_shell_command_substitution() {
12890        // Cascade pin on the load-bearing leading-byte arm: a
12891        // leading `/` value with embedded backtick (``"/etc/passwd
12892        // <backtick>whoami<backtick>"``) routes through
12893        // `FonteCaminhoAbsolute` not
12894        // `FonteCaminhoShellCommandSubstitution` — the host-layout-
12895        // leak diagnostic is the load-bearing axis, the backtick
12896        // byte is the secondary observation. Same precedence logic
12897        // as every prior leading-byte arm.
12898        let d = dep_with_fonte(DepSource::Path {
12899            caminho: "/etc/passwd `whoami`".into(),
12900        });
12901        let err = d.validate().unwrap_err();
12902        assert!(
12903            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
12904            "got {err:?}",
12905        );
12906    }
12907
12908    #[test]
12909    fn fonte_caminho_shell_command_substitution_fires_before_trailing_slash() {
12910        // Cascade pin on the immediate-successor arm: a value
12911        // carrying both a backtick and a trailing `/`
12912        // (``"../`whoami`/"`` — the canonical "I tab-completed a
12913        // path that already had a backticked `whoami` substitution
12914        // tail" footgun) routes through
12915        // `FonteCaminhoShellCommandSubstitution` not
12916        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar
12917        // is the more semantic-locating axis (an author who removes
12918        // the backtick typically also drops the trailing separator
12919        // since both are paste-from-shell artifacts).
12920        let d = dep_with_fonte(DepSource::Path {
12921            caminho: "../`whoami`/".into(),
12922        });
12923        let err = d.validate().unwrap_err();
12924        assert!(
12925            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
12926            "got {err:?}",
12927        );
12928    }
12929
12930    #[test]
12931    fn fonte_caminho_shell_command_substitution_diagnostic_carries_offending_dep_and_caminho() {
12932        // Diagnostic-shape pin (peer with
12933        // `fonte_caminho_shell_background_diagnostic_carries_offending_dep_and_caminho`
12934        // on the closest single-byte peer arm): the error's Display
12935        // surfaces the offending `:nome` and the offending `:caminho`
12936        // verbatim, and names the shell-command-substitution footgun
12937        // explicitly so a `feira lint` run can render the diagnostic
12938        // without re-parsing.
12939        let d = dep_with_fonte(DepSource::Path {
12940            caminho: "../caixa-teia/`whoami`".into(),
12941        });
12942        let rendered = d.validate().unwrap_err().to_string();
12943        assert!(
12944            rendered.contains("caixa-teia"),
12945            "diagnostic must name the offending dep: {rendered}",
12946        );
12947        assert!(
12948            rendered.contains("../caixa-teia/`whoami`"),
12949            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
12950        );
12951        assert!(
12952            rendered.contains('`'),
12953            "diagnostic must reference the backtick footgun: {rendered:?}",
12954        );
12955        assert!(
12956            rendered.contains("command-substitution"),
12957            "diagnostic must name the shell-command-substitution footgun: {rendered:?}",
12958        );
12959    }
12960
12961    #[test]
12962    fn validate_rejects_path_fonte_with_caminho_carrying_star_glob() {
12963        // The fail-before-pass-after pin for the canonical pathname-
12964        // expansion paste footgun: an author copies an `ls
12965        // ../caixa-teia/*` shell-listing tail into the `:caminho`
12966        // slot and silently passes every prior arm
12967        // (`Path::is_absolute` false on `..`, no control bytes, no
12968        // `\`, no `<` / `>`, no `|`, no `;`, no `&`, no backtick,
12969        // doesn't end in `/`). The lacre embedded the value
12970        // verbatim, the resolver folded it through `Path::join`
12971        // looking for a literal `./../caixa-teia/*` subdirectory,
12972        // and the failure surfaced at resolve time with a non-self-
12973        // locating `No such file or directory` error. The new arm
12974        // moves the rejection to validate time and names the
12975        // offending dep + caminho + byte verbatim.
12976        let d = dep_with_fonte(DepSource::Path {
12977            caminho: "../caixa-teia/*".into(),
12978        });
12979        let err = d.validate().unwrap_err();
12980        let DepError::FonteCaminhoShellGlob {
12981            nome,
12982            caminho,
12983            byte,
12984        } = err
12985        else {
12986            panic!("expected FonteCaminhoShellGlob, got {err:?}");
12987        };
12988        assert_eq!(nome, "caixa-teia");
12989        assert_eq!(caminho, "../caixa-teia/*");
12990        assert_eq!(byte, b'*');
12991    }
12992
12993    #[test]
12994    fn validate_rejects_path_fonte_with_caminho_carrying_question_glob() {
12995        // The symmetric single-char-wildcard paste shape
12996        // (`"../foo?"` — the canonical "I copied a `rm foo?` line
12997        // out of shell history" idiom). Pinned separately from the
12998        // `*` shape so the gate's contract is "any `*` or `?`
12999        // anywhere", not single-byte coverage.
13000        let d = dep_with_fonte(DepSource::Path {
13001            caminho: "../foo?".into(),
13002        });
13003        let err = d.validate().unwrap_err();
13004        let DepError::FonteCaminhoShellGlob { byte, .. } = err else {
13005            panic!("expected FonteCaminhoShellGlob, got {err:?}");
13006        };
13007        assert_eq!(byte, b'?');
13008    }
13009
13010    #[test]
13011    fn validate_rejects_path_fonte_with_caminho_carrying_leading_star_glob() {
13012        // Leading-position `*` shape (`"*/caixa-teia"` — the
13013        // degenerate "I selected only the wildcard prefix out of a
13014        // shell-glob expression" idiom). Pinned separately from the
13015        // embedded-byte shapes so the gate covers every position,
13016        // not only mid-path.
13017        let d = dep_with_fonte(DepSource::Path {
13018            caminho: "*/caixa-teia".into(),
13019        });
13020        let err = d.validate().unwrap_err();
13021        assert!(
13022            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13023            "got {err:?}",
13024        );
13025    }
13026
13027    #[test]
13028    fn validate_rejects_path_fonte_with_caminho_carrying_double_star_recursive_glob() {
13029        // The bash/zsh `globstar` recursive-glob shape
13030        // (`"../caixa-teia/**/foo"` — the canonical "I copied a
13031        // `find ../caixa-teia/**/foo` recursive expansion" idiom).
13032        // The arm fires on the first `*` encountered; pinned so a
13033        // future arm that tries to distinguish single `*` from
13034        // double `**` doesn't break the broader contract.
13035        let d = dep_with_fonte(DepSource::Path {
13036            caminho: "../caixa-teia/**/foo".into(),
13037        });
13038        let err = d.validate().unwrap_err();
13039        assert!(
13040            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13041            "got {err:?}",
13042        );
13043    }
13044
13045    #[test]
13046    fn validate_rejects_path_fonte_with_caminho_carrying_dotted_extension_glob() {
13047        // The canonical extension-glob shape (`"../caixa-teia/*.lisp"`
13048        // — the "I selected `*.lisp` to mean every Lisp source file
13049        // in the dep root" footgun the prior arms structurally
13050        // cannot catch since `.` is a POSIX-valid path-component
13051        // byte). Pinned so the gate's contract covers the most
13052        // idiomatic glob-paste shape every author meets first.
13053        let d = dep_with_fonte(DepSource::Path {
13054            caminho: "../caixa-teia/*.lisp".into(),
13055        });
13056        let err = d.validate().unwrap_err();
13057        assert!(
13058            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13059            "got {err:?}",
13060        );
13061    }
13062
13063    #[test]
13064    fn validate_accepts_path_fonte_with_caminho_carrying_no_glob() {
13065        // The positive-control pin: the gate targets only `*` /
13066        // `?`, never adjacent printable ASCII or POSIX-valid bytes.
13067        // The canonical relative POSIX path (`"../caixa-teia"`) and
13068        // a nested deeply-pathed variant with adjacent printable
13069        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue
13070        // to validate cleanly so the gate doesn't widen to a "no
13071        // printable punctuation anywhere" sweep that would defeat
13072        // the entire path-fonte author surface.
13073        let d = dep_with_fonte(DepSource::Path {
13074            caminho: "../caixa-teia/sub-dir.v2".into(),
13075        });
13076        d.validate().unwrap();
13077    }
13078
13079    #[test]
13080    fn fonte_caminho_shell_command_substitution_fires_before_shell_glob() {
13081        // Cascade pin on the immediate-predecessor arm: a value
13082        // carrying both a backtick and `*` (``"../`whoami`/*"`` —
13083        // the canonical "I pasted a `cd <backtick>whoami<backtick>/*`
13084        // command-substitution + glob chain") routes through
13085        // `FonteCaminhoShellCommandSubstitution` not
13086        // `FonteCaminhoShellGlob`. The CWE-78 shell-command-
13087        // injection vector is the load-bearing root-cause edit on
13088        // every probe-as-both value — same cascade discipline every
13089        // prior `:caminho` arm establishes.
13090        let d = dep_with_fonte(DepSource::Path {
13091            caminho: "../`whoami`/*".into(),
13092        });
13093        let err = d.validate().unwrap_err();
13094        assert!(
13095            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
13096            "got {err:?}",
13097        );
13098    }
13099
13100    #[test]
13101    fn fonte_caminho_shell_background_fires_before_shell_glob() {
13102        // Cascade pin on the upstream shell-background arm: a value
13103        // carrying both `&` and `*` (`"../caixa-teia & ls /*"` — the
13104        // canonical "I pasted a `cmd & ls /*` background + glob
13105        // chain" footgun) routes through `FonteCaminhoShellBackground`
13106        // not `FonteCaminhoShellGlob`. The background-launch tail is
13107        // the load-bearing root-cause edit on every probe-as-both
13108        // value.
13109        let d = dep_with_fonte(DepSource::Path {
13110            caminho: "../caixa-teia & ls /*".into(),
13111        });
13112        let err = d.validate().unwrap_err();
13113        assert!(
13114            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
13115            "got {err:?}",
13116        );
13117    }
13118
13119    #[test]
13120    fn fonte_caminho_shell_semicolon_fires_before_shell_glob() {
13121        // Cascade pin on the upstream shell-semicolon arm: a value
13122        // carrying both `;` and `*` (`"../caixa-teia; rm *"` — the
13123        // canonical sequential-cleanup + glob paste idiom) routes
13124        // through `FonteCaminhoShellSemicolon` not
13125        // `FonteCaminhoShellGlob`. The sequential-command-separator
13126        // paste is the load-bearing root-cause edit on every
13127        // probe-as-both value.
13128        let d = dep_with_fonte(DepSource::Path {
13129            caminho: "../caixa-teia; rm *".into(),
13130        });
13131        let err = d.validate().unwrap_err();
13132        assert!(
13133            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
13134            "got {err:?}",
13135        );
13136    }
13137
13138    #[test]
13139    fn fonte_caminho_shell_pipe_fires_before_shell_glob() {
13140        // Cascade pin on the upstream shell-pipe arm: a value
13141        // carrying both `|` and `*` (`"../caixa-teia | ls *"` — the
13142        // canonical pipeline-to-glob paste idiom) routes through
13143        // `FonteCaminhoShellPipe` not `FonteCaminhoShellGlob`. The
13144        // pipeline-tail paste is the load-bearing root-cause edit
13145        // on every probe-as-both value.
13146        let d = dep_with_fonte(DepSource::Path {
13147            caminho: "../caixa-teia | ls *".into(),
13148        });
13149        let err = d.validate().unwrap_err();
13150        assert!(
13151            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
13152            "got {err:?}",
13153        );
13154    }
13155
13156    #[test]
13157    fn fonte_caminho_shell_redirection_fires_before_shell_glob() {
13158        // Cascade pin on the upstream shell-redirection arm: a value
13159        // carrying both `>` and `*` (`"../caixa-teia>log *"` — the
13160        // canonical "I pasted a `cmd > log *` redirect-plus-glob
13161        // chain" footgun) routes through
13162        // `FonteCaminhoShellRedirection` not `FonteCaminhoShellGlob`.
13163        // The input/output redirection metachar carries the more
13164        // self-locating `byte` payload (it names which of `<` or `>`
13165        // triggered), so the prior arm wins on every probe-as-both
13166        // value.
13167        let d = dep_with_fonte(DepSource::Path {
13168            caminho: "../caixa-teia>log *".into(),
13169        });
13170        let err = d.validate().unwrap_err();
13171        assert!(
13172            matches!(
13173                err,
13174                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
13175            ),
13176            "got {err:?}",
13177        );
13178    }
13179
13180    #[test]
13181    fn fonte_caminho_backslash_fires_before_shell_glob() {
13182        // Cascade pin on the upstream backslash arm: a value
13183        // carrying both `\` and `*` (`"..\caixa-teia\*"` — the
13184        // canonical "I pasted a Windows-shell `cd ..\path\*` glob
13185        // expression" footgun) routes through
13186        // `FonteCaminhoBackslash` not `FonteCaminhoShellGlob`. The
13187        // cross-host-OS-separator divergence is the load-bearing
13188        // axis on every probe-as-both value (an author who removes
13189        // the `\` is the root-cause edit; the `*` falls away in the
13190        // same edit since it's downstream of the Windows-shell
13191        // convention).
13192        let d = dep_with_fonte(DepSource::Path {
13193            caminho: "..\\caixa-teia\\*".into(),
13194        });
13195        let err = d.validate().unwrap_err();
13196        assert!(
13197            matches!(err, DepError::FonteCaminhoBackslash { .. }),
13198            "got {err:?}",
13199        );
13200    }
13201
13202    #[test]
13203    fn fonte_caminho_control_char_fires_before_shell_glob() {
13204        // Cascade pin on the embedded-control-byte arm: a value
13205        // carrying both a control byte and `*` (`"../foo\n*"` — the
13206        // canonical paste-from-multiline-doc footgun where a
13207        // newline landed mid-caminho between two paste fragments)
13208        // routes through `FonteCaminhoControlChar` not
13209        // `FonteCaminhoShellGlob`. The POSIX-syscall-rejected-byte /
13210        // NUL-`CString::new`-fail diagnostic is the load-bearing
13211        // axis on every value that probes positive for both —
13212        // mirrors the cascade discipline on every prior arm.
13213        let d = dep_with_fonte(DepSource::Path {
13214            caminho: "../foo\n*".into(),
13215        });
13216        let err = d.validate().unwrap_err();
13217        assert!(
13218            matches!(err, DepError::FonteCaminhoControlChar { .. }),
13219            "got {err:?}",
13220        );
13221    }
13222
13223    #[test]
13224    fn fonte_caminho_absolute_fires_before_shell_glob() {
13225        // Cascade pin on the load-bearing leading-byte arm: a
13226        // leading `/` value with embedded `*` (`"/etc/*"`) routes
13227        // through `FonteCaminhoAbsolute` not `FonteCaminhoShellGlob`
13228        // — the host-layout-leak diagnostic is the load-bearing
13229        // axis, the glob byte is the secondary observation. Same
13230        // precedence logic as every prior leading-byte arm.
13231        let d = dep_with_fonte(DepSource::Path {
13232            caminho: "/etc/*".into(),
13233        });
13234        let err = d.validate().unwrap_err();
13235        assert!(
13236            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
13237            "got {err:?}",
13238        );
13239    }
13240
13241    #[test]
13242    fn fonte_caminho_shell_glob_fires_before_trailing_slash() {
13243        // Cascade pin on the immediate-successor arm: a value
13244        // carrying both `*` and a trailing `/` (`"../foo*/"` — the
13245        // canonical "I tab-completed a path that already had a
13246        // glob-expansion tail" footgun) routes through
13247        // `FonteCaminhoShellGlob` not `FonteCaminhoTrailingSlash`.
13248        // The embedded shell-metachar is the more semantic-locating
13249        // axis (an author who removes the `*` typically also drops
13250        // the trailing separator since both are paste-from-shell
13251        // artifacts).
13252        let d = dep_with_fonte(DepSource::Path {
13253            caminho: "../foo*/".into(),
13254        });
13255        let err = d.validate().unwrap_err();
13256        assert!(
13257            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13258            "got {err:?}",
13259        );
13260    }
13261
13262    #[test]
13263    fn fonte_caminho_shell_glob_diagnostic_carries_offending_dep_caminho_and_byte() {
13264        // Diagnostic-shape pin (peer with
13265        // `fonte_caminho_shell_redirection_diagnostic_*` on the
13266        // closest two-byte peer arm): the error's Display surfaces
13267        // the offending `:nome`, the offending `:caminho` verbatim,
13268        // the offending byte's hex / character form, and names the
13269        // shell-glob / pathname-expansion footgun explicitly so a
13270        // `feira lint` run can render the diagnostic without
13271        // re-parsing.
13272        let d = dep_with_fonte(DepSource::Path {
13273            caminho: "../caixa-teia/*.lisp".into(),
13274        });
13275        let rendered = d.validate().unwrap_err().to_string();
13276        assert!(
13277            rendered.contains("caixa-teia"),
13278            "diagnostic must name the offending dep: {rendered}",
13279        );
13280        assert!(
13281            rendered.contains("../caixa-teia/*.lisp"),
13282            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
13283        );
13284        assert!(
13285            rendered.contains("0x2a"),
13286            "diagnostic must surface the offending byte hex: {rendered:?}",
13287        );
13288        assert!(
13289            rendered.contains("glob"),
13290            "diagnostic must name the shell-glob footgun: {rendered:?}",
13291        );
13292        assert!(
13293            rendered.contains("pathname-expansion"),
13294            "diagnostic must reference the POSIX pathname-expansion vocabulary: {rendered:?}",
13295        );
13296    }
13297
13298    #[test]
13299    fn validate_rejects_path_fonte_with_caminho_carrying_modern_command_substitution() {
13300        // The fail-before-pass-after pin for the canonical modern-Bourne
13301        // command-substitution paste footgun: an author copies a
13302        // `cd ../caixa-teia/$(date)/build` shell-history one-liner whose
13303        // `$(<cmd>)` expansion would land the current date as a
13304        // subdirectory name and silently passed every prior arm
13305        // (`Path::is_absolute` false on `..`, no control bytes, no `\`,
13306        // no `<` / `>`, no `|`, no `;`, no `&`, no backtick, no `*` /
13307        // `?`, doesn't end in `/`; the leading-`$` f4efe9c
13308        // `FonteCaminhoVarExpansion` arm doesn't fire because the `$`
13309        // sits mid-path). The lacre embedded the value verbatim, the
13310        // resolver folded it through `Path::join` looking for a literal
13311        // `./../caixa-teia/$(date)/build` subdirectory, and the failure
13312        // surfaced at resolve time with a non-self-locating `No such
13313        // file or directory` error. The new arm moves the rejection to
13314        // validate time and names the offending dep + caminho + byte
13315        // verbatim. The arm fires on the first `(` encountered (the
13316        // opening byte of `$(date)`).
13317        let d = dep_with_fonte(DepSource::Path {
13318            caminho: "../caixa-teia/$(date)/build".into(),
13319        });
13320        let err = d.validate().unwrap_err();
13321        let DepError::FonteCaminhoShellSubshellGrouping {
13322            nome,
13323            caminho,
13324            byte,
13325        } = err
13326        else {
13327            panic!("expected FonteCaminhoShellSubshellGrouping, got {err:?}");
13328        };
13329        assert_eq!(nome, "caixa-teia");
13330        assert_eq!(caminho, "../caixa-teia/$(date)/build");
13331        assert_eq!(byte, b'(');
13332    }
13333
13334    #[test]
13335    fn validate_rejects_path_fonte_with_caminho_carrying_close_paren() {
13336        // The symmetric close-paren paste shape (`"../caixa-teia)"` —
13337        // the degenerate "I selected an unbalanced closing paren out of
13338        // a shell-history block" idiom that probes for the cascade's
13339        // last-byte handling on a value carrying only the closing byte).
13340        // Pinned separately from the open-paren shape so the gate's
13341        // contract is "any `(` or `)` anywhere", not single-byte
13342        // coverage. Mirrors the peer `validate_rejects_path_fonte_with_\
13343        // caminho_carrying_question_glob` shape on the immediate-
13344        // predecessor `FonteCaminhoShellGlob` arm.
13345        let d = dep_with_fonte(DepSource::Path {
13346            caminho: "../caixa-teia)".into(),
13347        });
13348        let err = d.validate().unwrap_err();
13349        let DepError::FonteCaminhoShellSubshellGrouping { byte, .. } = err else {
13350            panic!("expected FonteCaminhoShellSubshellGrouping, got {err:?}");
13351        };
13352        assert_eq!(byte, b')');
13353    }
13354
13355    #[test]
13356    fn validate_rejects_path_fonte_with_caminho_carrying_leading_open_paren() {
13357        // Leading-position `(` shape (`"(cd foo)/caixa-teia"` — the
13358        // canonical "I selected a `(cd foo)` subshell-grouping prefix
13359        // out of a `(cd foo) && cmd` shell-history one-liner" idiom).
13360        // Pinned separately from the embedded-byte shape so the gate
13361        // covers every position, not only mid-path.
13362        let d = dep_with_fonte(DepSource::Path {
13363            caminho: "(cd foo)/caixa-teia".into(),
13364        });
13365        let err = d.validate().unwrap_err();
13366        assert!(
13367            matches!(
13368                err,
13369                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
13370            ),
13371            "got {err:?}",
13372        );
13373    }
13374
13375    #[test]
13376    fn validate_rejects_path_fonte_with_caminho_carrying_balanced_subshell_grouping_pair() {
13377        // The canonical balanced-pair shape (`"../(pwd)/caixa-teia"`
13378        // — the canonical "I copied a `(pwd)` working-directory-probe
13379        // subshell-grouping idiom every shell-history block carries"
13380        // footgun). The value carries no other cascade-preceding
13381        // shell metachar (`&` / `;` / `|` / `<` / `>` / backtick /
13382        // `*` / `?`) so the arm fires on the first `(` encountered;
13383        // pinned so a future arm that tries to distinguish the
13384        // opening from the closing byte doesn't break the broader
13385        // contract. Mirrors the peer
13386        // `validate_rejects_path_fonte_with_caminho_carrying_balanced_\
13387        // backtick_pair` shape on the upstream `FonteCaminhoShell\
13388        // CommandSubstitution` arm.
13389        let d = dep_with_fonte(DepSource::Path {
13390            caminho: "../(pwd)/caixa-teia".into(),
13391        });
13392        let err = d.validate().unwrap_err();
13393        assert!(
13394            matches!(
13395                err,
13396                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
13397            ),
13398            "got {err:?}",
13399        );
13400    }
13401
13402    #[test]
13403    fn validate_accepts_path_fonte_with_caminho_carrying_no_subshell_grouping() {
13404        // The positive-control pin: the gate targets only `(` / `)`,
13405        // never adjacent printable ASCII or POSIX-valid bytes. The
13406        // canonical relative POSIX path (`"../caixa-teia"`) and a
13407        // nested deeply-pathed variant with adjacent printable
13408        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue to
13409        // validate cleanly so the gate doesn't widen to a "no printable
13410        // punctuation anywhere" sweep that would defeat the entire
13411        // path-fonte author surface.
13412        let d = dep_with_fonte(DepSource::Path {
13413            caminho: "../caixa-teia/sub-dir.v2".into(),
13414        });
13415        d.validate().unwrap();
13416    }
13417
13418    #[test]
13419    fn fonte_caminho_shell_glob_fires_before_shell_subshell_grouping() {
13420        // Cascade pin on the immediate-predecessor arm: a value
13421        // carrying both `*` and `(` (`"../caixa-teia/*(date)"` — the
13422        // canonical "I pasted a glob expansion followed by a
13423        // subshell-grouping tail" footgun) routes through
13424        // `FonteCaminhoShellGlob` not
13425        // `FonteCaminhoShellSubshellGrouping`. The pathname-expansion
13426        // shape is the more common shell-history paste idiom on every
13427        // probe-as-both value — same cascade discipline every prior
13428        // `:caminho` arm establishes.
13429        let d = dep_with_fonte(DepSource::Path {
13430            caminho: "../caixa-teia/*(date)".into(),
13431        });
13432        let err = d.validate().unwrap_err();
13433        assert!(
13434            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13435            "got {err:?}",
13436        );
13437    }
13438
13439    #[test]
13440    fn fonte_caminho_shell_command_substitution_fires_before_shell_subshell_grouping() {
13441        // Cascade pin on the upstream shell-command-substitution arm: a
13442        // value carrying both a backtick and `(` (``"../`whoami`/$(date)"``
13443        // — the canonical "I pasted a legacy-backtick + modern-paren
13444        // command-substitution chain" footgun) routes through
13445        // `FonteCaminhoShellCommandSubstitution` not
13446        // `FonteCaminhoShellSubshellGrouping`. The CWE-78 shell-
13447        // command-injection vector is the load-bearing root-cause edit
13448        // on every probe-as-both value.
13449        let d = dep_with_fonte(DepSource::Path {
13450            caminho: "../`whoami`/$(date)".into(),
13451        });
13452        let err = d.validate().unwrap_err();
13453        assert!(
13454            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
13455            "got {err:?}",
13456        );
13457    }
13458
13459    #[test]
13460    fn fonte_caminho_shell_background_fires_before_shell_subshell_grouping() {
13461        // Cascade pin on the upstream shell-background arm: a value
13462        // carrying both `&` and `(` (`"../caixa-teia & (cd foo)"` —
13463        // the canonical "I pasted a `cmd & (cd foo)` background-launch
13464        // + subshell-grouping chain" footgun) routes through
13465        // `FonteCaminhoShellBackground` not
13466        // `FonteCaminhoShellSubshellGrouping`. The background-launch
13467        // tail is the load-bearing root-cause edit on every probe-as-
13468        // both value.
13469        let d = dep_with_fonte(DepSource::Path {
13470            caminho: "../caixa-teia & (cd foo)".into(),
13471        });
13472        let err = d.validate().unwrap_err();
13473        assert!(
13474            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
13475            "got {err:?}",
13476        );
13477    }
13478
13479    #[test]
13480    fn fonte_caminho_shell_semicolon_fires_before_shell_subshell_grouping() {
13481        // Cascade pin on the upstream shell-semicolon arm: a value
13482        // carrying both `;` and `(` (`"../caixa-teia; (cd foo)"` —
13483        // the canonical sequential-cleanup + subshell-grouping paste
13484        // idiom) routes through `FonteCaminhoShellSemicolon` not
13485        // `FonteCaminhoShellSubshellGrouping`. The sequential-command-
13486        // separator paste is the load-bearing root-cause edit on
13487        // every probe-as-both value.
13488        let d = dep_with_fonte(DepSource::Path {
13489            caminho: "../caixa-teia; (cd foo)".into(),
13490        });
13491        let err = d.validate().unwrap_err();
13492        assert!(
13493            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
13494            "got {err:?}",
13495        );
13496    }
13497
13498    #[test]
13499    fn fonte_caminho_shell_pipe_fires_before_shell_subshell_grouping() {
13500        // Cascade pin on the upstream shell-pipe arm: a value carrying
13501        // both `|` and `(` (`"../caixa-teia | (tee log)"` — the
13502        // canonical pipeline-to-subshell-grouping paste idiom) routes
13503        // through `FonteCaminhoShellPipe` not
13504        // `FonteCaminhoShellSubshellGrouping`. The pipeline-tail paste
13505        // is the load-bearing root-cause edit on every probe-as-both
13506        // value.
13507        let d = dep_with_fonte(DepSource::Path {
13508            caminho: "../caixa-teia | (tee log)".into(),
13509        });
13510        let err = d.validate().unwrap_err();
13511        assert!(
13512            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
13513            "got {err:?}",
13514        );
13515    }
13516
13517    #[test]
13518    fn fonte_caminho_shell_redirection_fires_before_shell_subshell_grouping() {
13519        // Cascade pin on the upstream shell-redirection arm: a value
13520        // carrying both `>` and `(` (`"../caixa-teia>log (cd foo)"` —
13521        // the canonical "I pasted a `cmd > log (cd foo)` redirect-
13522        // plus-subshell-grouping chain" footgun) routes through
13523        // `FonteCaminhoShellRedirection` not
13524        // `FonteCaminhoShellSubshellGrouping`. The input/output
13525        // redirection metachar carries the more self-locating `byte`
13526        // payload (it names which of `<` or `>` triggered), so the
13527        // prior arm wins on every probe-as-both value.
13528        let d = dep_with_fonte(DepSource::Path {
13529            caminho: "../caixa-teia>log (cd foo)".into(),
13530        });
13531        let err = d.validate().unwrap_err();
13532        assert!(
13533            matches!(
13534                err,
13535                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
13536            ),
13537            "got {err:?}",
13538        );
13539    }
13540
13541    #[test]
13542    fn fonte_caminho_backslash_fires_before_shell_subshell_grouping() {
13543        // Cascade pin on the upstream backslash arm: a value carrying
13544        // both `\` and `(` (`"..\caixa-teia\(cd foo)"` — the canonical
13545        // "I pasted a Windows-shell `cd ..\path\(cmd)` chain") routes
13546        // through `FonteCaminhoBackslash` not
13547        // `FonteCaminhoShellSubshellGrouping`. The cross-host-OS-
13548        // separator divergence is the load-bearing axis on every
13549        // probe-as-both value (an author who removes the `\` is the
13550        // root-cause edit; the `(` falls away in the same edit since
13551        // it's downstream of the Windows-shell convention).
13552        let d = dep_with_fonte(DepSource::Path {
13553            caminho: "..\\caixa-teia\\(cd foo)".into(),
13554        });
13555        let err = d.validate().unwrap_err();
13556        assert!(
13557            matches!(err, DepError::FonteCaminhoBackslash { .. }),
13558            "got {err:?}",
13559        );
13560    }
13561
13562    #[test]
13563    fn fonte_caminho_control_char_fires_before_shell_subshell_grouping() {
13564        // Cascade pin on the embedded-control-byte arm: a value
13565        // carrying both a control byte and `(` (`"../foo\n(cd bar)"` —
13566        // the canonical paste-from-multiline-doc footgun where a
13567        // newline landed mid-caminho between two paste fragments)
13568        // routes through `FonteCaminhoControlChar` not
13569        // `FonteCaminhoShellSubshellGrouping`. The POSIX-syscall-
13570        // rejected-byte / NUL-`CString::new`-fail diagnostic is the
13571        // load-bearing axis on every value that probes positive for
13572        // both — mirrors the cascade discipline on every prior arm.
13573        let d = dep_with_fonte(DepSource::Path {
13574            caminho: "../foo\n(cd bar)".into(),
13575        });
13576        let err = d.validate().unwrap_err();
13577        assert!(
13578            matches!(err, DepError::FonteCaminhoControlChar { .. }),
13579            "got {err:?}",
13580        );
13581    }
13582
13583    #[test]
13584    fn fonte_caminho_absolute_fires_before_shell_subshell_grouping() {
13585        // Cascade pin on the load-bearing leading-byte arm: a leading
13586        // `/` value with embedded `(` (`"/etc/(cd foo)"`) routes
13587        // through `FonteCaminhoAbsolute` not
13588        // `FonteCaminhoShellSubshellGrouping` — the host-layout-leak
13589        // diagnostic is the load-bearing axis, the subshell-grouping
13590        // byte is the secondary observation. Same precedence logic as
13591        // every prior leading-byte arm.
13592        let d = dep_with_fonte(DepSource::Path {
13593            caminho: "/etc/(cd foo)".into(),
13594        });
13595        let err = d.validate().unwrap_err();
13596        assert!(
13597            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
13598            "got {err:?}",
13599        );
13600    }
13601
13602    #[test]
13603    fn fonte_caminho_var_expansion_fires_before_shell_subshell_grouping() {
13604        // Cascade pin on the upstream leading-`$` var-expansion arm: a
13605        // value carrying both a leading `$` and a `(` (`"$(date)/\
13606        // caixa-teia"` — the canonical "I pasted a `$(date)` modern-
13607        // command-substitution at the head of a sibling-workspace
13608        // path" footgun) routes through `FonteCaminhoVarExpansion` not
13609        // `FonteCaminhoShellSubshellGrouping`. The leading-byte
13610        // shell-variable-expansion is the more self-locating diagnostic
13611        // on values that probe as both — same load-bearing-leading-
13612        // byte cascade discipline every prior `:caminho` arm
13613        // establishes. Closing both halves of `$(<cmd>)` structurally
13614        // (leading `$` here, trailing `)` on the new arm) excludes the
13615        // entire modern Bourne command-substitution surface from the
13616        // typed `:caminho` accepted set; the cascade preserves the
13617        // narrower leading-byte diagnostic on values that probe both
13618        // halves at the canonical leading position.
13619        let d = dep_with_fonte(DepSource::Path {
13620            caminho: "$(date)/caixa-teia".into(),
13621        });
13622        let err = d.validate().unwrap_err();
13623        assert!(
13624            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
13625            "got {err:?}",
13626        );
13627    }
13628
13629    #[test]
13630    fn fonte_caminho_shell_subshell_grouping_fires_before_trailing_slash() {
13631        // Cascade pin on the immediate-successor arm: a value carrying
13632        // both `(` and a trailing `/` (`"../(cd foo)/"` — the canonical
13633        // "I tab-completed a path that already had a subshell-grouping
13634        // expansion tail" footgun) routes through
13635        // `FonteCaminhoShellSubshellGrouping` not
13636        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar is
13637        // the more semantic-locating axis (an author who removes the
13638        // `(` typically also drops the trailing separator since both
13639        // are paste-from-shell artifacts).
13640        let d = dep_with_fonte(DepSource::Path {
13641            caminho: "../(cd foo)/".into(),
13642        });
13643        let err = d.validate().unwrap_err();
13644        assert!(
13645            matches!(
13646                err,
13647                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
13648            ),
13649            "got {err:?}",
13650        );
13651    }
13652
13653    #[test]
13654    fn fonte_caminho_shell_subshell_grouping_diagnostic_carries_offending_dep_caminho_and_byte() {
13655        // Diagnostic-shape pin (peer with
13656        // `fonte_caminho_shell_glob_diagnostic_carries_offending_dep_caminho_and_byte`
13657        // on the closest two-byte peer arm): the error's Display
13658        // surfaces the offending `:nome`, the offending `:caminho`
13659        // verbatim, the offending byte's hex / character form, and
13660        // names the shell-subshell-grouping footgun explicitly so a
13661        // `feira lint` run can render the diagnostic without re-
13662        // parsing.
13663        let d = dep_with_fonte(DepSource::Path {
13664            caminho: "../caixa-teia/$(date)/build".into(),
13665        });
13666        let rendered = d.validate().unwrap_err().to_string();
13667        assert!(
13668            rendered.contains("caixa-teia"),
13669            "diagnostic must name the offending dep: {rendered}",
13670        );
13671        assert!(
13672            rendered.contains("../caixa-teia/$(date)/build"),
13673            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
13674        );
13675        assert!(
13676            rendered.contains("0x28"),
13677            "diagnostic must surface the offending byte hex: {rendered:?}",
13678        );
13679        assert!(
13680            rendered.contains("subshell-grouping"),
13681            "diagnostic must name the shell-subshell-grouping footgun: {rendered:?}",
13682        );
13683        assert!(
13684            rendered.contains("command-substitution"),
13685            "diagnostic must reference the `$(<cmd>)` command-substitution vocabulary: \
13686             {rendered:?}",
13687        );
13688    }
13689
13690    // ── shell-brace-expansion / URI-Template-placeholder arm ───────────
13691    //
13692    // Peer with the prior `FonteCaminhoShellSubshellGrouping` (`(` /
13693    // `)`) byte-pair arm: the same per-byte cascade with the same
13694    // self-locating `byte: u8` diagnostic on the orthogonal `{` /
13695    // `}` brace-expansion / URI-Template placeholder axis. The peer
13696    // [`crate::render::is_git_repo_url`] (42d8f9d) closes the same
13697    // byte pair on the sibling `:fonte :repo` axis under the same
13698    // banner.
13699
13700    #[test]
13701    fn validate_rejects_path_fonte_with_caminho_carrying_brace_expansion_fan_across_siblings() {
13702        // The fail-before-pass-after pin for the canonical paste-from-
13703        // shell-history brace-expansion footgun: an author copies a
13704        // `cd ../{caixa-teia,caixa-helm}/build` shell-history one-
13705        // liner whose `{a,b}` brace expansion fans across two siblings
13706        // and silently passed every prior arm (`Path::is_absolute`
13707        // false on `..`, no control bytes, no `\`, no `<` / `>`, no
13708        // `|`, no `;`, no `&`, no backtick, no `*` / `?`, no `(` /
13709        // `)`, doesn't end in `/`; the leading-`$` f4efe9c
13710        // `FonteCaminhoVarExpansion` arm doesn't fire because the
13711        // value starts with `..` not `$`). The lacre embedded the
13712        // value verbatim, the resolver folded it through `Path::join`
13713        // looking for a literal `./../{caixa-teia,caixa-helm}/build`
13714        // subdirectory, and the failure surfaced at resolve time with
13715        // a non-self-locating `No such file or directory` error. The
13716        // new arm moves the rejection to validate time and names the
13717        // offending dep + caminho + byte verbatim. The arm fires on
13718        // the first `{` encountered.
13719        let d = dep_with_fonte(DepSource::Path {
13720            caminho: "../{caixa-teia,caixa-helm}/build".into(),
13721        });
13722        let err = d.validate().unwrap_err();
13723        let DepError::FonteCaminhoShellBraceExpansion {
13724            nome,
13725            caminho,
13726            byte,
13727        } = err
13728        else {
13729            panic!("expected FonteCaminhoShellBraceExpansion, got {err:?}");
13730        };
13731        assert_eq!(nome, "caixa-teia");
13732        assert_eq!(caminho, "../{caixa-teia,caixa-helm}/build");
13733        assert_eq!(byte, b'{');
13734    }
13735
13736    #[test]
13737    fn validate_rejects_path_fonte_with_caminho_carrying_close_brace() {
13738        // The symmetric close-brace paste shape (`"../caixa-teia}"` —
13739        // the degenerate "I selected an unbalanced closing brace out
13740        // of a shell-history block" idiom that probes for the
13741        // cascade's last-byte handling on a value carrying only the
13742        // closing byte). Pinned separately from the open-brace shape
13743        // so the gate's contract is "any `{` or `}` anywhere", not
13744        // single-byte coverage. Mirrors the peer
13745        // `validate_rejects_path_fonte_with_caminho_carrying_close_paren`
13746        // shape on the immediate-predecessor `FonteCaminhoShellSubshellGrouping`
13747        // arm.
13748        let d = dep_with_fonte(DepSource::Path {
13749            caminho: "../caixa-teia}".into(),
13750        });
13751        let err = d.validate().unwrap_err();
13752        let DepError::FonteCaminhoShellBraceExpansion { byte, .. } = err else {
13753            panic!("expected FonteCaminhoShellBraceExpansion, got {err:?}");
13754        };
13755        assert_eq!(byte, b'}');
13756    }
13757
13758    #[test]
13759    fn validate_rejects_path_fonte_with_caminho_carrying_leading_open_brace() {
13760        // Leading-position `{` shape (`"{caixa-teia,caixa-helm}/build"`
13761        // — the canonical "I selected a `{a,b}` brace-expansion prefix
13762        // out of a shell-history one-liner" idiom). Pinned separately
13763        // from the embedded-byte shape so the gate covers every
13764        // position, not only mid-path.
13765        let d = dep_with_fonte(DepSource::Path {
13766            caminho: "{caixa-teia,caixa-helm}/build".into(),
13767        });
13768        let err = d.validate().unwrap_err();
13769        assert!(
13770            matches!(
13771                err,
13772                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
13773            ),
13774            "got {err:?}",
13775        );
13776    }
13777
13778    #[test]
13779    fn validate_rejects_path_fonte_with_caminho_carrying_uri_template_placeholder() {
13780        // The canonical URI-Template / Mustache / Helm doubled-brace
13781        // placeholder shape (`"../{{org}}/caixa-teia"` — the canonical
13782        // "I copied a `https://github.com/{{org}}/caixa-teia` README
13783        // quick-start / OpenAPI spec / Helm chart `home:` template
13784        // and forgot to substitute the placeholder" footgun). The arm
13785        // fires on the first `{` encountered; pinned so the gate's
13786        // coverage extends from the bare-brace shell-history shape to
13787        // the doubled-brace URI-Template / templating-engine shape.
13788        // Mirrors the peer 42d8f9d `is_git_repo_url` arm on the
13789        // sibling `:fonte :repo` axis.
13790        let d = dep_with_fonte(DepSource::Path {
13791            caminho: "../{{org}}/caixa-teia".into(),
13792        });
13793        let err = d.validate().unwrap_err();
13794        assert!(
13795            matches!(
13796                err,
13797                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
13798            ),
13799            "got {err:?}",
13800        );
13801    }
13802
13803    #[test]
13804    fn validate_rejects_path_fonte_with_caminho_carrying_brace_range_expansion() {
13805        // The canonical bash brace-range-expansion shape (`"../caixa-
13806        // v{1..10}"` — the `{1..10}` sequence expansion every bash /
13807        // zsh `for i in {1..10}; do …; done` idiom uses, the symmetric
13808        // sequence-range form to the `{a,b,c}` comma-separated form).
13809        // The arm fires on the first `{` encountered; pinned so the
13810        // gate's coverage extends from the comma-separated form to
13811        // the integer-range form.
13812        let d = dep_with_fonte(DepSource::Path {
13813            caminho: "../caixa-v{1..10}".into(),
13814        });
13815        let err = d.validate().unwrap_err();
13816        assert!(
13817            matches!(
13818                err,
13819                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
13820            ),
13821            "got {err:?}",
13822        );
13823    }
13824
13825    #[test]
13826    fn validate_accepts_path_fonte_with_caminho_carrying_no_brace_expansion() {
13827        // The positive-control pin: the gate targets only `{` / `}`,
13828        // never adjacent printable ASCII or POSIX-valid bytes. The
13829        // canonical relative POSIX path (`"../caixa-teia"`) and a
13830        // nested deeply-pathed variant with adjacent printable
13831        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue to
13832        // validate cleanly so the gate doesn't widen to a "no
13833        // printable punctuation anywhere" sweep that would defeat
13834        // the entire path-fonte author surface. Peer with
13835        // `validate_accepts_path_fonte_with_caminho_carrying_no_subshell_grouping`
13836        // on the immediate-predecessor arm.
13837        let d = dep_with_fonte(DepSource::Path {
13838            caminho: "../caixa-teia/sub-dir.v2".into(),
13839        });
13840        d.validate().unwrap();
13841    }
13842
13843    #[test]
13844    fn fonte_caminho_shell_subshell_grouping_fires_before_shell_brace_expansion() {
13845        // Cascade pin on the immediate-predecessor arm: a value
13846        // carrying both `(` and `{` (`"../(cd foo)/{a,b}"` — the
13847        // canonical "I pasted a subshell-grouping followed by a
13848        // brace-expansion tail" footgun) routes through
13849        // `FonteCaminhoShellSubshellGrouping` not
13850        // `FonteCaminhoShellBraceExpansion`. The subshell-grouping
13851        // shape is the more semantic-locating axis on every probe-
13852        // as-both value because it closes both halves of the modern
13853        // Bourne `$(<cmd>)` command-substitution surface — same
13854        // cascade discipline every prior `:caminho` arm establishes.
13855        let d = dep_with_fonte(DepSource::Path {
13856            caminho: "../(cd foo)/{a,b}".into(),
13857        });
13858        let err = d.validate().unwrap_err();
13859        assert!(
13860            matches!(
13861                err,
13862                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
13863            ),
13864            "got {err:?}",
13865        );
13866    }
13867
13868    #[test]
13869    fn fonte_caminho_shell_glob_fires_before_shell_brace_expansion() {
13870        // Cascade pin on the upstream shell-glob arm: a value carrying
13871        // both `*` and `{` (`"../caixa-teia/*{a,b}"` — the canonical
13872        // "I pasted a glob expansion followed by a brace-expansion
13873        // tail" footgun) routes through `FonteCaminhoShellGlob` not
13874        // `FonteCaminhoShellBraceExpansion`. The pathname-expansion
13875        // shape is the load-bearing root-cause edit on every
13876        // probe-as-both value.
13877        let d = dep_with_fonte(DepSource::Path {
13878            caminho: "../caixa-teia/*{a,b}".into(),
13879        });
13880        let err = d.validate().unwrap_err();
13881        assert!(
13882            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
13883            "got {err:?}",
13884        );
13885    }
13886
13887    #[test]
13888    fn fonte_caminho_shell_command_substitution_fires_before_shell_brace_expansion() {
13889        // Cascade pin on the upstream shell-command-substitution arm:
13890        // a value carrying both a backtick and `{` (``"../`whoami`/{a,b}"``
13891        // — the canonical "I pasted a legacy-backtick command-
13892        // substitution followed by a brace-expansion fan-out" footgun)
13893        // routes through `FonteCaminhoShellCommandSubstitution` not
13894        // `FonteCaminhoShellBraceExpansion`. The CWE-78 shell-
13895        // command-injection vector is the load-bearing root-cause
13896        // edit on every probe-as-both value.
13897        let d = dep_with_fonte(DepSource::Path {
13898            caminho: "../`whoami`/{a,b}".into(),
13899        });
13900        let err = d.validate().unwrap_err();
13901        assert!(
13902            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
13903            "got {err:?}",
13904        );
13905    }
13906
13907    #[test]
13908    fn fonte_caminho_shell_background_fires_before_shell_brace_expansion() {
13909        // Cascade pin on the upstream shell-background arm: a value
13910        // carrying both `&` and `{` (`"../caixa-teia & {a,b}"` — the
13911        // canonical "I pasted a `cmd & {fork-fan}` background-launch
13912        // + brace-expansion chain" footgun) routes through
13913        // `FonteCaminhoShellBackground` not
13914        // `FonteCaminhoShellBraceExpansion`. The background-launch
13915        // tail is the load-bearing root-cause edit on every
13916        // probe-as-both value.
13917        let d = dep_with_fonte(DepSource::Path {
13918            caminho: "../caixa-teia & {a,b}".into(),
13919        });
13920        let err = d.validate().unwrap_err();
13921        assert!(
13922            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
13923            "got {err:?}",
13924        );
13925    }
13926
13927    #[test]
13928    fn fonte_caminho_shell_semicolon_fires_before_shell_brace_expansion() {
13929        // Cascade pin on the upstream shell-semicolon arm: a value
13930        // carrying both `;` and `{` (`"../caixa-teia; {a,b}"` — the
13931        // canonical sequential-cleanup + brace-expansion paste
13932        // idiom) routes through `FonteCaminhoShellSemicolon` not
13933        // `FonteCaminhoShellBraceExpansion`. The sequential-command-
13934        // separator paste is the load-bearing root-cause edit on
13935        // every probe-as-both value.
13936        let d = dep_with_fonte(DepSource::Path {
13937            caminho: "../caixa-teia; {a,b}".into(),
13938        });
13939        let err = d.validate().unwrap_err();
13940        assert!(
13941            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
13942            "got {err:?}",
13943        );
13944    }
13945
13946    #[test]
13947    fn fonte_caminho_shell_pipe_fires_before_shell_brace_expansion() {
13948        // Cascade pin on the upstream shell-pipe arm: a value
13949        // carrying both `|` and `{` (`"../caixa-teia | {tee,cat}"`
13950        // — the canonical pipeline-to-brace-expansion paste idiom)
13951        // routes through `FonteCaminhoShellPipe` not
13952        // `FonteCaminhoShellBraceExpansion`. The pipeline-tail paste
13953        // is the load-bearing root-cause edit on every probe-as-
13954        // both value.
13955        let d = dep_with_fonte(DepSource::Path {
13956            caminho: "../caixa-teia | {tee,cat}".into(),
13957        });
13958        let err = d.validate().unwrap_err();
13959        assert!(
13960            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
13961            "got {err:?}",
13962        );
13963    }
13964
13965    #[test]
13966    fn fonte_caminho_shell_redirection_fires_before_shell_brace_expansion() {
13967        // Cascade pin on the upstream shell-redirection arm: a value
13968        // carrying both `>` and `{` (`"../caixa-teia>log {a,b}"` —
13969        // the canonical "I pasted a `cmd > log {a,b}` redirect-
13970        // plus-brace-expansion chain" footgun) routes through
13971        // `FonteCaminhoShellRedirection` not
13972        // `FonteCaminhoShellBraceExpansion`. The input/output
13973        // redirection metachar carries the more self-locating
13974        // `byte` payload, so the prior arm wins on every probe-
13975        // as-both value.
13976        let d = dep_with_fonte(DepSource::Path {
13977            caminho: "../caixa-teia>log {a,b}".into(),
13978        });
13979        let err = d.validate().unwrap_err();
13980        assert!(
13981            matches!(
13982                err,
13983                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
13984            ),
13985            "got {err:?}",
13986        );
13987    }
13988
13989    #[test]
13990    fn fonte_caminho_backslash_fires_before_shell_brace_expansion() {
13991        // Cascade pin on the upstream backslash arm: a value
13992        // carrying both `\` and `{` (`"..\caixa-teia\{a,b}"` — the
13993        // canonical "I pasted a Windows-shell `cd ..\path\{a,b}`
13994        // chain") routes through `FonteCaminhoBackslash` not
13995        // `FonteCaminhoShellBraceExpansion`. The cross-host-OS-
13996        // separator divergence is the load-bearing axis on every
13997        // probe-as-both value.
13998        let d = dep_with_fonte(DepSource::Path {
13999            caminho: "..\\caixa-teia\\{a,b}".into(),
14000        });
14001        let err = d.validate().unwrap_err();
14002        assert!(
14003            matches!(err, DepError::FonteCaminhoBackslash { .. }),
14004            "got {err:?}",
14005        );
14006    }
14007
14008    #[test]
14009    fn fonte_caminho_control_char_fires_before_shell_brace_expansion() {
14010        // Cascade pin on the embedded-control-byte arm: a value
14011        // carrying both a control byte and `{` (`"../foo\n{a,b}"` —
14012        // the canonical paste-from-multiline-doc footgun where a
14013        // newline landed mid-caminho between two paste fragments)
14014        // routes through `FonteCaminhoControlChar` not
14015        // `FonteCaminhoShellBraceExpansion`. The POSIX-syscall-
14016        // rejected-byte / NUL-`CString::new`-fail diagnostic is the
14017        // load-bearing axis on every value that probes positive for
14018        // both — mirrors the cascade discipline on every prior arm.
14019        let d = dep_with_fonte(DepSource::Path {
14020            caminho: "../foo\n{a,b}".into(),
14021        });
14022        let err = d.validate().unwrap_err();
14023        assert!(
14024            matches!(err, DepError::FonteCaminhoControlChar { .. }),
14025            "got {err:?}",
14026        );
14027    }
14028
14029    #[test]
14030    fn fonte_caminho_absolute_fires_before_shell_brace_expansion() {
14031        // Cascade pin on the load-bearing leading-byte arm: a
14032        // leading `/` value with embedded `{` (`"/etc/{a,b}"`)
14033        // routes through `FonteCaminhoAbsolute` not
14034        // `FonteCaminhoShellBraceExpansion` — the host-layout-leak
14035        // diagnostic is the load-bearing axis, the brace-expansion
14036        // byte is the secondary observation. Same precedence logic
14037        // as every prior leading-byte arm.
14038        let d = dep_with_fonte(DepSource::Path {
14039            caminho: "/etc/{a,b}".into(),
14040        });
14041        let err = d.validate().unwrap_err();
14042        assert!(
14043            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
14044            "got {err:?}",
14045        );
14046    }
14047
14048    #[test]
14049    fn fonte_caminho_var_expansion_fires_before_shell_brace_expansion() {
14050        // Cascade pin on the upstream leading-`$` var-expansion
14051        // arm: a value carrying both a leading `$` and a `{`
14052        // (`"${ORG}/caixa-teia"` — the canonical "I pasted a
14053        // `${ORG}` shell-variable + curly-brace expansion at the
14054        // head of a sibling-workspace path" footgun) routes through
14055        // `FonteCaminhoVarExpansion` not
14056        // `FonteCaminhoShellBraceExpansion`. The leading-byte
14057        // shell-variable-expansion is the more self-locating
14058        // diagnostic on values that probe as both — same
14059        // load-bearing-leading-byte cascade discipline every prior
14060        // `:caminho` arm establishes.
14061        let d = dep_with_fonte(DepSource::Path {
14062            caminho: "${ORG}/caixa-teia".into(),
14063        });
14064        let err = d.validate().unwrap_err();
14065        assert!(
14066            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
14067            "got {err:?}",
14068        );
14069    }
14070
14071    #[test]
14072    fn fonte_caminho_shell_brace_expansion_fires_before_trailing_slash() {
14073        // Cascade pin on the immediate-successor arm: a value
14074        // carrying both `{` and a trailing `/`
14075        // (`"../{caixa-teia,caixa-helm}/"` — the canonical "I
14076        // tab-completed a path that already had a brace-expansion
14077        // expansion tail" footgun) routes through
14078        // `FonteCaminhoShellBraceExpansion` not
14079        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar
14080        // is the more semantic-locating axis (an author who removes
14081        // the `{` typically also drops the trailing separator since
14082        // both are paste-from-shell artifacts).
14083        let d = dep_with_fonte(DepSource::Path {
14084            caminho: "../{caixa-teia,caixa-helm}/".into(),
14085        });
14086        let err = d.validate().unwrap_err();
14087        assert!(
14088            matches!(
14089                err,
14090                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
14091            ),
14092            "got {err:?}",
14093        );
14094    }
14095
14096    #[test]
14097    fn fonte_caminho_shell_brace_expansion_diagnostic_carries_offending_dep_caminho_and_byte() {
14098        // Diagnostic-shape pin (peer with
14099        // `fonte_caminho_shell_subshell_grouping_diagnostic_carries_offending_dep_caminho_and_byte`
14100        // on the closest two-byte peer arm): the error's Display
14101        // surfaces the offending `:nome`, the offending `:caminho`
14102        // verbatim, the offending byte's hex / character form, and
14103        // names the shell-brace-expansion / URI-Template footgun
14104        // explicitly so a `feira lint` run can render the diagnostic
14105        // without re-parsing.
14106        let d = dep_with_fonte(DepSource::Path {
14107            caminho: "../{caixa-teia,caixa-helm}/build".into(),
14108        });
14109        let rendered = d.validate().unwrap_err().to_string();
14110        assert!(
14111            rendered.contains("caixa-teia"),
14112            "diagnostic must name the offending dep: {rendered}",
14113        );
14114        assert!(
14115            rendered.contains("../{caixa-teia,caixa-helm}/build"),
14116            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
14117        );
14118        assert!(
14119            rendered.contains("0x7b"),
14120            "diagnostic must surface the offending byte hex: {rendered:?}",
14121        );
14122        assert!(
14123            rendered.contains("brace-expansion"),
14124            "diagnostic must name the shell-brace-expansion footgun: {rendered:?}",
14125        );
14126        assert!(
14127            rendered.contains("URI Template"),
14128            "diagnostic must reference the RFC-6570 URI-Template-placeholder vocabulary: \
14129             {rendered:?}",
14130        );
14131    }
14132
14133    #[test]
14134    fn validate_rejects_path_fonte_with_caminho_carrying_bracket_glob_character_class() {
14135        // The canonical paste-from-shell-history bracket-glob /
14136        // character-class footgun: an author copies a
14137        // `cd ../caixa-[a-z]/build` shell-history one-liner whose
14138        // `[a-z]` POSIX glob character-class matches every lowercase-
14139        // ASCII-suffix sibling caixa directory and silently passed
14140        // every prior arm (`Path::is_absolute` false on `..`, no
14141        // control bytes, no `\`, no `<` / `>`, no `|`, no `;`, no
14142        // `&`, no backtick, no `*` / `?`, no `(` / `)`, no `{` /
14143        // `}`, doesn't end in `/`; the leading-`$` f4efe9c
14144        // `FonteCaminhoVarExpansion` arm doesn't fire because the
14145        // value starts with `..` not `$`). The lacre embedded the
14146        // value verbatim, the resolver folded it through
14147        // `Path::join` looking for a literal `./../caixa-[a-z]/
14148        // build` subdirectory, and the failure surfaced at resolve
14149        // time with a non-self-locating `No such file or directory`
14150        // error. The new arm moves the rejection to validate time
14151        // and names the offending dep + caminho + byte verbatim.
14152        // The arm fires on the first `[` encountered.
14153        let d = dep_with_fonte(DepSource::Path {
14154            caminho: "../caixa-[a-z]/build".into(),
14155        });
14156        let err = d.validate().unwrap_err();
14157        let DepError::FonteCaminhoShellBracketExpansion {
14158            nome,
14159            caminho,
14160            byte,
14161        } = err
14162        else {
14163            panic!("expected FonteCaminhoShellBracketExpansion, got {err:?}");
14164        };
14165        assert_eq!(nome, "caixa-teia");
14166        assert_eq!(caminho, "../caixa-[a-z]/build");
14167        assert_eq!(byte, b'[');
14168    }
14169
14170    #[test]
14171    fn validate_rejects_path_fonte_with_caminho_carrying_close_bracket() {
14172        // The symmetric close-bracket paste shape (`"../caixa-teia]"`
14173        // — the degenerate "I selected an unbalanced closing bracket
14174        // out of a glob character-class block" idiom that probes for
14175        // the cascade's last-byte handling on a value carrying only
14176        // the closing byte). Pinned separately from the open-bracket
14177        // shape so the gate's contract is "any `[` or `]` anywhere",
14178        // not single-byte coverage. Mirrors the peer
14179        // `validate_rejects_path_fonte_with_caminho_carrying_close_brace`
14180        // shape on the immediate-predecessor
14181        // `FonteCaminhoShellBraceExpansion` arm.
14182        let d = dep_with_fonte(DepSource::Path {
14183            caminho: "../caixa-teia]".into(),
14184        });
14185        let err = d.validate().unwrap_err();
14186        let DepError::FonteCaminhoShellBracketExpansion { byte, .. } = err else {
14187            panic!("expected FonteCaminhoShellBracketExpansion, got {err:?}");
14188        };
14189        assert_eq!(byte, b']');
14190    }
14191
14192    #[test]
14193    fn validate_rejects_path_fonte_with_caminho_carrying_leading_open_bracket() {
14194        // Leading-position `[` shape (`"[caixa-teia]/build"` — the
14195        // canonical "I selected a `[caixa-teia]` TOML-table-header /
14196        // glob-character-class prefix out of an aligned config /
14197        // shell-history one-liner" idiom). Pinned separately from
14198        // the embedded-byte shape so the gate covers every position,
14199        // not only mid-path.
14200        let d = dep_with_fonte(DepSource::Path {
14201            caminho: "[caixa-teia]/build".into(),
14202        });
14203        let err = d.validate().unwrap_err();
14204        assert!(
14205            matches!(
14206                err,
14207                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
14208            ),
14209            "got {err:?}",
14210        );
14211    }
14212
14213    #[test]
14214    fn validate_rejects_path_fonte_with_caminho_carrying_toml_inline_array() {
14215        // The canonical TOML inline-array / YAML flow-sequence
14216        // paste shape (`"../[\"a\", \"b\"]/caixa-teia"` — the
14217        // canonical "I copied a `features = [\"a\", \"b\"]` TOML
14218        // inline-array out of a sibling-Cargo manifest" cross-idiom
14219        // leak; the symmetric YAML flow-sequence form `paths: [/a,
14220        // /b]` paste-from-values.yaml shape carries the same
14221        // bracket pair). The arm fires on the first `[` encountered;
14222        // pinned so the gate's coverage extends from the bare-
14223        // bracket glob-character-class shape to the TOML / YAML /
14224        // JSON array-literal shape.
14225        let d = dep_with_fonte(DepSource::Path {
14226            caminho: "../[\"a\", \"b\"]/caixa-teia".into(),
14227        });
14228        let err = d.validate().unwrap_err();
14229        assert!(
14230            matches!(
14231                err,
14232                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
14233            ),
14234            "got {err:?}",
14235        );
14236    }
14237
14238    #[test]
14239    fn validate_rejects_path_fonte_with_caminho_carrying_shell_test_builtin() {
14240        // The canonical POSIX `test` / `[` builtin command paste
14241        // shape (`"../[ -d caixa-teia ]"` — the `[ <expr> ]` shell-
14242        // script conditional every paste-from-shell-script idiom
14243        // carries; bash's `[[ <expr> ]]` extended-test grammar
14244        // would surface the same byte pair). The arm fires on the
14245        // first `[` encountered; pinned so the gate's coverage
14246        // extends from the embedded-glob-character-class shape to
14247        // the leading-`test`-builtin / extended-test form.
14248        let d = dep_with_fonte(DepSource::Path {
14249            caminho: "../[ -d caixa-teia ]".into(),
14250        });
14251        let err = d.validate().unwrap_err();
14252        assert!(
14253            matches!(
14254                err,
14255                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
14256            ),
14257            "got {err:?}",
14258        );
14259    }
14260
14261    #[test]
14262    fn validate_accepts_path_fonte_with_caminho_carrying_no_bracket_expansion() {
14263        // The positive-control pin: the gate targets only `[` /
14264        // `]`, never adjacent printable ASCII or POSIX-valid bytes.
14265        // The canonical relative POSIX path (`"../caixa-teia"`) and
14266        // a nested deeply-pathed variant with adjacent printable
14267        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue
14268        // to validate cleanly so the gate doesn't widen to a "no
14269        // printable punctuation anywhere" sweep that would defeat
14270        // the entire path-fonte author surface. Peer with
14271        // `validate_accepts_path_fonte_with_caminho_carrying_no_brace_expansion`
14272        // on the immediate-predecessor arm.
14273        let d = dep_with_fonte(DepSource::Path {
14274            caminho: "../caixa-teia/sub-dir.v2".into(),
14275        });
14276        d.validate().unwrap();
14277    }
14278
14279    #[test]
14280    fn fonte_caminho_shell_brace_expansion_fires_before_shell_bracket_expansion() {
14281        // Cascade pin on the immediate-predecessor arm: a value
14282        // carrying both `{` and `[` (`"../{a,b}[ch]"` — the
14283        // canonical "I pasted a brace-expansion fan followed by a
14284        // glob-character-class tail" footgun) routes through
14285        // `FonteCaminhoShellBraceExpansion` not
14286        // `FonteCaminhoShellBracketExpansion`. The brace-expansion
14287        // fan is the load-bearing root-cause edit on every
14288        // probe-as-both value because the bracket-class tail
14289        // typically rides on a prior brace-expansion expansion;
14290        // same cascade discipline every prior `:caminho` arm
14291        // establishes.
14292        let d = dep_with_fonte(DepSource::Path {
14293            caminho: "../{a,b}[ch]".into(),
14294        });
14295        let err = d.validate().unwrap_err();
14296        assert!(
14297            matches!(
14298                err,
14299                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
14300            ),
14301            "got {err:?}",
14302        );
14303    }
14304
14305    #[test]
14306    fn fonte_caminho_shell_subshell_grouping_fires_before_shell_bracket_expansion() {
14307        // Cascade pin on the upstream shell-subshell-grouping arm:
14308        // a value carrying both `(` and `[` (`"../(cd foo)/[ch]"` —
14309        // the canonical "I pasted a subshell-grouping followed by
14310        // a glob-character-class tail" footgun) routes through
14311        // `FonteCaminhoShellSubshellGrouping` not
14312        // `FonteCaminhoShellBracketExpansion`. The modern Bourne
14313        // `$(<cmd>)` command-substitution boundary is the load-
14314        // bearing axis on every probe-as-both value.
14315        let d = dep_with_fonte(DepSource::Path {
14316            caminho: "../(cd foo)/[ch]".into(),
14317        });
14318        let err = d.validate().unwrap_err();
14319        assert!(
14320            matches!(
14321                err,
14322                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
14323            ),
14324            "got {err:?}",
14325        );
14326    }
14327
14328    #[test]
14329    fn fonte_caminho_shell_glob_fires_before_shell_bracket_expansion() {
14330        // Cascade pin on the upstream shell-glob arm: a value
14331        // carrying both `*` and `[` (`"../caixa-teia/*[ch]"` — the
14332        // canonical "I pasted a `*.[ch]` C-source-file glob whose
14333        // unbounded `*` precedes the bracket character-class"
14334        // footgun) routes through `FonteCaminhoShellGlob` not
14335        // `FonteCaminhoShellBracketExpansion`. The unbounded
14336        // pathname-expansion sentinel is the load-bearing root-
14337        // cause edit on every probe-as-both value — the unbounded
14338        // `*` carries the more aggressive expansion vector than
14339        // the bounded `[ch]` class, so the prior arm wins.
14340        let d = dep_with_fonte(DepSource::Path {
14341            caminho: "../caixa-teia/*[ch]".into(),
14342        });
14343        let err = d.validate().unwrap_err();
14344        assert!(
14345            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
14346            "got {err:?}",
14347        );
14348    }
14349
14350    #[test]
14351    fn fonte_caminho_shell_command_substitution_fires_before_shell_bracket_expansion() {
14352        // Cascade pin on the upstream shell-command-substitution
14353        // arm: a value carrying both a backtick and `[`
14354        // (``"../`whoami`/[ch]"`` — the canonical "I pasted a
14355        // legacy-backtick command-substitution followed by a
14356        // glob-character-class tail" footgun) routes through
14357        // `FonteCaminhoShellCommandSubstitution` not
14358        // `FonteCaminhoShellBracketExpansion`. The CWE-78 shell-
14359        // command-injection vector is the load-bearing root-cause
14360        // edit on every probe-as-both value.
14361        let d = dep_with_fonte(DepSource::Path {
14362            caminho: "../`whoami`/[ch]".into(),
14363        });
14364        let err = d.validate().unwrap_err();
14365        assert!(
14366            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
14367            "got {err:?}",
14368        );
14369    }
14370
14371    #[test]
14372    fn fonte_caminho_shell_background_fires_before_shell_bracket_expansion() {
14373        // Cascade pin on the upstream shell-background arm: a
14374        // value carrying both `&` and `[` (`"../caixa-teia & [ch]"`
14375        // — the canonical "I pasted a `cmd & [glob]` background-
14376        // launch + bracket-class chain" footgun) routes through
14377        // `FonteCaminhoShellBackground` not
14378        // `FonteCaminhoShellBracketExpansion`. The background-
14379        // launch tail is the load-bearing root-cause edit on
14380        // every probe-as-both value.
14381        let d = dep_with_fonte(DepSource::Path {
14382            caminho: "../caixa-teia & [ch]".into(),
14383        });
14384        let err = d.validate().unwrap_err();
14385        assert!(
14386            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
14387            "got {err:?}",
14388        );
14389    }
14390
14391    #[test]
14392    fn fonte_caminho_shell_semicolon_fires_before_shell_bracket_expansion() {
14393        // Cascade pin on the upstream shell-semicolon arm: a value
14394        // carrying both `;` and `[` (`"../caixa-teia; [ch]"` — the
14395        // canonical sequential-cleanup + bracket-class paste
14396        // idiom) routes through `FonteCaminhoShellSemicolon` not
14397        // `FonteCaminhoShellBracketExpansion`. The sequential-
14398        // command-separator paste is the load-bearing root-cause
14399        // edit on every probe-as-both value.
14400        let d = dep_with_fonte(DepSource::Path {
14401            caminho: "../caixa-teia; [ch]".into(),
14402        });
14403        let err = d.validate().unwrap_err();
14404        assert!(
14405            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
14406            "got {err:?}",
14407        );
14408    }
14409
14410    #[test]
14411    fn fonte_caminho_shell_pipe_fires_before_shell_bracket_expansion() {
14412        // Cascade pin on the upstream shell-pipe arm: a value
14413        // carrying both `|` and `[` (`"../caixa-teia | [tee]"` —
14414        // the canonical pipeline-to-bracket-class paste idiom)
14415        // routes through `FonteCaminhoShellPipe` not
14416        // `FonteCaminhoShellBracketExpansion`. The pipeline-tail
14417        // paste is the load-bearing root-cause edit on every
14418        // probe-as-both value.
14419        let d = dep_with_fonte(DepSource::Path {
14420            caminho: "../caixa-teia | [tee]".into(),
14421        });
14422        let err = d.validate().unwrap_err();
14423        assert!(
14424            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
14425            "got {err:?}",
14426        );
14427    }
14428
14429    #[test]
14430    fn fonte_caminho_shell_redirection_fires_before_shell_bracket_expansion() {
14431        // Cascade pin on the upstream shell-redirection arm: a
14432        // value carrying both `>` and `[` (`"../caixa-teia>log
14433        // [ch]"` — the canonical "I pasted a `cmd > log [glob]`
14434        // redirect-plus-bracket chain" footgun) routes through
14435        // `FonteCaminhoShellRedirection` not
14436        // `FonteCaminhoShellBracketExpansion`. The input/output
14437        // redirection metachar carries the more self-locating
14438        // `byte` payload, so the prior arm wins on every
14439        // probe-as-both value.
14440        let d = dep_with_fonte(DepSource::Path {
14441            caminho: "../caixa-teia>log [ch]".into(),
14442        });
14443        let err = d.validate().unwrap_err();
14444        assert!(
14445            matches!(
14446                err,
14447                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
14448            ),
14449            "got {err:?}",
14450        );
14451    }
14452
14453    #[test]
14454    fn fonte_caminho_backslash_fires_before_shell_bracket_expansion() {
14455        // Cascade pin on the upstream backslash arm: a value
14456        // carrying both `\` and `[` (`"..\caixa-teia\[ch]"` — the
14457        // canonical "I pasted a Windows-shell `cd ..\path\[glob]`
14458        // chain") routes through `FonteCaminhoBackslash` not
14459        // `FonteCaminhoShellBracketExpansion`. The cross-host-OS-
14460        // separator divergence is the load-bearing axis on every
14461        // probe-as-both value.
14462        let d = dep_with_fonte(DepSource::Path {
14463            caminho: "..\\caixa-teia\\[ch]".into(),
14464        });
14465        let err = d.validate().unwrap_err();
14466        assert!(
14467            matches!(err, DepError::FonteCaminhoBackslash { .. }),
14468            "got {err:?}",
14469        );
14470    }
14471
14472    #[test]
14473    fn fonte_caminho_control_char_fires_before_shell_bracket_expansion() {
14474        // Cascade pin on the embedded-control-byte arm: a value
14475        // carrying both a control byte and `[` (`"../foo\n[ch]"` —
14476        // the canonical paste-from-multiline-doc footgun where a
14477        // newline landed mid-caminho between two paste fragments)
14478        // routes through `FonteCaminhoControlChar` not
14479        // `FonteCaminhoShellBracketExpansion`. The POSIX-syscall-
14480        // rejected-byte / NUL-`CString::new`-fail diagnostic is
14481        // the load-bearing axis on every value that probes
14482        // positive for both — mirrors the cascade discipline on
14483        // every prior arm.
14484        let d = dep_with_fonte(DepSource::Path {
14485            caminho: "../foo\n[ch]".into(),
14486        });
14487        let err = d.validate().unwrap_err();
14488        assert!(
14489            matches!(err, DepError::FonteCaminhoControlChar { .. }),
14490            "got {err:?}",
14491        );
14492    }
14493
14494    #[test]
14495    fn fonte_caminho_absolute_fires_before_shell_bracket_expansion() {
14496        // Cascade pin on the load-bearing leading-byte arm: a
14497        // leading `/` value with embedded `[` (`"/etc/[ch]"`)
14498        // routes through `FonteCaminhoAbsolute` not
14499        // `FonteCaminhoShellBracketExpansion` — the host-layout-
14500        // leak diagnostic is the load-bearing axis, the bracket-
14501        // expansion byte is the secondary observation. Same
14502        // precedence logic as every prior leading-byte arm.
14503        let d = dep_with_fonte(DepSource::Path {
14504            caminho: "/etc/[ch]".into(),
14505        });
14506        let err = d.validate().unwrap_err();
14507        assert!(
14508            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
14509            "got {err:?}",
14510        );
14511    }
14512
14513    #[test]
14514    fn fonte_caminho_var_expansion_fires_before_shell_bracket_expansion() {
14515        // Cascade pin on the upstream leading-`$` var-expansion
14516        // arm: a value carrying both a leading `$` and a `[`
14517        // (`"$DIR/[ch]"` — the canonical "I pasted a `$DIR` shell-
14518        // variable + bracket-class at the head of a sibling-
14519        // workspace path" footgun) routes through
14520        // `FonteCaminhoVarExpansion` not
14521        // `FonteCaminhoShellBracketExpansion`. The leading-byte
14522        // shell-variable-expansion is the more self-locating
14523        // diagnostic on values that probe as both — same
14524        // load-bearing-leading-byte cascade discipline every
14525        // prior `:caminho` arm establishes.
14526        let d = dep_with_fonte(DepSource::Path {
14527            caminho: "$DIR/[ch]".into(),
14528        });
14529        let err = d.validate().unwrap_err();
14530        assert!(
14531            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
14532            "got {err:?}",
14533        );
14534    }
14535
14536    #[test]
14537    fn fonte_caminho_shell_bracket_expansion_fires_before_trailing_slash() {
14538        // Cascade pin on the immediate-successor arm: a value
14539        // carrying both `[` and a trailing `/` (`"../[a-z]/"` —
14540        // the canonical "I tab-completed a path that already had
14541        // a bracket-glob-character-class expansion tail" footgun)
14542        // routes through `FonteCaminhoShellBracketExpansion` not
14543        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar
14544        // is the more semantic-locating axis (an author who
14545        // removes the `[` typically also drops the trailing
14546        // separator since both are paste-from-shell artifacts).
14547        let d = dep_with_fonte(DepSource::Path {
14548            caminho: "../[a-z]/".into(),
14549        });
14550        let err = d.validate().unwrap_err();
14551        assert!(
14552            matches!(
14553                err,
14554                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
14555            ),
14556            "got {err:?}",
14557        );
14558    }
14559
14560    #[test]
14561    fn fonte_caminho_shell_bracket_expansion_diagnostic_carries_offending_dep_caminho_and_byte() {
14562        // Diagnostic-shape pin (peer with
14563        // `fonte_caminho_shell_brace_expansion_diagnostic_carries_offending_dep_caminho_and_byte`
14564        // on the closest two-byte peer arm): the error's Display
14565        // surfaces the offending `:nome`, the offending `:caminho`
14566        // verbatim, the offending byte's hex / character form, and
14567        // names the shell-bracket-expansion / glob-character-class
14568        // footgun explicitly so a `feira lint` run can render the
14569        // diagnostic without re-parsing.
14570        let d = dep_with_fonte(DepSource::Path {
14571            caminho: "../caixa-[a-z]/build".into(),
14572        });
14573        let rendered = d.validate().unwrap_err().to_string();
14574        assert!(
14575            rendered.contains("caixa-teia"),
14576            "diagnostic must name the offending dep: {rendered}",
14577        );
14578        assert!(
14579            rendered.contains("../caixa-[a-z]/build"),
14580            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
14581        );
14582        assert!(
14583            rendered.contains("0x5b"),
14584            "diagnostic must surface the offending byte hex: {rendered:?}",
14585        );
14586        assert!(
14587            rendered.contains("bracket-expansion"),
14588            "diagnostic must name the shell-bracket-expansion footgun: {rendered:?}",
14589        );
14590        assert!(
14591            rendered.contains("glob-character-class"),
14592            "diagnostic must reference the POSIX glob-character-class vocabulary: \
14593             {rendered:?}",
14594        );
14595    }
14596
14597    #[test]
14598    fn validate_rejects_path_fonte_with_caminho_carrying_single_quote_grouping() {
14599        // The canonical paste-from-shell-history strong-quoted
14600        // sibling-workspace-path footgun: an author copies a
14601        // `cd '../caixa-teia'` shell-history one-liner whose strong-
14602        // quoting preserved the path across a whitespace paste
14603        // boundary and silently passed every prior arm
14604        // (`Path::is_absolute` false on `'..`, no control bytes, no
14605        // `\`, no `<` / `>`, no `|`, no `;`, no `&`, no backtick, no
14606        // `*` / `?`, no `(` / `)`, no `{` / `}`, no `[` / `]`,
14607        // doesn't end in `/`; the leading-`$` f4efe9c
14608        // `FonteCaminhoVarExpansion` arm doesn't fire because the
14609        // value starts with `'` not `$`). The lacre embedded the
14610        // value verbatim, the resolver folded it through
14611        // `Path::join` looking for a literal `./'../caixa-teia'`
14612        // subdirectory, and the failure surfaced at resolve time
14613        // with a non-self-locating `No such file or directory`
14614        // error. The new arm moves the rejection to validate time
14615        // and names the offending dep + caminho + byte verbatim.
14616        // The arm fires on the first `'` encountered.
14617        let d = dep_with_fonte(DepSource::Path {
14618            caminho: "'../caixa-teia'".into(),
14619        });
14620        let err = d.validate().unwrap_err();
14621        let DepError::FonteCaminhoShellQuoteGrouping {
14622            nome,
14623            caminho,
14624            byte,
14625        } = err
14626        else {
14627            panic!("expected FonteCaminhoShellQuoteGrouping, got {err:?}");
14628        };
14629        assert_eq!(nome, "caixa-teia");
14630        assert_eq!(caminho, "'../caixa-teia'");
14631        assert_eq!(byte, b'\'');
14632    }
14633
14634    #[test]
14635    fn validate_rejects_path_fonte_with_caminho_carrying_double_quote_grouping() {
14636        // The symmetric weak-quoted paste shape (`"\"../caixa-teia\""`
14637        // — the canonical paste-from-JSON-config / paste-from-YAML-
14638        // flow-scalar / paste-from-TOML-basic-string / paste-from-
14639        // tatara-lisp-string-literal cross-idiom leak). Pinned
14640        // separately from the single-quote shape so the gate's
14641        // contract is "any `'` or `\"` anywhere", not single-byte
14642        // coverage. Mirrors the peer
14643        // `validate_rejects_path_fonte_with_caminho_carrying_close_bracket`
14644        // shape on the immediate-predecessor
14645        // `FonteCaminhoShellBracketExpansion` arm.
14646        let d = dep_with_fonte(DepSource::Path {
14647            caminho: "\"../caixa-teia\"".into(),
14648        });
14649        let err = d.validate().unwrap_err();
14650        let DepError::FonteCaminhoShellQuoteGrouping { byte, .. } = err else {
14651            panic!("expected FonteCaminhoShellQuoteGrouping, got {err:?}");
14652        };
14653        assert_eq!(byte, b'"');
14654    }
14655
14656    #[test]
14657    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_double_quote() {
14658        // Embedded-position `"` shape (`"../\"caixa-teia\""` — the
14659        // canonical "I pasted a JSON key-value pair fragment into
14660        // the middle of the path" idiom). Pinned separately from
14661        // the leading-byte shape so the gate covers every position,
14662        // not only leading.
14663        let d = dep_with_fonte(DepSource::Path {
14664            caminho: "../\"caixa-teia\"".into(),
14665        });
14666        let err = d.validate().unwrap_err();
14667        assert!(
14668            matches!(
14669                err,
14670                DepError::FonteCaminhoShellQuoteGrouping { byte: b'"', .. },
14671            ),
14672            "got {err:?}",
14673        );
14674    }
14675
14676    #[test]
14677    fn validate_rejects_path_fonte_with_caminho_carrying_yaml_flow_scalar_paste() {
14678        // The canonical YAML double-quoted flow-scalar cross-idiom
14679        // leak shape (`"path: \"../caixa-teia\""` — the "I copied a
14680        // `path: \"...\"` YAML flow-scalar entry out of an aligned
14681        // values.yaml / K8s manifest and dropped it verbatim into
14682        // the `:caminho` slot including the `path: ` key prefix"
14683        // paste-idiom). The arm fires on the first `"` encountered;
14684        // pinned so the gate's coverage extends from the bare-quote
14685        // paste shape to the aligned-YAML-manifest cross-idiom-leak
14686        // shape.
14687        let d = dep_with_fonte(DepSource::Path {
14688            caminho: "path: \"../caixa-teia\"".into(),
14689        });
14690        let err = d.validate().unwrap_err();
14691        assert!(
14692            matches!(
14693                err,
14694                DepError::FonteCaminhoShellQuoteGrouping { byte: b'"', .. },
14695            ),
14696            "got {err:?}",
14697        );
14698    }
14699
14700    #[test]
14701    fn validate_accepts_path_fonte_with_caminho_carrying_no_quote_grouping() {
14702        // The positive-control pin: the gate targets only `'` /
14703        // `"`, never adjacent printable ASCII or POSIX-valid bytes.
14704        // The canonical relative POSIX path (`"../caixa-teia"`) and
14705        // a nested deeply-pathed variant with adjacent printable
14706        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue
14707        // to validate cleanly so the gate doesn't widen to a "no
14708        // printable punctuation anywhere" sweep that would defeat
14709        // the entire path-fonte author surface. Peer with
14710        // `validate_accepts_path_fonte_with_caminho_carrying_no_bracket_expansion`
14711        // on the immediate-predecessor arm.
14712        let d = dep_with_fonte(DepSource::Path {
14713            caminho: "../caixa-teia/sub-dir.v2".into(),
14714        });
14715        d.validate().unwrap();
14716    }
14717
14718    #[test]
14719    fn fonte_caminho_shell_bracket_expansion_fires_before_shell_quote_grouping() {
14720        // Cascade pin on the immediate-predecessor arm: a value
14721        // carrying both `[` and `'` (`"../[a-z]'x'"` — the canonical
14722        // "I pasted a glob-character-class followed by a strong-
14723        // quoted literal tail" footgun) routes through
14724        // `FonteCaminhoShellBracketExpansion` not
14725        // `FonteCaminhoShellQuoteGrouping`. The glob-character-class
14726        // expansion is the load-bearing root-cause edit on every
14727        // probe-as-both value; same cascade discipline every prior
14728        // `:caminho` arm establishes.
14729        let d = dep_with_fonte(DepSource::Path {
14730            caminho: "../[a-z]'x'".into(),
14731        });
14732        let err = d.validate().unwrap_err();
14733        assert!(
14734            matches!(
14735                err,
14736                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
14737            ),
14738            "got {err:?}",
14739        );
14740    }
14741
14742    #[test]
14743    fn fonte_caminho_shell_brace_expansion_fires_before_shell_quote_grouping() {
14744        // Cascade pin on the upstream shell-brace-expansion arm: a
14745        // value carrying both `{` and `'` (`"../{a,b}'x'"` — the
14746        // canonical "I pasted a brace-expansion fan followed by a
14747        // strong-quoted literal tail" footgun) routes through
14748        // `FonteCaminhoShellBraceExpansion` not
14749        // `FonteCaminhoShellQuoteGrouping`. The brace-expansion fan
14750        // is the load-bearing root-cause edit on every probe-as-
14751        // both value.
14752        let d = dep_with_fonte(DepSource::Path {
14753            caminho: "../{a,b}'x'".into(),
14754        });
14755        let err = d.validate().unwrap_err();
14756        assert!(
14757            matches!(
14758                err,
14759                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
14760            ),
14761            "got {err:?}",
14762        );
14763    }
14764
14765    #[test]
14766    fn fonte_caminho_shell_subshell_grouping_fires_before_shell_quote_grouping() {
14767        // Cascade pin on the upstream shell-subshell-grouping arm:
14768        // a value carrying both `(` and `'` (`"../(cd foo)/'x'"` —
14769        // the canonical "I pasted a subshell-grouping followed by
14770        // a strong-quoted literal tail" footgun) routes through
14771        // `FonteCaminhoShellSubshellGrouping` not
14772        // `FonteCaminhoShellQuoteGrouping`. The modern Bourne
14773        // `$(<cmd>)` command-substitution boundary is the load-
14774        // bearing axis on every probe-as-both value.
14775        let d = dep_with_fonte(DepSource::Path {
14776            caminho: "../(cd foo)/'x'".into(),
14777        });
14778        let err = d.validate().unwrap_err();
14779        assert!(
14780            matches!(
14781                err,
14782                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
14783            ),
14784            "got {err:?}",
14785        );
14786    }
14787
14788    #[test]
14789    fn fonte_caminho_shell_glob_fires_before_shell_quote_grouping() {
14790        // Cascade pin on the upstream shell-glob arm: a value
14791        // carrying both `*` and `'` (`"../caixa-teia/*'x'"` — the
14792        // canonical "I pasted a `*` unbounded pathname-expansion
14793        // followed by a strong-quoted literal tail" footgun) routes
14794        // through `FonteCaminhoShellGlob` not
14795        // `FonteCaminhoShellQuoteGrouping`. The unbounded pathname-
14796        // expansion sentinel is the load-bearing root-cause edit
14797        // on every probe-as-both value.
14798        let d = dep_with_fonte(DepSource::Path {
14799            caminho: "../caixa-teia/*'x'".into(),
14800        });
14801        let err = d.validate().unwrap_err();
14802        assert!(
14803            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
14804            "got {err:?}",
14805        );
14806    }
14807
14808    #[test]
14809    fn fonte_caminho_shell_command_substitution_fires_before_shell_quote_grouping() {
14810        // Cascade pin on the upstream shell-command-substitution
14811        // arm: a value carrying both a backtick and `'`
14812        // (``"../`whoami`/'x'"`` — the canonical "I pasted a
14813        // legacy-backtick command-substitution followed by a
14814        // strong-quoted literal tail" footgun) routes through
14815        // `FonteCaminhoShellCommandSubstitution` not
14816        // `FonteCaminhoShellQuoteGrouping`. The CWE-78 shell-
14817        // command-injection vector is the load-bearing root-cause
14818        // edit on every probe-as-both value.
14819        let d = dep_with_fonte(DepSource::Path {
14820            caminho: "../`whoami`/'x'".into(),
14821        });
14822        let err = d.validate().unwrap_err();
14823        assert!(
14824            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
14825            "got {err:?}",
14826        );
14827    }
14828
14829    #[test]
14830    fn fonte_caminho_shell_background_fires_before_shell_quote_grouping() {
14831        // Cascade pin on the upstream shell-background arm: a value
14832        // carrying both `&` and `'` (`"../caixa-teia & 'x'"` — the
14833        // canonical "I pasted a `cmd & 'literal'` background-launch
14834        // + quote chain" footgun) routes through
14835        // `FonteCaminhoShellBackground` not
14836        // `FonteCaminhoShellQuoteGrouping`. The background-launch
14837        // tail is the load-bearing root-cause edit on every
14838        // probe-as-both value.
14839        let d = dep_with_fonte(DepSource::Path {
14840            caminho: "../caixa-teia & 'x'".into(),
14841        });
14842        let err = d.validate().unwrap_err();
14843        assert!(
14844            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
14845            "got {err:?}",
14846        );
14847    }
14848
14849    #[test]
14850    fn fonte_caminho_shell_semicolon_fires_before_shell_quote_grouping() {
14851        // Cascade pin on the upstream shell-semicolon arm: a value
14852        // carrying both `;` and `'` (`"../caixa-teia; 'x'"` — the
14853        // canonical sequential-cleanup + quote paste idiom) routes
14854        // through `FonteCaminhoShellSemicolon` not
14855        // `FonteCaminhoShellQuoteGrouping`. The sequential-command-
14856        // separator paste is the load-bearing root-cause edit on
14857        // every probe-as-both value.
14858        let d = dep_with_fonte(DepSource::Path {
14859            caminho: "../caixa-teia; 'x'".into(),
14860        });
14861        let err = d.validate().unwrap_err();
14862        assert!(
14863            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
14864            "got {err:?}",
14865        );
14866    }
14867
14868    #[test]
14869    fn fonte_caminho_shell_pipe_fires_before_shell_quote_grouping() {
14870        // Cascade pin on the upstream shell-pipe arm: a value
14871        // carrying both `|` and `'` (`"../caixa-teia | 'x'"` — the
14872        // canonical pipeline-to-quoted-literal paste idiom) routes
14873        // through `FonteCaminhoShellPipe` not
14874        // `FonteCaminhoShellQuoteGrouping`. The pipeline-tail paste
14875        // is the load-bearing root-cause edit on every probe-as-
14876        // both value.
14877        let d = dep_with_fonte(DepSource::Path {
14878            caminho: "../caixa-teia | 'x'".into(),
14879        });
14880        let err = d.validate().unwrap_err();
14881        assert!(
14882            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
14883            "got {err:?}",
14884        );
14885    }
14886
14887    #[test]
14888    fn fonte_caminho_shell_redirection_fires_before_shell_quote_grouping() {
14889        // Cascade pin on the upstream shell-redirection arm: a
14890        // value carrying both `>` and `'` (`"../caixa-teia>log 'x'"`
14891        // — the canonical "I pasted a `cmd > log 'literal'`
14892        // redirect-plus-quote chain" footgun) routes through
14893        // `FonteCaminhoShellRedirection` not
14894        // `FonteCaminhoShellQuoteGrouping`. The input/output
14895        // redirection metachar carries the more self-locating
14896        // `byte` payload, so the prior arm wins on every probe-as-
14897        // both value.
14898        let d = dep_with_fonte(DepSource::Path {
14899            caminho: "../caixa-teia>log 'x'".into(),
14900        });
14901        let err = d.validate().unwrap_err();
14902        assert!(
14903            matches!(
14904                err,
14905                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
14906            ),
14907            "got {err:?}",
14908        );
14909    }
14910
14911    #[test]
14912    fn fonte_caminho_backslash_fires_before_shell_quote_grouping() {
14913        // Cascade pin on the upstream backslash arm: a value
14914        // carrying both `\` and `'` (`"..\caixa-teia\'x'"` — the
14915        // canonical "I pasted a Windows-shell `cd ..\path\'literal'`
14916        // chain" footgun) routes through `FonteCaminhoBackslash`
14917        // not `FonteCaminhoShellQuoteGrouping`. The cross-host-OS-
14918        // separator divergence is the load-bearing axis on every
14919        // probe-as-both value.
14920        let d = dep_with_fonte(DepSource::Path {
14921            caminho: "..\\caixa-teia\\'x'".into(),
14922        });
14923        let err = d.validate().unwrap_err();
14924        assert!(
14925            matches!(err, DepError::FonteCaminhoBackslash { .. }),
14926            "got {err:?}",
14927        );
14928    }
14929
14930    #[test]
14931    fn fonte_caminho_control_char_fires_before_shell_quote_grouping() {
14932        // Cascade pin on the embedded-control-byte arm: a value
14933        // carrying both a control byte and `'` (`"../foo\n'x'"` —
14934        // the canonical paste-from-multiline-doc footgun where a
14935        // newline landed mid-caminho between two paste fragments)
14936        // routes through `FonteCaminhoControlChar` not
14937        // `FonteCaminhoShellQuoteGrouping`. The POSIX-syscall-
14938        // rejected-byte / NUL-`CString::new`-fail diagnostic is
14939        // the load-bearing axis on every value that probes
14940        // positive for both — mirrors the cascade discipline on
14941        // every prior arm.
14942        let d = dep_with_fonte(DepSource::Path {
14943            caminho: "../foo\n'x'".into(),
14944        });
14945        let err = d.validate().unwrap_err();
14946        assert!(
14947            matches!(err, DepError::FonteCaminhoControlChar { .. }),
14948            "got {err:?}",
14949        );
14950    }
14951
14952    #[test]
14953    fn fonte_caminho_absolute_fires_before_shell_quote_grouping() {
14954        // Cascade pin on the load-bearing leading-byte arm: a
14955        // leading `/` value with embedded `'` (`"/etc/'x'"`) routes
14956        // through `FonteCaminhoAbsolute` not
14957        // `FonteCaminhoShellQuoteGrouping` — the host-layout-leak
14958        // diagnostic is the load-bearing axis, the quote byte is
14959        // the secondary observation. Same precedence logic as every
14960        // prior leading-byte arm.
14961        let d = dep_with_fonte(DepSource::Path {
14962            caminho: "/etc/'x'".into(),
14963        });
14964        let err = d.validate().unwrap_err();
14965        assert!(
14966            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
14967            "got {err:?}",
14968        );
14969    }
14970
14971    #[test]
14972    fn fonte_caminho_var_expansion_fires_before_shell_quote_grouping() {
14973        // Cascade pin on the upstream leading-`$` var-expansion
14974        // arm: a value carrying both a leading `$` and a `'`
14975        // (`"$DIR/'x'"` — the canonical "I pasted a `$DIR` shell-
14976        // variable + quoted literal at the head of a sibling-
14977        // workspace path" footgun) routes through
14978        // `FonteCaminhoVarExpansion` not
14979        // `FonteCaminhoShellQuoteGrouping`. The leading-byte
14980        // shell-variable-expansion is the more self-locating
14981        // diagnostic on values that probe as both — same
14982        // load-bearing-leading-byte cascade discipline every
14983        // prior `:caminho` arm establishes.
14984        let d = dep_with_fonte(DepSource::Path {
14985            caminho: "$DIR/'x'".into(),
14986        });
14987        let err = d.validate().unwrap_err();
14988        assert!(
14989            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
14990            "got {err:?}",
14991        );
14992    }
14993
14994    #[test]
14995    fn fonte_caminho_shell_quote_grouping_fires_before_trailing_slash() {
14996        // Cascade pin on the immediate-successor arm: a value
14997        // carrying both `'` and a trailing `/` (`"../'caixa-teia'/"`
14998        // — the canonical "I tab-completed a path whose strong-
14999        // quoted body already carried the quoting from a shell-
15000        // history paste" footgun) routes through
15001        // `FonteCaminhoShellQuoteGrouping` not
15002        // `FonteCaminhoTrailingSlash`. The embedded shell-metachar
15003        // is the more semantic-locating axis (an author who removes
15004        // the `'` typically also drops the trailing separator since
15005        // both are paste-from-shell artifacts).
15006        let d = dep_with_fonte(DepSource::Path {
15007            caminho: "../'caixa-teia'/".into(),
15008        });
15009        let err = d.validate().unwrap_err();
15010        assert!(
15011            matches!(
15012                err,
15013                DepError::FonteCaminhoShellQuoteGrouping { byte: b'\'', .. },
15014            ),
15015            "got {err:?}",
15016        );
15017    }
15018
15019    #[test]
15020    fn fonte_caminho_shell_quote_grouping_diagnostic_carries_offending_dep_caminho_and_byte() {
15021        // Diagnostic-shape pin (peer with
15022        // `fonte_caminho_shell_bracket_expansion_diagnostic_carries_offending_dep_caminho_and_byte`
15023        // on the closest two-byte peer arm): the error's Display
15024        // surfaces the offending `:nome`, the offending `:caminho`
15025        // verbatim, the offending byte's hex / character form, and
15026        // names the shell-quote-grouping / cross-config-DSL-string-
15027        // literal-delimiter footgun explicitly so a `feira lint`
15028        // run can render the diagnostic without re-parsing.
15029        let d = dep_with_fonte(DepSource::Path {
15030            caminho: "'../caixa-teia'".into(),
15031        });
15032        let rendered = d.validate().unwrap_err().to_string();
15033        assert!(
15034            rendered.contains("caixa-teia"),
15035            "diagnostic must name the offending dep: {rendered}",
15036        );
15037        assert!(
15038            rendered.contains("'../caixa-teia'"),
15039            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
15040        );
15041        assert!(
15042            rendered.contains("0x27"),
15043            "diagnostic must surface the offending byte hex: {rendered:?}",
15044        );
15045        assert!(
15046            rendered.contains("quote-grouping"),
15047            "diagnostic must name the shell-quote-grouping footgun: {rendered:?}",
15048        );
15049        assert!(
15050            rendered.contains("string-literal"),
15051            "diagnostic must reference the cross-config-DSL string-literal-delimiter \
15052             vocabulary: {rendered:?}",
15053        );
15054    }
15055
15056    #[test]
15057    fn validate_rejects_path_fonte_with_caminho_carrying_shell_comment_lead() {
15058        // The canonical paste-from-shell-history-with-trailing-
15059        // annotation footgun: an author pastes a `cd ../caixa-teia
15060        // # legacy sibling` shell-history one-liner whose unquoted `#`
15061        // comment-lead separates the path from an inline annotation.
15062        // The POSIX shell trims the annotation to `../caixa-teia`
15063        // (POSIX.1-2017 §2.3 Token Recognition step 6), but
15064        // `Path::is_absolute` returns false on `..`, `#` is neither
15065        // a leading-byte sentinel nor a control byte nor `\` nor
15066        // `<` / `>` nor `|` nor `;` nor `&` nor backtick nor `*` /
15067        // `?` nor `(` / `)` nor `{` / `}` nor `[` / `]` nor `'` /
15068        // `"`, and the value's last byte isn't `/` — so the value
15069        // silently passed every prior arm. The resolver folded the
15070        // value through `Path::join` looking for a literal
15071        // `./../caixa-teia # legacy sibling` subdirectory and the
15072        // failure surfaced at resolve time with a non-self-locating
15073        // `No such file or directory` error. The new arm moves the
15074        // rejection to validate time and names the offending dep +
15075        // caminho + byte verbatim.
15076        let d = dep_with_fonte(DepSource::Path {
15077            caminho: "../caixa-teia # legacy sibling".into(),
15078        });
15079        let err = d.validate().unwrap_err();
15080        let DepError::FonteCaminhoShellComment {
15081            nome,
15082            caminho,
15083            byte,
15084        } = err
15085        else {
15086            panic!("expected FonteCaminhoShellComment, got {err:?}");
15087        };
15088        assert_eq!(nome, "caixa-teia");
15089        assert_eq!(caminho, "../caixa-teia # legacy sibling");
15090        assert_eq!(byte, b'#');
15091    }
15092
15093    #[test]
15094    fn validate_rejects_path_fonte_with_caminho_carrying_yaml_comment_paste() {
15095        // The symmetric YAML flow-scalar / values.yaml / K8s-manifest
15096        // cross-idiom-leak shape (`"../caixa-teia  # pin"` — the
15097        // canonical "I copied a `path: ../caixa-teia  # pin` YAML
15098        // scalar-plus-comment entry out of an aligned values.yaml and
15099        // dropped it verbatim into the `:caminho` slot" paste-idiom).
15100        // Pinned separately from the shell-history shape so the
15101        // gate's coverage extends from the single-space `#` shape to
15102        // the YAML-canonical double-space `  #` shape. YAML 1.2 §6.6
15103        // requires the `#` to be preceded by whitespace to lex as a
15104        // comment (bare `foo#bar` is a single scalar); the double-
15105        // space paste from an aligned manifest is the canonical
15106        // shape.
15107        let d = dep_with_fonte(DepSource::Path {
15108            caminho: "../caixa-teia  # pin".into(),
15109        });
15110        let err = d.validate().unwrap_err();
15111        assert!(
15112            matches!(err, DepError::FonteCaminhoShellComment { byte: b'#', .. }),
15113            "got {err:?}",
15114        );
15115    }
15116
15117    #[test]
15118    fn validate_rejects_path_fonte_with_caminho_carrying_url_fragment_anchor() {
15119        // The URL-fragment-identifier paste shape
15120        // (`"../caixa-teia#readme"` — the canonical
15121        // paste-from-browser-address-bar permalink shape where the
15122        // browser preserved the `#anchor` tail on the copy). Pinned
15123        // separately from the whitespace-separated shell / YAML
15124        // comment shapes so the gate covers the unpadded RFC 3986
15125        // §3.5 fragment-delimiter position too, not only positions
15126        // preceded by unquoted whitespace. Peer with the immediate-
15127        // sibling `is_git_repo_url` arm on the `:fonte :repo` axis
15128        // (a68f818) which closes the same byte under the same URL-
15129        // fragment-identifier banner.
15130        let d = dep_with_fonte(DepSource::Path {
15131            caminho: "../caixa-teia#readme".into(),
15132        });
15133        let err = d.validate().unwrap_err();
15134        assert!(
15135            matches!(err, DepError::FonteCaminhoShellComment { byte: b'#', .. }),
15136            "got {err:?}",
15137        );
15138    }
15139
15140    #[test]
15141    fn validate_rejects_path_fonte_with_caminho_carrying_leading_shell_comment() {
15142        // Leading-position `#` shape (`"#../caixa-teia"` — the
15143        // "I copied a shell-comment-out entry from a commented-out
15144        // dep row" footgun). Pinned separately from the embedded
15145        // shapes so the gate covers every position, not only
15146        // whitespace-preceded / mid-value.
15147        let d = dep_with_fonte(DepSource::Path {
15148            caminho: "#../caixa-teia".into(),
15149        });
15150        let err = d.validate().unwrap_err();
15151        assert!(
15152            matches!(err, DepError::FonteCaminhoShellComment { byte: b'#', .. }),
15153            "got {err:?}",
15154        );
15155    }
15156
15157    #[test]
15158    fn validate_accepts_path_fonte_with_caminho_carrying_no_shell_comment() {
15159        // The positive-control pin: the gate targets only `#`,
15160        // never adjacent printable ASCII or POSIX-valid bytes. The
15161        // canonical relative POSIX path (`"../caixa-teia"`) and a
15162        // nested deeply-pathed variant with adjacent printable
15163        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue
15164        // to validate cleanly so the gate doesn't widen to a "no
15165        // printable punctuation anywhere" sweep that would defeat
15166        // the entire path-fonte author surface. Peer with
15167        // `validate_accepts_path_fonte_with_caminho_carrying_no_quote_grouping`
15168        // on the immediate-predecessor arm.
15169        let d = dep_with_fonte(DepSource::Path {
15170            caminho: "../caixa-teia/sub-dir.v2".into(),
15171        });
15172        d.validate().unwrap();
15173    }
15174
15175    #[test]
15176    fn fonte_caminho_shell_quote_grouping_fires_before_shell_comment() {
15177        // Cascade pin on the immediate-predecessor arm: a value
15178        // carrying both `'` and `#` (`"../'x'#pin"` — the canonical
15179        // "I pasted a strong-quoted literal followed by a URL-
15180        // fragment permalink tail" footgun) routes through
15181        // `FonteCaminhoShellQuoteGrouping` not
15182        // `FonteCaminhoShellComment`. The shell-string-literal-
15183        // delimiter is the load-bearing root-cause edit on every
15184        // probe-as-both value; same cascade discipline every prior
15185        // `:caminho` arm establishes.
15186        let d = dep_with_fonte(DepSource::Path {
15187            caminho: "../'x'#pin".into(),
15188        });
15189        let err = d.validate().unwrap_err();
15190        assert!(
15191            matches!(
15192                err,
15193                DepError::FonteCaminhoShellQuoteGrouping { byte: b'\'', .. },
15194            ),
15195            "got {err:?}",
15196        );
15197    }
15198
15199    #[test]
15200    fn fonte_caminho_shell_bracket_expansion_fires_before_shell_comment() {
15201        // Cascade pin on the upstream shell-bracket-expansion arm:
15202        // a value carrying both `[` and `#` (`"../[a-z]#pin"` — the
15203        // canonical "I pasted a glob-character-class followed by a
15204        // URL-fragment tail" footgun) routes through
15205        // `FonteCaminhoShellBracketExpansion` not
15206        // `FonteCaminhoShellComment`. The glob-character-class
15207        // expansion is the load-bearing root-cause edit on every
15208        // probe-as-both value.
15209        let d = dep_with_fonte(DepSource::Path {
15210            caminho: "../[a-z]#pin".into(),
15211        });
15212        let err = d.validate().unwrap_err();
15213        assert!(
15214            matches!(
15215                err,
15216                DepError::FonteCaminhoShellBracketExpansion { byte: b'[', .. },
15217            ),
15218            "got {err:?}",
15219        );
15220    }
15221
15222    #[test]
15223    fn fonte_caminho_shell_brace_expansion_fires_before_shell_comment() {
15224        // Cascade pin on the upstream shell-brace-expansion arm: a
15225        // value carrying both `{` and `#` (`"../{a,b}#pin"` — the
15226        // canonical "I pasted a brace-expansion fan followed by a
15227        // URL-fragment tail" footgun) routes through
15228        // `FonteCaminhoShellBraceExpansion` not
15229        // `FonteCaminhoShellComment`. The brace-expansion fan is the
15230        // load-bearing root-cause edit on every probe-as-both value.
15231        let d = dep_with_fonte(DepSource::Path {
15232            caminho: "../{a,b}#pin".into(),
15233        });
15234        let err = d.validate().unwrap_err();
15235        assert!(
15236            matches!(
15237                err,
15238                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. },
15239            ),
15240            "got {err:?}",
15241        );
15242    }
15243
15244    #[test]
15245    fn fonte_caminho_shell_subshell_grouping_fires_before_shell_comment() {
15246        // Cascade pin on the upstream shell-subshell-grouping arm:
15247        // a value carrying both `(` and `#` (`"../(cd foo)#pin"` —
15248        // the canonical "I pasted a subshell-grouping followed by a
15249        // URL-fragment tail" footgun) routes through
15250        // `FonteCaminhoShellSubshellGrouping` not
15251        // `FonteCaminhoShellComment`. The modern Bourne `$(<cmd>)`
15252        // command-substitution boundary is the load-bearing axis on
15253        // every probe-as-both value.
15254        let d = dep_with_fonte(DepSource::Path {
15255            caminho: "../(cd foo)#pin".into(),
15256        });
15257        let err = d.validate().unwrap_err();
15258        assert!(
15259            matches!(
15260                err,
15261                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. },
15262            ),
15263            "got {err:?}",
15264        );
15265    }
15266
15267    #[test]
15268    fn fonte_caminho_shell_glob_fires_before_shell_comment() {
15269        // Cascade pin on the upstream shell-glob arm: a value
15270        // carrying both `*` and `#` (`"../caixa-teia/*#pin"` — the
15271        // canonical "I pasted a `*` unbounded pathname-expansion
15272        // followed by a URL-fragment tail" footgun) routes through
15273        // `FonteCaminhoShellGlob` not `FonteCaminhoShellComment`.
15274        // The unbounded pathname-expansion sentinel is the load-
15275        // bearing root-cause edit on every probe-as-both value.
15276        let d = dep_with_fonte(DepSource::Path {
15277            caminho: "../caixa-teia/*#pin".into(),
15278        });
15279        let err = d.validate().unwrap_err();
15280        assert!(
15281            matches!(err, DepError::FonteCaminhoShellGlob { byte: b'*', .. }),
15282            "got {err:?}",
15283        );
15284    }
15285
15286    #[test]
15287    fn fonte_caminho_shell_command_substitution_fires_before_shell_comment() {
15288        // Cascade pin on the upstream shell-command-substitution
15289        // arm: a value carrying both a backtick and `#`
15290        // (``"../`whoami`#pin"`` — the canonical "I pasted a
15291        // legacy-backtick command-substitution followed by a URL-
15292        // fragment tail" footgun) routes through
15293        // `FonteCaminhoShellCommandSubstitution` not
15294        // `FonteCaminhoShellComment`. The CWE-78 shell-command-
15295        // injection vector is the load-bearing root-cause edit on
15296        // every probe-as-both value.
15297        let d = dep_with_fonte(DepSource::Path {
15298            caminho: "../`whoami`#pin".into(),
15299        });
15300        let err = d.validate().unwrap_err();
15301        assert!(
15302            matches!(err, DepError::FonteCaminhoShellCommandSubstitution { .. }),
15303            "got {err:?}",
15304        );
15305    }
15306
15307    #[test]
15308    fn fonte_caminho_shell_background_fires_before_shell_comment() {
15309        // Cascade pin on the upstream shell-background arm: a value
15310        // carrying both `&` and `#` (`"../caixa-teia&pin#tail"` —
15311        // the canonical "I pasted a `cmd &` background-launch
15312        // followed by a URL-fragment tail" footgun) routes through
15313        // `FonteCaminhoShellBackground` not
15314        // `FonteCaminhoShellComment`. The background-launch tail is
15315        // the load-bearing root-cause edit on every probe-as-both
15316        // value.
15317        let d = dep_with_fonte(DepSource::Path {
15318            caminho: "../caixa-teia&pin#tail".into(),
15319        });
15320        let err = d.validate().unwrap_err();
15321        assert!(
15322            matches!(err, DepError::FonteCaminhoShellBackground { .. }),
15323            "got {err:?}",
15324        );
15325    }
15326
15327    #[test]
15328    fn fonte_caminho_shell_semicolon_fires_before_shell_comment() {
15329        // Cascade pin on the upstream shell-semicolon arm: a value
15330        // carrying both `;` and `#` (`"../caixa-teia;pin#tail"` —
15331        // the canonical sequential-cleanup + URL-fragment paste
15332        // idiom) routes through `FonteCaminhoShellSemicolon` not
15333        // `FonteCaminhoShellComment`. The sequential-command-
15334        // separator paste is the load-bearing root-cause edit on
15335        // every probe-as-both value.
15336        let d = dep_with_fonte(DepSource::Path {
15337            caminho: "../caixa-teia;pin#tail".into(),
15338        });
15339        let err = d.validate().unwrap_err();
15340        assert!(
15341            matches!(err, DepError::FonteCaminhoShellSemicolon { .. }),
15342            "got {err:?}",
15343        );
15344    }
15345
15346    #[test]
15347    fn fonte_caminho_shell_pipe_fires_before_shell_comment() {
15348        // Cascade pin on the upstream shell-pipe arm: a value
15349        // carrying both `|` and `#` (`"../caixa-teia|pin#tail"` —
15350        // the canonical pipeline-to-URL-fragment paste idiom) routes
15351        // through `FonteCaminhoShellPipe` not
15352        // `FonteCaminhoShellComment`. The pipeline-tail paste is
15353        // the load-bearing root-cause edit on every probe-as-both
15354        // value.
15355        let d = dep_with_fonte(DepSource::Path {
15356            caminho: "../caixa-teia|pin#tail".into(),
15357        });
15358        let err = d.validate().unwrap_err();
15359        assert!(
15360            matches!(err, DepError::FonteCaminhoShellPipe { .. }),
15361            "got {err:?}",
15362        );
15363    }
15364
15365    #[test]
15366    fn fonte_caminho_shell_redirection_fires_before_shell_comment() {
15367        // Cascade pin on the upstream shell-redirection arm: a
15368        // value carrying both `>` and `#` (`"../caixa-teia>log#pin"`
15369        // — the canonical "I pasted a `cmd > log` redirect followed
15370        // by a URL-fragment tail" footgun) routes through
15371        // `FonteCaminhoShellRedirection` not
15372        // `FonteCaminhoShellComment`. The input/output redirection
15373        // metachar carries the more self-locating `byte` payload,
15374        // so the prior arm wins on every probe-as-both value.
15375        let d = dep_with_fonte(DepSource::Path {
15376            caminho: "../caixa-teia>log#pin".into(),
15377        });
15378        let err = d.validate().unwrap_err();
15379        assert!(
15380            matches!(
15381                err,
15382                DepError::FonteCaminhoShellRedirection { byte: b'>', .. }
15383            ),
15384            "got {err:?}",
15385        );
15386    }
15387
15388    #[test]
15389    fn fonte_caminho_backslash_fires_before_shell_comment() {
15390        // Cascade pin on the upstream backslash arm: a value
15391        // carrying both `\` and `#` (`"..\caixa-teia#pin"` — the
15392        // canonical "I pasted a Windows-shell path followed by a
15393        // URL-fragment tail" footgun) routes through
15394        // `FonteCaminhoBackslash` not `FonteCaminhoShellComment`.
15395        // The cross-host-OS-separator divergence is the load-
15396        // bearing axis on every probe-as-both value.
15397        let d = dep_with_fonte(DepSource::Path {
15398            caminho: "..\\caixa-teia#pin".into(),
15399        });
15400        let err = d.validate().unwrap_err();
15401        assert!(
15402            matches!(err, DepError::FonteCaminhoBackslash { .. }),
15403            "got {err:?}",
15404        );
15405    }
15406
15407    #[test]
15408    fn fonte_caminho_control_char_fires_before_shell_comment() {
15409        // Cascade pin on the embedded-control-byte arm: a value
15410        // carrying both a control byte and `#` (`"../foo\n#pin"` —
15411        // the canonical paste-from-multiline-doc footgun where a
15412        // newline landed mid-caminho between the path and an
15413        // annotation) routes through `FonteCaminhoControlChar` not
15414        // `FonteCaminhoShellComment`. The POSIX-syscall-rejected-
15415        // byte diagnostic is the load-bearing axis on every value
15416        // that probes positive for both — mirrors the cascade
15417        // discipline on every prior arm.
15418        let d = dep_with_fonte(DepSource::Path {
15419            caminho: "../foo\n#pin".into(),
15420        });
15421        let err = d.validate().unwrap_err();
15422        assert!(
15423            matches!(err, DepError::FonteCaminhoControlChar { .. }),
15424            "got {err:?}",
15425        );
15426    }
15427
15428    #[test]
15429    fn fonte_caminho_absolute_fires_before_shell_comment() {
15430        // Cascade pin on the load-bearing leading-byte arm: a
15431        // leading `/` value with embedded `#` (`"/etc/foo#pin"`)
15432        // routes through `FonteCaminhoAbsolute` not
15433        // `FonteCaminhoShellComment` — the host-layout-leak
15434        // diagnostic is the load-bearing axis, the fragment byte is
15435        // the secondary observation. Same precedence logic as every
15436        // prior leading-byte arm.
15437        let d = dep_with_fonte(DepSource::Path {
15438            caminho: "/etc/foo#pin".into(),
15439        });
15440        let err = d.validate().unwrap_err();
15441        assert!(
15442            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
15443            "got {err:?}",
15444        );
15445    }
15446
15447    #[test]
15448    fn fonte_caminho_var_expansion_fires_before_shell_comment() {
15449        // Cascade pin on the upstream leading-`$` var-expansion
15450        // arm: a value carrying both a leading `$` and a `#`
15451        // (`"$DIR/foo#pin"` — the canonical "I pasted a `$DIR`
15452        // shell-variable at the head of a sibling-workspace path
15453        // followed by a URL-fragment tail" footgun) routes through
15454        // `FonteCaminhoVarExpansion` not `FonteCaminhoShellComment`.
15455        // The leading-byte shell-variable-expansion is the more
15456        // self-locating diagnostic on values that probe as both.
15457        let d = dep_with_fonte(DepSource::Path {
15458            caminho: "$DIR/foo#pin".into(),
15459        });
15460        let err = d.validate().unwrap_err();
15461        assert!(
15462            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
15463            "got {err:?}",
15464        );
15465    }
15466
15467    #[test]
15468    fn fonte_caminho_shell_comment_fires_before_trailing_slash() {
15469        // Cascade pin on the immediate-successor arm: a value
15470        // carrying both `#` and a trailing `/`
15471        // (`"../caixa-teia#pin/"` — the canonical "I tab-completed
15472        // a URL-fragment-carrying path" footgun) routes through
15473        // `FonteCaminhoShellComment` not
15474        // `FonteCaminhoTrailingSlash`. The embedded fragment /
15475        // comment-lead byte is the more semantic-locating axis (an
15476        // author who removes the `#pin` fragment typically also
15477        // drops the trailing separator since both are paste-from-
15478        // URL / paste-from-shell-tab-completion artifacts).
15479        let d = dep_with_fonte(DepSource::Path {
15480            caminho: "../caixa-teia#pin/".into(),
15481        });
15482        let err = d.validate().unwrap_err();
15483        assert!(
15484            matches!(err, DepError::FonteCaminhoShellComment { byte: b'#', .. },),
15485            "got {err:?}",
15486        );
15487    }
15488
15489    #[test]
15490    fn fonte_caminho_shell_comment_diagnostic_carries_offending_dep_caminho_and_byte() {
15491        // Diagnostic-shape pin (peer with
15492        // `fonte_caminho_shell_quote_grouping_diagnostic_carries_offending_dep_caminho_and_byte`
15493        // on the immediate-predecessor arm): the error's Display
15494        // surfaces the offending `:nome`, the offending `:caminho`
15495        // verbatim, the offending byte's hex / character form, and
15496        // names the shell-comment / URL-fragment-identifier /
15497        // YAML-comment cross-config-DSL footgun explicitly so a
15498        // `feira lint` run can render the diagnostic without
15499        // re-parsing.
15500        let d = dep_with_fonte(DepSource::Path {
15501            caminho: "../caixa-teia#readme".into(),
15502        });
15503        let rendered = d.validate().unwrap_err().to_string();
15504        assert!(
15505            rendered.contains("caixa-teia"),
15506            "diagnostic must name the offending dep: {rendered}",
15507        );
15508        assert!(
15509            rendered.contains("../caixa-teia#readme"),
15510            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
15511        );
15512        assert!(
15513            rendered.contains("0x23"),
15514            "diagnostic must surface the offending byte hex: {rendered:?}",
15515        );
15516        assert!(
15517            rendered.contains("shell-comment") || rendered.contains("comment-lead"),
15518            "diagnostic must name the shell-comment footgun: {rendered:?}",
15519        );
15520        assert!(
15521            rendered.contains("fragment") || rendered.contains("URL-fragment"),
15522            "diagnostic must reference the URL-fragment-identifier vocabulary: \
15523             {rendered:?}",
15524        );
15525    }
15526
15527    #[test]
15528    fn validate_rejects_path_fonte_with_caminho_carrying_url_percent_encoded_space() {
15529        // The canonical paste-from-browser-address-bar percent-
15530        // encoded-space footgun: an author copies `../caixa%20teia`
15531        // out of a URL-encoded README hyperlink / browser address
15532        // bar / percent-encoded permalink expecting `%20` to decode
15533        // to a literal space at the filesystem layer. POSIX
15534        // `std::path::Path` treats `%` as a literal path-component
15535        // byte, so `Path::join` looks for a literal
15536        // `./../caixa%20teia` subdirectory. `Path::is_absolute`
15537        // returns false on `..`, `%` is neither a leading-byte
15538        // sentinel nor a control byte nor `\` nor `<` / `>` nor
15539        // `|` nor `;` nor `&` nor backtick nor `*` / `?` nor `(` /
15540        // `)` nor `{` / `}` nor `[` / `]` nor `'` / `"` nor `#`,
15541        // and the value's last byte isn't `/` — so the value
15542        // silently passed every prior arm. The new arm moves the
15543        // rejection to validate time and names the offending dep +
15544        // caminho + byte verbatim.
15545        let d = dep_with_fonte(DepSource::Path {
15546            caminho: "../caixa%20teia".into(),
15547        });
15548        let err = d.validate().unwrap_err();
15549        let DepError::FonteCaminhoUrlPercentEncoding {
15550            nome,
15551            caminho,
15552            byte,
15553        } = err
15554        else {
15555            panic!("expected FonteCaminhoUrlPercentEncoding, got {err:?}");
15556        };
15557        assert_eq!(nome, "caixa-teia");
15558        assert_eq!(caminho, "../caixa%20teia");
15559        assert_eq!(byte, b'%');
15560    }
15561
15562    #[test]
15563    fn validate_rejects_path_fonte_with_caminho_carrying_url_percent_encoded_slash() {
15564        // The over-encoded path-separator shape (`"../caixa%2Fteia"`
15565        // intending the `%2F` as the URL encoding of `/`) locks a
15566        // `path:../caixa%2Fteia` BLAKE3 closure that diverges from
15567        // the byte-identical `path:../caixa/teia` form. Pinned
15568        // separately from the space-encoded shape so the gate's
15569        // coverage extends past the single canonical `%20` example
15570        // to any two-hex-digit percent-encoded sequence.
15571        let d = dep_with_fonte(DepSource::Path {
15572            caminho: "../caixa%2Fteia".into(),
15573        });
15574        let err = d.validate().unwrap_err();
15575        assert!(
15576            matches!(
15577                err,
15578                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
15579            ),
15580            "got {err:?}",
15581        );
15582    }
15583
15584    #[test]
15585    fn validate_rejects_path_fonte_with_caminho_carrying_lone_percent() {
15586        // The lone-`%` malformed-escape shape (`"../caixa-teia%foo"`
15587        // where `%` isn't followed by two hex digits) — every
15588        // WHATWG-conformant URL parser rejects the value at parse
15589        // time per RFC 3986 §2.1, but the byte would silently ride
15590        // into the lacre before the resolver subprocess crosses the
15591        // URL-parser boundary. Pinned separately from the well-
15592        // formed `%HH` shapes so the gate covers every percent-
15593        // occurrence, not only strictly-conformant escapes.
15594        let d = dep_with_fonte(DepSource::Path {
15595            caminho: "../caixa-teia%foo".into(),
15596        });
15597        let err = d.validate().unwrap_err();
15598        assert!(
15599            matches!(
15600                err,
15601                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
15602            ),
15603            "got {err:?}",
15604        );
15605    }
15606
15607    #[test]
15608    fn validate_rejects_path_fonte_with_caminho_carrying_leading_yaml_directive() {
15609        // The YAML-directive-lead paste shape (`"%YAML/../caixa-teia"`
15610        // — the canonical paste-from-top-of-doc YAML directive
15611        // block cross-idiom leak per YAML 1.2 §6.8.1). Pinned
15612        // separately from embedded shapes so the gate covers the
15613        // leading-position `%` too, not only mid-value occurrences.
15614        let d = dep_with_fonte(DepSource::Path {
15615            caminho: "%YAML/../caixa-teia".into(),
15616        });
15617        let err = d.validate().unwrap_err();
15618        assert!(
15619            matches!(
15620                err,
15621                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
15622            ),
15623            "got {err:?}",
15624        );
15625    }
15626
15627    #[test]
15628    fn validate_rejects_path_fonte_with_caminho_carrying_printf_format_specifier() {
15629        // The printf-format-specifier paste shape
15630        // (`"../caixa-%s-teia"` — the canonical paste-from-shell-
15631        // diagnostic-one-liner `printf "path=%s\n" ...` idiom, CWE-
15632        // 134 format-string-injection vector). Pinned separately
15633        // from the URL-encoding shapes so the gate's rationale
15634        // extends past the RFC 3986 axis to the C / POSIX printf
15635        // format-directive-lead axis.
15636        let d = dep_with_fonte(DepSource::Path {
15637            caminho: "../caixa-%s-teia".into(),
15638        });
15639        let err = d.validate().unwrap_err();
15640        assert!(
15641            matches!(
15642                err,
15643                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
15644            ),
15645            "got {err:?}",
15646        );
15647    }
15648
15649    #[test]
15650    fn validate_accepts_path_fonte_with_caminho_carrying_no_percent() {
15651        // The positive-control pin: the gate targets only `%`,
15652        // never adjacent printable ASCII or POSIX-valid bytes. The
15653        // canonical relative POSIX path (`"../caixa-teia"`) and a
15654        // nested deeply-pathed variant with adjacent printable
15655        // punctuation (`"../caixa-teia/sub-dir.v2"`) must continue
15656        // to validate cleanly so the gate doesn't widen to a "no
15657        // printable punctuation anywhere" sweep that would defeat
15658        // the entire path-fonte author surface. Peer with
15659        // `validate_accepts_path_fonte_with_caminho_carrying_no_shell_comment`
15660        // on the immediate-predecessor arm.
15661        let d = dep_with_fonte(DepSource::Path {
15662            caminho: "../caixa-teia/sub-dir.v2".into(),
15663        });
15664        d.validate().unwrap();
15665    }
15666
15667    #[test]
15668    fn fonte_caminho_shell_comment_fires_before_url_percent_encoding() {
15669        // Cascade pin on the immediate-predecessor arm: a value
15670        // carrying both `#` and `%` (`"../caixa-teia#pin%20"` — the
15671        // canonical "I pasted a URL-fragment permalink followed by a
15672        // percent-encoded space tail" footgun) routes through
15673        // `FonteCaminhoShellComment` not
15674        // `FonteCaminhoUrlPercentEncoding`. The URL-fragment-
15675        // identifier is the load-bearing downstream-truncation edit
15676        // on every probe-as-both value; same cascade discipline
15677        // every prior `:caminho` arm establishes.
15678        let d = dep_with_fonte(DepSource::Path {
15679            caminho: "../caixa-teia#pin%20".into(),
15680        });
15681        let err = d.validate().unwrap_err();
15682        assert!(
15683            matches!(err, DepError::FonteCaminhoShellComment { byte: b'#', .. }),
15684            "got {err:?}",
15685        );
15686    }
15687
15688    #[test]
15689    fn fonte_caminho_shell_quote_grouping_fires_before_url_percent_encoding() {
15690        // Cascade pin on the upstream shell-quote-grouping arm: a
15691        // value carrying both `'` and `%` (`"../'x'%20teia"` — the
15692        // canonical "I pasted a strong-quoted literal followed by
15693        // a percent-encoded space" footgun) routes through
15694        // `FonteCaminhoShellQuoteGrouping` not
15695        // `FonteCaminhoUrlPercentEncoding`. The shell-string-
15696        // literal-delimiter is the load-bearing root-cause edit on
15697        // every probe-as-both value.
15698        let d = dep_with_fonte(DepSource::Path {
15699            caminho: "../'x'%20teia".into(),
15700        });
15701        let err = d.validate().unwrap_err();
15702        assert!(
15703            matches!(
15704                err,
15705                DepError::FonteCaminhoShellQuoteGrouping { byte: b'\'', .. },
15706            ),
15707            "got {err:?}",
15708        );
15709    }
15710
15711    #[test]
15712    fn fonte_caminho_backslash_fires_before_url_percent_encoding() {
15713        // Cascade pin on the upstream backslash arm: a value
15714        // carrying both `\` and `%` (`"..\\caixa%20teia"` — the
15715        // canonical "I pasted a Windows-shell path followed by a
15716        // percent-encoded space" footgun) routes through
15717        // `FonteCaminhoBackslash` not
15718        // `FonteCaminhoUrlPercentEncoding`. The cross-host-OS-
15719        // separator divergence is the load-bearing root-cause edit
15720        // on every probe-as-both value.
15721        let d = dep_with_fonte(DepSource::Path {
15722            caminho: "..\\caixa%20teia".into(),
15723        });
15724        let err = d.validate().unwrap_err();
15725        assert!(
15726            matches!(err, DepError::FonteCaminhoBackslash { .. }),
15727            "got {err:?}",
15728        );
15729    }
15730
15731    #[test]
15732    fn fonte_caminho_control_char_fires_before_url_percent_encoding() {
15733        // Cascade pin on the upstream control-char arm: a value
15734        // carrying both a NUL byte and `%` (`"../caixa\0%20teia"` —
15735        // the canonical "I pasted a paste-from-binary-blob path
15736        // followed by a percent-encoded space" footgun) routes
15737        // through `FonteCaminhoControlChar` not
15738        // `FonteCaminhoUrlPercentEncoding`. The POSIX-syscall-
15739        // rejected byte is the load-bearing root-cause edit on
15740        // every probe-as-both value.
15741        let d = dep_with_fonte(DepSource::Path {
15742            caminho: "../caixa\0%20teia".into(),
15743        });
15744        let err = d.validate().unwrap_err();
15745        assert!(
15746            matches!(err, DepError::FonteCaminhoControlChar { byte: 0x00, .. },),
15747            "got {err:?}",
15748        );
15749    }
15750
15751    #[test]
15752    fn fonte_caminho_absolute_fires_before_url_percent_encoding() {
15753        // Cascade pin on the upstream absolute-path arm: a value
15754        // that's both absolute and carries `%` (`"/etc/passwd%20"`
15755        // — the canonical "I pasted an absolute path with a
15756        // percent-encoded space tail" footgun) routes through
15757        // `FonteCaminhoAbsolute` not
15758        // `FonteCaminhoUrlPercentEncoding`. The host-layout-leak is
15759        // the load-bearing root-cause edit on every probe-as-both
15760        // value.
15761        let d = dep_with_fonte(DepSource::Path {
15762            caminho: "/etc/passwd%20".into(),
15763        });
15764        let err = d.validate().unwrap_err();
15765        assert!(
15766            matches!(err, DepError::FonteCaminhoAbsolute { .. }),
15767            "got {err:?}",
15768        );
15769    }
15770
15771    #[test]
15772    fn fonte_caminho_var_expansion_fires_before_url_percent_encoding() {
15773        // Cascade pin on the upstream var-expansion arm: a value
15774        // starting with `$` and carrying `%` (`"$HOME/caixa%20teia"`
15775        // — the canonical "I pasted a `$HOME`-rooted path with a
15776        // percent-encoded space" footgun) routes through
15777        // `FonteCaminhoVarExpansion` not
15778        // `FonteCaminhoUrlPercentEncoding`. The shell-variable-
15779        // expansion is the load-bearing root-cause edit on every
15780        // probe-as-both value.
15781        let d = dep_with_fonte(DepSource::Path {
15782            caminho: "$HOME/caixa%20teia".into(),
15783        });
15784        let err = d.validate().unwrap_err();
15785        assert!(
15786            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
15787            "got {err:?}",
15788        );
15789    }
15790
15791    #[test]
15792    fn fonte_caminho_url_percent_encoding_fires_before_trailing_slash() {
15793        // Cascade pin on the immediate-successor arm: a value
15794        // carrying both `%` and a trailing `/`
15795        // (`"../caixa%20teia/"` — the canonical "I tab-completed a
15796        // percent-encoded-space-carrying path" footgun) routes
15797        // through `FonteCaminhoUrlPercentEncoding` not
15798        // `FonteCaminhoTrailingSlash`. The embedded percent-
15799        // encoding-escape byte is the more semantic-locating axis
15800        // (an author who decodes the `%20` to a literal space is
15801        // likely to also tab-strip the trailing separator since
15802        // both are paste-from-URL / paste-from-shell-tab-completion
15803        // artifacts).
15804        let d = dep_with_fonte(DepSource::Path {
15805            caminho: "../caixa%20teia/".into(),
15806        });
15807        let err = d.validate().unwrap_err();
15808        assert!(
15809            matches!(
15810                err,
15811                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
15812            ),
15813            "got {err:?}",
15814        );
15815    }
15816
15817    #[test]
15818    fn fonte_caminho_url_percent_encoding_diagnostic_carries_offending_dep_caminho_and_byte() {
15819        // Diagnostic-shape pin (peer with
15820        // `fonte_caminho_shell_comment_diagnostic_carries_offending_dep_caminho_and_byte`
15821        // on the immediate-predecessor arm): the error's Display
15822        // surfaces the offending `:nome`, the offending `:caminho`
15823        // verbatim, the offending byte's hex / character form, and
15824        // names the URL-percent-encoding-escape / printf-format-
15825        // specifier footgun explicitly so a `feira lint` run can
15826        // render the diagnostic without re-parsing.
15827        let d = dep_with_fonte(DepSource::Path {
15828            caminho: "../caixa%20teia".into(),
15829        });
15830        let rendered = d.validate().unwrap_err().to_string();
15831        assert!(
15832            rendered.contains("caixa-teia"),
15833            "diagnostic must name the offending dep: {rendered}",
15834        );
15835        assert!(
15836            rendered.contains("../caixa%20teia"),
15837            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
15838        );
15839        assert!(
15840            rendered.contains("0x25"),
15841            "diagnostic must surface the offending byte hex: {rendered:?}",
15842        );
15843        assert!(
15844            rendered.contains("percent-encoding") || rendered.contains("percent-encoded"),
15845            "diagnostic must name the URL-percent-encoding-escape footgun: {rendered:?}",
15846        );
15847        assert!(
15848            rendered.contains("printf") || rendered.contains("format-specifier"),
15849            "diagnostic must reference the printf-format-specifier vocabulary: \
15850             {rendered:?}",
15851        );
15852    }
15853
15854    #[test]
15855    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_var_expansion() {
15856        // The canonical embedded-`$` shell-variable-expansion paste
15857        // shape (`"../foo$HOME/bar"` — an author copies a partially-
15858        // substituted shell one-liner where the leading segment is a
15859        // literal `../foo` while the mid segment carries the un-
15860        // substituted `$HOME` template). The leading-`$` position is
15861        // already gated by the f4efe9c leading-byte arm which routes
15862        // through `FonteCaminhoVarExpansion`; this arm closes the
15863        // last positional gap on `$` — every position on the axis is
15864        // structurally rejected.
15865        let d = dep_with_fonte(DepSource::Path {
15866            caminho: "../foo$HOME/bar".into(),
15867        });
15868        let err = d.validate().unwrap_err();
15869        let DepError::FonteCaminhoShellVariableExpansion {
15870            nome,
15871            caminho,
15872            byte,
15873        } = err
15874        else {
15875            panic!("expected FonteCaminhoShellVariableExpansion, got {err:?}");
15876        };
15877        assert_eq!(nome, "caixa-teia");
15878        assert_eq!(caminho, "../foo$HOME/bar");
15879        assert_eq!(byte, b'$');
15880    }
15881
15882    #[test]
15883    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_braced_var_expansion() {
15884        // The symmetric braced-CI-manifest paste shape
15885        // (`"../foo${WORKSPACE}/bar"` — the canonical paste-from-
15886        // GitHub-Actions-workflow / paste-from-`.gitlab-ci.yml`
15887        // footgun). Pinned separately from the bare-`$VAR` shape so
15888        // the gate covers both POSIX shell §2.6 Parameter Expansion
15889        // syntactic forms, not only the unbraced variant. The
15890        // embedded `{` byte in `${...}` is also caught by the 598b770
15891        // shell-brace-expansion arm but that arm fires earlier in
15892        // the cascade — the `$` arm's coverage extends to `${...}`
15893        // structurally, so the diagnostic asserted here is the
15894        // brace-expansion one (which is a valid outcome; the point
15895        // of the pin is that the value never survives validation).
15896        let d = dep_with_fonte(DepSource::Path {
15897            caminho: "../foo${WORKSPACE}/bar".into(),
15898        });
15899        let err = d.validate().unwrap_err();
15900        assert!(
15901            matches!(
15902                err,
15903                DepError::FonteCaminhoShellBraceExpansion { byte: b'{', .. }
15904                    | DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
15905            ),
15906            "got {err:?}",
15907        );
15908    }
15909
15910    #[test]
15911    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_command_substitution() {
15912        // The paste-from-shell-prompt command-substitution idiom
15913        // (`"../foo$(whoami)/bar"`). Pinned separately from the bare-
15914        // `$VAR` shape so the gate's rationale extends to POSIX shell
15915        // §2.6.3 Command Substitution (the modern `$(<cmd>)` form; the
15916        // legacy `` `<cmd>` `` form is already closed by the c370458
15917        // backtick arm). The embedded `(` byte in `$(...)` is also
15918        // caught structurally by the 0633c91 shell-subshell-grouping
15919        // arm which fires earlier in the cascade — the diagnostic
15920        // asserted here is either outcome, since both structurally
15921        // reject the value; the point of the pin is that the value
15922        // never survives validation.
15923        let d = dep_with_fonte(DepSource::Path {
15924            caminho: "../foo$(whoami)/bar".into(),
15925        });
15926        let err = d.validate().unwrap_err();
15927        assert!(
15928            matches!(
15929                err,
15930                DepError::FonteCaminhoShellSubshellGrouping { byte: b'(', .. }
15931                    | DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
15932            ),
15933            "got {err:?}",
15934        );
15935    }
15936
15937    #[test]
15938    fn validate_rejects_path_fonte_with_caminho_carrying_embedded_positional_parameter() {
15939        // The paste-from-`Makefile` / paste-from-SQL-migration bare-
15940        // `$1` positional-parameter shape (`"../foo$1/bar"` — a Make
15941        // automatic-variable `$1` or a PostgreSQL bind-parameter `$1`
15942        // idiom copied into a caminho template). None of the prior
15943        // shell-metachar arms cover this shape (`1` is a bare digit;
15944        // no `(` / `{` / letter follows the `$`), so the arm is the
15945        // sole gate on the shape.
15946        let d = dep_with_fonte(DepSource::Path {
15947            caminho: "../foo$1/bar".into(),
15948        });
15949        let err = d.validate().unwrap_err();
15950        assert!(
15951            matches!(
15952                err,
15953                DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
15954            ),
15955            "got {err:?}",
15956        );
15957    }
15958
15959    #[test]
15960    fn validate_accepts_path_fonte_with_caminho_carrying_no_dollar() {
15961        // The positive-control pin (peer with
15962        // `validate_accepts_path_fonte_with_caminho_carrying_no_percent`
15963        // on the immediate-predecessor arm): the gate targets only
15964        // `$`, never adjacent printable ASCII or POSIX-valid bytes.
15965        // A relative POSIX path carrying dashes / dots / slashes /
15966        // digits (`"../caixa-teia/sub-dir.v2"`) must continue to
15967        // validate cleanly so the gate doesn't widen to a "no
15968        // printable punctuation anywhere" sweep that would defeat
15969        // the entire path-fonte author surface.
15970        let d = dep_with_fonte(DepSource::Path {
15971            caminho: "../caixa-teia/sub-dir.v2".into(),
15972        });
15973        d.validate().unwrap();
15974    }
15975
15976    #[test]
15977    fn fonte_caminho_var_expansion_fires_before_shell_variable_expansion() {
15978        // Cascade pin on the leading-`$` sibling arm at line 540: a
15979        // value starting with `$` and carrying an embedded `$` too
15980        // (`"$HOME/foo$WORKSPACE/bar"` — the canonical "I pasted a
15981        // fully-templated CI path with two un-substituted variables")
15982        // routes through `FonteCaminhoVarExpansion` not
15983        // `FonteCaminhoShellVariableExpansion`. The leading-byte
15984        // host-layout-leak is the load-bearing self-locating axis
15985        // (the leading position dominates the semantic-locating
15986        // rationale on every probe-as-both value); the embedded
15987        // arm's positional-agnostic sweep catches only values whose
15988        // leading byte doesn't route through the earlier leading-
15989        // byte arms.
15990        let d = dep_with_fonte(DepSource::Path {
15991            caminho: "$HOME/foo$WORKSPACE/bar".into(),
15992        });
15993        let err = d.validate().unwrap_err();
15994        assert!(
15995            matches!(err, DepError::FonteCaminhoVarExpansion { .. }),
15996            "got {err:?}",
15997        );
15998    }
15999
16000    #[test]
16001    fn fonte_caminho_url_percent_encoding_fires_before_shell_variable_expansion() {
16002        // Cascade pin on the immediate-predecessor arm: a value
16003        // carrying both `%` and embedded `$` (`"../foo%20$HOME/bar"`
16004        // — the canonical "I pasted a percent-encoded space adjacent
16005        // to a `$HOME` template") routes through
16006        // `FonteCaminhoUrlPercentEncoding` not
16007        // `FonteCaminhoShellVariableExpansion`. The URL-percent-
16008        // encoding-escape byte is the more semantic-locating axis
16009        // (the paste-from-browser-address-bar shape is the load-
16010        // bearing self-locating edit); same cascade discipline every
16011        // prior `:caminho` arm establishes.
16012        let d = dep_with_fonte(DepSource::Path {
16013            caminho: "../foo%20$HOME/bar".into(),
16014        });
16015        let err = d.validate().unwrap_err();
16016        assert!(
16017            matches!(
16018                err,
16019                DepError::FonteCaminhoUrlPercentEncoding { byte: b'%', .. },
16020            ),
16021            "got {err:?}",
16022        );
16023    }
16024
16025    #[test]
16026    fn fonte_caminho_shell_variable_expansion_fires_before_trailing_slash() {
16027        // Cascade pin on the immediate-successor arm: a value
16028        // carrying both embedded `$` and a trailing `/`
16029        // (`"../foo$HOME/bar/"` — the canonical "I tab-completed a
16030        // `$HOME`-template-carrying path") routes through
16031        // `FonteCaminhoShellVariableExpansion` not
16032        // `FonteCaminhoTrailingSlash`. The embedded shell-variable-
16033        // expansion byte is the more semantic-locating axis on
16034        // probe-as-both values (an author who substitutes the
16035        // `$HOME` template with a literal value is likely to also
16036        // tab-strip the trailing separator).
16037        let d = dep_with_fonte(DepSource::Path {
16038            caminho: "../foo$HOME/bar/".into(),
16039        });
16040        let err = d.validate().unwrap_err();
16041        assert!(
16042            matches!(
16043                err,
16044                DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
16045            ),
16046            "got {err:?}",
16047        );
16048    }
16049
16050    #[test]
16051    fn fonte_caminho_shell_variable_expansion_diagnostic_carries_offending_dep_caminho_and_byte() {
16052        // Diagnostic-shape pin (peer with
16053        // `fonte_caminho_url_percent_encoding_diagnostic_carries_offending_dep_caminho_and_byte`
16054        // on the immediate-predecessor arm): the error's Display
16055        // surfaces the offending `:nome`, the offending `:caminho`
16056        // verbatim, the offending byte's hex / character form, and
16057        // names the shell-variable-expansion / command-substitution
16058        // footgun explicitly so a `feira lint` run can render the
16059        // diagnostic without re-parsing.
16060        let d = dep_with_fonte(DepSource::Path {
16061            caminho: "../foo$HOME/bar".into(),
16062        });
16063        let rendered = d.validate().unwrap_err().to_string();
16064        assert!(
16065            rendered.contains("caixa-teia"),
16066            "diagnostic must name the offending dep: {rendered}",
16067        );
16068        assert!(
16069            rendered.contains("../foo$HOME/bar"),
16070            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
16071        );
16072        assert!(
16073            rendered.contains("0x24"),
16074            "diagnostic must surface the offending byte hex: {rendered:?}",
16075        );
16076        assert!(
16077            rendered.contains("variable-expansion") || rendered.contains("variable expansion"),
16078            "diagnostic must name the shell-variable-expansion footgun: {rendered:?}",
16079        );
16080        assert!(
16081            rendered.contains("command-substitution") || rendered.contains("command substitution"),
16082            "diagnostic must reference the command-substitution vocabulary: {rendered:?}",
16083        );
16084    }
16085
16086    #[test]
16087    fn validate_rejects_path_fonte_with_caminho_carrying_shell_history_expansion() {
16088        // The fail-before-pass-after pin for the canonical paste-from-
16089        // shell-history footgun on `:caminho`. An author copies a `cd
16090        // ../caixa-teia && !sudo make install` one-liner from a quick-
16091        // start README, intending the trailing `!sudo` as a shell-
16092        // history-expansion reference but the typed slot is itself a
16093        // byte-level string parser, not a shell context, so the byte
16094        // rides into the value verbatim. Until this arm landed the `!`
16095        // byte silently passed every prior `:caminho` cascade arm
16096        // (`!` isn't `\` / `<` / `>` / `|` / `;` / `&` / backtick /
16097        // `*` / `?` / `(` / `)` / `{` / `}` / `[` / `]` / `'` / `"` /
16098        // `#` / `%` / `$`); bash with the default `histexpand` mode
16099        // rewrites `!command` to the most recent history entry
16100        // beginning with `command`, the canonical RCE-class injection
16101        // vector when the byte rides into a shell argument executed
16102        // under `bash -i` (the operator-notebook interactive shell).
16103        let d = dep_with_fonte(DepSource::Path {
16104            caminho: "../caixa-teia!sudo".into(),
16105        });
16106        let err = d.validate().unwrap_err();
16107        let DepError::FonteCaminhoShellHistoryExpansion {
16108            nome,
16109            caminho,
16110            byte,
16111        } = err
16112        else {
16113            panic!("expected FonteCaminhoShellHistoryExpansion, got {err:?}");
16114        };
16115        assert_eq!(nome, "caixa-teia");
16116        assert_eq!(caminho, "../caixa-teia!sudo");
16117        assert_eq!(byte, b'!');
16118    }
16119
16120    #[test]
16121    fn validate_rejects_path_fonte_with_caminho_carrying_double_bang_history_reference() {
16122        // The symmetric `!!` repeat-prior-command paste idiom (peer with
16123        // `validate_rejects_git_fonte_with_repo_carrying_double_bang_history_reference`
16124        // on `is_git_repo_url`). Pinned separately from the wrapped
16125        // `!command` shape so a future diagnostic-surface change that
16126        // only checked the leading or paired-bang position surfaces
16127        // here — the per-byte arm fires anywhere `!` appears in the
16128        // value, including at consecutive positions in the middle.
16129        let d = dep_with_fonte(DepSource::Path {
16130            caminho: "../foo!!/bar".into(),
16131        });
16132        let err = d.validate().unwrap_err();
16133        assert!(
16134            matches!(
16135                err,
16136                DepError::FonteCaminhoShellHistoryExpansion { byte: b'!', .. },
16137            ),
16138            "got {err:?}",
16139        );
16140    }
16141
16142    #[test]
16143    fn validate_rejects_path_fonte_with_caminho_carrying_trailing_enthusiasm_bang() {
16144        // The English-typography enthusiasm-form paste-from-prose
16145        // idiom: an author writes `:caminho "../caixa-teia!"`
16146        // expecting the substrate to coerce it to a kebab-case slug.
16147        // Pinned separately from the `!<word>` shell-history shape so
16148        // the gate's rationale extends to the paste-from-prose surface
16149        // (the same rationale the peer `is_git_repo_url` bang arm at
16150        // 7d53c68 covers). None of the prior shell-metachar arms cover
16151        // this shape (no `!<word>` reference and no `!!` repeat), so
16152        // the arm is the sole gate on the shape.
16153        let d = dep_with_fonte(DepSource::Path {
16154            caminho: "../caixa-teia!".into(),
16155        });
16156        let err = d.validate().unwrap_err();
16157        assert!(
16158            matches!(
16159                err,
16160                DepError::FonteCaminhoShellHistoryExpansion { byte: b'!', .. },
16161            ),
16162            "got {err:?}",
16163        );
16164    }
16165
16166    #[test]
16167    fn validate_accepts_path_fonte_with_caminho_carrying_no_bang() {
16168        // The positive-control pin (peer with
16169        // `validate_accepts_path_fonte_with_caminho_carrying_no_dollar`
16170        // on the immediate-predecessor arm): the gate targets only
16171        // `!`, never adjacent printable ASCII or POSIX-valid bytes.
16172        // A relative POSIX path carrying dashes / dots / slashes /
16173        // digits (`"../caixa-teia/sub-dir.v2"`) must continue to
16174        // validate cleanly so the gate doesn't widen to a "no
16175        // printable punctuation anywhere" sweep that would defeat
16176        // the entire path-fonte author surface.
16177        let d = dep_with_fonte(DepSource::Path {
16178            caminho: "../caixa-teia/sub-dir.v2".into(),
16179        });
16180        d.validate().unwrap();
16181    }
16182
16183    #[test]
16184    fn fonte_caminho_shell_variable_expansion_fires_before_shell_history_expansion() {
16185        // Cascade pin on the immediate-predecessor arm: a value
16186        // carrying both embedded `$` and `!` (`"../foo$HOME/bar!sudo"`
16187        // — the canonical "I pasted a `$HOME`-templated path adjacent
16188        // to a trailing `!sudo` history-expansion") routes through
16189        // `FonteCaminhoShellVariableExpansion` not
16190        // `FonteCaminhoShellHistoryExpansion`. The shell-variable-
16191        // expansion byte is the more semantic-locating axis on
16192        // probe-as-both values (the paste-from-CI-manifest-with-`$VAR`-
16193        // template shape is the load-bearing self-locating edit);
16194        // same cascade discipline every prior `:caminho` arm
16195        // establishes.
16196        let d = dep_with_fonte(DepSource::Path {
16197            caminho: "../foo$HOME/bar!sudo".into(),
16198        });
16199        let err = d.validate().unwrap_err();
16200        assert!(
16201            matches!(
16202                err,
16203                DepError::FonteCaminhoShellVariableExpansion { byte: b'$', .. },
16204            ),
16205            "got {err:?}",
16206        );
16207    }
16208
16209    #[test]
16210    fn fonte_caminho_shell_history_expansion_fires_before_trailing_slash() {
16211        // Cascade pin on the immediate-successor arm: a value carrying
16212        // both embedded `!` and a trailing `/` (`"../caixa-teia!sudo/"`
16213        // — the canonical "I tab-completed a `!sudo`-carrying path")
16214        // routes through `FonteCaminhoShellHistoryExpansion` not
16215        // `FonteCaminhoTrailingSlash`. The embedded shell-history-
16216        // expansion byte is the more semantic-locating axis on probe-
16217        // as-both values (an author who removes the `!sudo` history
16218        // reference is likely to also tab-strip the trailing separator).
16219        let d = dep_with_fonte(DepSource::Path {
16220            caminho: "../caixa-teia!sudo/".into(),
16221        });
16222        let err = d.validate().unwrap_err();
16223        assert!(
16224            matches!(
16225                err,
16226                DepError::FonteCaminhoShellHistoryExpansion { byte: b'!', .. },
16227            ),
16228            "got {err:?}",
16229        );
16230    }
16231
16232    #[test]
16233    fn fonte_caminho_shell_history_expansion_diagnostic_carries_offending_dep_caminho_and_byte() {
16234        // Diagnostic-shape pin (peer with
16235        // `fonte_caminho_shell_variable_expansion_diagnostic_carries_offending_dep_caminho_and_byte`
16236        // on the immediate-predecessor arm): the error's Display
16237        // surfaces the offending `:nome`, the offending `:caminho`
16238        // verbatim, the offending byte's hex / character form, and
16239        // names the shell-history-expansion / bang-operator footgun
16240        // explicitly so a `feira lint` run can render the diagnostic
16241        // without re-parsing.
16242        let d = dep_with_fonte(DepSource::Path {
16243            caminho: "../caixa-teia!sudo".into(),
16244        });
16245        let rendered = d.validate().unwrap_err().to_string();
16246        assert!(
16247            rendered.contains("caixa-teia"),
16248            "diagnostic must name the offending dep: {rendered}",
16249        );
16250        assert!(
16251            rendered.contains("../caixa-teia!sudo"),
16252            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
16253        );
16254        assert!(
16255            rendered.contains("0x21"),
16256            "diagnostic must surface the offending byte hex: {rendered:?}",
16257        );
16258        assert!(
16259            rendered.contains("history-expansion") || rendered.contains("history expansion"),
16260            "diagnostic must name the shell-history-expansion footgun: {rendered:?}",
16261        );
16262        assert!(
16263            rendered.contains("bang"),
16264            "diagnostic must reference the bang-operator vocabulary: {rendered:?}",
16265        );
16266    }
16267
16268    #[test]
16269    fn validate_rejects_path_fonte_with_caminho_carrying_shell_history_substitution() {
16270        // The fail-before-pass-after pin for the canonical paste-from-
16271        // shell-history-quick-substitution footgun on `:caminho`. An
16272        // author copies a `git clone <bad-url>` line from their terminal,
16273        // corrects it via bash's `^bad^good` quick-substitution history
16274        // operator (bash reference §9.3, `set -o histexpand` mode's
16275        // default for interactive sessions), and pastes the trailing
16276        // `^bad^good` substitution fragment into a `:caminho` value
16277        // without trimming the leading `git clone` prefix — the byte
16278        // rides into the manifest verbatim. Until this arm landed the
16279        // `^` byte silently passed every prior `:caminho` cascade arm
16280        // (`^` isn't `\` / `<` / `>` / `|` / `;` / `&` / backtick / `*`
16281        // / `?` / `(` / `)` / `{` / `}` / `[` / `]` / `'` / `"` / `#` /
16282        // `%` / `$` / `!`); bash with the default `histexpand` mode
16283        // rewrites the prior command's `bad` string to `good` and re-
16284        // executes it, the paired-operator half of the `set -o
16285        // histexpand` feature the peer `!` arm already closes the prefix
16286        // half of. The peer `is_git_repo_url` axis rejects the byte at
16287        // 49e142f under the same shell-history-substitution / RFC-3986-
16288        // unwise banner.
16289        let d = dep_with_fonte(DepSource::Path {
16290            caminho: "../foo^bad^good".into(),
16291        });
16292        let err = d.validate().unwrap_err();
16293        let DepError::FonteCaminhoShellHistorySubstitution {
16294            nome,
16295            caminho,
16296            byte,
16297        } = err
16298        else {
16299            panic!("expected FonteCaminhoShellHistorySubstitution, got {err:?}");
16300        };
16301        assert_eq!(nome, "caixa-teia");
16302        assert_eq!(caminho, "../foo^bad^good");
16303        assert_eq!(byte, b'^');
16304    }
16305
16306    #[test]
16307    fn validate_rejects_path_fonte_with_caminho_carrying_regex_negation_anchor() {
16308        // The symmetric paste-from-doc-grep-pipeline footgun (peer with
16309        // `validate_rejects_git_fonte_with_repo_carrying_caret_regex_anchor`
16310        // on `is_git_repo_url`). An author copies a `grep '^archived'`
16311        // regex-anchor / negation idiom from a doc snippet and the byte
16312        // rides in verbatim. Pinned separately from the `^old^new^`
16313        // quick-substitution shape so a future diagnostic-surface change
16314        // that only checked the paired-caret history-substitution
16315        // position surfaces here — the per-byte arm fires anywhere `^`
16316        // appears in the value, including at a solitary leading-of-
16317        // segment position.
16318        let d = dep_with_fonte(DepSource::Path {
16319            caminho: "../foo/^archived".into(),
16320        });
16321        let err = d.validate().unwrap_err();
16322        assert!(
16323            matches!(
16324                err,
16325                DepError::FonteCaminhoShellHistorySubstitution { byte: b'^', .. },
16326            ),
16327            "got {err:?}",
16328        );
16329    }
16330
16331    #[test]
16332    fn validate_rejects_path_fonte_with_caminho_carrying_trailing_history_substitution_open() {
16333        // The trailing-`^` history-substitution-open shape — an author
16334        // starts typing a `^bad^good` quick-substitution but pastes only
16335        // the leading `^` sentinel before context-switching (a bash-
16336        // reference §9.3 valid histexpand prefix on its own — even a
16337        // solitary `^` on the prior command's whole re-execution shape).
16338        // Pinned separately from the `^old^new^` full-form and the leading-
16339        // of-segment `^archived` regex-anchor shape so the gate's
16340        // rationale extends to the paste-from-shell-history-with-only-
16341        // the-first-byte-selected surface. None of the prior shell-
16342        // metachar arms cover this shape.
16343        let d = dep_with_fonte(DepSource::Path {
16344            caminho: "../caixa-teia^".into(),
16345        });
16346        let err = d.validate().unwrap_err();
16347        assert!(
16348            matches!(
16349                err,
16350                DepError::FonteCaminhoShellHistorySubstitution { byte: b'^', .. },
16351            ),
16352            "got {err:?}",
16353        );
16354    }
16355
16356    #[test]
16357    fn validate_accepts_path_fonte_with_caminho_carrying_no_caret() {
16358        // The positive-control pin (peer with
16359        // `validate_accepts_path_fonte_with_caminho_carrying_no_bang`
16360        // on the immediate-predecessor arm): the gate targets only
16361        // `^`, never adjacent printable ASCII or POSIX-valid bytes.
16362        // A relative POSIX path carrying dashes / dots / slashes /
16363        // digits / underscore (`"../caixa-teia/sub_v2.rc"`) must
16364        // continue to validate cleanly so the gate doesn't widen to
16365        // a "no printable punctuation anywhere" sweep that would
16366        // defeat the entire path-fonte author surface.
16367        let d = dep_with_fonte(DepSource::Path {
16368            caminho: "../caixa-teia/sub_v2.rc".into(),
16369        });
16370        d.validate().unwrap();
16371    }
16372
16373    #[test]
16374    fn fonte_caminho_shell_history_expansion_fires_before_shell_history_substitution() {
16375        // Cascade pin on the immediate-predecessor arm: a value carrying
16376        // both embedded `!` and `^` (`"../foo!sudo^bad^good"` — the
16377        // canonical "I pasted a `!sudo` history-reference next to a
16378        // `^bad^good` quick-substitution") routes through
16379        // `FonteCaminhoShellHistoryExpansion` not
16380        // `FonteCaminhoShellHistorySubstitution`. The `!` prefix form is
16381        // the more semantic-locating axis on probe-as-both values (an
16382        // author who removes the `!sudo` reference is likely to also
16383        // strip the paired `^` substitution fragment); same cascade
16384        // discipline every prior `:caminho` arm establishes.
16385        let d = dep_with_fonte(DepSource::Path {
16386            caminho: "../foo!sudo^bad^good".into(),
16387        });
16388        let err = d.validate().unwrap_err();
16389        assert!(
16390            matches!(
16391                err,
16392                DepError::FonteCaminhoShellHistoryExpansion { byte: b'!', .. },
16393            ),
16394            "got {err:?}",
16395        );
16396    }
16397
16398    #[test]
16399    fn fonte_caminho_shell_history_substitution_fires_before_trailing_slash() {
16400        // Cascade pin on the immediate-successor arm: a value carrying
16401        // both embedded `^` and a trailing `/` (`"../foo^bad^good/"` —
16402        // the canonical "I tab-completed a `^bad^good`-carrying path")
16403        // routes through `FonteCaminhoShellHistorySubstitution` not
16404        // `FonteCaminhoTrailingSlash`. The embedded shell-history-
16405        // substitution byte is the more semantic-locating axis on probe-
16406        // as-both values (an author who removes the `^bad^good`
16407        // substitution fragment is likely to also tab-strip the trailing
16408        // separator).
16409        let d = dep_with_fonte(DepSource::Path {
16410            caminho: "../foo^bad^good/".into(),
16411        });
16412        let err = d.validate().unwrap_err();
16413        assert!(
16414            matches!(
16415                err,
16416                DepError::FonteCaminhoShellHistorySubstitution { byte: b'^', .. },
16417            ),
16418            "got {err:?}",
16419        );
16420    }
16421
16422    #[test]
16423    fn fonte_caminho_shell_history_substitution_diagnostic_carries_offending_dep_caminho_and_byte()
16424    {
16425        // Diagnostic-shape pin (peer with
16426        // `fonte_caminho_shell_history_expansion_diagnostic_carries_offending_dep_caminho_and_byte`
16427        // on the immediate-predecessor arm): the error's Display
16428        // surfaces the offending `:nome`, the offending `:caminho`
16429        // verbatim, the offending byte's hex form, and names the
16430        // shell-history-substitution / RFC-3986-'unwise' / regex-
16431        // negation footgun explicitly so a `feira lint` run can render
16432        // the diagnostic without re-parsing.
16433        let d = dep_with_fonte(DepSource::Path {
16434            caminho: "../foo^bad^good".into(),
16435        });
16436        let rendered = d.validate().unwrap_err().to_string();
16437        assert!(
16438            rendered.contains("caixa-teia"),
16439            "diagnostic must name the offending dep: {rendered}",
16440        );
16441        assert!(
16442            rendered.contains("../foo^bad^good"),
16443            "diagnostic must quote the offending caminho verbatim: {rendered:?}",
16444        );
16445        assert!(
16446            rendered.contains("0x5e") || rendered.contains("0x5E"),
16447            "diagnostic must surface the offending byte hex: {rendered:?}",
16448        );
16449        assert!(
16450            rendered.contains("history-substitution") || rendered.contains("history substitution"),
16451            "diagnostic must name the shell-history-substitution footgun: {rendered:?}",
16452        );
16453        assert!(
16454            rendered.contains("unwise"),
16455            "diagnostic must reference the RFC-3986 'unwise' set vocabulary: {rendered:?}",
16456        );
16457    }
16458
16459    #[test]
16460    fn fonte_repo_empty_fires_before_pin_missing() {
16461        // Order pin: empty `:repo` is the more self-locating diagnostic
16462        // (every git source needs a repo; the pin discussion is
16463        // secondary), so it fires before the pin-missing arm even when
16464        // both are violated. Mirrors the
16465        // `nome_empty_takes_precedence_over_versao_invalid` ordering
16466        // discipline on the per-entry layer.
16467        let d = dep_with_fonte(DepSource::Git {
16468            repo: String::new(),
16469            tag: None,
16470            rev: None,
16471            branch: None,
16472        });
16473        let err = d.validate().unwrap_err();
16474        assert!(
16475            matches!(err, DepError::FonteRepoEmpty { .. }),
16476            "got {err:?}"
16477        );
16478    }
16479
16480    #[test]
16481    fn fonte_pin_missing_fires_before_pin_empty() {
16482        // Order pin: a fully-None pin set is structurally distinct from
16483        // a Some(empty) pin — the first surfaces as FontePinMissing
16484        // (no axis chosen), the second as FontePinEmpty (axis chosen
16485        // but value blank). Pin the disjoint relationship so a future
16486        // unification collapses to one variant only as a structural
16487        // decision.
16488        let d = dep_with_fonte(DepSource::Git {
16489            repo: "github:pleme-io/caixa-teia".into(),
16490            tag: None,
16491            rev: None,
16492            branch: None,
16493        });
16494        assert!(matches!(
16495            d.validate().unwrap_err(),
16496            DepError::FontePinMissing { .. }
16497        ));
16498    }
16499
16500    #[test]
16501    fn nome_empty_takes_precedence_over_fonte_invalid() {
16502        // Order pin: a per-entry diagnostic without a non-empty :nome
16503        // can't be self-locating, so :nome "" fires first even when
16504        // :fonte is also malformed. Mirrors
16505        // `nome_empty_takes_precedence_over_versao_invalid` on the
16506        // adjacent axis.
16507        let mut d = dep_with_fonte(DepSource::Git {
16508            repo: String::new(),
16509            tag: None,
16510            rev: None,
16511            branch: None,
16512        });
16513        d.nome = String::new();
16514        assert_eq!(d.validate().unwrap_err(), DepError::NomeEmpty);
16515    }
16516
16517    #[test]
16518    fn versao_invalid_takes_precedence_over_fonte_invalid() {
16519        // Order pin: the :versao parse-side diagnostic is narrower than
16520        // the :fonte shape diagnostic — a malformed :versao always names
16521        // the parser's reason, which is more actionable than the
16522        // :fonte gate's "the pins are wrong" wording. Pin the ordering
16523        // so a re-ordering surfaces here.
16524        let mut d = dep_with_fonte(DepSource::Git {
16525            repo: String::new(),
16526            tag: None,
16527            rev: None,
16528            branch: None,
16529        });
16530        d.versao = "v0.1".into();
16531        let err = d.validate().unwrap_err();
16532        assert!(
16533            matches!(err, DepError::VersaoInvalid { ref nome, .. } if nome == "caixa-teia"),
16534            "got {err:?}"
16535        );
16536    }
16537
16538    #[test]
16539    fn fonte_invalid_diagnostic_carries_offending_nome() {
16540        // The diagnostic-shape pin: every :fonte error variant names
16541        // the offending dep's :nome verbatim, so the author can grep
16542        // caixa.lisp for the `:nome "<n>"` block and fix it in one
16543        // edit. Cover all seven variants so a future variant addition
16544        // forces a parallel diagnostic-shape decision.
16545        for (case, fonte) in [
16546            (
16547                "repo-empty",
16548                DepSource::Git {
16549                    repo: String::new(),
16550                    tag: Some("v1".into()),
16551                    rev: None,
16552                    branch: None,
16553                },
16554            ),
16555            (
16556                "repo-shape",
16557                DepSource::Git {
16558                    repo: "github:p/x ".into(),
16559                    tag: Some("v1".into()),
16560                    rev: None,
16561                    branch: None,
16562                },
16563            ),
16564            (
16565                "pin-missing",
16566                DepSource::Git {
16567                    repo: "github:p/x".into(),
16568                    tag: None,
16569                    rev: None,
16570                    branch: None,
16571                },
16572            ),
16573            (
16574                "pin-ambiguous",
16575                DepSource::Git {
16576                    repo: "github:p/x".into(),
16577                    tag: Some("v1".into()),
16578                    rev: None,
16579                    branch: Some("main".into()),
16580                },
16581            ),
16582            (
16583                "pin-empty",
16584                DepSource::Git {
16585                    repo: "github:p/x".into(),
16586                    tag: Some(String::new()),
16587                    rev: None,
16588                    branch: None,
16589                },
16590            ),
16591            (
16592                "caminho-empty",
16593                DepSource::Path {
16594                    caminho: String::new(),
16595                },
16596            ),
16597            (
16598                "caminho-absolute",
16599                DepSource::Path {
16600                    caminho: "/home/me/work/caixa-teia".into(),
16601                },
16602            ),
16603        ] {
16604            let d = dep_with_fonte(fonte);
16605            let msg = d
16606                .validate()
16607                .expect_err(&format!("{case}: expected fonte error"))
16608                .to_string();
16609            assert!(
16610                msg.contains("\"caixa-teia\""),
16611                "{case}: diagnostic must quote the offending :nome verbatim, got {msg:?}"
16612            );
16613        }
16614    }
16615
16616    // -- :tag / :branch value-shape gate ----------------------------------
16617
16618    #[test]
16619    fn validate_rejects_git_fonte_with_tag_carrying_trailing_space() {
16620        // The canonical paste-from-doc footgun on `:tag` — author
16621        // copies `"v0.1.0 "` (trailing space) out of a release-notes
16622        // paragraph. Until this gate landed the empty-pin arm passed
16623        // (the string isn't empty), the resolver issued
16624        // `git fetch <remote> tag 'v0.1.0 '`, and the failure
16625        // surfaced at clone time with a quoting-confused git error
16626        // far from the source caixa.lisp. The new gate moves the
16627        // check to caixa-build time and names the offending dep +
16628        // pin + value verbatim.
16629        let d = dep_with_fonte(DepSource::Git {
16630            repo: "github:pleme-io/caixa-teia".into(),
16631            tag: Some("v0.1.0 ".into()),
16632            rev: None,
16633            branch: None,
16634        });
16635        let err = d.validate().unwrap_err();
16636        let DepError::FontePinShape {
16637            nome,
16638            pin,
16639            value,
16640            reason,
16641        } = err
16642        else {
16643            panic!("expected FontePinShape, got other variant");
16644        };
16645        assert_eq!(nome, "caixa-teia");
16646        assert_eq!(pin, ":tag");
16647        assert_eq!(value, "v0.1.0 ");
16648        assert!(
16649            reason.contains("whitespace"),
16650            "reason must surface the whitespace arm, got {reason:?}"
16651        );
16652    }
16653
16654    #[test]
16655    fn validate_rejects_git_fonte_with_tag_carrying_lock_suffix() {
16656        // The `.lock` suffix is git's atomic-rename guard for
16657        // in-flight ref updates — a refname ending in `.lock` is
16658        // unwritable on disk. Pinned separately from the whitespace
16659        // arm so a future relaxation that admits one but not the
16660        // other surfaces here.
16661        let d = dep_with_fonte(DepSource::Git {
16662            repo: "github:pleme-io/caixa-teia".into(),
16663            tag: Some("v0.1.0.lock".into()),
16664            rev: None,
16665            branch: None,
16666        });
16667        let err = d.validate().unwrap_err();
16668        let DepError::FontePinShape {
16669            pin, value, reason, ..
16670        } = err
16671        else {
16672            panic!("expected FontePinShape, got other variant");
16673        };
16674        assert_eq!(pin, ":tag");
16675        assert_eq!(value, "v0.1.0.lock");
16676        assert!(
16677            reason.contains(".lock"),
16678            "reason must surface the .lock arm, got {reason:?}"
16679        );
16680    }
16681
16682    #[test]
16683    fn validate_rejects_git_fonte_with_branch_carrying_embedded_space() {
16684        // The canonical "branch name with spaces" footgun (`feature
16685        // foo`, `release branch`) — git's refname parser rejects raw
16686        // whitespace, and the failure surfaces at `git checkout
16687        // 'feature foo'` time with a quoting-confused error far from
16688        // the source caixa.lisp. Pinned on the `:branch` axis so the
16689        // gate-applies-to-both-:tag-and-:branch contract is a build-
16690        // error to relax.
16691        let d = dep_with_fonte(DepSource::Git {
16692            repo: "github:pleme-io/caixa-teia".into(),
16693            tag: None,
16694            rev: None,
16695            branch: Some("feature/foo bar".into()),
16696        });
16697        let err = d.validate().unwrap_err();
16698        let DepError::FontePinShape {
16699            pin, value, reason, ..
16700        } = err
16701        else {
16702            panic!("expected FontePinShape, got other variant");
16703        };
16704        assert_eq!(pin, ":branch");
16705        assert_eq!(value, "feature/foo bar");
16706        assert!(
16707            reason.contains("whitespace"),
16708            "reason must surface the whitespace arm, got {reason:?}"
16709        );
16710    }
16711
16712    #[test]
16713    fn validate_rejects_git_fonte_with_branch_carrying_qualified_prefix() {
16714        // The `refs/heads/main` shape — the canonical "I copied the
16715        // fully-qualified ref out of `git show-ref` instead of the
16716        // leaf" footgun. The caixa-resolver prepends `refs/heads/`
16717        // at clone time, so this resolves to a literal ref named
16718        // `refs/heads/refs/heads/main` on disk; the silent double-
16719        // prefix is the load-bearing reason to gate at validate.
16720        // The diagnostic must enumerate the leaf the author probably
16721        // meant (`"main"`) so the fix is one edit.
16722        let d = dep_with_fonte(DepSource::Git {
16723            repo: "github:pleme-io/caixa-teia".into(),
16724            tag: None,
16725            rev: None,
16726            branch: Some("refs/heads/main".into()),
16727        });
16728        let err = d.validate().unwrap_err();
16729        let DepError::FontePinShape {
16730            pin, value, reason, ..
16731        } = err
16732        else {
16733            panic!("expected FontePinShape, got other variant");
16734        };
16735        assert_eq!(pin, ":branch");
16736        assert_eq!(value, "refs/heads/main");
16737        assert!(
16738            reason.contains("fully-qualified"),
16739            "reason must surface the qualified-prefix arm, got {reason:?}"
16740        );
16741        assert!(
16742            reason.contains("\"main\""),
16743            "reason must quote the leaf the author probably meant, got {reason:?}"
16744        );
16745    }
16746
16747    #[test]
16748    fn validate_rejects_git_fonte_with_tag_carrying_qualified_prefix() {
16749        // Sibling arm of the qualified-prefix gate on the `:tag`
16750        // axis (`refs/tags/v0.1.0` — same `git show-ref` output-leak
16751        // footgun). Pinned separately so a future relaxation that
16752        // only catches the `:branch` arm surfaces here.
16753        let d = dep_with_fonte(DepSource::Git {
16754            repo: "github:pleme-io/caixa-teia".into(),
16755            tag: Some("refs/tags/v0.1.0".into()),
16756            rev: None,
16757            branch: None,
16758        });
16759        let err = d.validate().unwrap_err();
16760        let DepError::FontePinShape {
16761            pin, value, reason, ..
16762        } = err
16763        else {
16764            panic!("expected FontePinShape, got other variant");
16765        };
16766        assert_eq!(pin, ":tag");
16767        assert_eq!(value, "refs/tags/v0.1.0");
16768        assert!(
16769            reason.contains("fully-qualified"),
16770            "reason must surface the qualified-prefix arm, got {reason:?}"
16771        );
16772        assert!(
16773            reason.contains("\"v0.1.0\""),
16774            "reason must quote the leaf the author probably meant, got {reason:?}"
16775        );
16776    }
16777
16778    #[test]
16779    fn validate_rejects_git_fonte_with_branch_named_at() {
16780        // The bare `@` is git's alias for `HEAD`; a `:branch "@"` is
16781        // unsourceable. Pinned so a future relaxation that admits
16782        // any single-character refname surfaces here.
16783        let d = dep_with_fonte(DepSource::Git {
16784            repo: "github:pleme-io/caixa-teia".into(),
16785            tag: None,
16786            rev: None,
16787            branch: Some("@".into()),
16788        });
16789        let err = d.validate().unwrap_err();
16790        let DepError::FontePinShape { pin, value, .. } = err else {
16791            panic!("expected FontePinShape, got other variant");
16792        };
16793        assert_eq!(pin, ":branch");
16794        assert_eq!(value, "@");
16795    }
16796
16797    #[test]
16798    fn validate_rejects_git_fonte_with_tag_carrying_double_dot() {
16799        // Git's `<rev1>..<rev2>` range grammar reserves `..` —
16800        // a `:tag "../escape"` (path-traversal-shaped slug) silently
16801        // passes parse and surfaces as a refname-parse error or, on
16802        // older git, a literal `../escape` checkout that escapes the
16803        // refs/ directory tree. Pinned separately from the
16804        // qualified-prefix arm so a future relaxation that catches
16805        // one but not the other surfaces here.
16806        let d = dep_with_fonte(DepSource::Git {
16807            repo: "github:pleme-io/caixa-teia".into(),
16808            tag: Some("../escape".into()),
16809            rev: None,
16810            branch: None,
16811        });
16812        let err = d.validate().unwrap_err();
16813        let DepError::FontePinShape { pin, value, .. } = err else {
16814            panic!("expected FontePinShape, got other variant");
16815        };
16816        assert_eq!(pin, ":tag");
16817        assert_eq!(value, "../escape");
16818    }
16819
16820    #[test]
16821    fn validate_accepts_git_fonte_with_hierarchical_branch() {
16822        // The positive-control pin: hierarchical refnames with one or
16823        // more `/` separators (the `feature/foo` / `user/jdoe/feat`
16824        // canonical idiom) round-trip through the gate. Pinned
16825        // separately from the leaf-`"main"` positive control so a
16826        // future tightening that rejects all multi-component refnames
16827        // surfaces here.
16828        let d = dep_with_fonte(DepSource::Git {
16829            repo: "github:pleme-io/caixa-teia".into(),
16830            tag: None,
16831            rev: None,
16832            branch: Some("feature/checkout-rewrite".into()),
16833        });
16834        d.validate().unwrap();
16835    }
16836
16837    #[test]
16838    fn validate_accepts_git_fonte_with_prerelease_tag() {
16839        // The positive-control pin: semver pre-release shape
16840        // (`v0.1.0-alpha.1`) — the in-component dot is allowed
16841        // (only consecutive `..` and trailing `.` are rejected), the
16842        // mid-component hyphen is allowed. Pinned separately from
16843        // the bare-`"v0.1.0"` positive control so a future tightening
16844        // that rejects pre-release tags surfaces here.
16845        let d = dep_with_fonte(DepSource::Git {
16846            repo: "github:pleme-io/caixa-teia".into(),
16847            tag: Some("v0.1.0-alpha.1".into()),
16848            rev: None,
16849            branch: None,
16850        });
16851        d.validate().unwrap();
16852    }
16853
16854    #[test]
16855    fn validate_rejects_git_fonte_with_rev_carrying_refname_unfriendly_value() {
16856        // The `:rev` axis is routed through `crate::render::is_git_oid`
16857        // (a SHA's character set is `[0-9a-f]`, not a refname's), so a
16858        // value with refname-shape punctuation (here, a `:` mid-string
16859        // — would be a refname violation under `is_git_ref_name` too)
16860        // is rejected at the OID-shape gate. The two predicates
16861        // partition the `:fonte` pin axes structurally: an `:rev` value
16862        // that's a valid refname (`:rev "main"`, `:rev "v0.1.0"`) is
16863        // *still* rejected here because every refname character outside
16864        // `[0-9a-f]` fails the OID gate. Same shape as
16865        // `fonte_pin_shape_diagnostic_carries_offending_nome_pin_value`
16866        // on the refname-shaped axes — the diagnostic names the
16867        // offending dep + pin + value verbatim. The flip-from-accept
16868        // case the prior `:tag`/`:branch` gate left as a "future axis"
16869        // (e70d213) — now landed.
16870        let d = dep_with_fonte(DepSource::Git {
16871            repo: "github:pleme-io/caixa-teia".into(),
16872            tag: None,
16873            rev: Some("c0ffee:notarefname".into()),
16874            branch: None,
16875        });
16876        let err = d.validate().unwrap_err();
16877        let DepError::FontePinShape {
16878            nome,
16879            pin,
16880            value,
16881            reason,
16882        } = err
16883        else {
16884            panic!("expected FontePinShape, got other variant");
16885        };
16886        assert_eq!(nome, "caixa-teia");
16887        assert_eq!(pin, ":rev");
16888        assert_eq!(value, "c0ffee:notarefname");
16889        assert!(
16890            !reason.is_empty(),
16891            "FontePinShape `reason` must carry the predicate's wording verbatim"
16892        );
16893    }
16894
16895    #[test]
16896    fn validate_accepts_git_fonte_with_rev_full_sha1() {
16897        // The positive-control pin on the SHA-1 OID width: exactly 40
16898        // lowercase hex characters — the canonical `git rev-parse HEAD`
16899        // emission on a SHA-1-hashed repository (the default on every
16900        // pre-2.42 git and the canonical pleme-io substrate hash).
16901        // Pinned separately from the SHA-256 positive control so a
16902        // future tightening that only admits one width surfaces here.
16903        let d = dep_with_fonte(DepSource::Git {
16904            repo: "github:pleme-io/caixa-teia".into(),
16905            tag: None,
16906            rev: Some("0123456789abcdef0123456789abcdef01234567".into()),
16907            branch: None,
16908        });
16909        d.validate().unwrap();
16910    }
16911
16912    #[test]
16913    fn validate_accepts_git_fonte_with_rev_full_sha256() {
16914        // The positive-control pin on the SHA-256 OID width: exactly
16915        // 64 lowercase hex characters — `git`'s
16916        // `extensions.objectFormat = sha256` emission (GA since Git
16917        // 2.42 / Oct 2023). The substrate admits either canonical
16918        // width so an `:rev` authored against a SHA-256-hashed
16919        // upstream round-trips through the gate without per-repo
16920        // configuration. Pinned separately from the SHA-1 positive
16921        // control so a future tightening that drops one width surfaces
16922        // here as a structural decision.
16923        let d = dep_with_fonte(DepSource::Git {
16924            repo: "github:pleme-io/caixa-teia".into(),
16925            tag: None,
16926            rev: Some("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef".into()),
16927            branch: None,
16928        });
16929        d.validate().unwrap();
16930    }
16931
16932    #[test]
16933    fn validate_rejects_git_fonte_with_rev_abbreviated_prefix() {
16934        // The canonical `git log --short` / `git rev-parse --short HEAD`
16935        // paste-from-release-notes footgun: a 7-char prefix (git's
16936        // default `core.abbrev`) silently passes string emptiness
16937        // checks and resolves to one commit today, but becomes ambiguous
16938        // tomorrow as the repo grows. Until this gate landed the empty-
16939        // pin arm passed (the string isn't empty) and the resolver
16940        // accepted the prefix through git's separate prefix-lookup pass
16941        // — defeating the reproducibility contract `:rev` carries vs.
16942        // `:tag` / `:branch`. The new gate moves the check to caixa-
16943        // build time and names the offending dep + pin + value verbatim.
16944        let d = dep_with_fonte(DepSource::Git {
16945            repo: "github:pleme-io/caixa-teia".into(),
16946            tag: None,
16947            rev: Some("c0ffee0".into()),
16948            branch: None,
16949        });
16950        let err = d.validate().unwrap_err();
16951        let DepError::FontePinShape {
16952            pin, value, reason, ..
16953        } = err
16954        else {
16955            panic!("expected FontePinShape, got other variant");
16956        };
16957        assert_eq!(pin, ":rev");
16958        assert_eq!(value, "c0ffee0");
16959        assert!(
16960            reason.contains("abbreviated") || reason.contains("ambiguous"),
16961            "reason must surface the abbreviation arm, got {reason:?}"
16962        );
16963    }
16964
16965    #[test]
16966    fn validate_rejects_git_fonte_with_rev_uppercase_hex() {
16967        // The canonical "I pasted the SHA in uppercase" footgun: `git
16968        // porcelain` emits OIDs lowercase exclusively, so an uppercase-
16969        // bearing `:rev` round-trips inconsistently across the
16970        // resolver's `git fetch <remote> <:rev>` ↔ `git rev-parse HEAD`
16971        // equality-check pipeline and fails the lacre's content-
16972        // addressing probe with a confusing case-only diff. Pinned
16973        // separately from the non-hex arm so a future relaxation that
16974        // admits one but not the other surfaces here.
16975        let d = dep_with_fonte(DepSource::Git {
16976            repo: "github:pleme-io/caixa-teia".into(),
16977            tag: None,
16978            rev: Some("DEADBEEFCAFEBABE0123456789ABCDEF01234567".into()),
16979            branch: None,
16980        });
16981        let err = d.validate().unwrap_err();
16982        let DepError::FontePinShape {
16983            pin, value, reason, ..
16984        } = err
16985        else {
16986            panic!("expected FontePinShape, got other variant");
16987        };
16988        assert_eq!(pin, ":rev");
16989        assert_eq!(value, "DEADBEEFCAFEBABE0123456789ABCDEF01234567");
16990        assert!(
16991            reason.contains("uppercase"),
16992            "reason must surface the uppercase arm, got {reason:?}"
16993        );
16994    }
16995
16996    #[test]
16997    fn validate_rejects_git_fonte_with_rev_refname_value() {
16998        // The cross-axis mis-slot footgun: `:rev "main"` — the author
16999        // conflated `:rev` (hex commit ID, immutable) and `:branch`
17000        // (mutable ref pointing at whatever HEAD is today). Until this
17001        // gate landed the resolver silently dispatched on the value
17002        // shape ("`main` doesn't look like a SHA, fall back to
17003        // refname"), defeating the `:rev` reproducibility contract.
17004        // The new gate rejects every non-hex value on the `:rev` axis,
17005        // so the `:rev`/`:branch` boundary is structurally enforced —
17006        // a refname in the `:rev` slot is a build error, not a
17007        // resolver-time silent reinterpretation.
17008        let d = dep_with_fonte(DepSource::Git {
17009            repo: "github:pleme-io/caixa-teia".into(),
17010            tag: None,
17011            rev: Some("main".into()),
17012            branch: None,
17013        });
17014        let err = d.validate().unwrap_err();
17015        let DepError::FontePinShape {
17016            pin, value, reason, ..
17017        } = err
17018        else {
17019            panic!("expected FontePinShape, got other variant");
17020        };
17021        assert_eq!(pin, ":rev");
17022        assert_eq!(value, "main");
17023        // 4 chars `main` fails the length arm before the character arm,
17024        // so the diagnostic surfaces the abbreviation wording (same
17025        // path the `c0ffee0` 7-char fixture lands on); the structural
17026        // assertion is just that the `:rev "main"` value is rejected.
17027        assert!(
17028            !reason.is_empty(),
17029            "FontePinShape reason must be non-empty for refname-shaped :rev"
17030        );
17031    }
17032
17033    #[test]
17034    fn validate_rejects_git_fonte_with_rev_tag_shaped_value() {
17035        // Sibling cross-axis mis-slot: `:rev "v0.1.0"` — the author
17036        // conflated `:rev` and `:tag`. Pinned separately from the
17037        // `:rev "main"` (`:branch` mis-slot) arm so a future relaxation
17038        // that catches one but not the other surfaces here. The
17039        // length arm fires first (6 chars ≠ 40 ≠ 64); the structural
17040        // assertion is just that the cross-axis mis-slot is a build
17041        // error, regardless of which sub-arm surfaces the diagnostic
17042        // (`is_git_oid` rejects at the first violation; longer
17043        // tag-shape values would hit the non-hex arm instead).
17044        let d = dep_with_fonte(DepSource::Git {
17045            repo: "github:pleme-io/caixa-teia".into(),
17046            tag: None,
17047            rev: Some("v0.1.0".into()),
17048            branch: None,
17049        });
17050        let err = d.validate().unwrap_err();
17051        let DepError::FontePinShape {
17052            pin, value, reason, ..
17053        } = err
17054        else {
17055            panic!("expected FontePinShape, got other variant");
17056        };
17057        assert_eq!(pin, ":rev");
17058        assert_eq!(value, "v0.1.0");
17059        assert!(
17060            !reason.is_empty(),
17061            "FontePinShape reason must be non-empty for tag-shaped :rev"
17062        );
17063    }
17064
17065    #[test]
17066    fn validate_rejects_git_fonte_with_rev_too_long() {
17067        // Boundary case on the upper end: 41 hex chars — one past the
17068        // SHA-1 width, well below the SHA-256 width. Pin so a future
17069        // relaxation that admits "long enough to be a SHA" without
17070        // matching either canonical width surfaces here. The diagnostic
17071        // names the offending length verbatim so the author's grep
17072        // target is unambiguous (either trim one char or paste the
17073        // full SHA-256).
17074        let too_long: String = "0".repeat(41);
17075        let d = dep_with_fonte(DepSource::Git {
17076            repo: "github:pleme-io/caixa-teia".into(),
17077            tag: None,
17078            rev: Some(too_long.clone()),
17079            branch: None,
17080        });
17081        let err = d.validate().unwrap_err();
17082        let DepError::FontePinShape {
17083            pin, value, reason, ..
17084        } = err
17085        else {
17086            panic!("expected FontePinShape, got other variant");
17087        };
17088        assert_eq!(pin, ":rev");
17089        assert_eq!(value, too_long);
17090        assert!(
17091            reason.contains("41"),
17092            "reason must surface the offending length verbatim, got {reason:?}"
17093        );
17094    }
17095
17096    #[test]
17097    fn validate_rejects_git_fonte_with_rev_carrying_whitespace() {
17098        // The canonical paste-from-doc footgun on `:rev` — author
17099        // copies `"deadbeefcafe…0123 "` (trailing space) out of a
17100        // commit-message paragraph. Until this gate landed the empty-
17101        // pin arm passed (the string isn't empty), the resolver issued
17102        // `git fetch <remote> 'deadbeef… '` and the failure surfaced at
17103        // clone time with a quoting-confused git error far from the
17104        // source caixa.lisp. The new gate moves the check to caixa-
17105        // build time. Length is 41 (40 hex + space) so the length arm
17106        // fires first — pinned separately from the pure-length arm to
17107        // ensure the diagnostic surfaces *some* parser wording, not
17108        // silently pass through.
17109        let with_space = "0123456789abcdef0123456789abcdef01234567 ".to_string();
17110        let d = dep_with_fonte(DepSource::Git {
17111            repo: "github:pleme-io/caixa-teia".into(),
17112            tag: None,
17113            rev: Some(with_space.clone()),
17114            branch: None,
17115        });
17116        let err = d.validate().unwrap_err();
17117        let DepError::FontePinShape {
17118            pin, value, reason, ..
17119        } = err
17120        else {
17121            panic!("expected FontePinShape, got other variant");
17122        };
17123        assert_eq!(pin, ":rev");
17124        assert_eq!(value, with_space);
17125        assert!(
17126            !reason.is_empty(),
17127            "FontePinShape reason must be non-empty for whitespace-bearing :rev"
17128        );
17129    }
17130
17131    #[test]
17132    fn fonte_pin_shape_diagnostic_carries_offending_nome_pin_value_for_rev() {
17133        // Diagnostic-shape pin on the `:rev` axis: every FontePinShape
17134        // variant on this axis names the offending dep's `:nome` + the
17135        // `:rev` axis + the offending value verbatim, so the author's
17136        // grep target is the literal `:rev "<value>"` block in
17137        // caixa.lisp. Sibling of the `fonte_pin_shape_diagnostic_
17138        // carries_offending_nome_pin_value` test on the refname-shaped
17139        // (`:tag` / `:branch`) axes.
17140        let d = dep_with_fonte(DepSource::Git {
17141            repo: "github:p/x".into(),
17142            tag: None,
17143            rev: Some("not-a-sha".into()),
17144            branch: None,
17145        });
17146        let msg = d
17147            .validate()
17148            .expect_err(":rev: expected FontePinShape")
17149            .to_string();
17150        assert!(
17151            msg.contains("\"caixa-teia\""),
17152            ":rev: diagnostic must quote the offending :nome verbatim, got {msg:?}"
17153        );
17154        assert!(
17155            msg.contains(":rev"),
17156            ":rev: diagnostic must name the offending pin axis, got {msg:?}"
17157        );
17158        assert!(
17159            msg.contains("not-a-sha"),
17160            ":rev: diagnostic must quote the offending value verbatim, got {msg:?}"
17161        );
17162    }
17163
17164    #[test]
17165    fn fonte_pin_empty_fires_before_pin_shape() {
17166        // Order pin: a `Some("")` `:tag` is the more self-locating
17167        // diagnostic (the author chose an axis but left it blank;
17168        // grep is unambiguous), so it fires before the shape gate
17169        // even when both arms would match. Pinned so a future
17170        // reordering surfaces here. Mirrors the
17171        // `fonte_repo_empty_fires_before_pin_missing` ordering
17172        // discipline on the peer per-axis arms.
17173        let d = dep_with_fonte(DepSource::Git {
17174            repo: "github:pleme-io/caixa-teia".into(),
17175            tag: Some(String::new()),
17176            rev: None,
17177            branch: None,
17178        });
17179        assert!(matches!(
17180            d.validate().unwrap_err(),
17181            DepError::FontePinEmpty { ref pin, .. } if pin == ":tag"
17182        ));
17183    }
17184
17185    #[test]
17186    fn fonte_pin_shape_fires_after_repo_empty() {
17187        // Order pin: `:repo ""` is the more self-locating axis
17188        // (every git source needs a repo; the per-pin shape gate is
17189        // secondary), so the repo-empty arm fires before the
17190        // per-pin shape arm even when both are violated. Pinned so
17191        // a future reordering surfaces here. Mirrors
17192        // `fonte_repo_empty_fires_before_pin_missing` on the
17193        // adjacent axis pair.
17194        let d = dep_with_fonte(DepSource::Git {
17195            repo: String::new(),
17196            tag: Some("v0.1.0 ".into()),
17197            rev: None,
17198            branch: None,
17199        });
17200        assert!(matches!(
17201            d.validate().unwrap_err(),
17202            DepError::FonteRepoEmpty { .. }
17203        ));
17204    }
17205
17206    #[test]
17207    fn fonte_pin_shape_diagnostic_carries_offending_nome_pin_value() {
17208        // Diagnostic-shape pin across both refname-shaped axes
17209        // (`:tag` + `:branch`): every `FontePinShape` variant names
17210        // the offending dep's `:nome` + the offending pin axis + the
17211        // offending value verbatim, so the author's grep target is
17212        // unambiguous (the literal `:tag "<value>"` / `:branch
17213        // "<value>"` lands in caixa.lisp with quotes). Cover both
17214        // pin axes so a future variant addition forces a parallel
17215        // diagnostic-shape decision.
17216        for (pin_label, fonte) in [
17217            (
17218                ":tag",
17219                DepSource::Git {
17220                    repo: "github:p/x".into(),
17221                    tag: Some("v0.1.0~1".into()),
17222                    rev: None,
17223                    branch: None,
17224                },
17225            ),
17226            (
17227                ":branch",
17228                DepSource::Git {
17229                    repo: "github:p/x".into(),
17230                    tag: None,
17231                    rev: None,
17232                    branch: Some("feature/foo*".into()),
17233                },
17234            ),
17235        ] {
17236            let d = dep_with_fonte(fonte);
17237            let msg = d
17238                .validate()
17239                .expect_err(&format!("{pin_label}: expected FontePinShape"))
17240                .to_string();
17241            assert!(
17242                msg.contains("\"caixa-teia\""),
17243                "{pin_label}: diagnostic must quote the offending :nome verbatim, got {msg:?}"
17244            );
17245            assert!(
17246                msg.contains(pin_label),
17247                "{pin_label}: diagnostic must name the offending pin axis, got {msg:?}"
17248            );
17249        }
17250    }
17251
17252    #[test]
17253    fn git_source_json_round_trip() {
17254        let src = DepSource::Git {
17255            repo: "github:pleme-io/caixa-teia".into(),
17256            tag: Some("v0.1.0".into()),
17257            rev: None,
17258            branch: None,
17259        };
17260        let s = serde_json::to_string(&src).unwrap();
17261        assert!(s.contains(&format!(
17262            r#""{tipo}":"{git}""#,
17263            tipo = crate::render::DEP_SOURCE_KEY_TIPO,
17264            git = crate::render::DEP_SOURCE_TIPO_GIT,
17265        )));
17266        assert!(s.contains(r#""repo":"github:pleme-io/caixa-teia""#));
17267        assert!(s.contains(r#""tag":"v0.1.0""#));
17268        assert!(!s.contains("rev"));
17269        assert!(!s.contains("branch"));
17270        let round: DepSource = serde_json::from_str(&s).unwrap();
17271        assert_eq!(round, src);
17272    }
17273
17274    // ── DEP_SOURCE_{KEY_TIPO,TIPO_GIT,TIPO_PATH} drift-detection ────────
17275    //
17276    // The `#[serde(tag = "tipo", rename_all = "lowercase")]` derive
17277    // attribute on [`DepSource`] pins three load-bearing byte-sequences
17278    // that flow into every serialized `Dep.fonte` block: the outer
17279    // discriminator-key `"tipo"` the `tag = "tipo"` attribute names, and
17280    // the two admitted variant-tag values `"git"` / `"path"` the
17281    // `rename_all = "lowercase"` attribute pins as the discriminator's
17282    // closed-set arms. The three pin tests below round-trip a
17283    // fully-populated variant of each arm through
17284    // [`serde_json::to_value`] and assert each canonical byte-sequence
17285    // appears at its axis — pins a hypothetical future
17286    // `tag = "type"` / `tag = "source_type"` typo, a `rename_all`
17287    // rebrand (`"UPPERCASE"` / `"snake_case"` / `"kebab-case"`), or a
17288    // Rust-side variant rename (`Git` → `Repository`, `Path` → `Local`)
17289    // at build time rather than at fetch time when the resolver's
17290    // `Dep.fonte` dispatch silently fails to match on the drifted
17291    // discriminator. Same "serialize-and-check" discipline the peer
17292    // `M2_LIMITS_KEY_*`, `M2_BEHAVIOR_KEY_ON_*`, `SUPERVISOR_KEY_*`,
17293    // and `MEMBRO_KEY_*` drift-detection pins carry — extended here
17294    // to the last `#[serde(tag = ..., rename_all = ...)]` discriminator
17295    // family in caixa-core lacking a lifted peer.
17296
17297    #[test]
17298    fn dep_source_git_serde_keys_match_lifted_dep_source_key_consts() {
17299        // Fail-before-pass-after: a future `tag = "type"` at the derive
17300        // attribute would serialize under `"type":"git"`, and this test
17301        // would trip because `"tipo"` no longer appears at the emitted
17302        // discriminator key. A future `rename_all = "kebab-case"` /
17303        // `"snake_case"` (both no-ops on `Git` since it lacks internal
17304        // word boundaries) is caught by the sibling
17305        // `dep_source_path_serde_keys_match_lifted_dep_source_key_consts`
17306        // pin below (Path has no internal boundary either but the pair
17307        // catches any per-arm inconsistency). A future variant rename
17308        // `Git` → `Repository` would emit `"tipo":"repository"` and
17309        // trip this pin.
17310        let src = DepSource::Git {
17311            repo: "github:pleme-io/caixa-teia".into(),
17312            tag: Some("v0.1.0".into()),
17313            rev: None,
17314            branch: None,
17315        };
17316        let json = serde_json::to_value(&src).unwrap();
17317        let obj = json.as_object().expect("Git serializes as a JSON object");
17318        assert_eq!(
17319            obj.get(crate::render::DEP_SOURCE_KEY_TIPO)
17320                .and_then(serde_json::Value::as_str),
17321            Some(crate::render::DEP_SOURCE_TIPO_GIT),
17322            "DepSource::Git must serialize the tipo discriminator at DEP_SOURCE_KEY_TIPO \
17323             with value DEP_SOURCE_TIPO_GIT — attribute drift or variant rename \
17324             detected in {json}"
17325        );
17326    }
17327
17328    #[test]
17329    fn dep_source_path_serde_keys_match_lifted_dep_source_key_consts() {
17330        // Fail-before-pass-after: a future variant rename `Path` →
17331        // `Local` / `Filesystem` would emit `"tipo":"local"` and trip
17332        // this pin. A per-consumer disambiguation as the `defcaixa`
17333        // macro stabilizes ("caminho" → "path" for English-uniformity)
17334        // is scoped to the inner field key, not the discriminator; this
17335        // pin is orthogonal to that and catches only the outer
17336        // discriminator drift.
17337        let src = DepSource::Path {
17338            caminho: "../caixa-teia".into(),
17339        };
17340        let json = serde_json::to_value(&src).unwrap();
17341        let obj = json.as_object().expect("Path serializes as a JSON object");
17342        assert_eq!(
17343            obj.get(crate::render::DEP_SOURCE_KEY_TIPO)
17344                .and_then(serde_json::Value::as_str),
17345            Some(crate::render::DEP_SOURCE_TIPO_PATH),
17346            "DepSource::Path must serialize the tipo discriminator at DEP_SOURCE_KEY_TIPO \
17347             with value DEP_SOURCE_TIPO_PATH — attribute drift or variant rename \
17348             detected in {json}"
17349        );
17350    }
17351
17352    #[test]
17353    fn dep_source_key_consts_are_pairwise_distinct() {
17354        // Cross-axis collapse detector: a hypothetical future edit that
17355        // accidentally set two of the three consts to the same byte
17356        // (`DEP_SOURCE_TIPO_GIT = "path"` typo matching a peer arm) would
17357        // pass every per-arm serialize pin above but silently collapse
17358        // the discriminator's closed-set arms onto one another; this pin
17359        // catches the collapse at build time.
17360        assert_ne!(
17361            crate::render::DEP_SOURCE_KEY_TIPO,
17362            crate::render::DEP_SOURCE_TIPO_GIT,
17363        );
17364        assert_ne!(
17365            crate::render::DEP_SOURCE_KEY_TIPO,
17366            crate::render::DEP_SOURCE_TIPO_PATH,
17367        );
17368        assert_ne!(
17369            crate::render::DEP_SOURCE_TIPO_GIT,
17370            crate::render::DEP_SOURCE_TIPO_PATH,
17371        );
17372    }
17373
17374    #[test]
17375    fn dep_source_tipo_variant_consts_are_ascii_lowercase_shape() {
17376        // Shape pin against `rename_all` drift: the two variant-tag
17377        // consts must be ASCII-lowercase-only to match the
17378        // `rename_all = "lowercase"` attribute the derive uses; a future
17379        // rebrand to `"UPPERCASE"` / `"PascalCase"` at the attribute
17380        // would emit `"GIT"` / `"Git"` instead and trip this pin.
17381        for (label, s) in [
17382            ("DEP_SOURCE_TIPO_GIT", crate::render::DEP_SOURCE_TIPO_GIT),
17383            ("DEP_SOURCE_TIPO_PATH", crate::render::DEP_SOURCE_TIPO_PATH),
17384        ] {
17385            assert!(!s.is_empty(), "{label} must not be empty");
17386            assert!(
17387                s.bytes().all(|b| b.is_ascii_lowercase()),
17388                "{label} must be ASCII-lowercase-only (matching \
17389                 rename_all = \"lowercase\"), got {s:?}",
17390            );
17391        }
17392    }
17393
17394    // ── per-entry :caracteristicas set-not-multiset gate ────────────
17395    //
17396    // Every Vec-keyed-by-name authoring surface on the typed Caixa
17397    // surface that identifies its entries by a name field now uniformly
17398    // closes the set-not-multiset discipline at build time (cite
17399    // `validate_caracteristicas`'s peer-axis enumeration). The
17400    // `:caracteristicas` axis is per-`Dep`: the feature-toggle slot is
17401    // set-shaped (a feature is either enabled or not — there is no
17402    // `feature × 2` semantic), so two entries naming the same feature
17403    // are a redundant declaration the caixa-resolver's lacre pipeline
17404    // would silently dedup at resolve time. The empty-feature arm
17405    // closes the parallel "operationally-meaningless value" axis on
17406    // the same slot. Same linear-walk + `HashSet` + first-collision
17407    // shape every peer set gate uses; same empty-first cascade every
17408    // peer per-entry shape + duplicate gate uses (the empty-feature
17409    // axis is the more-actionable defect since two `""` entries would
17410    // both report `caracteristica: ""` under a duplicate-first
17411    // ordering, with no way to distinguish the offending site).
17412
17413    fn dep_with_features(features: &[&str]) -> Dep {
17414        Dep {
17415            nome: "caixa-teia".into(),
17416            versao: "^0.1".into(),
17417            fonte: None,
17418            opcional: false,
17419            caracteristicas: features.iter().map(|s| (*s).into()).collect(),
17420        }
17421    }
17422
17423    #[test]
17424    fn validate_rejects_empty_caracteristica() {
17425        // Fail-before-pass-after pin: every pre-gate codebase accepted
17426        // `(:caracteristicas (""))` cleanly (the `Vec<String>` field
17427        // imposed no per-entry shape contract), the dep validated, and
17428        // the empty feature would have reached the future caixa-resolver
17429        // lacre pipeline as a no-op feature enable — silently dropping
17430        // the author's intent far from the source `caixa.lisp`. The new
17431        // gate surfaces the structural defect at the typed-validate
17432        // surface with a self-locating diagnostic naming the offending
17433        // dep's `:nome`.
17434        let d = dep_with_features(&[""]);
17435        assert!(
17436            matches!(d.validate().unwrap_err(), DepError::CaracteristicaEmpty { ref nome } if nome == "caixa-teia"),
17437            "expected CaracteristicaEmpty, got {:?}",
17438            d.validate(),
17439        );
17440    }
17441
17442    #[test]
17443    fn validate_rejects_duplicate_caracteristica() {
17444        // Fail-before-pass-after pin on the set-not-multiset arm: the
17445        // feature-toggle slot is set-shaped, so `(:caracteristicas
17446        // ("http" "http"))` is a redundant declaration the lacre
17447        // pipeline dedupes silently at resolve time. The diagnostic
17448        // names the offending dep + the colliding feature verbatim so
17449        // the author can grep their caixa.lisp for `:caracteristicas`
17450        // and fix it in one edit. First-collision determinism is
17451        // pinned separately below.
17452        let d = dep_with_features(&["http", "http"]);
17453        assert!(
17454            matches!(
17455                d.validate().unwrap_err(),
17456                DepError::CaracteristicaDuplicate { ref nome, ref caracteristica }
17457                    if nome == "caixa-teia" && caracteristica == "http"
17458            ),
17459            "expected CaracteristicaDuplicate, got {:?}",
17460            d.validate(),
17461        );
17462    }
17463
17464    #[test]
17465    fn validate_accepts_distinct_caracteristicas() {
17466        // The canonical authoring shape — every feature distinct — must
17467        // remain a clean pass (positive control sweep). Covers the
17468        // canonical kebab-case feature names a target caixa typically
17469        // declares.
17470        dep_with_features(&["http", "json", "tls"])
17471            .validate()
17472            .unwrap();
17473    }
17474
17475    #[test]
17476    fn validate_accepts_single_caracteristica() {
17477        // Single-element list is the minimum non-empty shape; passes
17478        // the gate as the identity of the duplicate check (no second
17479        // entry to collide with).
17480        dep_with_features(&["http"]).validate().unwrap();
17481    }
17482
17483    #[test]
17484    fn validate_accepts_empty_caracteristicas_list() {
17485        // The bare-dep authoring shape (`Dep::simple` / `Dep::git`)
17486        // produces `caracteristicas: Vec::new()`; the empty list is
17487        // the gate's empty-set identity and passes vacuously. Pin
17488        // this so a future tightening that requires ≥1 feature
17489        // surfaces here as a test failure rather than a silent
17490        // contract narrowing.
17491        Dep::simple("caixa-teia", "^0.1").validate().unwrap();
17492        assert!(dep_with_features(&[]).validate().is_ok());
17493    }
17494
17495    #[test]
17496    fn validate_caracteristica_empty_fires_before_duplicate() {
17497        // Empty-first cascade: an entry with an empty feature *and*
17498        // duplicate entries surfaces the empty diagnostic first. The
17499        // empty-feature axis is the more-actionable defect since
17500        // `caracteristica: ""` is unambiguous; under duplicate-first
17501        // ordering the diagnostic could report the empty string from
17502        // either of two empty entries with no way to distinguish.
17503        // Mirrors the peer empty-before-duplicate ordering
17504        // discipline every per-entry shape + duplicate gate establishes
17505        // (`SupervisorSpec::validate`'s `EmptyChildName` arm before
17506        // `DuplicateChildCaixa`, `validate_membros`'s
17507        // `MembroCaixaEmpty` arm before `MembroDuplicate`).
17508        let d = dep_with_features(&["", "http", "http"]);
17509        assert!(matches!(
17510            d.validate().unwrap_err(),
17511            DepError::CaracteristicaEmpty { .. }
17512        ));
17513    }
17514
17515    #[test]
17516    fn validate_caracteristica_duplicate_first_collision_determinism() {
17517        // Three matching entries: the second occurrence surfaces the
17518        // diagnostic (the second is the first *collision* — the first
17519        // entry is the establishing one, not a duplicate). Mirrors
17520        // every peer first-collision posture
17521        // (`SupervisorError::DuplicateChildCaixa` reports the second
17522        // collision, `AplicacaoError::MembroDuplicate` reports the
17523        // second, `DepError::DuplicateNome` reports the second).
17524        // Pinning this so a future shortcut that flips to last-
17525        // collision (or non-deterministic) surfaces here.
17526        let d = dep_with_features(&["http", "http", "http"]);
17527        assert!(matches!(
17528            d.validate().unwrap_err(),
17529            DepError::CaracteristicaDuplicate { ref caracteristica, .. } if caracteristica == "http"
17530        ));
17531    }
17532
17533    #[test]
17534    fn validate_per_entry_shape_fires_before_caracteristicas() {
17535        // Per-entry shape precedence: a dep with a malformed `:nome`
17536        // (uppercase) AND duplicate `:caracteristicas` surfaces the
17537        // narrower `NomeInvalid` diagnostic first, not the set-gate
17538        // diagnostic. The `:nome` is the self-locating axis (every
17539        // diagnostic from the caracteristicas gate quotes the
17540        // offending dep's `:nome` to anchor the grep target —
17541        // surfacing the malformed name first keeps that anchor
17542        // valid). Same precedence shape every peer per-entry-shape
17543        // arm establishes against its peer set-gate
17544        // (`validate_deps_per_entry_validate_fires_before_duplicate_in_deps`
17545        // on the cross-entry `:nome` axis).
17546        let d = Dep {
17547            nome: "Caixa-Teia".into(), // uppercase — DNS-1123 violation
17548            versao: "^0.1".into(),
17549            fonte: None,
17550            opcional: false,
17551            caracteristicas: vec!["http".into(), "http".into()],
17552        };
17553        assert!(matches!(
17554            d.validate().unwrap_err(),
17555            DepError::NomeInvalid { .. }
17556        ));
17557    }
17558
17559    // ── per-entry :caracteristicas value-shape gate ──────────────────
17560    //
17561    // Until this gate landed `:caracteristicas` only refused the empty
17562    // string and cross-entry duplicates: a non-empty distinct but
17563    // structurally invalid feature name silently passed validate and the
17564    // failure surfaced at `cargo metadata` time as Cargo's
17565    // `restricted_names::validate_feature_name` parser rejection, far from
17566    // the source `caixa.lisp` with no field naming which `:deps` entry's
17567    // `:caracteristicas` carried the typo. The lifted predicate makes the
17568    // Cargo-feature-name-grammar intersection-floor a substrate-level
17569    // invariant at validate time. Same trajectory as the eight peer
17570    // value-shape predicates each typed surface downstream of a structured
17571    // grammar already follows.
17572
17573    #[test]
17574    fn validate_rejects_caracteristica_with_leading_plus() {
17575        // Fail-before-pass-after pin on the canonical Cargo
17576        // `+<feature>` activation-form-in-feature-name-slot footgun.
17577        // Cargo's `[dependencies.<dep>.features]` list grammar accepts
17578        // `+optional-feature` as an enablement of a previously-disabled
17579        // feature; pasting that activation form into `:caracteristicas`
17580        // (which names the feature itself) silently passed pre-gate and
17581        // failed at `cargo metadata` parse time.
17582        let d = dep_with_features(&["+http"]);
17583        let err = d.validate().unwrap_err();
17584        assert!(
17585            matches!(
17586                err,
17587                DepError::CaracteristicaInvalid { ref nome, ref caracteristica, .. }
17588                    if nome == "caixa-teia" && caracteristica == "+http"
17589            ),
17590            "expected CaracteristicaInvalid, got {err:?}"
17591        );
17592    }
17593
17594    #[test]
17595    fn validate_rejects_caracteristica_with_leading_hyphen() {
17596        // Fail-before-pass-after pin on the leading-hyphen footgun. `-`
17597        // is a legitimate continuation character (kebab-case feature
17598        // names like `runtime-tokio` pass) but Cargo rejects it at the
17599        // start; the structural defect — and its CLI-argument-injection
17600        // adjacency at any downstream Cargo subprocess invocation — is
17601        // closed at validate time, not at `cargo metadata` time.
17602        let d = dep_with_features(&["-json"]);
17603        let err = d.validate().unwrap_err();
17604        assert!(
17605            matches!(
17606                err,
17607                DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "-json"
17608            ),
17609            "expected CaracteristicaInvalid, got {err:?}"
17610        );
17611    }
17612
17613    #[test]
17614    fn validate_rejects_caracteristica_with_leading_dot() {
17615        // Fail-before-pass-after pin on the leading-dot footgun. `.` is
17616        // a legitimate continuation character (version-suffix shapes
17617        // like `feat.v2` pass) but the leading-dot form is the
17618        // canonical dotted-version-suffix-as-feature-name confusion.
17619        let d = dep_with_features(&[".feat"]);
17620        let err = d.validate().unwrap_err();
17621        assert!(matches!(
17622            err,
17623            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == ".feat"
17624        ));
17625    }
17626
17627    #[test]
17628    fn validate_rejects_caracteristica_with_whitespace() {
17629        // Fail-before-pass-after pin on the embedded-whitespace footgun:
17630        // a feature name with a space inside is structurally a multi-
17631        // token blob (the canonical paste-from-doc footgun, or an
17632        // accidental `"http server"` where the author meant
17633        // `"http-server"`).
17634        let d = dep_with_features(&["http feature"]);
17635        let err = d.validate().unwrap_err();
17636        assert!(matches!(
17637            err,
17638            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "http feature"
17639        ));
17640    }
17641
17642    #[test]
17643    fn validate_rejects_caracteristica_with_comma() {
17644        // Fail-before-pass-after pin on the embedded-comma footgun:
17645        // the list-separator-belongs-to-the-list-grammar
17646        // miscomprehension where the author writes
17647        // `:caracteristicas ("http,json")` intending two features but
17648        // the `Vec<String>` field consumes the bare token as one entry.
17649        let d = dep_with_features(&["http,json"]);
17650        let err = d.validate().unwrap_err();
17651        assert!(matches!(
17652            err,
17653            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "http,json"
17654        ));
17655    }
17656
17657    #[test]
17658    fn validate_rejects_caracteristica_with_slash() {
17659        // Fail-before-pass-after pin on the embedded-slash footgun:
17660        // Cargo's `dep/feat` namespaced-dep syntax applies inside
17661        // `[dependencies.<dep>.features]` list entries that already
17662        // name the parent dep (so the syntax says "enable feature
17663        // `feat` on a transitive dep `dep`"); `:caracteristicas` is
17664        // per-dep already (a sibling slot on the `Dep` itself), so the
17665        // segment separator within an entry must be `-`, `_`, `+`,
17666        // or `.`. The diagnostic remediation points at the canonical
17667        // Cargo namespaced-dep discipline.
17668        let d = dep_with_features(&["http/json"]);
17669        let err = d.validate().unwrap_err();
17670        assert!(matches!(
17671            err,
17672            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "http/json"
17673        ));
17674    }
17675
17676    #[test]
17677    fn validate_rejects_caracteristica_with_non_ascii() {
17678        // Fail-before-pass-after pin on the un-percent-encoded non-ASCII
17679        // byte footgun: NFC-vs-NFD normalization across filesystems
17680        // silently rewrites the feature-key, breaking the lacre's
17681        // content-addressing invariant. Pinned at a canonical
17682        // smart-quote-paste shape (`café`) where the raw `é` byte is the
17683        // documented APFS round-trip break.
17684        let d = dep_with_features(&["caf\u{e9}"]);
17685        let err = d.validate().unwrap_err();
17686        assert!(matches!(
17687            err,
17688            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "caf\u{e9}"
17689        ));
17690    }
17691
17692    #[test]
17693    fn validate_rejects_caracteristica_with_control_character() {
17694        // Fail-before-pass-after pin on the embedded-control-character
17695        // footgun: a CR/LF or any 0x00..0x1F / 0x7F byte landing in a
17696        // feature name is the canonical paste-from-multiline-doc
17697        // footgun the predicate's reason wording specifically calls out.
17698        let d = dep_with_features(&["http\njson"]);
17699        let err = d.validate().unwrap_err();
17700        assert!(matches!(err, DepError::CaracteristicaInvalid { .. }));
17701    }
17702
17703    #[test]
17704    fn validate_accepts_canonical_caracteristicas_shapes() {
17705        // Positive control sweep: every canonical Cargo feature name
17706        // shape the pleme-io ecosystem uses must still pass. Mirrors
17707        // the substrate-side `cargo_feature_name_accepts_canonical_forms`
17708        // sweep — drift between either landing site and the predicate's
17709        // accepted set is a build error visible at this pair of tests,
17710        // not a per-renderer "this passed validate but failed at
17711        // cargo metadata time" surprise on the next acceptance.
17712        for s in [
17713            "http",
17714            "json",
17715            "derive",
17716            "serde_json",
17717            "runtime-tokio",
17718            "tokio.full",
17719            "v0.1",
17720            "http+json",
17721            "_internal",
17722            "__private",
17723            "default",
17724            "rt-multi-thread",
17725            "feat.v2",
17726        ] {
17727            let d = dep_with_features(&[s]);
17728            d.validate().unwrap_or_else(|e| {
17729                panic!("canonical Cargo feature name {s:?} must pass validate: {e:?}")
17730            });
17731        }
17732    }
17733
17734    #[test]
17735    fn validate_caracteristica_empty_fires_before_invalid() {
17736        // Cascade precedence pin: an entry list with both an empty
17737        // feature AND an invalid-shape feature surfaces the
17738        // `CaracteristicaEmpty` arm first (the empty value carries no
17739        // self-locating data — `caracteristica: ""` is the diagnostic
17740        // with no way to anchor a grep target — so closing the empty
17741        // axis first preserves the per-entry-shape diagnostic's
17742        // self-locating discipline). Same empty-first cascade every
17743        // peer per-entry shape gate establishes
17744        // (`SupervisorSpec::validate`'s `EmptyChildName` before
17745        // `ChildCaixaInvalid`, `validate_membros`'s `MembroCaixaEmpty`
17746        // before `MembroCaixaInvalid`).
17747        let d = dep_with_features(&["", "+http"]);
17748        assert!(matches!(
17749            d.validate().unwrap_err(),
17750            DepError::CaracteristicaEmpty { .. }
17751        ));
17752    }
17753
17754    #[test]
17755    fn validate_caracteristica_invalid_fires_before_duplicate() {
17756        // Per-entry-shape precedence pin: an entry list with the same
17757        // invalid feature shape declared twice surfaces the
17758        // `CaracteristicaInvalid` diagnostic on the first entry, not
17759        // the `CaracteristicaDuplicate` on the second collision. The
17760        // per-entry shape gate fires before the cross-entry set gate
17761        // — same precedence shape every peer two-arm-plus-set gate
17762        // establishes (`SupervisorSpec::validate`'s
17763        // `ChildCaixaInvalid` before `DuplicateChildCaixa`,
17764        // `validate_membros`'s `MembroCaixaInvalid` before
17765        // `MembroDuplicate`, `Dep::validate`'s `NomeInvalid` before
17766        // cross-list `DuplicateNome`).
17767        let d = dep_with_features(&["+http", "+http"]);
17768        assert!(matches!(
17769            d.validate().unwrap_err(),
17770            DepError::CaracteristicaInvalid { ref caracteristica, .. } if caracteristica == "+http"
17771        ));
17772    }
17773
17774    #[test]
17775    fn validate_rejects_caracteristica_at_65_byte_boundary() {
17776        // Boundary pin on the 64-byte cap — both the boundary-accepting
17777        // case and the boundary-exceeding case in one place, so a
17778        // future cap shift surfaces both arms simultaneously, mirroring
17779        // the peer `cargo_feature_name_rejects_at_65_byte_boundary`
17780        // predicate-level pin at the dep-axis landing site.
17781        let max_ok = "a".repeat(64);
17782        dep_with_features(&[&max_ok])
17783            .validate()
17784            .unwrap_or_else(|e| panic!("64-byte feature name must pass: {e:?}"));
17785        let too_long = "a".repeat(65);
17786        let d = dep_with_features(&[&too_long]);
17787        assert!(matches!(
17788            d.validate().unwrap_err(),
17789            DepError::CaracteristicaInvalid { .. }
17790        ));
17791    }
17792
17793    // ── self-dep cross-slot gate ─────────────────────────────────────
17794
17795    #[test]
17796    fn validate_no_self_dep_rejects_self_in_deps() {
17797        // A caixa whose `:deps` lists its own `:nome` is a one-node
17798        // cycle in the lacre closure's dep-graph traversal — rejected,
17799        // naming the parent and the offending list tag.
17800        let deps = vec![
17801            Dep::simple("caixa-teia", "^0.1"),
17802            Dep::simple("orquestra", "^0.1"),
17803        ];
17804        let err = validate_no_self_dep(&deps, &[], "orquestra").unwrap_err();
17805        assert!(
17806            matches!(err, DepError::DepIsSelf { ref nome, list } if nome == "orquestra" && list == crate::render::DEP_AUTHOR_KEY_DEPS),
17807            "got {err:?}"
17808        );
17809    }
17810
17811    #[test]
17812    fn validate_no_self_dep_rejects_self_in_deps_dev() {
17813        // Same gate on the `:deps-dev` axis — neither dep list is a
17814        // second-class citizen on the self-edge invariant.
17815        let deps_dev = vec![Dep::simple("orquestra", "^0.1")];
17816        let err = validate_no_self_dep(&[], &deps_dev, "orquestra").unwrap_err();
17817        assert!(
17818            matches!(err, DepError::DepIsSelf { ref nome, list } if nome == "orquestra" && list == crate::render::DEP_AUTHOR_KEY_DEPS_DEV),
17819            "got {err:?}"
17820        );
17821    }
17822
17823    #[test]
17824    fn validate_no_self_dep_deps_fires_before_deps_dev() {
17825        // Walk order pin: a caixa that self-references on both lists
17826        // surfaces the `:deps` arm first — the load-bearing axis the
17827        // lacre closure resolves at every build. Mirrors the canonical
17828        // [`Caixa::validate_deps`] cascade (`:deps` → `:deps-dev`).
17829        let deps = vec![Dep::simple("orquestra", "^0.1")];
17830        let deps_dev = vec![Dep::simple("orquestra", "^0.2")];
17831        let err = validate_no_self_dep(&deps, &deps_dev, "orquestra").unwrap_err();
17832        assert!(
17833            matches!(err, DepError::DepIsSelf { ref nome, list } if nome == "orquestra" && list == crate::render::DEP_AUTHOR_KEY_DEPS),
17834            "got {err:?}"
17835        );
17836    }
17837
17838    #[test]
17839    fn validate_no_self_dep_accepts_distinct_names() {
17840        // Positive control: every dep names a distinct caixa. The
17841        // canonical author surface — peer of
17842        // [`validate_no_self_supervision_accepts_distinct_children`].
17843        let deps = vec![
17844            Dep::simple("caixa-teia", "^0.1"),
17845            Dep::simple("caixa-arch", "^0.1"),
17846        ];
17847        let deps_dev = vec![Dep::simple("caixa-test", "^0.1")];
17848        validate_no_self_dep(&deps, &deps_dev, "orquestra").unwrap();
17849    }
17850
17851    #[test]
17852    fn validate_no_self_dep_empty_lists_pass() {
17853        // A caixa with no declared deps has nothing to self-reference —
17854        // the gate is vacuously satisfied. Peer of
17855        // [`validate_no_self_supervision_empty_children_is_ok`].
17856        validate_no_self_dep(&[], &[], "orquestra").unwrap();
17857    }
17858
17859    #[test]
17860    fn validate_no_self_dep_diagnostic_carries_offending_list_and_nome() {
17861        // Diagnostic-shape pin (peer with
17862        // [`validate_no_self_supervision`]'s diagnostic): the error's
17863        // Display surfaces both the offending list tag and the
17864        // parent's `:nome` verbatim, so the author can grep their
17865        // caixa.lisp for the offending block in one edit. Names
17866        // `:bibliotecas` / `:exe` / `:servicos` as the corrective
17867        // surface — every legitimate "I want to use code from this
17868        // caixa" intent routes through one of those three slots.
17869        let deps_dev = vec![Dep::simple("orquestra", "^0.1")];
17870        let rendered = validate_no_self_dep(&[], &deps_dev, "orquestra")
17871            .unwrap_err()
17872            .to_string();
17873        assert!(
17874            rendered.contains(crate::render::DEP_AUTHOR_KEY_DEPS_DEV),
17875            "diagnostic must name the offending list tag: {rendered}",
17876        );
17877        assert!(
17878            rendered.contains("orquestra"),
17879            "diagnostic must quote the parent caixa name: {rendered}",
17880        );
17881        assert!(
17882            rendered.contains(":bibliotecas"),
17883            "diagnostic must point at the corrective code-surface slot: {rendered}",
17884        );
17885    }
17886
17887    #[test]
17888    fn validate_no_self_dep_accepts_coincidental_substring_match() {
17889        // Identity is exact-string equality, not substring — a dep
17890        // named `"orquestra-helper"` is a distinct caixa even when the
17891        // parent is `"orquestra"`. Pin the exact-match discipline so a
17892        // future relaxation that uses `contains` surfaces here, peer
17893        // with the supervision-tree and Aplicacao-membership gates
17894        // which all use exact-string equality on the typed identity.
17895        let deps = vec![Dep::simple("orquestra-helper", "^0.1")];
17896        validate_no_self_dep(&deps, &[], "orquestra").unwrap();
17897    }
17898
17899    // ── drift-detection: DEP_AUTHOR_KEY_{DEPS,DEPS_DEV} pin ─────────────
17900
17901    #[test]
17902    fn dep_author_key_consts_pin_canonical_kebab_case_labels() {
17903        // Scalar-value pin: the two author-facing kebab-case labels the
17904        // `(defcaixa … :deps ((…)) :deps-dev ((…)))` surface admits on
17905        // the two-list dep-graph slot axis, one arm per typed slot.
17906        // Mirrors the peer scalar-value pin the sibling
17907        // [`crate::M2_AUTHOR_KEY_LIMITS`] /
17908        // [`crate::M2_AUTHOR_KEY_BEHAVIOR`] /
17909        // [`crate::M2_AUTHOR_KEY_UPGRADE_FROM`] (f49c8b0) M2 top-level
17910        // author-labels, [`crate::M3_AUTHOR_KEY_MEMBROS`] etc.
17911        // (882f498) M3 top-level author-labels, and
17912        // [`crate::SUPERVISOR_AUTHOR_KEY_ESTRATEGIA`] etc. (be40492)
17913        // Supervisor top-level author-labels carry, so every kind-scoped
17914        // typed-slot-family axis routes through one canonical per-arm
17915        // declaration.
17916        //
17917        // A future rebrand (`:deps` → `:dependencies` matching Cargo's
17918        // verbatim key, `:deps-dev` → `:dev-dependencies` matching the
17919        // same, `:deps` / `:deps-dev` → `:runtime-deps` / `:dev-deps`
17920        // for symmetry) lands as an edit to exactly one const, and
17921        // every consumer that reaches for the label picks it up at
17922        // build time rather than at runtime as a downstream mismatch on
17923        // a `DepError::DuplicateNome { list: … }` diagnostic far from
17924        // the rename's commit.
17925        assert_eq!(crate::render::DEP_AUTHOR_KEY_DEPS, ":deps");
17926        assert_eq!(crate::render::DEP_AUTHOR_KEY_DEPS_DEV, ":deps-dev");
17927    }
17928
17929    #[test]
17930    fn dep_author_key_consts_are_pairwise_distinct() {
17931        // Distinct-labels pin: the two `:deps` / `:deps-dev` labels
17932        // must not collapse onto one byte-string. A future copy-paste
17933        // slip that renamed both consts to the same value (or a rebrand
17934        // that dropped the `-dev` suffix from one but not the other)
17935        // would leave every `DepError::DuplicateNome { list: … }`
17936        // diagnostic naming an unattributable list — the linter would
17937        // route the author to the wrong caixa.lisp block, or the
17938        // cross-list precedence gate
17939        // (`validate_deps_duplicate_in_deps_fires_before_duplicate_in_deps_dev`)
17940        // would surface a `:deps`-tagged diagnostic on a `:deps-dev`
17941        // duplicate. Peer of the sibling
17942        // `m2_author_key_consts_are_pairwise_distinct`-shape gates the
17943        // other top-level kind-scoped slot-family axes carry
17944        // (implicitly held by their different byte-values today).
17945        assert_ne!(
17946            crate::render::DEP_AUTHOR_KEY_DEPS,
17947            crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
17948            "DEP_AUTHOR_KEY_{{DEPS,DEPS_DEV}} consts must be pairwise-distinct \
17949             so a `DepError::DuplicateNome {{ list: … }}` diagnostic \
17950             self-locates the offending block in the author's caixa.lisp",
17951        );
17952    }
17953
17954    #[test]
17955    fn validate_no_self_dep_routes_through_lifted_dep_author_key_consts() {
17956        // Production-through-const pin: the two per-arm list tags
17957        // [`validate_no_self_dep`] threads onto the `list:` field of a
17958        // returned [`DepError::DepIsSelf`] route through the lifted
17959        // [`crate::DEP_AUTHOR_KEY_DEPS`] /
17960        // [`crate::DEP_AUTHOR_KEY_DEPS_DEV`] consts. A future drift at
17961        // the walker (a rename that reaches one arm but not the const,
17962        // or vice versa) surfaces here at build time rather than at
17963        // runtime as a `feira lint` diagnostic naming the wrong list
17964        // tag. Mirror of the peer
17965        // [`crate::Caixa::declared_servico_slots`] production tagger
17966        // pin (f49c8b0) on the sibling M2 top-level slot axis, extended
17967        // onto the two-list dep-graph gate.
17968        let deps = vec![Dep::simple("orquestra", "^0.1")];
17969        let err = validate_no_self_dep(&deps, &[], "orquestra").unwrap_err();
17970        let DepError::DepIsSelf { list, .. } = err else {
17971            panic!("expected DepIsSelf from :deps walk");
17972        };
17973        assert_eq!(list, crate::render::DEP_AUTHOR_KEY_DEPS);
17974
17975        let deps_dev = vec![Dep::simple("orquestra", "^0.1")];
17976        let err = validate_no_self_dep(&[], &deps_dev, "orquestra").unwrap_err();
17977        let DepError::DepIsSelf { list, .. } = err else {
17978            panic!("expected DepIsSelf from :deps-dev walk");
17979        };
17980        assert_eq!(list, crate::render::DEP_AUTHOR_KEY_DEPS_DEV);
17981    }
17982
17983    // ── Dep::nome accessor pins ───────────────────────────────────────
17984    //
17985    // Three coherence pins on the lifted `Dep::nome` accessor: byte-equal
17986    // projection over the plain-shorthand / explicit-git / explicit-path
17987    // fixture triad the [`Dep`] docstring lists (so the accessor's
17988    // accept-set is exercised across every author-surface `:fonte`
17989    // shape); by-borrow pointer identity so the projection stays
17990    // zero-copy at every consumer site; and validate-composition through
17991    // the [`validate_no_self_dep`] cross-slot gate reading its
17992    // parent-name equality check through the lifted accessor rather than
17993    // the raw field.
17994
17995    #[test]
17996    fn dep_nome_returns_declared_nome_across_fonte_shapes() {
17997        // Plain-shorthand form (`:fonte None`).
17998        assert_eq!(Dep::simple("caixa-teia", "^0.1").nome(), "caixa-teia");
17999        // Explicit git-source form with a tag pin — same accessor path.
18000        assert_eq!(
18001            Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0").nome(),
18002            "caixa-teia",
18003        );
18004        // Explicit path-source form.
18005        assert_eq!(
18006            Dep {
18007                nome: "caixa-teia".to_string(),
18008                versao: "0.1.0".to_string(),
18009                fonte: Some(DepSource::Path {
18010                    caminho: "../caixa-teia".to_string(),
18011                }),
18012                opcional: false,
18013                caracteristicas: Vec::new(),
18014            }
18015            .nome(),
18016            "caixa-teia",
18017        );
18018        // The empty-string `:nome` sentinel (which [`Dep::validate`]
18019        // refuses through the [`DepError::NomeEmpty`] arm) still round-
18020        // trips as an empty `&str` through the accessor — the accessor is
18021        // a projection, not a gate; the gate is [`Dep::validate`].
18022        assert_eq!(Dep::simple("", "^0.1").nome(), "");
18023    }
18024
18025    #[test]
18026    fn dep_nome_is_by_borrow_pointer_identity() {
18027        // Zero-copy pin: the accessor must borrow into the field's own
18028        // storage, not clone. If a future rewrite regresses to
18029        // `self.nome.clone().leak()` or an owned-buffer shape, the two
18030        // pointers diverge and this pin fails at build time.
18031        let d = Dep::simple("caixa-teia", "^0.1");
18032        assert!(std::ptr::eq(d.nome().as_ptr(), d.nome.as_ptr()));
18033    }
18034
18035    // ── Dep::versao_requirement accessor pins ─────────────────────────
18036    //
18037    // Three coherence pins on the lifted `Dep::versao_requirement`
18038    // accessor: byte-equal projection over the plain-shorthand /
18039    // explicit-git / explicit-path fixture triad the [`Dep`] docstring
18040    // lists plus the empty-sentinel that round-trips as `""` (the accessor
18041    // is a projection, not a gate; the gate is [`Dep::validate`]); by-
18042    // borrow pointer identity so the projection stays zero-copy at every
18043    // consumer site; and validate-composition through the
18044    // [`crate::render::require_valid_versao_requirement`] cascade reading
18045    // its requirement-shape check through the lifted accessor rather than
18046    // the raw field.
18047    #[test]
18048    fn dep_versao_requirement_returns_declared_versao_across_fonte_shapes() {
18049        // Plain-shorthand form (`:fonte None`).
18050        assert_eq!(
18051            Dep::simple("caixa-teia", "^0.1").versao_requirement(),
18052            "^0.1",
18053        );
18054        // Explicit git-source form with a tag pin — same accessor path.
18055        assert_eq!(
18056            Dep::git(
18057                "caixa-teia",
18058                "~0.1.2",
18059                "github:pleme-io/caixa-teia",
18060                "v0.1.0"
18061            )
18062            .versao_requirement(),
18063            "~0.1.2",
18064        );
18065        // Explicit path-source form.
18066        assert_eq!(
18067            Dep {
18068                nome: "caixa-teia".to_string(),
18069                versao: "0.1.0".to_string(),
18070                fonte: Some(DepSource::Path {
18071                    caminho: "../caixa-teia".to_string(),
18072                }),
18073                opcional: false,
18074                caracteristicas: Vec::new(),
18075            }
18076            .versao_requirement(),
18077            "0.1.0",
18078        );
18079        // The wildcard requirement (`"*"`) — the shorthand
18080        // `parse_requirement` accepts as `VersionReq::STAR` — round-trips
18081        // verbatim through the accessor as `"*"`, same byte-shape the
18082        // author wrote.
18083        assert_eq!(Dep::simple("caixa-teia", "*").versao_requirement(), "*");
18084        // The empty-string `:versao` sentinel (which [`Dep::validate`]
18085        // refuses through the [`DepError::VersaoEmpty`] arm) still round-
18086        // trips as an empty `&str` through the accessor — the accessor is
18087        // a projection, not a gate; the gate is [`Dep::validate`]. Peer
18088        // of the sibling [`Dep::nome`] empty-sentinel round-trip pin.
18089        assert_eq!(Dep::simple("caixa-teia", "").versao_requirement(), "");
18090    }
18091
18092    #[test]
18093    fn dep_versao_requirement_is_by_borrow_pointer_identity() {
18094        // Zero-copy pin: the accessor must borrow into the field's own
18095        // storage, not clone. If a future rewrite regresses to
18096        // `self.versao.clone().leak()` or an owned-buffer shape, the two
18097        // pointers diverge and this pin fails at build time. Peer of the
18098        // sibling [`Dep::nome`] pointer-identity pin — same by-borrow
18099        // discipline extended onto the requirement-carrying axis.
18100        let d = Dep::simple("caixa-teia", "^0.1");
18101        assert!(std::ptr::eq(
18102            d.versao_requirement().as_ptr(),
18103            d.versao.as_ptr(),
18104        ));
18105    }
18106
18107    #[test]
18108    fn dep_validate_reads_requirement_through_accessor() {
18109        // Composition pin: the [`Dep::validate`]
18110        // [`crate::render::require_valid_versao_requirement`] cascade
18111        // consumes the requirement string through the lifted accessor —
18112        // both the requirement-gate input and the
18113        // [`DepError::VersaoInvalid`] error-body carrier route through
18114        // `self.versao_requirement()`. A valid requirement passes
18115        // (positive control); a malformed-but-non-empty requirement fails
18116        // and the diagnostic quotes the offending byte-string verbatim
18117        // (same shape the accessor projects), so a future regression that
18118        // detoured the requirement carrier through a different byte-
18119        // string (say the parsed `VersionReq`'s `Display`, or a
18120        // normalized rewrite) would surface here at build time. The
18121        // empty-`:versao` arm fires the [`DepError::VersaoEmpty`] variant
18122        // ahead of the parse arm, pinning the empty-first cascade the
18123        // accessor's `""` sentinel round-trip acknowledges.
18124        Dep::simple("caixa-teia", "^0.1").validate().unwrap();
18125        let err = Dep::simple("caixa-teia", "v0.1").validate().unwrap_err();
18126        assert!(
18127            matches!(
18128                &err,
18129                DepError::VersaoInvalid {
18130                    nome,
18131                    versao,
18132                    ..
18133                } if nome == "caixa-teia" && versao == "v0.1",
18134            ),
18135            "expected VersaoInvalid quoting the accessor-projected requirement, got {err:?}",
18136        );
18137        let err = Dep::simple("caixa-teia", "").validate().unwrap_err();
18138        assert!(
18139            matches!(
18140                &err,
18141                DepError::VersaoEmpty { nome } if nome == "caixa-teia",
18142            ),
18143            "expected VersaoEmpty from the empty-first arm, got {err:?}",
18144        );
18145    }
18146
18147    // ── Dep::fonte accessor pins ──────────────────────────────────────
18148    //
18149    // Three coherence pins on the lifted `Dep::fonte` accessor: byte-
18150    // equal projection over the plain-shorthand (`:fonte None`) /
18151    // explicit-git-tag / explicit-path fixture triad the [`Dep`]
18152    // docstring lists (so the accessor's accept-set is exercised across
18153    // every author-surface `:fonte` shape and both `DepSource` variants);
18154    // pointer identity so the borrowed reference points into the field's
18155    // own `Option<DepSource>` storage (not a cloned side-buffer); and
18156    // validate-composition through the [`Dep::validate`] gate reading
18157    // its per-`:fonte` [`DepSource::validate`] delegation through the
18158    // lifted accessor rather than the raw `if let Some(ref fonte) =
18159    // self.fonte` bracket.
18160
18161    #[test]
18162    fn dep_fonte_returns_declared_source_across_shapes() {
18163        // Plain-shorthand form — `:fonte` omitted, accessor projects
18164        // the `None` partition the resolver-side default-fill treats
18165        // as "resolve through `github:<default-org>/<nome>`".
18166        assert!(Dep::simple("caixa-teia", "^0.1").fonte().is_none());
18167        // Explicit git-source form with a tag pin — same accessor path.
18168        let git = Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0");
18169        match git.fonte() {
18170            Some(DepSource::Git {
18171                repo,
18172                tag,
18173                rev,
18174                branch,
18175            }) => {
18176                assert_eq!(repo, "github:pleme-io/caixa-teia");
18177                assert_eq!(tag.as_deref(), Some("v0.1.0"));
18178                assert!(rev.is_none());
18179                assert!(branch.is_none());
18180            }
18181            other => panic!("expected explicit git :fonte, got {other:?}"),
18182        }
18183        // Explicit path-source form — the dev-only local-filesystem
18184        // arm the [`Dep`] docstring's third fixture carries.
18185        let path = Dep {
18186            nome: "caixa-teia".to_string(),
18187            versao: "0.1.0".to_string(),
18188            fonte: Some(DepSource::Path {
18189                caminho: "../caixa-teia".to_string(),
18190            }),
18191            opcional: false,
18192            caracteristicas: Vec::new(),
18193        };
18194        match path.fonte() {
18195            Some(DepSource::Path { caminho }) => {
18196                assert_eq!(caminho, "../caixa-teia");
18197            }
18198            other => panic!("expected explicit path :fonte, got {other:?}"),
18199        }
18200    }
18201
18202    #[test]
18203    fn dep_fonte_is_by_borrow_pointer_identity() {
18204        // Zero-copy pin: the accessor must borrow into the field's own
18205        // `Option<DepSource>` storage, not clone into a side buffer. If
18206        // a future rewrite regresses to `self.fonte.clone()` or an
18207        // owned-buffer shape, the two pointers diverge and this pin
18208        // fails at build time. Peer of the sibling per-`Dep` [`Dep::nome`]
18209        // (eba2cde) / [`Dep::versao_requirement`] (05529b1) pointer-
18210        // identity pins — same by-borrow discipline extended onto the
18211        // outer-`Dep` `Option<&Composite>` composite-reference axis.
18212        let d = Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0");
18213        let accessed = d.fonte().expect("git :fonte present") as *const DepSource;
18214        let raw = d.fonte.as_ref().expect("git :fonte present") as *const DepSource;
18215        assert!(std::ptr::eq(accessed, raw));
18216    }
18217
18218    #[test]
18219    fn dep_validate_reads_fonte_through_accessor() {
18220        // Composition pin: [`Dep::validate`]'s per-`:fonte`
18221        // [`DepSource::validate`] delegation consumes the typed slot
18222        // through the lifted accessor — an author-omitted `:fonte`
18223        // still passes the outer gate (positive control), an explicit
18224        // well-formed git source with exactly one pin passes, and a
18225        // malformed git source (empty `:repo`) surfaces the
18226        // [`DepError::FonteRepoEmpty`] variant quoting the offending
18227        // dep's `:nome` verbatim so a future regression that detoured
18228        // the `:fonte` delegation through a different path (say a
18229        // per-scope override projector) would surface here at build
18230        // time. Peer of the sibling
18231        // `dep_validate_reads_requirement_through_accessor` composition
18232        // pin on the `:versao` axis.
18233        // Positive control 1: no `:fonte` at all.
18234        Dep::simple("caixa-teia", "^0.1").validate().unwrap();
18235        // Positive control 2: well-formed git source.
18236        Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0")
18237            .validate()
18238            .unwrap();
18239        // Negative control: empty `:repo` — the accessor still returns
18240        // `Some(&DepSource::Git { repo: "", … })` and the delegated
18241        // `DepSource::validate` gate raises the typed carrier.
18242        let bad = Dep {
18243            nome: "caixa-teia".to_string(),
18244            versao: "^0.1".to_string(),
18245            fonte: Some(DepSource::Git {
18246                repo: String::new(),
18247                tag: Some("v0.1.0".to_string()),
18248                rev: None,
18249                branch: None,
18250            }),
18251            opcional: false,
18252            caracteristicas: Vec::new(),
18253        };
18254        let err = bad.validate().unwrap_err();
18255        assert!(
18256            matches!(
18257                &err,
18258                DepError::FonteRepoEmpty { nome } if nome == "caixa-teia",
18259            ),
18260            "expected FonteRepoEmpty from the accessor-routed :fonte gate, got {err:?}",
18261        );
18262    }
18263
18264    #[test]
18265    fn validate_no_self_dep_reads_parent_equality_through_accessor() {
18266        // Composition pin: the cross-slot [`validate_no_self_dep`] gate
18267        // rejects a `:deps` entry whose `:nome` equals the parent caixa's
18268        // own `:nome` through the lifted accessor rather than the raw
18269        // field. Fails-before-passes-after: with the accessor lifted the
18270        // gate reads its equality check through `dep.nome() ==
18271        // parent_nome` on both the `:deps` and `:deps-dev` traversals, so
18272        // the diagnostic still names the offending list tag as expected.
18273        let deps = vec![Dep::simple("orquestra", "^0.1")];
18274        let err = validate_no_self_dep(&deps, &[], "orquestra").unwrap_err();
18275        assert!(matches!(
18276            err,
18277            DepError::DepIsSelf {
18278                ref nome,
18279                list,
18280            } if nome == "orquestra" && list == crate::render::DEP_AUTHOR_KEY_DEPS,
18281        ));
18282        let deps_dev = vec![Dep::simple("orquestra", "^0.1")];
18283        let err = validate_no_self_dep(&[], &deps_dev, "orquestra").unwrap_err();
18284        assert!(matches!(
18285            err,
18286            DepError::DepIsSelf {
18287                ref nome,
18288                list,
18289            } if nome == "orquestra" && list == crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
18290        ));
18291        // A non-matching `:nome` passes through the accessor gate.
18292        let deps = vec![Dep::simple("caixa-teia", "^0.1")];
18293        validate_no_self_dep(&deps, &[], "orquestra").unwrap();
18294    }
18295
18296    // ── Dep::caracteristicas accessor pins ────────────────────────────
18297    //
18298    // Three coherence pins on the lifted `Dep::caracteristicas` accessor:
18299    // byte-equal projection over the default-empty / single-entry /
18300    // multi-entry fixture triad (so the accessor's accept-set is
18301    // exercised across every author-surface `:caracteristicas` shape,
18302    // matching the peer sibling family's fixture-triad discipline); by-
18303    // borrow pointer identity so the projection stays zero-copy at every
18304    // consumer site; and validate-composition through the
18305    // [`Dep::validate_caracteristicas`] gate reading its per-entry
18306    // linear walk through the lifted accessor rather than the raw
18307    // `for c in &self.caracteristicas` bracket.
18308
18309    #[test]
18310    fn dep_caracteristicas_returns_declared_features_across_shapes() {
18311        // Default-empty form — the [`Dep::simple`] constructor's
18312        // `Vec::new()` fill; the accessor projects the empty slice
18313        // verbatim (no `None` collapse).
18314        assert!(
18315            Dep::simple("caixa-teia", "^0.1")
18316                .caracteristicas()
18317                .is_empty(),
18318        );
18319        // Single-entry form — the canonical Cargo-shaped one-feature
18320        // enable ([`crate::render::is_cargo_feature_name`] accepts the
18321        // `"http"` byte-string as a valid feature name).
18322        let one = Dep {
18323            nome: "caixa-teia".to_string(),
18324            versao: "^0.1".to_string(),
18325            fonte: None,
18326            opcional: false,
18327            caracteristicas: vec!["http".to_string()],
18328        };
18329        assert_eq!(one.caracteristicas(), &["http".to_string()]);
18330        // Multi-entry form — the substrate's set-shaped multi-feature
18331        // enable, exercising the accessor over a length-two slice with
18332        // no duplicate collapse.
18333        let two = Dep {
18334            nome: "caixa-teia".to_string(),
18335            versao: "^0.1".to_string(),
18336            fonte: None,
18337            opcional: false,
18338            caracteristicas: vec!["http".to_string(), "json".to_string()],
18339        };
18340        assert_eq!(
18341            two.caracteristicas(),
18342            &["http".to_string(), "json".to_string()],
18343        );
18344    }
18345
18346    #[test]
18347    fn dep_caracteristicas_is_by_borrow_pointer_identity() {
18348        // Zero-copy pin: the accessor must borrow into the field's own
18349        // `Vec<String>` storage, not clone into a side buffer. If a
18350        // future rewrite regresses to `self.caracteristicas.clone()` or
18351        // an owned-buffer shape, the two pointers diverge and this pin
18352        // fails at build time. Peer of the sibling per-`Dep`
18353        // [`Dep::nome`] (eba2cde) / [`Dep::versao_requirement`] (05529b1)
18354        // / [`Dep::fonte`] (d65d1bf) pointer-identity pins — same by-
18355        // borrow discipline extended onto the outer-`Dep` `&[String]`
18356        // slice-projection axis.
18357        let d = Dep {
18358            nome: "caixa-teia".to_string(),
18359            versao: "^0.1".to_string(),
18360            fonte: None,
18361            opcional: false,
18362            caracteristicas: vec!["http".to_string(), "json".to_string()],
18363        };
18364        assert!(std::ptr::eq(
18365            d.caracteristicas().as_ptr(),
18366            d.caracteristicas.as_ptr(),
18367        ));
18368    }
18369
18370    #[test]
18371    fn dep_validate_reads_caracteristicas_through_accessor() {
18372        // Composition pin: [`Dep::validate_caracteristicas`]'s per-entry
18373        // linear walk consumes the feature-toggle list through the
18374        // lifted accessor — a well-formed `:caracteristicas` set passes
18375        // (positive control), an empty-string entry surfaces the
18376        // [`DepError::CaracteristicaEmpty`] variant quoting the offending
18377        // `Dep::nome`, and a within-list duplicate surfaces the
18378        // [`DepError::CaracteristicaDuplicate`] variant so a future
18379        // regression that detoured the walk through a different byte-
18380        // string list (say a per-scope override projector) would surface
18381        // here at build time. Peer of the sibling
18382        // `dep_validate_reads_fonte_through_accessor` /
18383        // `dep_validate_reads_requirement_through_accessor` composition
18384        // pins on the `:fonte` / `:versao` axes.
18385        // Positive control: two distinct well-formed feature names pass.
18386        Dep {
18387            nome: "caixa-teia".to_string(),
18388            versao: "^0.1".to_string(),
18389            fonte: None,
18390            opcional: false,
18391            caracteristicas: vec!["http".to_string(), "json".to_string()],
18392        }
18393        .validate()
18394        .unwrap();
18395        // Negative control 1: empty-string feature-name entry — the
18396        // accessor still returns `&[""]` and the walk raises the typed
18397        // empty-first carrier.
18398        let err = Dep {
18399            nome: "caixa-teia".to_string(),
18400            versao: "^0.1".to_string(),
18401            fonte: None,
18402            opcional: false,
18403            caracteristicas: vec![String::new()],
18404        }
18405        .validate()
18406        .unwrap_err();
18407        assert!(
18408            matches!(
18409                &err,
18410                DepError::CaracteristicaEmpty { nome } if nome == "caixa-teia",
18411            ),
18412            "expected CaracteristicaEmpty from the accessor-routed walk, got {err:?}",
18413        );
18414        // Negative control 2: within-list duplicate — the accessor's
18415        // slice view carries both entries, and the walk's dedup arm
18416        // raises the typed duplicate carrier quoting the offending
18417        // feature name verbatim.
18418        let err = Dep {
18419            nome: "caixa-teia".to_string(),
18420            versao: "^0.1".to_string(),
18421            fonte: None,
18422            opcional: false,
18423            caracteristicas: vec!["http".to_string(), "http".to_string()],
18424        }
18425        .validate()
18426        .unwrap_err();
18427        assert!(
18428            matches!(
18429                &err,
18430                DepError::CaracteristicaDuplicate {
18431                    nome,
18432                    caracteristica,
18433                } if nome == "caixa-teia" && caracteristica == "http",
18434            ),
18435            "expected CaracteristicaDuplicate from the accessor-routed dedup, got {err:?}",
18436        );
18437    }
18438
18439    // ── Dep::opcional accessor pins ───────────────────────────────────
18440    //
18441    // Two coherence pins on the lifted `Dep::opcional` accessor: byte-
18442    // equal projection over the default-`false` / explicit-`true`
18443    // fixture pair across the plain-shorthand (`:fonte None`) / explicit-
18444    // git-tag / explicit-path fixture triad the [`Dep`] docstring lists,
18445    // exercising the accessor's accept-set over every author-surface
18446    // `:fonte` shape × every author-surface `:opcional` shape; and by-
18447    // `Copy` idempotency so the projection stays value-return (no
18448    // silent detour to a fresh `&bool` borrow that would introduce a
18449    // lifetime on the return type the plain-`Copy`-scalar axis's `bool`
18450    // shape elides). No composition pin — `:opcional` does not
18451    // participate in [`Dep::validate`] (an opcional dep with any bool
18452    // value is validate-accepted; the missing-source arm is a resolver-
18453    // side runtime dispatch, not a build-time refusal), so the axis
18454    // reduces to the value-shape + `Copy` pin pair the peer
18455    // [`crate::Caixa::max_restarts`] / [`crate::Caixa::estrategia`]
18456    // outer-`Option<Copy>` accessor pins already carry.
18457
18458    #[test]
18459    fn dep_opcional_returns_declared_opcional_across_fonte_shapes() {
18460        // Default-`false` form via the [`Dep::simple`] constructor —
18461        // the accessor projects the `false` bit the default-fill sets.
18462        assert!(!Dep::simple("caixa-teia", "^0.1").opcional());
18463        // Default-`false` form via the [`Dep::git`] constructor — same
18464        // default fill; the accessor projects `false` regardless of the
18465        // `:fonte` arm.
18466        assert!(!Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0").opcional(),);
18467        // Explicit-`true` form × plain-shorthand `:fonte` — the
18468        // canonical author-surface "this dep may be missing" shape.
18469        let plain_true = Dep {
18470            nome: "caixa-teia".to_string(),
18471            versao: "^0.1".to_string(),
18472            fonte: None,
18473            opcional: true,
18474            caracteristicas: Vec::new(),
18475        };
18476        assert!(plain_true.opcional());
18477        // Explicit-`true` form × explicit git-source — the accessor
18478        // projects the bit verbatim regardless of the `:fonte` arm.
18479        let git_true = Dep {
18480            nome: "caixa-teia".to_string(),
18481            versao: "^0.1".to_string(),
18482            fonte: Some(DepSource::Git {
18483                repo: "github:pleme-io/caixa-teia".to_string(),
18484                tag: Some("v0.1.0".to_string()),
18485                rev: None,
18486                branch: None,
18487            }),
18488            opcional: true,
18489            caracteristicas: Vec::new(),
18490        };
18491        assert!(git_true.opcional());
18492        // Explicit-`true` form × explicit path-source — the dev-only
18493        // local-filesystem arm the [`Dep`] docstring's third fixture
18494        // carries.
18495        let path_true = Dep {
18496            nome: "caixa-teia".to_string(),
18497            versao: "0.1.0".to_string(),
18498            fonte: Some(DepSource::Path {
18499                caminho: "../caixa-teia".to_string(),
18500            }),
18501            opcional: true,
18502            caracteristicas: Vec::new(),
18503        };
18504        assert!(path_true.opcional());
18505    }
18506
18507    #[test]
18508    fn dep_opcional_projects_bool_by_copy() {
18509        // The by-`Copy` pin: [`Dep::opcional`] returns `bool` by value
18510        // (`bool: Copy`) — the accessor does not borrow `&self` past
18511        // the call (no lifetime on the return type), and calling the
18512        // accessor twice on the same [`Dep`] must yield discriminant-
18513        // equal values (idempotent, no side effects on `&self`). Peer
18514        // of the sibling outer-`Caixa` `Option<Copy>` by-`Copy`
18515        // `max_restarts_projects_option_by_copy` (eba5211) /
18516        // `estrategia_projects_option_by_copy` (ed04d3c) pins on the
18517        // outer-`Caixa` altitude — extended here to the outer-`Dep`
18518        // altitude's plain-`Copy` `bool` axis. The `Copy` discipline
18519        // replaces the pointer-equality claim the sibling per-`Dep`
18520        // by-borrow pins (`dep_nome_is_by_borrow_pointer_identity`
18521        // eba2cde, `dep_versao_requirement_is_by_borrow_pointer_identity`
18522        // 05529b1, `dep_fonte_is_by_borrow_pointer_identity` d65d1bf,
18523        // `dep_caracteristicas_is_by_borrow_pointer_identity` 9197944)
18524        // carry (a fresh `Copy` of a `Copy` discriminant is definitionally
18525        // the same discriminant, so the axis reduces to discriminant
18526        // equality).
18527        //
18528        // Pins against a future silent detour that returned a fresh
18529        // `&bool` reference (which would type-check but silently
18530        // introduce a borrow of `&self` past the call, collapsing the
18531        // load-bearing "no lifetime on the return type" `Copy`
18532        // projection the plain-`Copy`-scalar axis's `bool` shape
18533        // carries) or a stale-read side effect that flipped the outer
18534        // discriminant on successive calls.
18535        for opcional in [false, true] {
18536            let d = Dep {
18537                nome: "caixa-teia".to_string(),
18538                versao: "^0.1".to_string(),
18539                fonte: None,
18540                opcional,
18541                caracteristicas: Vec::new(),
18542            };
18543            let first = d.opcional();
18544            let second = d.opcional();
18545            assert_eq!(
18546                first, second,
18547                "Dep::opcional must be idempotent — two successive calls \
18548                 on the same &self must return the same bool",
18549            );
18550            assert_eq!(
18551                first, opcional,
18552                "Dep::opcional must return :opcional verbatim by Copy — \
18553                 got {first}, expected {opcional}",
18554            );
18555            assert_eq!(
18556                d.opcional(),
18557                d.opcional,
18558                "Dep::opcional accessor and self.opcional field access \
18559                 must byte-equal — a bit-flip drift would silently split \
18560                 the paired resolver-side drop-vs-error dispatch from \
18561                 the storage-side default-fill the [`Dep::simple`] / \
18562                 [`Dep::git`] constructor pair carries",
18563            );
18564        }
18565    }
18566
18567    // ── DepSource::sole_pin — sole-set git-pin accessor ─────────────────
18568
18569    #[test]
18570    fn sole_pin_returns_none_for_path_source() {
18571        // A path source carries no git-ref, so `sole_pin()` returns
18572        // `None` structurally — the sibling arm every git-fetching
18573        // consumer partitions off before reaching for a git-ref. Pins
18574        // the Path-arm branch of the accessor against a future silent
18575        // detour that treats a `Self::Path` as an unpinned-git source
18576        // and returns the wrong "no pin" signal (e.g. the empty string,
18577        // or a hard-coded `Some("HEAD")` matching the caixa-crd
18578        // path-arm `git_ref` fill).
18579        let s = DepSource::Path {
18580            caminho: "../local-caixa".to_string(),
18581        };
18582        assert_eq!(s.sole_pin(), None);
18583    }
18584
18585    #[test]
18586    fn sole_pin_returns_none_for_unpinned_git_source() {
18587        // The [`DepSource::default_github`] shorthand shape carries no
18588        // pin — every `tag`/`rev`/`branch` is `None`, and `sole_pin()`
18589        // returns `None`. This is the shape caixa-resolver's `fetch_dep`
18590        // materializes when the author omits `:fonte` entirely, then
18591        // hands to `fetch_git` which raises `ResolveError::MissingPin`
18592        // on the `None` arm — the accessor's return matches the arm
18593        // the resolver's diagnostic keys off.
18594        let s = DepSource::default_github("pleme-io", "caixa-teia");
18595        assert_eq!(s.sole_pin(), None);
18596    }
18597
18598    #[test]
18599    fn sole_pin_returns_rev_when_only_rev_is_set() {
18600        let s = DepSource::Git {
18601            repo: "github:o/x".into(),
18602            tag: None,
18603            rev: Some("deadbeefcafebabe1234567890abcdef12345678".into()),
18604            branch: None,
18605        };
18606        assert_eq!(
18607            s.sole_pin(),
18608            Some("deadbeefcafebabe1234567890abcdef12345678")
18609        );
18610    }
18611
18612    #[test]
18613    fn sole_pin_returns_tag_when_only_tag_is_set() {
18614        let s = DepSource::Git {
18615            repo: "github:o/x".into(),
18616            tag: Some("v0.1.0".into()),
18617            rev: None,
18618            branch: None,
18619        };
18620        assert_eq!(s.sole_pin(), Some("v0.1.0"));
18621    }
18622
18623    #[test]
18624    fn sole_pin_returns_branch_when_only_branch_is_set() {
18625        let s = DepSource::Git {
18626            repo: "github:o/x".into(),
18627            tag: None,
18628            rev: None,
18629            branch: Some("main".into()),
18630        };
18631        assert_eq!(s.sole_pin(), Some("main"));
18632    }
18633
18634    #[test]
18635    fn sole_pin_precedence_rev_beats_tag_and_branch() {
18636        // Precedence: rev > tag > branch. Validate() rejects
18637        // multiple-pin shapes, but the accessor's precedence is defined
18638        // for pre-validate consumers (the resolver's `MissingPin`
18639        // diagnostic path, the caixa-crd round-trip's default `"main"`
18640        // fallback) and as defense-in-depth if the gate is ever
18641        // bypassed. Pins the same precedence caixa-resolver's
18642        // `fetch_git` and caixa-crd's `dep_into_ref` already apply
18643        // inline.
18644        let s = DepSource::Git {
18645            repo: "github:o/x".into(),
18646            tag: Some("v1".into()),
18647            rev: Some("deadbeefcafebabe1234567890abcdef12345678".into()),
18648            branch: Some("main".into()),
18649        };
18650        assert_eq!(
18651            s.sole_pin(),
18652            Some("deadbeefcafebabe1234567890abcdef12345678")
18653        );
18654    }
18655
18656    #[test]
18657    fn sole_pin_precedence_tag_beats_branch_when_no_rev() {
18658        let s = DepSource::Git {
18659            repo: "github:o/x".into(),
18660            tag: Some("v1".into()),
18661            rev: None,
18662            branch: Some("main".into()),
18663        };
18664        assert_eq!(s.sole_pin(), Some("v1"));
18665    }
18666
18667    #[test]
18668    fn sole_pin_byte_equals_inline_rev_or_tag_or_branch_cascade() {
18669        // Fail-before-pass-after byte-parity pin: the substrate accessor
18670        // must return byte-identical to the inline
18671        // `rev.as_deref().or(tag.as_deref()).or(branch.as_deref())`
18672        // cascade both caixa-resolver's `fetch_git` and caixa-crd's
18673        // `dep_into_ref` open-coded pre-lift. Trips at caixa-core build
18674        // time if the accessor's precedence silently drifts from the
18675        // consumer-side cascade — the exact drift this lift converges
18676        // to one substrate primitive to close structurally.
18677        //
18678        // Iterates through the 2^3 = 8 combinations of (tag, rev,
18679        // branch) each-either-`None`-or-`Some`, so every arm of the
18680        // precedence cascade lands under the pin. `validate()` refuses
18681        // the 4 multi-pin combinations, but the accessor's return is
18682        // defined on all 8.
18683        let vals = [Some("R".to_string()), None];
18684        for tag in &vals {
18685            for rev in &vals {
18686                for branch in &vals {
18687                    let s = DepSource::Git {
18688                        repo: "github:o/x".into(),
18689                        tag: tag.clone(),
18690                        rev: rev.clone(),
18691                        branch: branch.clone(),
18692                    };
18693                    // The exact inline cascade the two pre-lift
18694                    // consumer sites hand-rolled, byte-for-byte.
18695                    let expected = rev.as_deref().or(tag.as_deref()).or(branch.as_deref());
18696                    assert_eq!(
18697                        s.sole_pin(),
18698                        expected,
18699                        "sole_pin() must byte-equal \
18700                         rev.or(tag).or(branch) for \
18701                         (tag={tag:?}, rev={rev:?}, branch={branch:?}) — \
18702                         a drift would silently split caixa-resolver's \
18703                         fetch_git checkout target from caixa-crd's \
18704                         dep_into_ref git_ref fill",
18705                    );
18706                }
18707            }
18708        }
18709    }
18710
18711    // Fail-before-pass-after pins on the eleven
18712    // [`fonte_caminho_ctors!`]-generated `DepError::fonte_caminho_*`
18713    // constructors folded from the [`DepSource::validate_caminho`]
18714    // wire-up sites. Each pins the generated ctor's output to the
18715    // pre-lift struct-literal on the same `(&str, &str)` fixture, so
18716    // any wrapper-side lowercase / trim / re-order / silent-field-swap
18717    // regression on the two-field `{ nome: nome.to_string(), caminho:
18718    // caminho.to_string() }` construction surfaces here rather than at
18719    // a downstream diagnostic-shape mismatch. Peer of the sibling
18720    // `empty_child_version_ctor_matches_struct_literal_wrap` /
18721    // `contrato_endpoint_empty_ctor_matches_struct_literal_wrap` /
18722    // `entrada_host_invalid_ctor_matches_struct_literal_wrap` /
18723    // `nome_only_ctor_routes_caixa_through_nome_accessor` equivalence
18724    // pins on the peer `SupervisorError` / `AplicacaoError` /
18725    // `LayoutError` / `LimitsError` / `UpgradeError` envelopes.
18726
18727    #[test]
18728    fn fonte_caminho_absolute_ctor_matches_struct_literal_wrap() {
18729        assert_eq!(
18730            DepError::fonte_caminho_absolute("caixa-teia", "/home/me/work/caixa-teia"),
18731            DepError::FonteCaminhoAbsolute {
18732                nome: "caixa-teia".to_string(),
18733                caminho: "/home/me/work/caixa-teia".to_string(),
18734            },
18735            "generated fonte_caminho_absolute ctor must produce byte-equal \
18736             DepError to the open-coded struct-literal wrap on the same \
18737             (&str, &str) fixture",
18738        );
18739    }
18740
18741    #[test]
18742    fn fonte_caminho_tilde_expansion_ctor_matches_struct_literal_wrap() {
18743        assert_eq!(
18744            DepError::fonte_caminho_tilde_expansion("caixa-teia", "~/work/caixa-teia"),
18745            DepError::FonteCaminhoTildeExpansion {
18746                nome: "caixa-teia".to_string(),
18747                caminho: "~/work/caixa-teia".to_string(),
18748            },
18749        );
18750    }
18751
18752    #[test]
18753    fn fonte_caminho_var_expansion_ctor_matches_struct_literal_wrap() {
18754        assert_eq!(
18755            DepError::fonte_caminho_var_expansion("caixa-teia", "$HOME/work/caixa-teia"),
18756            DepError::FonteCaminhoVarExpansion {
18757                nome: "caixa-teia".to_string(),
18758                caminho: "$HOME/work/caixa-teia".to_string(),
18759            },
18760        );
18761    }
18762
18763    #[test]
18764    fn fonte_caminho_leading_whitespace_ctor_matches_struct_literal_wrap() {
18765        assert_eq!(
18766            DepError::fonte_caminho_leading_whitespace("caixa-teia", " ../caixa-teia"),
18767            DepError::FonteCaminhoLeadingWhitespace {
18768                nome: "caixa-teia".to_string(),
18769                caminho: " ../caixa-teia".to_string(),
18770            },
18771        );
18772    }
18773
18774    #[test]
18775    fn fonte_caminho_leading_hyphen_ctor_matches_struct_literal_wrap() {
18776        assert_eq!(
18777            DepError::fonte_caminho_leading_hyphen("caixa-teia", "-rf"),
18778            DepError::FonteCaminhoLeadingHyphen {
18779                nome: "caixa-teia".to_string(),
18780                caminho: "-rf".to_string(),
18781            },
18782        );
18783    }
18784
18785    #[test]
18786    fn fonte_caminho_backslash_ctor_matches_struct_literal_wrap() {
18787        assert_eq!(
18788            DepError::fonte_caminho_backslash("caixa-teia", "..\\caixa-teia"),
18789            DepError::FonteCaminhoBackslash {
18790                nome: "caixa-teia".to_string(),
18791                caminho: "..\\caixa-teia".to_string(),
18792            },
18793        );
18794    }
18795
18796    #[test]
18797    fn fonte_caminho_shell_pipe_ctor_matches_struct_literal_wrap() {
18798        assert_eq!(
18799            DepError::fonte_caminho_shell_pipe("caixa-teia", "../caixa-teia|evil"),
18800            DepError::FonteCaminhoShellPipe {
18801                nome: "caixa-teia".to_string(),
18802                caminho: "../caixa-teia|evil".to_string(),
18803            },
18804        );
18805    }
18806
18807    #[test]
18808    fn fonte_caminho_shell_semicolon_ctor_matches_struct_literal_wrap() {
18809        assert_eq!(
18810            DepError::fonte_caminho_shell_semicolon("caixa-teia", "../caixa-teia;evil"),
18811            DepError::FonteCaminhoShellSemicolon {
18812                nome: "caixa-teia".to_string(),
18813                caminho: "../caixa-teia;evil".to_string(),
18814            },
18815        );
18816    }
18817
18818    #[test]
18819    fn fonte_caminho_shell_background_ctor_matches_struct_literal_wrap() {
18820        assert_eq!(
18821            DepError::fonte_caminho_shell_background("caixa-teia", "../caixa-teia&"),
18822            DepError::FonteCaminhoShellBackground {
18823                nome: "caixa-teia".to_string(),
18824                caminho: "../caixa-teia&".to_string(),
18825            },
18826        );
18827    }
18828
18829    #[test]
18830    fn fonte_caminho_shell_command_substitution_ctor_matches_struct_literal_wrap() {
18831        assert_eq!(
18832            DepError::fonte_caminho_shell_command_substitution(
18833                "caixa-teia",
18834                "../caixa-teia`whoami`",
18835            ),
18836            DepError::FonteCaminhoShellCommandSubstitution {
18837                nome: "caixa-teia".to_string(),
18838                caminho: "../caixa-teia`whoami`".to_string(),
18839            },
18840        );
18841    }
18842
18843    #[test]
18844    fn fonte_caminho_trailing_slash_ctor_matches_struct_literal_wrap() {
18845        assert_eq!(
18846            DepError::fonte_caminho_trailing_slash("caixa-teia", "../caixa-teia/"),
18847            DepError::FonteCaminhoTrailingSlash {
18848                nome: "caixa-teia".to_string(),
18849                caminho: "../caixa-teia/".to_string(),
18850            },
18851        );
18852    }
18853
18854    #[test]
18855    fn fonte_caminho_ctors_route_nome_and_caminho_through_to_string() {
18856        // Cross-axis pin: sweep the two constructor input axes
18857        // (`nome: &str`, `caminho: &str`) through a non-default fixture
18858        // pair against every generated arm in the
18859        // [`fonte_caminho_ctors!`] macro, so any wrapper-side lowercase
18860        // / trim / truncate / re-order on the two-field
18861        // `{ nome, caminho }` construction — or a silent field swap
18862        // between the two axes at codegen time — surfaces here rather
18863        // than at a downstream diagnostic-shape mismatch. Peer of the
18864        // sibling `supervisor_caixa_only_ctors_route_caixa_through_
18865        // to_string` cross-axis routing pin on the peer
18866        // `SupervisorError` envelope, extended here onto the
18867        // `DepError` `{ nome: String, caminho: String }` envelope so
18868        // every substrate-primitive ctor family in caixa-core
18869        // guarantees each `&str`-field construction routes the
18870        // caller's `&str` verbatim through `.to_string()`.
18871        let nome = "sibling-teia";
18872        let caminho = "../workspace/sibling";
18873        let cases: [(DepError, DepError); 11] = [
18874            (
18875                DepError::fonte_caminho_absolute(nome, caminho),
18876                DepError::FonteCaminhoAbsolute {
18877                    nome: nome.to_string(),
18878                    caminho: caminho.to_string(),
18879                },
18880            ),
18881            (
18882                DepError::fonte_caminho_tilde_expansion(nome, caminho),
18883                DepError::FonteCaminhoTildeExpansion {
18884                    nome: nome.to_string(),
18885                    caminho: caminho.to_string(),
18886                },
18887            ),
18888            (
18889                DepError::fonte_caminho_var_expansion(nome, caminho),
18890                DepError::FonteCaminhoVarExpansion {
18891                    nome: nome.to_string(),
18892                    caminho: caminho.to_string(),
18893                },
18894            ),
18895            (
18896                DepError::fonte_caminho_leading_whitespace(nome, caminho),
18897                DepError::FonteCaminhoLeadingWhitespace {
18898                    nome: nome.to_string(),
18899                    caminho: caminho.to_string(),
18900                },
18901            ),
18902            (
18903                DepError::fonte_caminho_leading_hyphen(nome, caminho),
18904                DepError::FonteCaminhoLeadingHyphen {
18905                    nome: nome.to_string(),
18906                    caminho: caminho.to_string(),
18907                },
18908            ),
18909            (
18910                DepError::fonte_caminho_backslash(nome, caminho),
18911                DepError::FonteCaminhoBackslash {
18912                    nome: nome.to_string(),
18913                    caminho: caminho.to_string(),
18914                },
18915            ),
18916            (
18917                DepError::fonte_caminho_shell_pipe(nome, caminho),
18918                DepError::FonteCaminhoShellPipe {
18919                    nome: nome.to_string(),
18920                    caminho: caminho.to_string(),
18921                },
18922            ),
18923            (
18924                DepError::fonte_caminho_shell_semicolon(nome, caminho),
18925                DepError::FonteCaminhoShellSemicolon {
18926                    nome: nome.to_string(),
18927                    caminho: caminho.to_string(),
18928                },
18929            ),
18930            (
18931                DepError::fonte_caminho_shell_background(nome, caminho),
18932                DepError::FonteCaminhoShellBackground {
18933                    nome: nome.to_string(),
18934                    caminho: caminho.to_string(),
18935                },
18936            ),
18937            (
18938                DepError::fonte_caminho_shell_command_substitution(nome, caminho),
18939                DepError::FonteCaminhoShellCommandSubstitution {
18940                    nome: nome.to_string(),
18941                    caminho: caminho.to_string(),
18942                },
18943            ),
18944            (
18945                DepError::fonte_caminho_trailing_slash(nome, caminho),
18946                DepError::FonteCaminhoTrailingSlash {
18947                    nome: nome.to_string(),
18948                    caminho: caminho.to_string(),
18949                },
18950            ),
18951        ];
18952        for (via_ctor, via_struct_literal) in cases {
18953            assert_eq!(
18954                via_ctor, via_struct_literal,
18955                "fonte_caminho_ctors!-generated ctor must route (nome, caminho) \
18956                 through `.to_string()` in declared field order — a field-swap or \
18957                 silent-conversion regression surfaces here rather than at a \
18958                 downstream diagnostic-shape mismatch",
18959            );
18960        }
18961    }
18962
18963    // ── `dep_nome_only_ctors!` — the paired `{ nome: String }` single-slot
18964    //    envelope on `DepError`, sibling of the peer `fonte_caminho_ctors!`
18965    //    (f85f145) on the `{ nome, caminho }` two-slot envelope of the same
18966    //    enum, and of `supervisor_caixa_only_ctors!` (db09650) on the peer
18967    //    `SupervisorError` envelope's `{ caixa: String }` single-slot axis.
18968
18969    #[test]
18970    fn versao_empty_ctor_matches_struct_literal_wrap() {
18971        assert_eq!(
18972            DepError::versao_empty("caixa-teia"),
18973            DepError::VersaoEmpty {
18974                nome: "caixa-teia".to_string(),
18975            },
18976        );
18977    }
18978
18979    #[test]
18980    fn fonte_repo_empty_ctor_matches_struct_literal_wrap() {
18981        assert_eq!(
18982            DepError::fonte_repo_empty("caixa-teia"),
18983            DepError::FonteRepoEmpty {
18984                nome: "caixa-teia".to_string(),
18985            },
18986        );
18987    }
18988
18989    #[test]
18990    fn fonte_pin_missing_ctor_matches_struct_literal_wrap() {
18991        assert_eq!(
18992            DepError::fonte_pin_missing("caixa-teia"),
18993            DepError::FontePinMissing {
18994                nome: "caixa-teia".to_string(),
18995            },
18996        );
18997    }
18998
18999    #[test]
19000    fn fonte_caminho_empty_ctor_matches_struct_literal_wrap() {
19001        assert_eq!(
19002            DepError::fonte_caminho_empty("caixa-teia"),
19003            DepError::FonteCaminhoEmpty {
19004                nome: "caixa-teia".to_string(),
19005            },
19006        );
19007    }
19008
19009    #[test]
19010    fn caracteristica_empty_ctor_matches_struct_literal_wrap() {
19011        assert_eq!(
19012            DepError::caracteristica_empty("caixa-teia"),
19013            DepError::CaracteristicaEmpty {
19014                nome: "caixa-teia".to_string(),
19015            },
19016        );
19017    }
19018
19019    #[test]
19020    fn dep_nome_only_ctors_route_nome_through_to_string() {
19021        // Cross-axis routing pin: sweep the single constructor input
19022        // axis (`nome: &str`) through a non-default fixture against
19023        // every generated arm in the [`dep_nome_only_ctors!`] macro, so
19024        // any wrapper-side lowercase / trim / truncate at codegen time
19025        // — or a silent field re-name away from the canonical `nome`
19026        // axis on any one variant — surfaces here rather than at a
19027        // downstream diagnostic-shape mismatch. Peer of the sibling
19028        // `fonte_caminho_ctors_route_nome_and_caminho_through_
19029        // to_string` cross-axis routing pin on the same envelope's
19030        // two-slot family (f85f145) and of the peer
19031        // `supervisor_caixa_only_ctors_route_caixa_through_to_string`
19032        // pin on the `SupervisorError` single-slot family (db09650).
19033        let nome = "sibling-teia";
19034        let cases: [(DepError, DepError); 5] = [
19035            (
19036                DepError::versao_empty(nome),
19037                DepError::VersaoEmpty {
19038                    nome: nome.to_string(),
19039                },
19040            ),
19041            (
19042                DepError::fonte_repo_empty(nome),
19043                DepError::FonteRepoEmpty {
19044                    nome: nome.to_string(),
19045                },
19046            ),
19047            (
19048                DepError::fonte_pin_missing(nome),
19049                DepError::FontePinMissing {
19050                    nome: nome.to_string(),
19051                },
19052            ),
19053            (
19054                DepError::fonte_caminho_empty(nome),
19055                DepError::FonteCaminhoEmpty {
19056                    nome: nome.to_string(),
19057                },
19058            ),
19059            (
19060                DepError::caracteristica_empty(nome),
19061                DepError::CaracteristicaEmpty {
19062                    nome: nome.to_string(),
19063                },
19064            ),
19065        ];
19066        for (via_ctor, via_struct_literal) in cases {
19067            assert_eq!(
19068                via_ctor, via_struct_literal,
19069                "dep_nome_only_ctors!-generated ctor must route `nome` \
19070                 through `.to_string()` onto the canonical `nome` field \
19071                 — a field-rename or silent-conversion regression surfaces \
19072                 here rather than at a downstream diagnostic-shape mismatch",
19073            );
19074        }
19075    }
19076
19077    // ── `dep_nome_list_ctors!` — the paired `{ nome: String, list:
19078    //    &'static str }` two-slot envelope on `DepError`, strict
19079    //    sibling of the peer `dep_nome_only_ctors!` (792aa92) on the
19080    //    same envelope's `{ nome: String }` one-slot shape and of the
19081    //    peer `supervisor_caixa_only_ctors!` (db09650) on the
19082    //    `SupervisorError` envelope's `{ caixa: String }` one-slot axis.
19083
19084    #[test]
19085    fn duplicate_nome_ctor_matches_struct_literal_wrap() {
19086        assert_eq!(
19087            DepError::duplicate_nome("caixa-teia", crate::render::DEP_AUTHOR_KEY_DEPS),
19088            DepError::DuplicateNome {
19089                nome: "caixa-teia".to_string(),
19090                list: crate::render::DEP_AUTHOR_KEY_DEPS,
19091            },
19092            "generated duplicate_nome ctor must produce byte-equal \
19093             `DepError::DuplicateNome` to the pre-lift struct-literal \
19094             wrap on the same scalar fixtures",
19095        );
19096    }
19097
19098    #[test]
19099    fn dep_is_self_ctor_matches_struct_literal_wrap() {
19100        assert_eq!(
19101            DepError::dep_is_self("orquestra", crate::render::DEP_AUTHOR_KEY_DEPS_DEV),
19102            DepError::DepIsSelf {
19103                nome: "orquestra".to_string(),
19104                list: crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
19105            },
19106            "generated dep_is_self ctor must produce byte-equal \
19107             `DepError::DepIsSelf` to the pre-lift struct-literal \
19108             wrap on the same scalar fixtures",
19109        );
19110    }
19111
19112    #[test]
19113    fn dep_nome_list_ctors_route_nome_and_list_through_uniformly() {
19114        // Cross-axis routing pin: sweep the two constructor input axes
19115        // (`nome: &str`, `list: &'static str`) through non-default
19116        // fixtures against every generated arm in the
19117        // [`dep_nome_list_ctors!`] macro, so any wrapper-side
19118        // lowercase / trim / truncate at codegen time — or a silent
19119        // field re-name away from the canonical `nome` / `list` axes
19120        // on any one variant, or a `list` axis silently rerouted
19121        // through `.to_string()` instead of passed as `&'static str`
19122        // verbatim — surfaces here rather than at a downstream
19123        // diagnostic-shape mismatch. Peer of the sibling
19124        // `dep_nome_only_ctors_route_nome_through_to_string` pin
19125        // (792aa92) on the same envelope's one-slot family, and of the
19126        // peer
19127        // `supervisor_child_reason_ctors_route_reason_through_into_uniformly`
19128        // pin (d2ef2ec) on the sibling `SupervisorError` envelope's
19129        // two-slot `{ caixa: String, reason: String }` shape.
19130        let nome = "sibling-teia";
19131        let cases: [(DepError, DepError); 4] = [
19132            (
19133                DepError::duplicate_nome(nome, crate::render::DEP_AUTHOR_KEY_DEPS),
19134                DepError::DuplicateNome {
19135                    nome: nome.to_string(),
19136                    list: crate::render::DEP_AUTHOR_KEY_DEPS,
19137                },
19138            ),
19139            (
19140                DepError::duplicate_nome(nome, crate::render::DEP_AUTHOR_KEY_DEPS_DEV),
19141                DepError::DuplicateNome {
19142                    nome: nome.to_string(),
19143                    list: crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
19144                },
19145            ),
19146            (
19147                DepError::dep_is_self(nome, crate::render::DEP_AUTHOR_KEY_DEPS),
19148                DepError::DepIsSelf {
19149                    nome: nome.to_string(),
19150                    list: crate::render::DEP_AUTHOR_KEY_DEPS,
19151                },
19152            ),
19153            (
19154                DepError::dep_is_self(nome, crate::render::DEP_AUTHOR_KEY_DEPS_DEV),
19155                DepError::DepIsSelf {
19156                    nome: nome.to_string(),
19157                    list: crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
19158                },
19159            ),
19160        ];
19161        for (via_ctor, via_struct_literal) in cases {
19162            assert_eq!(
19163                via_ctor, via_struct_literal,
19164                "dep_nome_list_ctors!-generated ctor must route `nome` \
19165                 through `.to_string()` onto the canonical `nome` field \
19166                 and pass `list` verbatim onto the canonical `&'static str` \
19167                 `list` field — a field-rename, silent-conversion, or \
19168                 axis-swap regression surfaces here rather than at a \
19169                 downstream diagnostic-shape mismatch",
19170            );
19171        }
19172    }
19173
19174    // ── `fonte_pin_shape` — the paired `{ nome: String, pin: String,
19175    //    value: String, reason: String }` four-slot envelope on
19176    //    `DepError`, sibling of the peer `dep_nome_only_ctors!` (792aa92),
19177    //    `dep_nome_list_ctors!` (6f5e0cd), `fonte_caminho_ctors!` (f85f145),
19178    //    and `fonte_caminho_byte_ctors!` (0e35793) folds on the same
19179    //    envelope, and of the peer `contrato_pair_value_reason_ctors!`
19180    //    (14e13f1) four-slot fold on the sibling `AplicacaoError`
19181    //    envelope. Single-variant lift closing the last open-coded ctor
19182    //    site on the `:fonte (:tipo git …)` value-shape trajectory.
19183
19184    #[test]
19185    fn fonte_pin_shape_ctor_matches_struct_literal_wrap() {
19186        // Pre-lift equivalence pin on the [`DepError::fonte_pin_shape`]
19187        // ctor: sweep both wire-up-shape arms (the refname-pin arm
19188        // routing `":tag"` / `":branch"` value through
19189        // [`crate::render::is_git_ref_name`], and the hex-OID-pin arm
19190        // routing `":rev"` through [`crate::render::is_git_oid`]) and
19191        // assert byte-equal `PartialEq` against the pre-lift
19192        // struct-literal, so any wrapper-side field-rename /
19193        // silent-conversion regression surfaces here rather than at a
19194        // downstream diagnostic-shape mismatch. Peer of the sibling
19195        // per-envelope byte-equal ctor pins
19196        // ([`fonte_pin_missing_ctor_matches_struct_literal_wrap`],
19197        // [`duplicate_nome_ctor_matches_struct_literal_wrap`],
19198        // [`dep_is_self_ctor_matches_struct_literal_wrap`]).
19199        assert_eq!(
19200            DepError::fonte_pin_shape(
19201                "caixa-teia",
19202                ":tag",
19203                "v0.1.0 ",
19204                "trailing whitespace".to_string(),
19205            ),
19206            DepError::FontePinShape {
19207                nome: "caixa-teia".to_string(),
19208                pin: ":tag".to_string(),
19209                value: "v0.1.0 ".to_string(),
19210                reason: "trailing whitespace".to_string(),
19211            },
19212            "fonte_pin_shape ctor must produce byte-equal \
19213             `DepError::FontePinShape` to the pre-lift struct-literal \
19214             wrap on a refname-pin (`:tag` / `:branch`) fixture",
19215        );
19216        assert_eq!(
19217            DepError::fonte_pin_shape(
19218                "caixa-teia",
19219                ":rev",
19220                "DEADBEEF",
19221                "abbreviated OID rejected".to_string(),
19222            ),
19223            DepError::FontePinShape {
19224                nome: "caixa-teia".to_string(),
19225                pin: ":rev".to_string(),
19226                value: "DEADBEEF".to_string(),
19227                reason: "abbreviated OID rejected".to_string(),
19228            },
19229            "fonte_pin_shape ctor must produce byte-equal \
19230             `DepError::FontePinShape` to the pre-lift struct-literal \
19231             wrap on a hex-OID-pin (`:rev`) fixture",
19232        );
19233    }
19234
19235    #[test]
19236    fn fonte_pin_shape_ctor_routes_all_four_axes_through_to_string() {
19237        // Cross-axis routing pin: sweep every one of the four
19238        // constructor input axes (`nome: &str`, `pin: &str`,
19239        // `value: &str`, `reason: String`) through non-default
19240        // fixtures against the [`DepError::fonte_pin_shape`] ctor, so
19241        // any wrapper-side lowercase / trim / truncate at codegen time
19242        // — or a silent field re-name / axis-swap on any one of the
19243        // four fields, or a `reason` axis silently routed through
19244        // `.to_string()` instead of forwarded owned — surfaces here
19245        // rather than at a downstream diagnostic-shape mismatch. Peer
19246        // of the sibling
19247        // `dep_nome_only_ctors_route_nome_through_to_string` pin
19248        // (792aa92) and
19249        // `dep_nome_list_ctors_route_nome_and_list_through_uniformly`
19250        // pin (6f5e0cd) on the same envelope's one- and two-slot
19251        // families. Distinct-per-axis fixtures rule out any two-axis
19252        // swap (`nome` ↔ `pin`, `pin` ↔ `value`, `value` ↔ `reason`,
19253        // etc.) that would still pass a same-fixture-per-axis pin.
19254        let nome = "sibling-teia";
19255        let pin = ":branch";
19256        let value = "feature/bar";
19257        let reason = "embedded space".to_string();
19258        let via_ctor = DepError::fonte_pin_shape(nome, pin, value, reason.clone());
19259        let via_struct_literal = DepError::FontePinShape {
19260            nome: nome.to_string(),
19261            pin: pin.to_string(),
19262            value: value.to_string(),
19263            reason: reason.clone(),
19264        };
19265        assert_eq!(
19266            via_ctor, via_struct_literal,
19267            "fonte_pin_shape ctor must route `nome` / `pin` / `value` \
19268             through `.to_string()` onto their canonical fields and \
19269             forward `reason` owned onto the canonical `reason` field \
19270             — a field-rename, silent-conversion, or axis-swap \
19271             regression surfaces here rather than at a downstream \
19272             diagnostic-shape mismatch",
19273        );
19274        let DepError::FontePinShape {
19275            nome: n,
19276            pin: p,
19277            value: v,
19278            reason: r,
19279        } = via_ctor
19280        else {
19281            panic!("fonte_pin_shape ctor produced non-FontePinShape variant")
19282        };
19283        assert_eq!(n, nome);
19284        assert_eq!(p, pin);
19285        assert_eq!(v, value);
19286        assert_eq!(r, reason);
19287    }
19288
19289    // ── `fonte_caminho_byte_ctors!` — the paired `{ nome: String,
19290    //    caminho: String, byte: u8 }` three-slot envelope on `DepError`,
19291    //    strict sibling of the peer `fonte_caminho_ctors!` (f85f145) on
19292    //    the same envelope's `{ nome: String, caminho: String }` two-slot
19293    //    shape, and of the peer `dep_nome_only_ctors!` (792aa92) on the
19294    //    same envelope's `{ nome: String }` one-slot shape.
19295
19296    #[test]
19297    fn fonte_caminho_control_char_ctor_matches_struct_literal_wrap() {
19298        assert_eq!(
19299            DepError::fonte_caminho_control_char("caixa-teia", "../caixa-teia\x00foo", 0x00),
19300            DepError::FonteCaminhoControlChar {
19301                nome: "caixa-teia".to_string(),
19302                caminho: "../caixa-teia\x00foo".to_string(),
19303                byte: 0x00,
19304            },
19305        );
19306    }
19307
19308    #[test]
19309    fn fonte_caminho_shell_redirection_ctor_matches_struct_literal_wrap() {
19310        assert_eq!(
19311            DepError::fonte_caminho_shell_redirection("caixa-teia", "../caixa-teia>log", b'>'),
19312            DepError::FonteCaminhoShellRedirection {
19313                nome: "caixa-teia".to_string(),
19314                caminho: "../caixa-teia>log".to_string(),
19315                byte: b'>',
19316            },
19317        );
19318    }
19319
19320    #[test]
19321    #[allow(
19322        clippy::too_many_lines,
19323        reason = "cross-axis routing pin sweeps twelve typed variants, one per \
19324                  byte-classification arm on the {nome,caminho,byte} envelope; \
19325                  the linear per-variant repetition is exactly what the sweep \
19326                  is pinning — a helper macro would hide the shape the fold is \
19327                  keying on"
19328    )]
19329    fn fonte_caminho_byte_ctors_route_nome_caminho_and_byte_through_to_string() {
19330        // Cross-axis routing pin: sweep the three constructor input axes
19331        // (`nome: &str`, `caminho: &str`, `byte: u8`) through a
19332        // non-default fixture triple against every generated arm in the
19333        // [`fonte_caminho_byte_ctors!`] macro, so any wrapper-side
19334        // lowercase / trim / truncate on the two `&str` axes — a silent
19335        // field swap between `nome` and `caminho`, or a silent
19336        // re-classification of the offending byte — surfaces here rather
19337        // than at a downstream diagnostic-shape mismatch. Peer of the
19338        // sibling `fonte_caminho_ctors_route_nome_and_caminho_through_
19339        // to_string` cross-axis routing pin on the same envelope's
19340        // two-slot family (f85f145) and of the sibling
19341        // `dep_nome_only_ctors_route_nome_through_to_string` pin on the
19342        // same envelope's one-slot family (792aa92), extended here onto
19343        // the `{ nome: String, caminho: String, byte: u8 }` three-slot
19344        // envelope so every substrate-primitive ctor family in
19345        // caixa-core's `DepError` envelope guarantees each field routes
19346        // the caller's value verbatim through `.to_string()` (or byte-
19347        // identity for `byte: u8`) in declared field order.
19348        let nome = "sibling-teia";
19349        let caminho = "../workspace/sibling";
19350        let byte = 0x2A_u8;
19351        let cases: [(DepError, DepError); 12] = [
19352            (
19353                DepError::fonte_caminho_control_char(nome, caminho, byte),
19354                DepError::FonteCaminhoControlChar {
19355                    nome: nome.to_string(),
19356                    caminho: caminho.to_string(),
19357                    byte,
19358                },
19359            ),
19360            (
19361                DepError::fonte_caminho_shell_redirection(nome, caminho, byte),
19362                DepError::FonteCaminhoShellRedirection {
19363                    nome: nome.to_string(),
19364                    caminho: caminho.to_string(),
19365                    byte,
19366                },
19367            ),
19368            (
19369                DepError::fonte_caminho_shell_glob(nome, caminho, byte),
19370                DepError::FonteCaminhoShellGlob {
19371                    nome: nome.to_string(),
19372                    caminho: caminho.to_string(),
19373                    byte,
19374                },
19375            ),
19376            (
19377                DepError::fonte_caminho_shell_subshell_grouping(nome, caminho, byte),
19378                DepError::FonteCaminhoShellSubshellGrouping {
19379                    nome: nome.to_string(),
19380                    caminho: caminho.to_string(),
19381                    byte,
19382                },
19383            ),
19384            (
19385                DepError::fonte_caminho_shell_brace_expansion(nome, caminho, byte),
19386                DepError::FonteCaminhoShellBraceExpansion {
19387                    nome: nome.to_string(),
19388                    caminho: caminho.to_string(),
19389                    byte,
19390                },
19391            ),
19392            (
19393                DepError::fonte_caminho_shell_bracket_expansion(nome, caminho, byte),
19394                DepError::FonteCaminhoShellBracketExpansion {
19395                    nome: nome.to_string(),
19396                    caminho: caminho.to_string(),
19397                    byte,
19398                },
19399            ),
19400            (
19401                DepError::fonte_caminho_shell_quote_grouping(nome, caminho, byte),
19402                DepError::FonteCaminhoShellQuoteGrouping {
19403                    nome: nome.to_string(),
19404                    caminho: caminho.to_string(),
19405                    byte,
19406                },
19407            ),
19408            (
19409                DepError::fonte_caminho_shell_comment(nome, caminho, byte),
19410                DepError::FonteCaminhoShellComment {
19411                    nome: nome.to_string(),
19412                    caminho: caminho.to_string(),
19413                    byte,
19414                },
19415            ),
19416            (
19417                DepError::fonte_caminho_url_percent_encoding(nome, caminho, byte),
19418                DepError::FonteCaminhoUrlPercentEncoding {
19419                    nome: nome.to_string(),
19420                    caminho: caminho.to_string(),
19421                    byte,
19422                },
19423            ),
19424            (
19425                DepError::fonte_caminho_shell_variable_expansion(nome, caminho, byte),
19426                DepError::FonteCaminhoShellVariableExpansion {
19427                    nome: nome.to_string(),
19428                    caminho: caminho.to_string(),
19429                    byte,
19430                },
19431            ),
19432            (
19433                DepError::fonte_caminho_shell_history_expansion(nome, caminho, byte),
19434                DepError::FonteCaminhoShellHistoryExpansion {
19435                    nome: nome.to_string(),
19436                    caminho: caminho.to_string(),
19437                    byte,
19438                },
19439            ),
19440            (
19441                DepError::fonte_caminho_shell_history_substitution(nome, caminho, byte),
19442                DepError::FonteCaminhoShellHistorySubstitution {
19443                    nome: nome.to_string(),
19444                    caminho: caminho.to_string(),
19445                    byte,
19446                },
19447            ),
19448        ];
19449        for (via_ctor, via_struct_literal) in cases {
19450            assert_eq!(
19451                via_ctor, via_struct_literal,
19452                "fonte_caminho_byte_ctors!-generated ctor must route \
19453                 (nome, caminho, byte) through `.to_string()` / byte-\
19454                 identity in declared field order — a field-swap or \
19455                 silent-conversion regression surfaces here rather than \
19456                 at a downstream diagnostic-shape mismatch",
19457            );
19458        }
19459    }
19460
19461    #[test]
19462    fn dep_list_as_ref_str_routes_through_as_str_accessor() {
19463        // Fail-before-pass-after byte-parity pin on the lifted
19464        // `impl AsRef<str> for DepList` — asserts the standard-
19465        // library trait impl and the substrate-primitive
19466        // [`super::DepList::as_str`] `pub const fn` accessor resolve
19467        // to the same `&str` per instance across the two-arm closed
19468        // set, so any future silent detour that routes the impl
19469        // through a divergent projection (a per-arm inline
19470        // `match self { DepList::Prod => ":deps", … }` re-inlining
19471        // that opens a compile-time link to the un-lifted arm-literal,
19472        // a swap onto a second projection axis) trips at caixa-core
19473        // test time under `PartialEq` rather than at a downstream
19474        // `impl AsRef<str>`-bound consumer's silent split. Sweeps
19475        // every one of the two arms [`super::DepList::ALL`] carries
19476        // so no arm's projection is covered only by the sibling
19477        // `Display` path. Peer of the sibling
19478        // `caixa_dialeto_as_ref_str_routes_through_as_str_accessor`
19479        // (1723611) on the top-level dialect-classification closed-
19480        // set typed enum, and the peer
19481        // `rate_limit_unit_as_ref_str_routes_through_as_suffix_accessor`
19482        // (d8136db) pin on the M3 `:politicas :rate-limit` closed-set
19483        // typed enum — the pins together close the substrate
19484        // primitive's `AsRef<str>` projection axis onto the seventh
19485        // (and last unlifted) closed-set typed enum on the caixa
19486        // surface.
19487        for &list in super::DepList::ALL {
19488            assert_eq!(
19489                <super::DepList as AsRef<str>>::as_ref(&list),
19490                list.as_str(),
19491                "AsRef<str> impl on DepList::{list:?} must byte-equal \
19492                 DepList::as_str on the same instance — divergence \
19493                 signals a silent detour off the substrate-primitive \
19494                 accessor"
19495            );
19496        }
19497    }
19498
19499    #[test]
19500    fn dep_list_as_ref_str_routes_through_display_via_shared_accessor() {
19501        // Fail-before-pass-after byte-parity pin on the three-path
19502        // convergence discipline the [`super::DepList`] two-list
19503        // dep-graph closed-set typed enum now carries on the `&str`-
19504        // projection axis: `<DepList as AsRef<str>>::as_ref(&v)` (the
19505        // newly lifted impl), `format!("{v}")` (the pre-existing
19506        // [`fmt::Display`] impl), and `v.as_str()` (the substrate-
19507        // primitive `pub const fn` accessor both trait impls delegate
19508        // through) must resolve to the same byte-string on every
19509        // instance across the two-arm closed set. Refuses any future
19510        // divergence between the two trait impls (a stray
19511        // [`fmt::Display::fmt`] rewrite that hand-rolls the arms
19512        // rather than delegating through the shared accessor; a
19513        // hypothetical `AsRef<str>` rewrite that inlines a per-arm
19514        // literal cascade) that would silently split the two
19515        // projection paths of the same closed-set typed enum. Mirrors
19516        // the sibling three-path-convergence discipline the peer
19517        // [`crate::CaixaDialeto`] typed enum carries
19518        // (`caixa_dialeto_as_ref_str_routes_through_display_via_shared_accessor`,
19519        // 1723611), the peer [`crate::aplicacao::RateLimitUnit`] triple
19520        // (`rate_limit_unit_as_ref_str_routes_through_display_via_shared_accessor`,
19521        // d8136db), the peer [`crate::CaixaKind`] triple
19522        // (`caixa_kind_as_ref_str_routes_through_display_via_shared_accessor`,
19523        // cd2091f), and the [`crate::CaixaVersion`] typed newtype
19524        // triple (`caixa_version_as_ref_str_routes_through_display_via_shared_accessor`,
19525        // 16d5c7e).
19526        for &list in super::DepList::ALL {
19527            let via_as_ref: &str = <super::DepList as AsRef<str>>::as_ref(&list);
19528            let via_display: String = format!("{list}");
19529            let via_accessor: &str = list.as_str();
19530            assert_eq!(via_as_ref, via_accessor);
19531            assert_eq!(via_display, via_accessor);
19532            assert_eq!(via_as_ref, via_display.as_str());
19533        }
19534    }
19535
19536    #[test]
19537    fn dep_list_try_from_str_routes_through_from_wire_accessor() {
19538        // Fail-before-pass-after byte-parity pin on the newly lifted
19539        // `impl TryFrom<&str> for DepList` — asserts the standard-
19540        // library trait impl and the substrate-primitive
19541        // [`super::DepList::from_wire`] `Option<Self>` accessor resolve
19542        // to the same two-arm accept-set across every arm the
19543        // exhaustive [`super::DepList::ALL`] slice enumerates. Peer of
19544        // the sibling
19545        // `restart_strategy_try_from_str_routes_through_from_wire_accessor`
19546        // (5b828ed), `caixa_kind_try_from_str_routes_through_from_wire_accessor`,
19547        // and the 12 other substrate-wide trait-idiomatic reverse-
19548        // projection routes-through pins — closes the campaign's
19549        // completeness gap on the two-list dep-graph closed-set enum.
19550        for &list in super::DepList::ALL {
19551            let wire = list.as_str();
19552            assert_eq!(
19553                <super::DepList as TryFrom<&str>>::try_from(wire),
19554                Ok(list),
19555                "TryFrom<&str> impl on DepList must round-trip \
19556                 DepList::{list:?}.as_str() = {wire:?} back to \
19557                 Ok(DepList::{list:?}) — divergence from \
19558                 DepList::from_wire signals a silent detour off the \
19559                 substrate-primitive accessor"
19560            );
19561            assert_eq!(
19562                <super::DepList as TryFrom<&str>>::try_from(wire).ok(),
19563                super::DepList::from_wire(wire),
19564                "TryFrom<&str> ok()-projection on {wire:?} must byte-equal \
19565                 DepList::from_wire on the same input"
19566            );
19567        }
19568    }
19569
19570    #[test]
19571    fn dep_list_try_from_str_rejects_unknown_byte_strings() {
19572        // Rejection witness on the `impl TryFrom<&str> for DepList` —
19573        // sweeps candidate byte-strings outside the two-arm accept-set
19574        // the sibling [`super::DepList::as_str`] emits (`:deps` /
19575        // `:deps-dev`) and asserts every one lands on `Err(())`, so a
19576        // future accidental widening of the trait impl's accept-set (a
19577        // stray case-fold path, a silent inclusion of a rebrand alias
19578        // like `":packages"`, an English rebrand `":dev-deps"` in
19579        // reverse arm-order that would silently swap the two arms) trips
19580        // at caixa-core test time. Peer of the sibling
19581        // `restart_strategy_try_from_str_rejects_unknown_byte_strings`
19582        // (5b828ed) rejection witness.
19583        let rejected: &[&str] = &[
19584            "",
19585            " ",
19586            "\t",
19587            "\n",
19588            ":deps ",
19589            " :deps",
19590            ":DEPS",
19591            ":Deps",
19592            ":Deps-Dev",
19593            ":deps_dev",
19594            ":deps-development",
19595            ":dev-deps",
19596            ":packages",
19597            ":packages-dev",
19598            "deps",
19599            "deps-dev",
19600            "Prod",
19601            "Dev",
19602            "prod",
19603            "dev",
19604            "\":deps\"",
19605            "\":deps-dev\"",
19606            ":deps\n",
19607            ":deps-dev\n",
19608        ];
19609        for &input in rejected {
19610            assert_eq!(
19611                <super::DepList as TryFrom<&str>>::try_from(input),
19612                Err(()),
19613                "TryFrom<&str> impl on DepList must reject unknown \
19614                 byte-string {input:?} — divergence from \
19615                 DepList::from_wire on the same input signals a silent \
19616                 accept-set widening past the two lifted \
19617                 crate::render::DEP_AUTHOR_KEY_DEPS* wire constants"
19618            );
19619            assert_eq!(
19620                <super::DepList as TryFrom<&str>>::try_from(input).ok(),
19621                super::DepList::from_wire(input),
19622                "TryFrom<&str> ok()-projection on {input:?} must byte-equal \
19623                 DepList::from_wire on the same input — divergence signals \
19624                 the two reverse-projection paths have drifted onto \
19625                 different accept-sets"
19626            );
19627        }
19628    }
19629
19630    #[test]
19631    fn dep_list_from_into_static_str_routes_through_as_str_accessor() {
19632        // Fail-before-pass-after byte-parity pin on the newly lifted
19633        // `impl From<DepList> for &'static str` — asserts the standard-
19634        // library trait impl and the substrate-primitive
19635        // [`super::DepList::as_str`] `pub const fn` accessor resolve to
19636        // the same two-arm emit-set across every arm the exhaustive
19637        // [`super::DepList::ALL`] slice enumerates. Materializes the
19638        // `<&'static str as From<DepList>>::from` output in a
19639        // `const`-shape binding to make the `'static` lifetime promise
19640        // a build-time invariant — a future accidental downgrade of
19641        // either arm to a non-`&'static str` (a `String::leak()`-
19642        // produced return, a `Box::leak`-cast) trips at caixa-core
19643        // build time rather than at a downstream `'static`-bound
19644        // consumer. Peer of the sibling
19645        // `restart_strategy_from_into_static_str_routes_through_as_str_accessor`
19646        // (523157d) and the 13 other substrate-wide forward-projection
19647        // routes-through pins.
19648        const PROD: &str = super::DepList::Prod.as_str();
19649        const DEV: &str = super::DepList::Dev.as_str();
19650        for &list in super::DepList::ALL {
19651            let via_trait: &'static str = <&'static str as From<super::DepList>>::from(list);
19652            let via_method: &'static str = list.as_str();
19653            assert_eq!(
19654                via_trait, via_method,
19655                "From<DepList> for &'static str impl must round-trip \
19656                 DepList::{list:?} to the same lifted \
19657                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
19658                 DepList::as_str returns — divergence signals a silent \
19659                 detour off the substrate-primitive accessor"
19660            );
19661            let via_into: &'static str = list.into();
19662            assert_eq!(
19663                via_into, via_method,
19664                "Into<&'static str>::into on DepList::{list:?} must \
19665                 byte-equal DepList::as_str on the same input — the \
19666                 blanket-derived Into shape must resolve to the same \
19667                 as_str dispatch as the explicit From impl"
19668            );
19669        }
19670        assert_eq!(
19671            [PROD, DEV],
19672            [
19673                crate::render::DEP_AUTHOR_KEY_DEPS,
19674                crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
19675            ],
19676            "const-context DepList::as_str must resolve to the two lifted \
19677             DEP_AUTHOR_KEY_DEPS* consts — a future accidental downgrade \
19678             of either arm to a non-const or non-static byte-string breaks \
19679             the `&'static str`-lifetime promise the paired \
19680             From<DepList> for &'static str impl carries by construction"
19681        );
19682    }
19683
19684    #[test]
19685    fn dep_list_from_into_static_str_and_as_str_partition_the_emit_set() {
19686        // Cross-axis partition pin: the paired trait-idiomatic
19687        // `From<DepList> for &'static str` forward projection and the
19688        // method-named [`super::DepList::as_str`] forward projection
19689        // must resolve identically on every arm, locking the two paths
19690        // together so any future detour trips at caixa-core test time.
19691        // Then a round-trip witness: every arm's forward `From` output
19692        // re-parses through the paired trait-idiomatic reverse
19693        // `TryFrom<&str>` back to the original variant, closing the
19694        // two-way `DepList ↔ &'static str` round-trip on the trait-
19695        // idiomatic axis pair, mirroring the pre-existing method-named
19696        // `as_str` + `from_wire` round-trip. Peer of the sibling
19697        // `restart_strategy_from_into_static_str_and_as_str_partition_the_emit_set`
19698        // (523157d).
19699        for &list in super::DepList::ALL {
19700            let via_trait: &'static str = <&'static str as From<super::DepList>>::from(list);
19701            let via_method: &'static str = list.as_str();
19702            assert_eq!(
19703                via_trait, via_method,
19704                "From<DepList> for &'static str and DepList::as_str must \
19705                 resolve identically on DepList::{list:?} — divergence \
19706                 signals the two forward-projection paths have drifted \
19707                 onto different emit-sets"
19708            );
19709        }
19710        for &list in super::DepList::ALL {
19711            let emitted: &'static str = list.into();
19712            let re_parsed: Result<super::DepList, ()> =
19713                <super::DepList as TryFrom<&str>>::try_from(emitted);
19714            assert_eq!(
19715                re_parsed,
19716                Ok(list),
19717                "trait-idiomatic axis pair must round-trip \
19718                 DepList::{list:?} through `.into::<&'static str>()` and \
19719                 back through `TryFrom<&str>` — a break signals the \
19720                 forward-emit and reverse-parse axes have drifted onto \
19721                 different vocabularies"
19722            );
19723        }
19724    }
19725
19726    #[test]
19727    fn dep_list_from_borrowed_into_static_str_routes_through_as_str_accessor() {
19728        // Fail-before-pass-after byte-parity pin on the newly lifted
19729        // `impl From<&DepList> for &'static str` — asserts the borrowed-
19730        // input standard-library trait impl and the substrate-primitive
19731        // [`super::DepList::as_str`] `pub const fn` accessor resolve to
19732        // the same two-arm emit-set across every arm the exhaustive
19733        // [`super::DepList::ALL`] slice enumerates. Rust's `From` trait
19734        // does not auto-derive the borrowed-input sibling from a paired
19735        // owned-input impl (no `impl<T, U> From<&T> for U where T: Copy,
19736        // U: From<T>` blanket in `core`), so the borrowed-input axis is
19737        // a distinct trait-idiomatic surface that a `.iter().map(Into::into)`
19738        // shape over [`super::DepList::ALL`] (whose iterator yields
19739        // `&DepList`, not `DepList`) reaches through this impl and no
19740        // other — the paired owned-input [`From<DepList>`] impl requires
19741        // an explicit `.copied()` / dereference before the trait fires.
19742        // Materializes the `<&'static str as From<&DepList>>::from`
19743        // output in a `const`-shape binding to make the `'static`
19744        // lifetime promise a build-time invariant.
19745        const PROD: &str = super::DepList::Prod.as_str();
19746        const DEV: &str = super::DepList::Dev.as_str();
19747        for list in super::DepList::ALL {
19748            let via_trait: &'static str = <&'static str as From<&super::DepList>>::from(list);
19749            let via_method: &'static str = list.as_str();
19750            assert_eq!(
19751                via_trait, via_method,
19752                "From<&DepList> for &'static str impl must round-trip \
19753                 &DepList::{list:?} to the same lifted \
19754                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
19755                 DepList::as_str returns — divergence signals a silent \
19756                 detour off the substrate-primitive accessor"
19757            );
19758            let via_into: &'static str = list.into();
19759            assert_eq!(
19760                via_into, via_method,
19761                "Into<&'static str>::into on &DepList::{list:?} must \
19762                 byte-equal DepList::as_str on the same input — the \
19763                 blanket-derived Into shape must resolve to the same \
19764                 as_str dispatch as the explicit From impl"
19765            );
19766        }
19767        assert_eq!(
19768            [PROD, DEV],
19769            [
19770                crate::render::DEP_AUTHOR_KEY_DEPS,
19771                crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
19772            ],
19773            "const-context DepList::as_str must resolve to the two lifted \
19774             DEP_AUTHOR_KEY_DEPS* consts — the borrowed-input \
19775             From<&DepList> for &'static str impl inherits its `'static` \
19776             lifetime promise from the same accessor the owned-input \
19777             sibling routes through"
19778        );
19779    }
19780
19781    #[test]
19782    fn dep_list_from_owned_and_borrowed_into_static_str_agree_on_every_arm() {
19783        // Cross-axis partition pin: the paired trait-idiomatic
19784        // owned-input `From<DepList> for &'static str` (523157d
19785        // campaign-shape) and borrowed-input `From<&DepList> for
19786        // &'static str` (this lift) forward projections must resolve
19787        // identically on every arm, locking the two input-shape paths
19788        // together so any future detour trips at caixa-core test time.
19789        // Then a witness that a `.iter().map(Into::into)` pipe over
19790        // [`super::DepList::ALL`] (whose iterator yields `&DepList`)
19791        // materializes the two-arm accept-set through the borrowed-
19792        // input axis alone — the exact shape a future M4 admission-
19793        // webhook rejection body composer, a future substrate-wide
19794        // per-arm diagnostic column, or a
19795        // `HashMap::<&'static str, DepList>::from_iter(DepList::ALL.iter()
19796        //     .map(|l| (l.into(), *l)))`-style per-list lookup reaches
19797        // through — closing the two-way owned/borrowed input-shape
19798        // symmetry on the forward-projection trait-idiomatic axis.
19799        for &list in super::DepList::ALL {
19800            let owned: &'static str = <&'static str as From<super::DepList>>::from(list);
19801            let borrowed: &'static str = <&'static str as From<&super::DepList>>::from(&list);
19802            assert_eq!(
19803                owned, borrowed,
19804                "From<DepList> and From<&DepList> for &'static str must \
19805                 resolve identically on DepList::{list:?} — divergence \
19806                 signals the owned-input and borrowed-input forward-\
19807                 projection paths have drifted onto different emit-sets"
19808            );
19809        }
19810        let via_iter: Vec<&'static str> = super::DepList::ALL.iter().map(Into::into).collect();
19811        let via_method: Vec<&'static str> =
19812            super::DepList::ALL.iter().map(|l| l.as_str()).collect();
19813        assert_eq!(
19814            via_iter, via_method,
19815            "`.iter().map(Into::into)` over DepList::ALL must byte-equal \
19816             `.iter().map(|l| l.as_str())` on every arm — the borrowed-\
19817             input `From<&DepList> for &'static str` axis is what makes \
19818             the `.iter().map(Into::into)` shape route through the \
19819             substrate-primitive `DepList::as_str` accessor rather than \
19820             through a per-call-site `.copied()` / dereference detour"
19821        );
19822    }
19823
19824    #[test]
19825    fn dep_list_from_into_owned_string_routes_through_as_str_accessor() {
19826        // Fail-before-pass-after byte-parity pin on the newly lifted
19827        // `impl From<DepList> for String` — asserts the owned-`String`
19828        // -returning standard-library trait impl and the substrate-
19829        // primitive [`super::DepList::as_str`] `pub const fn` accessor
19830        // resolve to the same two-arm emit-set across every arm the
19831        // exhaustive [`super::DepList::ALL`] slice enumerates. Rust's
19832        // standard library does not carry a blanket
19833        // `impl<T: AsRef<str>> From<T> for String` (nor an
19834        // `impl<T: fmt::Display> From<T> for String`), so the
19835        // owned-`String` forward-projection axis is a distinct trait-
19836        // idiomatic surface that a `let key: String = list.into();`-
19837        // shaped call site reaches through this impl and no other — the
19838        // paired sibling `From<DepList> for &'static str` impl forces
19839        // every owned-`String` call site through an explicit
19840        // `.to_owned()` / `String::from` restatement. Peer of the
19841        // first-mover
19842        // [`crate::supervisor::tests::restart_strategy_from_into_owned_string_routes_through_as_str_accessor`]
19843        // (7baa18a), the second-peer
19844        // [`crate::supervisor::tests::restart_policy_from_into_owned_string_routes_through_as_str_accessor`]
19845        // (7851725), the third-peer
19846        // [`crate::kind::tests::caixa_kind_from_into_owned_string_routes_through_as_str_accessor`]
19847        // (231a18c), and the fourth-peer
19848        // [`crate::dialeto::tests::caixa_dialeto_from_into_owned_string_routes_through_as_str_accessor`]
19849        // (88942cd) — extends the trait-idiomatic owned-`String`
19850        // forward-projection axis onto the fifth closed-set fieldless
19851        // typed enum on the caixa surface (the two-list dep-graph axis).
19852        for &variant in super::DepList::ALL {
19853            let via_trait: String = <String as From<super::DepList>>::from(variant);
19854            let via_method: &'static str = variant.as_str();
19855            assert_eq!(
19856                via_trait.as_str(),
19857                via_method,
19858                "From<DepList> for String impl must round-trip \
19859                 DepList::{variant:?} to the same lifted \
19860                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
19861                 DepList::as_str returns — divergence signals a silent \
19862                 detour off the substrate-primitive accessor"
19863            );
19864            let via_into: String = variant.into();
19865            assert_eq!(
19866                via_into.as_str(),
19867                via_method,
19868                "Into<String>::into on DepList::{variant:?} must \
19869                 byte-equal DepList::as_str on the same input — the \
19870                 blanket-derived Into shape must resolve to the same \
19871                 as_str dispatch as the explicit From impl"
19872            );
19873        }
19874    }
19875
19876    #[test]
19877    fn dep_list_from_into_owned_string_and_static_str_agree_on_every_arm() {
19878        // Cross-axis partition pin: the paired trait-idiomatic
19879        // owned-`String` `From<DepList> for String` (this lift) and
19880        // owned-`&'static str` `From<DepList> for &'static str`
19881        // (523157d campaign-shape) forward projections must resolve
19882        // identically on every arm, locking the two return-type-shape
19883        // paths together so any future detour trips at caixa-core test
19884        // time. Also byte-parity witness against the sibling
19885        // [`ToString::to_string`] surface routed through
19886        // [`std::fmt::Display`] — the three owned-heap-string paths
19887        // (`.into::<String>()`, `String::from`, `.to_string()`) must
19888        // resolve identically on every arm so a future consumer that
19889        // picks any of the three lands on the same two-arm lifted
19890        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
19891        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] accept-set.
19892        // Then a `.iter().copied().map(String::from)` pipe witness
19893        // over [`super::DepList::ALL`] that materializes the two-arm
19894        // accept-set through the owned-`String` axis alone — the exact
19895        // shape a future M4 admission-webhook rejection body composer
19896        // or a
19897        // `HashMap::<String, DepList>::from_iter(
19898        //     DepList::ALL.iter().copied().map(|l| (l.into(), l)))`-
19899        // style owned-key per-list lookup reaches through — closing the
19900        // owned-`String` forward-projection axis's iterator-pipe shape.
19901        // Then a direct round-trip witness through the paired
19902        // trait-idiomatic reverse [`TryFrom<&str>`] axis on the
19903        // owned-`String`'s [`String::as_str`] borrow that closes the
19904        // two-way `Self → String → Self` round-trip on the trait-
19905        // idiomatic owned-`String` forward + reverse axis pair.
19906        //
19907        // Unlike the peer [`crate::CaixaKind`] axis pair (whose forward
19908        // `From` emit lands on the lowercase Portuguese `as_str`
19909        // diagnostic vocabulary while the reverse `TryFrom<&str>`
19910        // parses the `PascalCase` `wire_name` author-surface vocabulary,
19911        // forcing the round-trip through an intermediate
19912        // [`crate::CaixaKind::wire_name`] hop), [`super::DepList`]'s
19913        // [`super::DepList::as_str`] emit and [`super::DepList::from_wire`]
19914        // parse resolve through the same lifted
19915        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
19916        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] consts by
19917        // construction (there is no wire/diagnostic axis split on this
19918        // enum), so the owned-`String` forward axis and the reverse
19919        // axis compose directly — matching the peer
19920        // [`crate::supervisor::RestartStrategy`] /
19921        // [`crate::supervisor::RestartPolicy`] /
19922        // [`crate::CaixaDialeto`] owned-`String` axis pairs.
19923        for &list in super::DepList::ALL {
19924            let owned_string: String = <String as From<super::DepList>>::from(list);
19925            let owned_static: &'static str = <&'static str as From<super::DepList>>::from(list);
19926            assert_eq!(
19927                owned_string.as_str(),
19928                owned_static,
19929                "From<DepList> for String and From<DepList> for \
19930                 &'static str must resolve identically on \
19931                 DepList::{list:?} — divergence signals the owned-\
19932                 `String` and owned-`&'static str` forward-projection \
19933                 return-type-shape paths have drifted onto different \
19934                 emit-sets"
19935            );
19936            let via_to_string: String = list.to_string();
19937            assert_eq!(
19938                owned_string, via_to_string,
19939                "From<DepList> for String must byte-equal \
19940                 DepList::to_string on DepList::{list:?} — divergence \
19941                 signals the trait-idiomatic owned-`String` forward-\
19942                 projection axis and the ToString-through-Display axis \
19943                 have drifted onto different emit-sets"
19944            );
19945        }
19946        let via_iter: Vec<String> = super::DepList::ALL
19947            .iter()
19948            .copied()
19949            .map(String::from)
19950            .collect();
19951        let via_method: Vec<String> = super::DepList::ALL
19952            .iter()
19953            .map(|l| l.as_str().to_owned())
19954            .collect();
19955        assert_eq!(
19956            via_iter, via_method,
19957            "`.iter().copied().map(String::from)` over DepList::ALL must \
19958             byte-equal `.iter().map(|l| l.as_str().to_owned())` on \
19959             every arm — the owned-`String` `From<DepList> for String` \
19960             axis is what makes the `String::from` composition route \
19961             through the substrate-primitive `DepList::as_str` accessor \
19962             rather than through a per-call-site `.to_owned()` / \
19963             `String::from(list.as_str())` detour"
19964        );
19965        for &variant in super::DepList::ALL {
19966            let emitted: String = variant.into();
19967            let re_parsed: Result<super::DepList, ()> =
19968                <super::DepList as TryFrom<&str>>::try_from(emitted.as_str());
19969            assert_eq!(
19970                re_parsed,
19971                Ok(variant),
19972                "trait-idiomatic owned-`String` forward-projection + \
19973                 reverse-projection axis pair must round-trip \
19974                 DepList::{variant:?} through `.into::<String>()` and \
19975                 back through `TryFrom<&str>` on the owned-`String`'s \
19976                 String::as_str borrow — a break signals the owned-\
19977                 `String` forward-emit and reverse-parse axes have \
19978                 drifted onto different vocabularies (unlike the peer \
19979                 CaixaKind axis pair, DepList's forward emit and \
19980                 reverse parse share the same lifted \
19981                 DEP_AUTHOR_KEY_DEPS* consts by construction, so the \
19982                 round-trip composes directly)"
19983            );
19984        }
19985    }
19986
19987    #[test]
19988    fn dep_list_from_into_borrowed_owned_string_routes_through_as_str_accessor() {
19989        // Fail-before-pass-after byte-parity pin on the newly lifted
19990        // `impl From<&DepList> for String` — asserts the borrowed-input
19991        // owned-`String`-returning standard-library trait impl and the
19992        // substrate-primitive [`super::DepList::as_str`] `pub const fn`
19993        // accessor resolve to the same two-arm emit-set across every
19994        // arm the exhaustive [`super::DepList::ALL`] slice enumerates.
19995        // Rust's standard library does not carry a blanket
19996        // `impl<T: AsRef<str>> From<&T> for String` (nor an
19997        // `impl<T: fmt::Display> From<&T> for String`), so the
19998        // borrowed-input owned-`String` forward-projection axis is a
19999        // distinct trait-idiomatic surface that a
20000        // `let key: String = (&list).into();`-shaped call site reaches
20001        // through this impl and no other — the paired sibling
20002        // `From<DepList> for String` impl forces every borrowed-input
20003        // call site through an explicit `Copy` deref
20004        // (`String::from(*list)`) or an `.as_str().to_owned()` /
20005        // `.to_string()` detour. Peer of the first-mover
20006        // [`crate::supervisor::tests::restart_strategy_from_into_borrowed_owned_string_routes_through_as_str_accessor`]
20007        // (579385f) and the second-peer
20008        // [`crate::supervisor::tests::restart_policy_from_into_borrowed_owned_string_routes_through_as_str_accessor`]
20009        // (8465740) — extends the trait-idiomatic borrowed-input owned-
20010        // `String` forward-projection axis off the M2 OTP-shape sibling
20011        // axis pair onto the first non-M2 closed-set fieldless typed
20012        // enum peer (the two-list dep-graph axis).
20013        for &variant in super::DepList::ALL {
20014            let via_trait: String = <String as From<&super::DepList>>::from(&variant);
20015            let via_method: &'static str = variant.as_str();
20016            assert_eq!(
20017                via_trait.as_str(),
20018                via_method,
20019                "From<&DepList> for String impl must round-trip \
20020                 &DepList::{variant:?} to the same lifted \
20021                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20022                 DepList::as_str returns — divergence signals a silent \
20023                 detour off the substrate-primitive accessor"
20024            );
20025            let via_into: String = (&variant).into();
20026            assert_eq!(
20027                via_into.as_str(),
20028                via_method,
20029                "Into<String>::into on &DepList::{variant:?} must \
20030                 byte-equal DepList::as_str on the same input — the \
20031                 blanket-derived Into shape must resolve to the same \
20032                 as_str dispatch as the explicit From impl"
20033            );
20034        }
20035    }
20036
20037    #[test]
20038    fn dep_list_from_into_borrowed_owned_string_agrees_with_paired_axes_on_every_arm() {
20039        // Cross-axis partition pin: the newly lifted trait-idiomatic
20040        // borrowed-input owned-`String` `From<&DepList> for String`
20041        // (this lift), the paired owned-input owned-`String`
20042        // `From<DepList> for String` (32b0ee8), the paired borrowed-
20043        // input owned-`&'static str` `From<&DepList> for &'static str`
20044        // (64aa742), and the paired owned-input owned-`&'static str`
20045        // `From<DepList> for &'static str` (3455cbf) — every corner of
20046        // the `{Self, &Self} × {&'static str, String}` 2×2 trait-
20047        // idiomatic projection family — must resolve identically on
20048        // every arm, locking the four return-shape × input-shape paths
20049        // together so any future detour trips at caixa-core test time.
20050        // Also byte-parity witness against the sibling
20051        // [`ToString::to_string`] surface routed through
20052        // [`std::fmt::Display`] and a direct round-trip witness through
20053        // the paired trait-idiomatic reverse [`TryFrom<&str>`] axis on
20054        // the owned-`String`'s [`String::as_str`] borrow that closes
20055        // the two-way `&Self → String → Self` round-trip on the trait-
20056        // idiomatic borrowed-input owned-`String` forward + reverse
20057        // axis pair. Peer of the first-mover
20058        // [`crate::supervisor::tests::restart_strategy_from_into_borrowed_owned_string_agrees_with_paired_axes_on_every_arm`]
20059        // (579385f) and the second-peer
20060        // [`crate::supervisor::tests::restart_policy_from_into_borrowed_owned_string_agrees_with_paired_axes_on_every_arm`]
20061        // (8465740) — closes the whole `{Self, &Self} × {&'static str,
20062        // String}` 2×2 projection corner on the third substrate-wide
20063        // closed-set fieldless typed enum peer (the two-list dep-graph
20064        // axis, first outside the M2 OTP-shape sibling pair).
20065        //
20066        // Unlike the peer [`crate::CaixaKind`] axis pair (whose forward
20067        // `From` emit lands on the lowercase Portuguese `as_str`
20068        // diagnostic vocabulary while the reverse `TryFrom<&str>`
20069        // parses the `PascalCase` `wire_name` author-surface vocabulary,
20070        // forcing the round-trip through an intermediate
20071        // [`crate::CaixaKind::wire_name`] hop), [`super::DepList`]'s
20072        // [`super::DepList::as_str`] emit and
20073        // [`super::DepList::from_wire`] parse resolve through the same
20074        // lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20075        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] consts by
20076        // construction (there is no wire/diagnostic axis split on this
20077        // enum), so the borrowed-input owned-`String` forward axis and
20078        // the reverse axis compose directly — matching the peer
20079        // [`crate::supervisor::RestartStrategy`] /
20080        // [`crate::supervisor::RestartPolicy`] borrowed-input owned-
20081        // `String` axis pairs.
20082        for &list in super::DepList::ALL {
20083            let borrowed_string: String = <String as From<&super::DepList>>::from(&list);
20084            let owned_string: String = <String as From<super::DepList>>::from(list);
20085            let borrowed_static: &'static str =
20086                <&'static str as From<&super::DepList>>::from(&list);
20087            let owned_static: &'static str = <&'static str as From<super::DepList>>::from(list);
20088            assert_eq!(
20089                borrowed_string, owned_string,
20090                "From<&DepList> for String and From<DepList> for String \
20091                 must resolve identically on DepList::{list:?} — \
20092                 divergence signals the borrowed-input and owned-input \
20093                 owned-`String` forward-projection input-shape paths \
20094                 have drifted onto different emit-sets"
20095            );
20096            assert_eq!(
20097                borrowed_string.as_str(),
20098                borrowed_static,
20099                "From<&DepList> for String and From<&DepList> for \
20100                 &'static str must resolve identically on \
20101                 DepList::{list:?} — divergence signals the borrowed-\
20102                 input `&'static str` and owned-`String` return-shape \
20103                 paths have drifted onto different emit-sets"
20104            );
20105            assert_eq!(
20106                borrowed_string.as_str(),
20107                owned_static,
20108                "From<&DepList> for String and From<DepList> for \
20109                 &'static str must resolve identically on \
20110                 DepList::{list:?} — divergence signals a break in the \
20111                 diagonal corner of the {{Self, &Self}} × {{&'static \
20112                 str, String}} 2×2 trait-idiomatic projection family"
20113            );
20114            let via_to_string: String = list.to_string();
20115            assert_eq!(
20116                borrowed_string, via_to_string,
20117                "From<&DepList> for String must byte-equal \
20118                 DepList::to_string on DepList::{list:?} — divergence \
20119                 signals the trait-idiomatic borrowed-input owned-\
20120                 `String` forward-projection axis and the ToString-\
20121                 through-Display axis have drifted onto different \
20122                 emit-sets"
20123            );
20124        }
20125        let via_iter: Vec<String> = super::DepList::ALL.iter().map(String::from).collect();
20126        let via_method: Vec<String> = super::DepList::ALL
20127            .iter()
20128            .map(|l| l.as_str().to_owned())
20129            .collect();
20130        assert_eq!(
20131            via_iter, via_method,
20132            "`.iter().map(String::from)` over DepList::ALL — a call \
20133             site whose iteration axis holds `&DepList` by construction \
20134             — must byte-equal `.iter().map(|l| l.as_str().to_owned())` \
20135             on every arm — the borrowed-input owned-`String` \
20136             `From<&DepList> for String` axis is what makes the \
20137             `String::from` composition route through the substrate-\
20138             primitive `DepList::as_str` accessor without a spurious \
20139             `Copy` deref (which would only be reachable through the \
20140             owned-input `From<DepList> for String` axis by first \
20141             calling `.copied()` on the iterator)"
20142        );
20143        for &variant in super::DepList::ALL {
20144            let emitted: String = (&variant).into();
20145            let re_parsed: Result<super::DepList, ()> =
20146                <super::DepList as TryFrom<&str>>::try_from(emitted.as_str());
20147            assert_eq!(
20148                re_parsed,
20149                Ok(variant),
20150                "trait-idiomatic borrowed-input owned-`String` \
20151                 forward-projection + reverse-projection axis pair must \
20152                 round-trip &DepList::{variant:?} through \
20153                 `.into::<String>()` on the borrowed-input surface and \
20154                 back through `TryFrom<&str>` on the owned-`String`'s \
20155                 String::as_str borrow — a break signals the \
20156                 borrowed-input owned-`String` forward-emit and \
20157                 reverse-parse axes have drifted onto different \
20158                 vocabularies (unlike the peer CaixaKind axis pair, \
20159                 DepList's forward emit and reverse parse share the \
20160                 same lifted DEP_AUTHOR_KEY_DEPS* consts by \
20161                 construction, so the round-trip composes directly)"
20162            );
20163        }
20164    }
20165
20166    #[test]
20167    fn dep_list_from_into_static_cow_str_routes_through_as_str_accessor() {
20168        // Fail-before-pass-after byte-parity pin on the newly lifted
20169        // `impl From<DepList> for std::borrow::Cow<'static, str>` —
20170        // asserts the standard-library trait impl and the substrate-
20171        // primitive [`super::DepList::as_str`] `pub const fn`
20172        // accessor resolve to the same two-arm emit-set across every
20173        // arm the exhaustive [`super::DepList::ALL`] slice
20174        // enumerates. Rust's standard library does not carry a
20175        // blanket `impl<T: AsRef<str>> From<T> for Cow<'static, str>`
20176        // (nor an `impl<T: fmt::Display> From<T> for
20177        // Cow<'static, str>`), so the `Cow<'static, str>` forward-
20178        // projection axis is a distinct trait-idiomatic surface that
20179        // a `let key: Cow<'static, str> = list.into();`-shaped call
20180        // site reaches through this impl and no other — the paired
20181        // sibling `From<DepList> for &'static str` and
20182        // `From<DepList> for String` impls force every
20183        // `Cow<'static, str>`-parameterized call site through a
20184        // `Cow::Borrowed(list.as_str())` /
20185        // `Cow::Owned(list.to_string())` composition whose type
20186        // bounds have no compile-time link back to the substrate
20187        // primitive.
20188        //
20189        // Also asserts the projection lands on the zero-alloc
20190        // [`std::borrow::Cow::Borrowed`] arm (not the
20191        // [`std::borrow::Cow::Owned`] arm) — the substrate-primitive
20192        // [`super::DepList::as_str`] accessor's `&'static str`
20193        // return lifetime by construction (each match arm resolves
20194        // to one of the two lifted
20195        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20196        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const
20197        // &str` values) makes the borrowed arm the type-correct
20198        // projection with no runtime allocation. Any future silent
20199        // detour that routes the impl through the owned arm trips
20200        // at caixa-core test time under the
20201        // [`std::borrow::Cow::Borrowed`] discriminator witness
20202        // rather than at a downstream `Cow<'static, str>`-bound
20203        // consumer's silent allocation.
20204        //
20205        // First-mover on the outside-M3 substrate-wide tier of the
20206        // substrate-wide trait-idiomatic
20207        // [`std::borrow::Cow<'static, str>`] forward-projection
20208        // campaign — extends the axis off the paired
20209        // [`crate::CaixaKind`] top-level opener (99c1735 + d45c409),
20210        // the paired M2 OTP-shape
20211        // [`crate::supervisor::RestartStrategy`] (7dd28b3 + 9b3e4b3)
20212        // and [`crate::supervisor::RestartPolicy`] (0612398 +
20213        // ee577fd), and the paired M3-mesh-shape
20214        // [`crate::aplicacao::WitShape`] (8634dec + 25690ef),
20215        // [`crate::aplicacao::PlacementStrategy`] (eee504d +
20216        // afdf0f4), and [`crate::aplicacao::RateLimitUnit`] (1d59925)
20217        // peers onto the first outside-M3 caixa-core peer (the two-
20218        // list dep-graph axis), opening the outside-M3 caixa-core
20219        // tier of the substrate-wide Cow<'static, str> forward-
20220        // projection campaign's owned-input corner.
20221        for &variant in super::DepList::ALL {
20222            let via_trait: std::borrow::Cow<'static, str> =
20223                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
20224            let via_method: &'static str = variant.as_str();
20225            assert_eq!(
20226                via_trait.as_ref(),
20227                via_method,
20228                "From<DepList> for Cow<'static, str> impl must \
20229                 round-trip DepList::{variant:?} to the same lifted \
20230                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20231                 DepList::as_str returns — divergence signals a \
20232                 silent detour off the substrate-primitive accessor"
20233            );
20234            assert!(
20235                matches!(via_trait, std::borrow::Cow::Borrowed(_)),
20236                "From<DepList> for Cow<'static, str> impl must land \
20237                 on the zero-alloc Cow::Borrowed arm on \
20238                 DepList::{variant:?} — a Cow::Owned outcome signals \
20239                 the projection has silently allocated where the \
20240                 substrate-primitive DepList::as_str `&'static str` \
20241                 return makes the borrowed arm the type-correct \
20242                 projection"
20243            );
20244            let via_into: std::borrow::Cow<'static, str> = variant.into();
20245            assert_eq!(
20246                via_into.as_ref(),
20247                via_method,
20248                "Into<Cow<'static, str>>::into on DepList::\
20249                 {variant:?} must byte-equal DepList::as_str on the \
20250                 same input — the blanket-derived Into shape must \
20251                 resolve to the same as_str dispatch as the explicit \
20252                 From impl"
20253            );
20254            assert!(
20255                matches!(via_into, std::borrow::Cow::Borrowed(_)),
20256                "Into<Cow<'static, str>>::into on DepList::\
20257                 {variant:?} must land on the zero-alloc \
20258                 Cow::Borrowed arm — the blanket-derived Into shape \
20259                 must resolve to the same Cow::Borrowed dispatch as \
20260                 the explicit From impl"
20261            );
20262        }
20263    }
20264
20265    #[test]
20266    fn dep_list_from_into_static_cow_str_agrees_with_paired_axes_on_every_arm() {
20267        // Cross-axis partition pin: the newly lifted trait-idiomatic
20268        // `From<DepList> for std::borrow::Cow<'static, str>` (this
20269        // lift), the paired owned-input `From<DepList> for
20270        // &'static str` (3455cbf), and the paired owned-input
20271        // `From<DepList> for String` (32b0ee8) forward projections
20272        // must resolve identically on every arm, locking the three
20273        // return-shape paths together by construction so any future
20274        // detour trips at caixa-core test time. Also byte-parity
20275        // witness against the sibling [`ToString::to_string`]
20276        // surface routed through [`std::fmt::Display`] — every
20277        // owned-heap-string path (the `Cow::Owned` promotion of
20278        // this axis's `.into_owned()`, `From<DepList> for String`,
20279        // and `.to_string()`) resolves to the same two-arm lifted
20280        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20281        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-string per
20282        // arm.
20283        //
20284        // Then a `.iter().copied().map(std::borrow::Cow::from)` pipe
20285        // witness over [`super::DepList::ALL`] that materializes the
20286        // two-arm accept-set through the
20287        // [`std::borrow::Cow<'static, str>`] axis alone — the exact
20288        // shape a future M4 admission-webhook rejection body's
20289        // accepted-`:deps` / `:deps-dev` list-key enumeration, a
20290        // future substrate-wide per-arm diagnostic surface whose
20291        // typing rules out the sibling [`AsRef<str>`] borrowed
20292        // return, or a future per-arm dep-list emitter that binds
20293        // through a [`std::borrow::Cow<'static, str>`] boundary
20294        // reaches through — opening the composable-projection axis
20295        // on the first outside-M3 caixa-core closed-set fieldless
20296        // typed enum peer on the caixa surface. The pipe witness
20297        // also pins the zero-alloc discipline: every element in the
20298        // collected vector satisfies the
20299        // [`std::borrow::Cow::Borrowed`] arm predicate, so a future
20300        // accidental silent-allocation regression on the pipe's
20301        // iteration axis is a caixa-core-test-time failure.
20302        for &variant in super::DepList::ALL {
20303            let via_cow: std::borrow::Cow<'static, str> =
20304                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
20305            let via_static: &'static str = <&'static str as From<super::DepList>>::from(variant);
20306            let via_string: String = <String as From<super::DepList>>::from(variant);
20307            assert_eq!(
20308                via_cow.as_ref(),
20309                via_static,
20310                "From<DepList> for Cow<'static, str> and \
20311                 From<DepList> for &'static str must resolve \
20312                 identically on DepList::{variant:?} — divergence \
20313                 signals the Cow<'static, str> and &'static str \
20314                 return-shape paths have drifted onto different \
20315                 emit-sets"
20316            );
20317            assert_eq!(
20318                via_cow.as_ref(),
20319                via_string.as_str(),
20320                "From<DepList> for Cow<'static, str> and \
20321                 From<DepList> for String must resolve identically \
20322                 on DepList::{variant:?} — divergence signals the \
20323                 Cow<'static, str> and String return-shape paths \
20324                 have drifted onto different emit-sets"
20325            );
20326            let via_to_string: String = variant.to_string();
20327            assert_eq!(
20328                via_cow.as_ref(),
20329                via_to_string.as_str(),
20330                "From<DepList> for Cow<'static, str> must byte-equal \
20331                 DepList::to_string on DepList::{variant:?} — \
20332                 divergence signals the trait-idiomatic \
20333                 Cow<'static, str> forward-projection axis and the \
20334                 ToString-through-Display axis have drifted onto \
20335                 different emit-sets"
20336            );
20337        }
20338        let via_iter: Vec<std::borrow::Cow<'static, str>> = super::DepList::ALL
20339            .iter()
20340            .copied()
20341            .map(std::borrow::Cow::from)
20342            .collect();
20343        let via_method: Vec<std::borrow::Cow<'static, str>> = super::DepList::ALL
20344            .iter()
20345            .map(|l| std::borrow::Cow::Borrowed(l.as_str()))
20346            .collect();
20347        assert_eq!(
20348            via_iter, via_method,
20349            "`.iter().copied().map(Cow::from)` over DepList::ALL \
20350             must byte-equal `.iter().map(|l| \
20351             Cow::Borrowed(l.as_str()))` on every arm — the trait-\
20352             idiomatic `From<DepList> for Cow<'static, str>` axis is \
20353             what makes the `Cow::from` composition route through \
20354             the substrate-primitive `DepList::as_str` accessor with \
20355             the zero-alloc Cow::Borrowed arm by construction, \
20356             rather than a per-call-site `Cow::Owned(list.to_string())` \
20357             allocation"
20358        );
20359        for cow in &via_iter {
20360            assert!(
20361                matches!(cow, std::borrow::Cow::Borrowed(_)),
20362                "every element of the .iter().copied().map(Cow::from) \
20363                 pipe over DepList::ALL must land on the zero-alloc \
20364                 Cow::Borrowed arm — a Cow::Owned outcome on any arm \
20365                 signals the pipe's iteration axis has silently \
20366                 allocated where the substrate-primitive \
20367                 DepList::as_str `&'static str` return makes the \
20368                 borrowed arm the type-correct projection"
20369            );
20370        }
20371    }
20372
20373    #[test]
20374    fn dep_list_from_borrowed_into_static_cow_str_routes_through_as_str_accessor() {
20375        // Fail-before-pass-after byte-parity pin on the newly lifted
20376        // `impl From<&DepList> for std::borrow::Cow<'static, str>` —
20377        // asserts the borrowed-input standard-library trait impl and
20378        // the substrate-primitive [`super::DepList::as_str`] `pub const
20379        // fn` accessor resolve to the same two-arm emit-set across
20380        // every arm the exhaustive [`super::DepList::ALL`] slice
20381        // enumerates. Rust's standard library does not carry a blanket
20382        // `impl<T: AsRef<str>> From<&T> for Cow<'static, str>` (nor a
20383        // `Copy`-based `impl<T: Copy, U: From<T>> From<&T> for U`), so
20384        // the borrowed-input `Cow<'static, str>` forward-projection
20385        // axis is a distinct trait-idiomatic surface that a
20386        // `let key: Cow<'static, str> = (&list).into();`-shaped call
20387        // site or a `DepList::ALL.iter().map(Cow::from)`-shaped pipe
20388        // reaches through this impl and no other — the paired owned-
20389        // input `From<DepList> for Cow<'static, str>` impl (6858bac)
20390        // forces every borrowed-input call site through an explicit
20391        // `Copy` deref (`Cow::from(*list)`) or a
20392        // `Cow::Borrowed(list.as_str())` open-code whose type bounds
20393        // have no compile-time link back to the substrate primitive.
20394        //
20395        // Also asserts the projection lands on the zero-alloc
20396        // [`std::borrow::Cow::Borrowed`] arm (not the
20397        // [`std::borrow::Cow::Owned`] arm) — the substrate-primitive
20398        // [`super::DepList::as_str`] accessor's `&'static str` return
20399        // lifetime by construction (each match arm resolves to one of
20400        // the two lifted [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20401        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
20402        // values) makes the borrowed arm the type-correct projection
20403        // with no runtime allocation on the borrowed-input surface
20404        // just as on the paired owned-input surface.
20405        //
20406        // Closes the `{Self, &Self}` input-shape corner on the outside-
20407        // M3 caixa-core two-list dep-graph [`Cow<'static, str>`] axis
20408        // on the first outside-M3 caixa-core closed-set fieldless typed
20409        // enum peer on the caixa surface, exactly as afdf0f4 closed it
20410        // on the second M3-mesh-primitive peer
20411        // ([`crate::aplicacao::PlacementStrategy`]) one commit after
20412        // the owning half (eee504d) landed, as 25690ef closed it on
20413        // the first M3-mesh-primitive peer
20414        // ([`crate::aplicacao::WitShape`]) one commit after the owning
20415        // half (8634dec) landed, as d45c409 closed it on the top-level
20416        // [`crate::CaixaKind`] one commit after the owning half
20417        // (99c1735) landed, and as 9b3e4b3 / ee577fd closed it on the
20418        // M2 OTP-shape [`crate::supervisor::RestartStrategy`] /
20419        // [`crate::supervisor::RestartPolicy`] sibling peers one
20420        // commit after (7dd28b3 / 0612398) landed.
20421        for &variant in super::DepList::ALL {
20422            let via_trait: std::borrow::Cow<'static, str> =
20423                <std::borrow::Cow<'static, str> as From<&super::DepList>>::from(&variant);
20424            let via_method: &'static str = variant.as_str();
20425            assert_eq!(
20426                via_trait.as_ref(),
20427                via_method,
20428                "From<&DepList> for Cow<'static, str> impl must \
20429                 round-trip &DepList::{variant:?} to the same lifted \
20430                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20431                 DepList::as_str returns — divergence signals a silent \
20432                 detour off the substrate-primitive accessor"
20433            );
20434            assert!(
20435                matches!(via_trait, std::borrow::Cow::Borrowed(_)),
20436                "From<&DepList> for Cow<'static, str> impl must land \
20437                 on the zero-alloc Cow::Borrowed arm on \
20438                 &DepList::{variant:?} — a Cow::Owned outcome signals \
20439                 the projection has silently allocated where the \
20440                 substrate-primitive DepList::as_str `&'static str` \
20441                 return makes the borrowed arm the type-correct \
20442                 projection"
20443            );
20444            let via_into: std::borrow::Cow<'static, str> = (&variant).into();
20445            assert_eq!(
20446                via_into.as_ref(),
20447                via_method,
20448                "Into<Cow<'static, str>>::into on &DepList::\
20449                 {variant:?} must byte-equal DepList::as_str on the \
20450                 same input — the blanket-derived Into shape must \
20451                 resolve to the same as_str dispatch as the explicit \
20452                 From impl"
20453            );
20454            assert!(
20455                matches!(via_into, std::borrow::Cow::Borrowed(_)),
20456                "Into<Cow<'static, str>>::into on &DepList::\
20457                 {variant:?} must land on the zero-alloc \
20458                 Cow::Borrowed arm — the blanket-derived Into shape \
20459                 must resolve to the same Cow::Borrowed dispatch as \
20460                 the explicit From impl"
20461            );
20462        }
20463    }
20464
20465    #[test]
20466    fn dep_list_from_borrowed_into_static_cow_str_agrees_with_paired_axes_on_every_arm() {
20467        // Cross-axis partition pin: the newly lifted trait-idiomatic
20468        // borrowed-input `From<&DepList> for std::borrow::Cow<'static,
20469        // str>` (this lift), the paired owned-input `From<DepList> for
20470        // std::borrow::Cow<'static, str>` (6858bac), the paired
20471        // borrowed-input owned-`&'static str` `From<&DepList> for
20472        // &'static str` (3455cbf), and the paired borrowed-input
20473        // owned-`String` `From<&DepList> for String` must resolve
20474        // identically on every arm, locking the four return-shape ×
20475        // input-shape paths together by construction so any future
20476        // detour trips at caixa-core test time. Also byte-parity
20477        // witness against the sibling [`ToString::to_string`] surface
20478        // routed through [`std::fmt::Display`] — every owned-heap-
20479        // string path (this axis's `.into_owned()` promotion, the
20480        // paired [`From<&DepList> for String`], and `.to_string()`)
20481        // resolves to the same two-arm lifted
20482        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20483        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] byte-string per
20484        // arm.
20485        //
20486        // Then a `.iter().map(std::borrow::Cow::from)` pipe witness
20487        // over [`super::DepList::ALL`] — whose iterator yields
20488        // `&DepList` by construction, so the borrowed-input
20489        // [`Cow<'static, str>`] axis is what routes the pipe through
20490        // the substrate-primitive [`super::DepList::as_str`] accessor
20491        // without a spurious [`Copy`] deref (which would only be
20492        // reachable through the owned-input [`From<DepList> for
20493        // Cow<'static, str>`] axis by first calling `.copied()` on the
20494        // iterator). The pipe witness also pins the zero-alloc
20495        // discipline: every element in the collected vector satisfies
20496        // the [`std::borrow::Cow::Borrowed`] arm predicate, so a
20497        // future accidental silent-allocation regression on the pipe's
20498        // iteration axis is a caixa-core-test-time failure. Peer of
20499        // the sibling
20500        // [`placement_strategy_from_borrowed_into_static_cow_str_agrees_with_paired_axes_on_every_arm`]
20501        // (afdf0f4) on the M3 mesh-shape `:placement :estrategia`
20502        // axis — extends the whole borrowed-input `Cow<'static, str>`
20503        // + paired `{&'static str, String}` cross-axis-parity corner
20504        // onto the first outside-M3 caixa-core closed-set fieldless
20505        // typed enum peer on the caixa surface.
20506        for &variant in super::DepList::ALL {
20507            let borrowed_cow: std::borrow::Cow<'static, str> =
20508                <std::borrow::Cow<'static, str> as From<&super::DepList>>::from(&variant);
20509            let owned_cow: std::borrow::Cow<'static, str> =
20510                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
20511            let borrowed_static: &'static str =
20512                <&'static str as From<&super::DepList>>::from(&variant);
20513            let borrowed_string: String = <String as From<&super::DepList>>::from(&variant);
20514            assert_eq!(
20515                borrowed_cow, owned_cow,
20516                "From<&DepList> for Cow<'static, str> and \
20517                 From<DepList> for Cow<'static, str> must resolve \
20518                 identically on DepList::{variant:?} — divergence \
20519                 signals the borrowed-input and owned-input \
20520                 Cow<'static, str> forward-projection input-shape \
20521                 paths have drifted onto different emit-sets"
20522            );
20523            assert_eq!(
20524                borrowed_cow.as_ref(),
20525                borrowed_static,
20526                "From<&DepList> for Cow<'static, str> and \
20527                 From<&DepList> for &'static str must resolve \
20528                 identically on DepList::{variant:?} — divergence \
20529                 signals the borrowed-input Cow<'static, str> and \
20530                 &'static str return-shape paths have drifted onto \
20531                 different emit-sets"
20532            );
20533            assert_eq!(
20534                borrowed_cow.as_ref(),
20535                borrowed_string.as_str(),
20536                "From<&DepList> for Cow<'static, str> and \
20537                 From<&DepList> for String must resolve identically \
20538                 on DepList::{variant:?} — divergence signals the \
20539                 borrowed-input Cow<'static, str> and owned-`String` \
20540                 return-shape paths have drifted onto different \
20541                 emit-sets"
20542            );
20543            let via_to_string: String = variant.to_string();
20544            assert_eq!(
20545                borrowed_cow.as_ref(),
20546                via_to_string.as_str(),
20547                "From<&DepList> for Cow<'static, str> must byte-equal \
20548                 DepList::to_string on DepList::{variant:?} — \
20549                 divergence signals the trait-idiomatic borrowed-input \
20550                 Cow<'static, str> forward-projection axis and the \
20551                 ToString-through-Display axis have drifted onto \
20552                 different emit-sets"
20553            );
20554        }
20555        let via_iter: Vec<std::borrow::Cow<'static, str>> = super::DepList::ALL
20556            .iter()
20557            .map(std::borrow::Cow::from)
20558            .collect();
20559        let via_method: Vec<std::borrow::Cow<'static, str>> = super::DepList::ALL
20560            .iter()
20561            .map(|l| std::borrow::Cow::Borrowed(l.as_str()))
20562            .collect();
20563        assert_eq!(
20564            via_iter, via_method,
20565            "`.iter().map(Cow::from)` over DepList::ALL — a call site \
20566             whose iteration axis holds &DepList by construction — \
20567             must byte-equal `.iter().map(|l| \
20568             Cow::Borrowed(l.as_str()))` on every arm — the borrowed-\
20569             input Cow<'static, str> `From<&DepList> for Cow<'static, \
20570             str>` axis is what makes the `Cow::from` composition \
20571             route through the substrate-primitive `DepList::as_str` \
20572             accessor with the zero-alloc Cow::Borrowed arm by \
20573             construction and without a spurious `Copy` deref (which \
20574             would only be reachable through the owned-input \
20575             `From<DepList> for Cow<'static, str>` axis by first \
20576             calling `.copied()` on the iterator)"
20577        );
20578        for cow in &via_iter {
20579            assert!(
20580                matches!(cow, std::borrow::Cow::Borrowed(_)),
20581                "every element of the .iter().map(Cow::from) pipe \
20582                 over DepList::ALL must land on the zero-alloc \
20583                 Cow::Borrowed arm — a Cow::Owned outcome on any arm \
20584                 signals the pipe's iteration axis has silently \
20585                 allocated where the substrate-primitive \
20586                 DepList::as_str `&'static str` return makes the \
20587                 borrowed arm the type-correct projection"
20588            );
20589        }
20590    }
20591
20592    #[test]
20593    fn dep_list_from_into_box_str_routes_through_as_str_accessor() {
20594        // Fail-before-pass-after byte-parity pin on the newly lifted
20595        // `impl From<DepList> for Box<str>` — asserts the owned-input
20596        // standard-library trait impl and the substrate-primitive
20597        // [`super::DepList::as_str`] `pub const fn` accessor resolve to
20598        // the same two-arm emit-set (the paired
20599        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20600        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
20601        // byte-strings) across every arm the exhaustive
20602        // [`super::DepList::ALL`] slice enumerates. Extends the caixa-
20603        // core-internal tier of the substrate-wide [`Box<str>`] forward-
20604        // projection campaign onto the second caixa-core-internal peer,
20605        // after the render-side path-shape-diagnostic
20606        // [`super::super::render::PathShapeViolation`] pair (0d87a72,
20607        // both corners in one axis) opened the tier. Rust's standard
20608        // library carries `impl From<&str> for Box<str>` and
20609        // `impl From<String> for Box<str>` but no blanket
20610        // `impl<T: AsRef<str>> From<T> for Box<str>`, so this axis is a
20611        // distinct trait-idiomatic surface that a
20612        // `let key: Box<str> = list.into();`-shaped call site reaches
20613        // through this impl and no other — a paired
20614        // `Box::from(list.as_str())` open-code has no compile-time link
20615        // back to the substrate primitive.
20616        for &variant in super::DepList::ALL {
20617            let via_trait: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
20618            let via_method: &'static str = variant.as_str();
20619            assert_eq!(
20620                via_trait.as_ref(),
20621                via_method,
20622                "From<DepList> for Box<str> impl must round-trip \
20623                 DepList::{variant:?} to the same lifted \
20624                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20625                 DepList::as_str returns — divergence signals a silent \
20626                 detour off the substrate-primitive accessor"
20627            );
20628            let via_into: Box<str> = variant.into();
20629            assert_eq!(
20630                via_into.as_ref(),
20631                via_method,
20632                "Into<Box<str>>::into on DepList::{variant:?} must \
20633                 byte-equal DepList::as_str on the same input — the \
20634                 blanket-derived Into shape must resolve to the same \
20635                 as_str dispatch as the explicit From impl"
20636            );
20637        }
20638    }
20639
20640    #[test]
20641    fn dep_list_from_borrowed_into_box_str_routes_through_as_str_accessor() {
20642        // Fail-before-pass-after byte-parity pin on the newly lifted
20643        // `impl From<&DepList> for Box<str>` — asserts the borrowed-input
20644        // standard-library trait impl and the substrate-primitive
20645        // [`super::DepList::as_str`] `pub const fn` accessor resolve to
20646        // the same two-arm emit-set (the paired
20647        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20648        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
20649        // byte-strings) across every arm the exhaustive
20650        // [`super::DepList::ALL`] slice enumerates. Rust's standard
20651        // library carries `impl From<&str> for Box<str>` and
20652        // `impl From<String> for Box<str>` but no blanket
20653        // `impl<T: AsRef<str>> From<&T> for Box<str>` (nor a `Copy`-based
20654        // `impl<T: Copy, U: From<T>> From<&T> for U`), so the borrowed-
20655        // input [`Box<str>`] forward-projection axis is a distinct
20656        // trait-idiomatic surface that a
20657        // `DepList::ALL.iter().map(Box::<str>::from)`-shaped pipe (whose
20658        // iterator over `&'static [DepList]` yields `&DepList` by
20659        // construction) or a `let key: Box<str> = (&list).into();`-shaped
20660        // call site reaches through this impl and no other — the paired
20661        // owned-input `From<DepList> for Box<str>` impl alone would force
20662        // every borrowed-input call site through an explicit `Copy` deref
20663        // (`Box::<str>::from(*list)`) or a
20664        // `Box::<str>::from(list.as_str())` open-code whose type bounds
20665        // have no compile-time link back to the substrate primitive.
20666        //
20667        // Closes the `{Self, &Self}` input-shape corner on the second
20668        // caixa-core-internal closed-set fieldless typed enum peer of
20669        // the substrate-wide [`Box<str>`] forward-projection campaign —
20670        // one commit after the paired render-side path-shape-diagnostic
20671        // [`super::super::render::PathShapeViolation`] pair (0d87a72)
20672        // opened the caixa-core-internal tier — matching the trajectory
20673        // the paired caixa-theme `Semantic` pair (0cd7dc3, both corners
20674        // in one axis), the caixa-provedor `FerriteRuntime` pair
20675        // (14886a8, both corners in one axis), and the render-side
20676        // `PathShapeViolation` pair (0d87a72, both corners in one axis)
20677        // walked before it.
20678        for &variant in super::DepList::ALL {
20679            let via_trait: Box<str> = <Box<str> as From<&super::DepList>>::from(&variant);
20680            let via_method: &'static str = variant.as_str();
20681            assert_eq!(
20682                via_trait.as_ref(),
20683                via_method,
20684                "From<&DepList> for Box<str> impl must round-trip \
20685                 &DepList::{variant:?} to the same lifted \
20686                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20687                 DepList::as_str returns — divergence signals a silent \
20688                 detour off the substrate-primitive accessor"
20689            );
20690            let via_into: Box<str> = (&variant).into();
20691            assert_eq!(
20692                via_into.as_ref(),
20693                via_method,
20694                "Into<Box<str>>::into on &DepList::{variant:?} must \
20695                 byte-equal DepList::as_str on the same input — the \
20696                 blanket-derived Into shape on the borrowed-input \
20697                 surface must resolve to the same as_str dispatch as \
20698                 the explicit From impl"
20699            );
20700        }
20701
20702        // Pipe witness — the distinguishing shape that forces the
20703        // borrowed-input axis to be independent of the owned-input
20704        // peer. `DepList::ALL.iter()` yields `&DepList` by
20705        // construction, so `.map(Box::<str>::from)` resolves through
20706        // the borrowed-input `From<&DepList> for Box<str>` impl and
20707        // no other — without this axis, the same pipe would force an
20708        // explicit `.copied()` restatement whose type bounds bypass
20709        // the substrate primitive.
20710        let via_pipe: Vec<Box<str>> = super::DepList::ALL.iter().map(Box::<str>::from).collect();
20711        let via_accessor: Vec<&'static str> =
20712            super::DepList::ALL.iter().map(|l| l.as_str()).collect();
20713        assert_eq!(
20714            via_pipe.len(),
20715            via_accessor.len(),
20716            "DepList::ALL.iter().map(Box::<str>::from) pipe must \
20717             preserve arity against the paired DepList::as_str \
20718             accessor — a length divergence signals the borrowed-input \
20719             axis has silently rejected an arm"
20720        );
20721        for (pipe_arm, accessor_arm) in via_pipe.iter().zip(via_accessor.iter()) {
20722            assert_eq!(
20723                pipe_arm.as_ref(),
20724                *accessor_arm,
20725                "DepList::ALL.iter().map(Box::<str>::from) pipe must \
20726                 byte-equal the paired \
20727                 DepList::ALL.iter().map(|l| l.as_str()) pipe on every \
20728                 arm — divergence signals the borrowed-input \
20729                 `From<&DepList> for Box<str>` axis has silently \
20730                 detoured off the substrate-primitive accessor"
20731            );
20732        }
20733    }
20734
20735    #[test]
20736    fn dep_list_from_into_arc_str_routes_through_as_str_accessor() {
20737        // Fail-before-pass-after byte-parity pin on the newly lifted
20738        // `impl From<DepList> for std::sync::Arc<str>` — asserts the
20739        // owned-input standard-library trait impl and the substrate-
20740        // primitive [`super::DepList::as_str`] `pub const fn` accessor
20741        // resolve to the same two-arm emit-set (the paired
20742        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
20743        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
20744        // byte-strings) across every arm the exhaustive
20745        // [`super::DepList::ALL`] slice enumerates. Extends the caixa-
20746        // core-internal tier of the substrate-wide
20747        // [`std::sync::Arc<str>`] forward-projection campaign onto the
20748        // second caixa-core-internal peer, after the top-level
20749        // [`crate::CaixaKind`] pair (c17be64, both corners in one axis)
20750        // opened the tier. Rust's standard library carries
20751        // `impl From<&str> for std::sync::Arc<str>` and
20752        // `impl From<String> for std::sync::Arc<str>` but no blanket
20753        // `impl<T: AsRef<str>> From<T> for std::sync::Arc<str>` (nor an
20754        // `impl<T: fmt::Display> From<T> for std::sync::Arc<str>`), so
20755        // this axis is a distinct trait-idiomatic surface that a
20756        // `let key: std::sync::Arc<str> = list.into();`-shaped call site
20757        // reaches through this impl and no other — a paired
20758        // `std::sync::Arc::<str>::from(list.as_str())` open-code has no
20759        // compile-time link back to the substrate primitive, and a two-
20760        // step `std::sync::Arc::<str>::from(String::from(list))`
20761        // composition through the owned-`String` axis allocates twice
20762        // (once into the intermediate `String`, once into the
20763        // [`std::sync::Arc<str>`] on the `From<String>` conversion)
20764        // where the single-step trait impl allocates once.
20765        //
20766        // Cross-axis byte-parity witness against the sibling owned-input
20767        // `{&'static str, String, Cow<'static, str>, Box<str>}` return-
20768        // shape axes — locking the five return-shape paths on the owned-
20769        // input surface together by construction so any future detour
20770        // off the substrate-primitive [`super::DepList::as_str`] accessor
20771        // trips at caixa-core test time.
20772        for &variant in super::DepList::ALL {
20773            let via_trait: std::sync::Arc<str> =
20774                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
20775            let via_method: &'static str = variant.as_str();
20776            assert_eq!(
20777                via_trait.as_ref(),
20778                via_method,
20779                "From<DepList> for std::sync::Arc<str> impl must round-\
20780                 trip DepList::{variant:?} to the same lifted \
20781                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20782                 DepList::as_str returns — divergence signals a silent \
20783                 detour off the substrate-primitive accessor"
20784            );
20785            let via_into: std::sync::Arc<str> = variant.into();
20786            assert_eq!(
20787                via_into.as_ref(),
20788                via_method,
20789                "Into<std::sync::Arc<str>>::into on DepList::{variant:?} \
20790                 must byte-equal DepList::as_str on the same input — \
20791                 the blanket-derived Into shape must resolve to the same \
20792                 as_str dispatch as the explicit From impl"
20793            );
20794            let owned_static: &'static str = <&'static str as From<super::DepList>>::from(variant);
20795            assert_eq!(
20796                via_trait.as_ref(),
20797                owned_static,
20798                "From<DepList> for std::sync::Arc<str> and \
20799                 From<DepList> for &'static str must resolve identically \
20800                 on DepList::{variant:?} — divergence signals the owned-\
20801                 input std::sync::Arc<str> and &'static str return-shape \
20802                 paths have drifted onto different emit-sets"
20803            );
20804            let owned_string: String = <String as From<super::DepList>>::from(variant);
20805            assert_eq!(
20806                via_trait.as_ref(),
20807                owned_string.as_str(),
20808                "From<DepList> for std::sync::Arc<str> and \
20809                 From<DepList> for String must resolve identically on \
20810                 DepList::{variant:?} — divergence signals the owned-\
20811                 input std::sync::Arc<str> and owned-`String` return-shape \
20812                 paths have drifted onto different emit-sets"
20813            );
20814            let owned_cow: std::borrow::Cow<'static, str> =
20815                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
20816            assert_eq!(
20817                via_trait.as_ref(),
20818                owned_cow.as_ref(),
20819                "From<DepList> for std::sync::Arc<str> and \
20820                 From<DepList> for Cow<'static, str> must resolve \
20821                 identically on DepList::{variant:?} — divergence signals \
20822                 the owned-input std::sync::Arc<str> and \
20823                 Cow<'static, str> return-shape paths have drifted onto \
20824                 different emit-sets"
20825            );
20826            let owned_box: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
20827            assert_eq!(
20828                via_trait.as_ref(),
20829                owned_box.as_ref(),
20830                "From<DepList> for std::sync::Arc<str> and \
20831                 From<DepList> for Box<str> must resolve identically on \
20832                 DepList::{variant:?} — divergence signals the owned-\
20833                 input std::sync::Arc<str> and Box<str> return-shape \
20834                 paths have drifted onto different emit-sets"
20835            );
20836        }
20837    }
20838
20839    #[test]
20840    #[allow(
20841        clippy::too_many_lines,
20842        reason = "cross-axis partition pin folds four borrowed-input \
20843                  return-shape paths (&'static str, String, Cow<'static, \
20844                  str>, Box<str>) plus the paired owned-input Arc<str> \
20845                  witness and the .iter().map(std::sync::Arc::<str>::from) \
20846                  pipe witness into one exhaustive round-trip over \
20847                  DepList::ALL — the accepted line-count cost of keying \
20848                  the whole borrowed-input Arc<str> corner to the \
20849                  substrate-primitive as_str accessor at the same test-site"
20850    )]
20851    fn dep_list_from_borrowed_into_arc_str_routes_through_as_str_accessor() {
20852        // Fail-before-pass-after byte-parity pin on the newly lifted
20853        // `impl From<&DepList> for std::sync::Arc<str>` — asserts the
20854        // borrowed-input standard-library trait impl and the substrate-
20855        // primitive [`super::DepList::as_str`] `pub const fn` accessor
20856        // resolve to the same two-arm emit-set across every arm the
20857        // exhaustive [`super::DepList::ALL`] slice enumerates. Rust's
20858        // standard library does not carry a blanket
20859        // `impl<T: AsRef<str>> From<&T> for std::sync::Arc<str>` (nor a
20860        // `Copy`-based `impl<T: Copy, U: From<T>> From<&T> for U`), so
20861        // the borrowed-input `std::sync::Arc<str>` forward-projection
20862        // axis is a distinct trait-idiomatic surface that a
20863        // `let key: std::sync::Arc<str> = (&list).into();`-shaped call
20864        // site or a
20865        // `DepList::ALL.iter().map(std::sync::Arc::<str>::from)`-shaped
20866        // pipe reaches through this impl and no other — the paired
20867        // owned-input `From<DepList> for std::sync::Arc<str>` impl alone
20868        // forces every borrowed-input call site through a spurious
20869        // `Copy` deref
20870        // (`std::sync::Arc::<str>::from((*list).as_str())`) or a
20871        // `.copied()` restatement whose type bounds have no compile-time
20872        // link back to the substrate primitive.
20873        //
20874        // Closes the `{Self, &Self}` input-shape corner on the second
20875        // caixa-core-internal closed-set fieldless typed enum peer of
20876        // the substrate-wide trait-idiomatic [`std::sync::Arc<str>`]
20877        // forward-projection campaign — one commit after the paired
20878        // top-level [`crate::CaixaKind`] pair (c17be64) opened the
20879        // caixa-core-internal tier — matching the
20880        // `{Self, &Self} × {&'static str, String, Cow<'static, str>,
20881        // Box<str>}` 2×4 forward-projection matrix the peer projection
20882        // surfaces already close on this same enum.
20883        //
20884        // Cross-axis partition pin against the paired owned-input
20885        // [`From<DepList> for std::sync::Arc<str>`] and the sibling
20886        // borrowed-input `{&'static str, String, Cow<'static, str>,
20887        // Box<str>}` return-shape axes — locking the five return-shape
20888        // × input-shape paths on the borrowed-input surface together by
20889        // construction so any future detour off the substrate-primitive
20890        // accessor trips at caixa-core test time. Then a
20891        // `.iter().map(std::sync::Arc::<str>::from)` pipe witness over
20892        // [`super::DepList::ALL`] — whose iterator yields `&DepList` by
20893        // construction, so the borrowed-input
20894        // [`std::sync::Arc<str>`] axis is what routes the pipe through
20895        // the substrate-primitive [`super::DepList::as_str`] accessor
20896        // without a spurious [`Copy`] deref (which would only be
20897        // reachable through the owned-input
20898        // [`From<DepList> for std::sync::Arc<str>`] axis by first
20899        // calling `.copied()` on the iterator).
20900        for &variant in super::DepList::ALL {
20901            let via_trait: std::sync::Arc<str> =
20902                <std::sync::Arc<str> as From<&super::DepList>>::from(&variant);
20903            let via_method: &'static str = variant.as_str();
20904            assert_eq!(
20905                via_trait.as_ref(),
20906                via_method,
20907                "From<&DepList> for std::sync::Arc<str> impl must round-\
20908                 trip &DepList::{variant:?} to the same lifted \
20909                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
20910                 DepList::as_str returns — divergence signals a silent \
20911                 detour off the substrate-primitive accessor"
20912            );
20913            let via_into: std::sync::Arc<str> = (&variant).into();
20914            assert_eq!(
20915                via_into.as_ref(),
20916                via_method,
20917                "Into<std::sync::Arc<str>>::into on &DepList::\
20918                 {variant:?} must byte-equal DepList::as_str on the \
20919                 same input — the blanket-derived Into shape on the \
20920                 borrowed-input surface must resolve to the same as_str \
20921                 dispatch as the explicit From impl"
20922            );
20923            let owned_arc: std::sync::Arc<str> =
20924                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
20925            assert_eq!(
20926                via_trait, owned_arc,
20927                "From<&DepList> for std::sync::Arc<str> and \
20928                 From<DepList> for std::sync::Arc<str> must resolve \
20929                 identically on DepList::{variant:?} — divergence \
20930                 signals the borrowed-input and owned-input \
20931                 std::sync::Arc<str> forward-projection input-shape \
20932                 paths have drifted onto different emit-sets"
20933            );
20934            let borrowed_static: &'static str =
20935                <&'static str as From<&super::DepList>>::from(&variant);
20936            assert_eq!(
20937                via_trait.as_ref(),
20938                borrowed_static,
20939                "From<&DepList> for std::sync::Arc<str> and \
20940                 From<&DepList> for &'static str must resolve \
20941                 identically on DepList::{variant:?} — divergence \
20942                 signals the borrowed-input std::sync::Arc<str> and \
20943                 &'static str return-shape paths have drifted onto \
20944                 different emit-sets"
20945            );
20946            let borrowed_string: String = <String as From<&super::DepList>>::from(&variant);
20947            assert_eq!(
20948                via_trait.as_ref(),
20949                borrowed_string.as_str(),
20950                "From<&DepList> for std::sync::Arc<str> and \
20951                 From<&DepList> for String must resolve identically on \
20952                 DepList::{variant:?} — divergence signals the \
20953                 borrowed-input std::sync::Arc<str> and owned-`String` \
20954                 return-shape paths have drifted onto different emit-\
20955                 sets"
20956            );
20957            let borrowed_cow: std::borrow::Cow<'static, str> =
20958                <std::borrow::Cow<'static, str> as From<&super::DepList>>::from(&variant);
20959            assert_eq!(
20960                via_trait.as_ref(),
20961                borrowed_cow.as_ref(),
20962                "From<&DepList> for std::sync::Arc<str> and \
20963                 From<&DepList> for Cow<'static, str> must resolve \
20964                 identically on DepList::{variant:?} — divergence \
20965                 signals the borrowed-input std::sync::Arc<str> and \
20966                 Cow<'static, str> return-shape paths have drifted onto \
20967                 different emit-sets"
20968            );
20969            let borrowed_box: Box<str> = <Box<str> as From<&super::DepList>>::from(&variant);
20970            assert_eq!(
20971                via_trait.as_ref(),
20972                borrowed_box.as_ref(),
20973                "From<&DepList> for std::sync::Arc<str> and \
20974                 From<&DepList> for Box<str> must resolve identically \
20975                 on DepList::{variant:?} — divergence signals the \
20976                 borrowed-input std::sync::Arc<str> and Box<str> \
20977                 return-shape paths have drifted onto different emit-sets"
20978            );
20979        }
20980        let via_iter: Vec<std::sync::Arc<str>> = super::DepList::ALL
20981            .iter()
20982            .map(std::sync::Arc::<str>::from)
20983            .collect();
20984        let via_method: Vec<std::sync::Arc<str>> = super::DepList::ALL
20985            .iter()
20986            .map(|l| std::sync::Arc::<str>::from(l.as_str()))
20987            .collect();
20988        assert_eq!(
20989            via_iter, via_method,
20990            "`.iter().map(std::sync::Arc::<str>::from)` over \
20991             DepList::ALL — a call site whose iteration axis holds \
20992             `&DepList` by construction — must byte-equal \
20993             `.iter().map(|l| std::sync::Arc::<str>::from(l.as_str()))` \
20994             on every arm — the borrowed-input std::sync::Arc<str> \
20995             `From<&DepList> for std::sync::Arc<str>` axis is what \
20996             makes the `std::sync::Arc::<str>::from` composition route \
20997             through the substrate-primitive `DepList::as_str` \
20998             accessor without a spurious `Copy` deref (which would \
20999             only be reachable through the owned-input \
21000             `From<DepList> for std::sync::Arc<str>` axis by first \
21001             calling `.copied()` on the iterator)"
21002        );
21003    }
21004
21005    #[test]
21006    fn dep_list_from_into_rc_str_routes_through_as_str_accessor() {
21007        // Fail-before-pass-after byte-parity pin on the newly lifted
21008        // `impl From<DepList> for std::rc::Rc<str>` — asserts the
21009        // owned-input standard-library trait impl and the substrate-
21010        // primitive [`super::DepList::as_str`] `pub const fn` accessor
21011        // resolve to the same two-arm emit-set (the paired
21012        // [`crate::render::DEP_AUTHOR_KEY_DEPS`] /
21013        // [`crate::render::DEP_AUTHOR_KEY_DEPS_DEV`] `pub const &str`
21014        // byte-strings) across every arm the exhaustive
21015        // [`super::DepList::ALL`] slice enumerates. Extends the caixa-
21016        // core-internal tier of the substrate-wide
21017        // [`std::rc::Rc<str>`] forward-projection campaign onto the
21018        // third caixa-core-internal peer, after the top-level
21019        // [`crate::CaixaKind`] (e04aff0), the second-peer
21020        // [`crate::dialeto::CaixaDialeto`] (c5595e5), and the render-
21021        // side [`crate::render::PathShapeViolation`] (31fc43e) pairs
21022        // opened the tier. Rust's standard library carries
21023        // `impl From<&str> for std::rc::Rc<str>` and
21024        // `impl From<String> for std::rc::Rc<str>` but no blanket
21025        // `impl<T: AsRef<str>> From<T> for std::rc::Rc<str>`, and the
21026        // [`std::sync::Arc<str>`] and [`std::rc::Rc<str>`] trait
21027        // tables are disjoint, so this axis is a distinct trait-
21028        // idiomatic surface that a
21029        // `let key: std::rc::Rc<str> = list.into();`-shaped call site
21030        // reaches through this impl and no other — a paired
21031        // `std::rc::Rc::<str>::from(list.as_str())` open-code has no
21032        // compile-time link back to the substrate primitive, and a
21033        // two-step `std::rc::Rc::<str>::from(String::from(list))`
21034        // composition through the owned-`String` axis allocates twice
21035        // (once into the intermediate `String`, once into the
21036        // [`std::rc::Rc<str>`] on the `From<String>` conversion) where
21037        // the single-step trait impl allocates once.
21038        //
21039        // Cross-axis byte-parity witness against the sibling owned-
21040        // input `{&'static str, String, Cow<'static, str>, Box<str>,
21041        // std::sync::Arc<str>}` return-shape axes — locking the six
21042        // return-shape paths on the owned-input surface together by
21043        // construction so any future detour off the substrate-
21044        // primitive [`super::DepList::as_str`] accessor trips at
21045        // caixa-core test time.
21046        for &variant in super::DepList::ALL {
21047            let via_trait: std::rc::Rc<str> =
21048                <std::rc::Rc<str> as From<super::DepList>>::from(variant);
21049            let via_method: &'static str = variant.as_str();
21050            assert_eq!(
21051                via_trait.as_ref(),
21052                via_method,
21053                "From<DepList> for std::rc::Rc<str> impl must round-\
21054                 trip DepList::{variant:?} to the same lifted \
21055                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
21056                 DepList::as_str returns — divergence signals a silent \
21057                 detour off the substrate-primitive accessor"
21058            );
21059            let via_into: std::rc::Rc<str> = variant.into();
21060            assert_eq!(
21061                via_into.as_ref(),
21062                via_method,
21063                "Into<std::rc::Rc<str>>::into on DepList::{variant:?} \
21064                 must byte-equal DepList::as_str on the same input — \
21065                 the blanket-derived Into shape must resolve to the \
21066                 same as_str dispatch as the explicit From impl"
21067            );
21068            let owned_static: &'static str = <&'static str as From<super::DepList>>::from(variant);
21069            assert_eq!(
21070                via_trait.as_ref(),
21071                owned_static,
21072                "From<DepList> for std::rc::Rc<str> and \
21073                 From<DepList> for &'static str must resolve identically \
21074                 on DepList::{variant:?} — divergence signals the owned-\
21075                 input std::rc::Rc<str> and &'static str return-shape \
21076                 paths have drifted onto different emit-sets"
21077            );
21078            let owned_string: String = <String as From<super::DepList>>::from(variant);
21079            assert_eq!(
21080                via_trait.as_ref(),
21081                owned_string.as_str(),
21082                "From<DepList> for std::rc::Rc<str> and \
21083                 From<DepList> for String must resolve identically on \
21084                 DepList::{variant:?} — divergence signals the owned-\
21085                 input std::rc::Rc<str> and owned-`String` return-shape \
21086                 paths have drifted onto different emit-sets"
21087            );
21088            let owned_cow: std::borrow::Cow<'static, str> =
21089                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
21090            assert_eq!(
21091                via_trait.as_ref(),
21092                owned_cow.as_ref(),
21093                "From<DepList> for std::rc::Rc<str> and \
21094                 From<DepList> for Cow<'static, str> must resolve \
21095                 identically on DepList::{variant:?} — divergence signals \
21096                 the owned-input std::rc::Rc<str> and Cow<'static, str> \
21097                 return-shape paths have drifted onto different emit-sets"
21098            );
21099            let owned_box: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
21100            assert_eq!(
21101                via_trait.as_ref(),
21102                owned_box.as_ref(),
21103                "From<DepList> for std::rc::Rc<str> and \
21104                 From<DepList> for Box<str> must resolve identically on \
21105                 DepList::{variant:?} — divergence signals the owned-\
21106                 input std::rc::Rc<str> and Box<str> return-shape paths \
21107                 have drifted onto different emit-sets"
21108            );
21109            let owned_arc: std::sync::Arc<str> =
21110                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
21111            assert_eq!(
21112                via_trait.as_ref(),
21113                owned_arc.as_ref(),
21114                "From<DepList> for std::rc::Rc<str> and \
21115                 From<DepList> for std::sync::Arc<str> must resolve \
21116                 identically on DepList::{variant:?} — divergence signals \
21117                 the owned-input std::rc::Rc<str> and std::sync::Arc<str> \
21118                 return-shape paths have drifted onto different emit-sets \
21119                 (the two disjoint reference-counted trait tables have \
21120                 desynchronized on the caixa-core two-list dep-graph axis)"
21121            );
21122        }
21123    }
21124
21125    #[test]
21126    #[allow(
21127        clippy::too_many_lines,
21128        reason = "cross-axis partition pin folds five borrowed-input \
21129                  return-shape paths (&'static str, String, Cow<'static, \
21130                  str>, Box<str>, std::sync::Arc<str>) plus the paired \
21131                  owned-input Rc<str> witness and the \
21132                  .iter().map(std::rc::Rc::<str>::from) pipe witness into \
21133                  one exhaustive round-trip over DepList::ALL — the \
21134                  accepted line-count cost of keying the whole borrowed-\
21135                  input Rc<str> corner to the substrate-primitive as_str \
21136                  accessor at the same test-site"
21137    )]
21138    fn dep_list_from_borrowed_into_rc_str_routes_through_as_str_accessor() {
21139        // Fail-before-pass-after byte-parity pin on the newly lifted
21140        // `impl From<&DepList> for std::rc::Rc<str>` — asserts the
21141        // borrowed-input standard-library trait impl and the substrate-
21142        // primitive [`super::DepList::as_str`] `pub const fn` accessor
21143        // resolve to the same two-arm emit-set across every arm the
21144        // exhaustive [`super::DepList::ALL`] slice enumerates. Rust's
21145        // standard library does not carry a blanket
21146        // `impl<T: AsRef<str>> From<&T> for std::rc::Rc<str>` (nor a
21147        // `Copy`-based `impl<T: Copy, U: From<T>> From<&T> for U`), so
21148        // the borrowed-input `std::rc::Rc<str>` forward-projection axis
21149        // is a distinct trait-idiomatic surface that a
21150        // `let key: std::rc::Rc<str> = (&list).into();`-shaped call
21151        // site or a
21152        // `DepList::ALL.iter().map(std::rc::Rc::<str>::from)`-shaped
21153        // pipe reaches through this impl and no other — the paired
21154        // owned-input `From<DepList> for std::rc::Rc<str>` impl alone
21155        // would force every borrowed-input call site through a spurious
21156        // `Copy` deref
21157        // (`std::rc::Rc::<str>::from((*list).as_str())`) or a
21158        // `.copied()` restatement whose type bounds have no compile-
21159        // time link back to the substrate primitive.
21160        //
21161        // Closes the `{Self, &Self}` input-shape corner on the third
21162        // caixa-core-internal closed-set fieldless typed enum peer of
21163        // the substrate-wide trait-idiomatic [`std::rc::Rc<str>`]
21164        // forward-projection campaign, matching the trajectory the
21165        // paired [`crate::CaixaKind`] (e04aff0),
21166        // [`crate::dialeto::CaixaDialeto`] (c5595e5), and
21167        // [`crate::render::PathShapeViolation`] (31fc43e) pairs walked
21168        // before it on the same tier of the same axis.
21169        //
21170        // Cross-axis partition pin against the paired owned-input
21171        // [`From<DepList> for std::rc::Rc<str>`] and the sibling
21172        // borrowed-input `{&'static str, String, Cow<'static, str>,
21173        // Box<str>, std::sync::Arc<str>}` return-shape axes — locking
21174        // the six return-shape × input-shape paths on the borrowed-
21175        // input surface together by construction so any future detour
21176        // off the substrate-primitive accessor trips at caixa-core
21177        // test time. Then a `.iter().map(std::rc::Rc::<str>::from)`
21178        // pipe witness over [`super::DepList::ALL`] — whose iterator
21179        // yields `&DepList` by construction, so the borrowed-input
21180        // [`std::rc::Rc<str>`] axis is what routes the pipe through
21181        // the substrate-primitive [`super::DepList::as_str`] accessor
21182        // without a spurious [`Copy`] deref (which would only be
21183        // reachable through the owned-input
21184        // [`From<DepList> for std::rc::Rc<str>`] axis by first calling
21185        // `.copied()` on the iterator).
21186        for &variant in super::DepList::ALL {
21187            let via_trait: std::rc::Rc<str> =
21188                <std::rc::Rc<str> as From<&super::DepList>>::from(&variant);
21189            let via_method: &'static str = variant.as_str();
21190            assert_eq!(
21191                via_trait.as_ref(),
21192                via_method,
21193                "From<&DepList> for std::rc::Rc<str> impl must round-\
21194                 trip &DepList::{variant:?} to the same lifted \
21195                 crate::render::DEP_AUTHOR_KEY_DEPS* const \
21196                 DepList::as_str returns — divergence signals a silent \
21197                 detour off the substrate-primitive accessor"
21198            );
21199            let via_into: std::rc::Rc<str> = (&variant).into();
21200            assert_eq!(
21201                via_into.as_ref(),
21202                via_method,
21203                "Into<std::rc::Rc<str>>::into on &DepList::\
21204                 {variant:?} must byte-equal DepList::as_str on the \
21205                 same input — the blanket-derived Into shape on the \
21206                 borrowed-input surface must resolve to the same \
21207                 as_str dispatch as the explicit From impl"
21208            );
21209            let owned_rc: std::rc::Rc<str> =
21210                <std::rc::Rc<str> as From<super::DepList>>::from(variant);
21211            assert_eq!(
21212                via_trait, owned_rc,
21213                "From<&DepList> for std::rc::Rc<str> and \
21214                 From<DepList> for std::rc::Rc<str> must resolve \
21215                 identically on DepList::{variant:?} — divergence \
21216                 signals the borrowed-input and owned-input \
21217                 std::rc::Rc<str> forward-projection input-shape \
21218                 paths have drifted onto different emit-sets"
21219            );
21220            let borrowed_static: &'static str =
21221                <&'static str as From<&super::DepList>>::from(&variant);
21222            assert_eq!(
21223                via_trait.as_ref(),
21224                borrowed_static,
21225                "From<&DepList> for std::rc::Rc<str> and \
21226                 From<&DepList> for &'static str must resolve \
21227                 identically on DepList::{variant:?} — divergence \
21228                 signals the borrowed-input std::rc::Rc<str> and \
21229                 &'static str return-shape paths have drifted onto \
21230                 different emit-sets"
21231            );
21232            let borrowed_string: String = <String as From<&super::DepList>>::from(&variant);
21233            assert_eq!(
21234                via_trait.as_ref(),
21235                borrowed_string.as_str(),
21236                "From<&DepList> for std::rc::Rc<str> and \
21237                 From<&DepList> for String must resolve identically on \
21238                 DepList::{variant:?} — divergence signals the \
21239                 borrowed-input std::rc::Rc<str> and owned-`String` \
21240                 return-shape paths have drifted onto different emit-\
21241                 sets"
21242            );
21243            let borrowed_cow: std::borrow::Cow<'static, str> =
21244                <std::borrow::Cow<'static, str> as From<&super::DepList>>::from(&variant);
21245            assert_eq!(
21246                via_trait.as_ref(),
21247                borrowed_cow.as_ref(),
21248                "From<&DepList> for std::rc::Rc<str> and \
21249                 From<&DepList> for Cow<'static, str> must resolve \
21250                 identically on DepList::{variant:?} — divergence \
21251                 signals the borrowed-input std::rc::Rc<str> and \
21252                 Cow<'static, str> return-shape paths have drifted onto \
21253                 different emit-sets"
21254            );
21255            let borrowed_box: Box<str> = <Box<str> as From<&super::DepList>>::from(&variant);
21256            assert_eq!(
21257                via_trait.as_ref(),
21258                borrowed_box.as_ref(),
21259                "From<&DepList> for std::rc::Rc<str> and \
21260                 From<&DepList> for Box<str> must resolve identically \
21261                 on DepList::{variant:?} — divergence signals the \
21262                 borrowed-input std::rc::Rc<str> and Box<str> \
21263                 return-shape paths have drifted onto different emit-sets"
21264            );
21265            let borrowed_arc: std::sync::Arc<str> =
21266                <std::sync::Arc<str> as From<&super::DepList>>::from(&variant);
21267            assert_eq!(
21268                via_trait.as_ref(),
21269                borrowed_arc.as_ref(),
21270                "From<&DepList> for std::rc::Rc<str> and \
21271                 From<&DepList> for std::sync::Arc<str> must resolve \
21272                 identically on DepList::{variant:?} — divergence \
21273                 signals the borrowed-input std::rc::Rc<str> and \
21274                 std::sync::Arc<str> return-shape paths have drifted \
21275                 onto different emit-sets (the two disjoint reference-\
21276                 counted trait tables have desynchronized on the \
21277                 caixa-core two-list dep-graph axis)"
21278            );
21279        }
21280        let via_iter: Vec<std::rc::Rc<str>> = super::DepList::ALL
21281            .iter()
21282            .map(std::rc::Rc::<str>::from)
21283            .collect();
21284        let via_method: Vec<std::rc::Rc<str>> = super::DepList::ALL
21285            .iter()
21286            .map(|l| std::rc::Rc::<str>::from(l.as_str()))
21287            .collect();
21288        assert_eq!(
21289            via_iter, via_method,
21290            "`.iter().map(std::rc::Rc::<str>::from)` over \
21291             DepList::ALL — a call site whose iteration axis holds \
21292             `&DepList` by construction — must byte-equal \
21293             `.iter().map(|l| std::rc::Rc::<str>::from(l.as_str()))` \
21294             on every arm — the borrowed-input std::rc::Rc<str> \
21295             `From<&DepList> for std::rc::Rc<str>` axis is what makes \
21296             the `std::rc::Rc::<str>::from` composition route through \
21297             the substrate-primitive `DepList::as_str` accessor \
21298             without a spurious `Copy` deref (which would only be \
21299             reachable through the owned-input \
21300             `From<DepList> for std::rc::Rc<str>` axis by first \
21301             calling `.copied()` on the iterator)"
21302        );
21303    }
21304
21305    #[test]
21306    fn dep_list_author_keys_covers_every_arm() {
21307        // Load-bearing pin on the substrate-canonical
21308        // [`super::DepList::AUTHOR_KEYS`] exhaustive accept-set roster
21309        // on the `:`-prefixed kebab-case tatara-lisp author-surface
21310        // key axis: every variant of the sibling
21311        // [`super::DepList::ALL`] exhaustive-iteration surface must
21312        // project through [`super::DepList::as_str`] onto an entry the
21313        // [`super::DepList::AUTHOR_KEYS`] roster carries, and the
21314        // roster's length must byte-equal `super::DepList::ALL.len()`
21315        // so a silent skew between the [`super::DepList::as_str`]
21316        // match's arm-set and the roster's arm-set trips here at
21317        // caixa-core test time rather than at a downstream M4
21318        // `mesh.pleme.io/v1alpha1/Caixa` CR admission-webhook rejection
21319        // body's `:deps` / `:deps-dev` accepted-key enumeration miss /
21320        // a `feira dep --list …` "did you mean" hint drift / a
21321        // downstream [`super::DepError`] widening's typed `list:
21322        // DepList` carry that fans on the enum through a stale
21323        // accepted-set. A future arm addition (a `:build-dep` or
21324        // `:tool-dep` third list once the substrate grows Cargo-style
21325        // split-graphs — both trajectory items the sibling
21326        // [`super::DepList::from_wire`] doc block already names)
21327        // extends [`super::DepList::ALL`] as a single edit and this
21328        // pin sweeps the new arm by iteration; the paired
21329        // [`super::DepList::AUTHOR_KEYS`] roster must grow in lockstep
21330        // or this assertion trips. Every entry is further pinned to
21331        // open with the ASCII `:` byte (the tatara-lisp author-surface
21332        // keyword marker) so a silent collapse of the author-key axis
21333        // with any hypothetical peer un-prefixed wire-form axis (an
21334        // entry byte-identical to a sibling `deps` / `deps-dev`
21335        // bare-kebab byte-string that would let an author-key-axis
21336        // consumer accept the un-prefixed vocabulary) trips here
21337        // rather than at a downstream consumer's
21338        // vocabulary-collision miss.
21339        //
21340        // Peer of the sibling
21341        // [`crate::kind::tests::caixa_kind_wire_names_covers_every_arm`]
21342        // (bd708bd) /
21343        // [`crate::kind::tests::caixa_kind_labels_covers_every_arm`]
21344        // (427fe75) /
21345        // [`crate::supervisor::tests::restart_strategy_wire_names_covers_every_arm`]
21346        // (3033f45) /
21347        // [`crate::supervisor::tests::restart_policy_wire_names_covers_every_arm`]
21348        // (ce9412b) /
21349        // [`crate::aplicacao::tests::placement_strategy_wire_names_covers_every_arm`]
21350        // (3e5b194) /
21351        // [`crate::aplicacao::tests::wit_shape_labels_covers_every_arm`]
21352        // (9d9f585) /
21353        // [`crate::aplicacao::tests::rate_limit_unit_suffixes_covers_every_arm`]
21354        // (b553ec9) /
21355        // [`crate::upgrade::tests::upgrade_instruction_lisp_forms_covers_every_arm`]
21356        // (1898d77) /
21357        // [`crate::upgrade::tests::upgrade_instruction_wire_forms_covers_every_arm`]
21358        // (cc42c0e) pins — the same closed-set exhaustive-roster
21359        // coverage discipline extended here onto the two-list dep-graph
21360        // closed-set typed enum, the ninth substrate-side closed-set
21361        // typed enum on the roster axis and the last unlifted
21362        // `&'static str`-carrying closed-set typed enum on the top-
21363        // level manifest surface to converge onto the discipline.
21364        //
21365        // Fail-before-pass-after locally verified by mutating one arm
21366        // of the paired [`crate::render::DEP_AUTHOR_KEY_*`] const
21367        // family (e.g. rebranding `DEP_AUTHOR_KEY_DEPS_DEV` from
21368        // `":deps-dev"` to `":deps_dev"`) — the length pin still
21369        // passes but the `contains` check fires on the mutated arm;
21370        // and by shortening the roster to one entry — the length pin
21371        // fires first.
21372        assert_eq!(
21373            super::DepList::AUTHOR_KEYS.len(),
21374            super::DepList::ALL.len(),
21375            "DepList::AUTHOR_KEYS.len() must byte-equal \
21376             DepList::ALL.len() — a mismatch means the roster and \
21377             the enum's arm-set have drifted; downstream consumers \
21378             that fan through both will silently disagree on the \
21379             accepted arm-set"
21380        );
21381        for &variant in super::DepList::ALL {
21382            let key = variant.as_str();
21383            assert!(
21384                super::DepList::AUTHOR_KEYS.contains(&key),
21385                "DepList::{variant:?}.as_str() = {key:?} must be a \
21386                 member of DepList::AUTHOR_KEYS — the emitter and the \
21387                 roster have drifted out of lockstep"
21388            );
21389        }
21390        for tag in super::DepList::AUTHOR_KEYS {
21391            let first = tag.chars().next().unwrap_or_else(|| {
21392                panic!(
21393                    "DepList::AUTHOR_KEYS entry {tag:?} must be a \
21394                     non-empty `:`-prefixed kebab-case tatara-lisp \
21395                     author-surface key byte-string"
21396                )
21397            });
21398            assert_eq!(
21399                first, ':',
21400                "DepList::AUTHOR_KEYS entry {tag:?} must open with \
21401                 the ASCII `:` byte (tatara-lisp author-surface \
21402                 keyword marker) — an un-prefixed entry would \
21403                 collide the roster with any hypothetical peer bare-\
21404                 kebab wire-form axis a downstream consumer might \
21405                 disambiguate against"
21406            );
21407        }
21408        // Pin the exact two-arm roster in declaration order so a
21409        // future arm-swap on either the roster or the paired
21410        // `render::DEP_AUTHOR_KEY_*` constants (a rebrand of the
21411        // arm-key mapping that leaves both the length pin and the
21412        // membership pin passing on their own) trips at caixa-core
21413        // test time under `assert_eq!`. Order matches variant
21414        // declaration order verbatim (`Prod` → `Dev`) so the roster
21415        // is the canonical ordering every listing / rendering
21416        // consumer defers to. Same declaration-order pin the sibling
21417        // [`crate::aplicacao::tests::rate_limit_unit_suffixes_covers_every_arm`]
21418        // (b553ec9) closes on the M3 `:politicas :rate-limit`
21419        // canonical-suffix axis.
21420        assert_eq!(
21421            super::DepList::AUTHOR_KEYS,
21422            &[
21423                crate::render::DEP_AUTHOR_KEY_DEPS,
21424                crate::render::DEP_AUTHOR_KEY_DEPS_DEV,
21425            ],
21426            "DepList::AUTHOR_KEYS must enumerate every arm's \
21427             author-surface key exactly once, in variant declaration \
21428             order (Prod → Dev)"
21429        );
21430    }
21431
21432    #[test]
21433    fn dep_list_from_str_routes_through_try_from_str_impl() {
21434        // Fail-before-pass-after byte-parity pin on the newly lifted
21435        // `impl std::str::FromStr for DepList` — asserts the standard-
21436        // library `.parse()` parse-axis entry point and the paired
21437        // [`super::DepList::try_from`] `TryFrom<&str>` impl (which in
21438        // turn routes through the substrate-primitive
21439        // [`super::DepList::from_wire`] `Option<Self>` accessor)
21440        // resolve to the same two-arm accept-set across every arm the
21441        // exhaustive [`super::DepList::ALL`] slice enumerates. First-
21442        // mover on the substrate-wide `FromStr` parse-axis campaign —
21443        // the peer method-named `from_wire` accessor and the paired
21444        // `TryFrom<&str>` trait impl fix the two-arm accept set; this
21445        // pin locks the `FromStr::from_str` trait entry point onto the
21446        // same set so any future divergence (a stray per-arm `match s`
21447        // re-inlining that opens a compile-time link to an un-lifted
21448        // arm-literal, a swap onto a hand-rolled parser that widens
21449        // the accept-set past the two wire-format consts) trips at
21450        // caixa-core test time.
21451        use std::str::FromStr;
21452        for &list in super::DepList::ALL {
21453            let wire = list.as_str();
21454            assert_eq!(
21455                <super::DepList as FromStr>::from_str(wire),
21456                Ok(list),
21457                "FromStr impl on DepList must round-trip \
21458                 DepList::{list:?}.as_str() = {wire:?} back to \
21459                 Ok(DepList::{list:?}) — divergence from \
21460                 DepList::try_from signals a silent detour off the \
21461                 paired reverse-projection trait impl"
21462            );
21463            assert_eq!(
21464                <super::DepList as FromStr>::from_str(wire).ok(),
21465                super::DepList::from_wire(wire),
21466                "FromStr ok()-projection on {wire:?} must byte-equal \
21467                 DepList::from_wire on the same input — divergence \
21468                 signals the two reverse-projection trait paths have \
21469                 drifted off the substrate-primitive accessor"
21470            );
21471            // `.parse::<DepList>()` short-form witness — the stdlib
21472            // consumer surface that reaches the enum through the
21473            // `T: FromStr` bound, not through `TryFrom<&str>`.
21474            let via_parse: Result<super::DepList, ()> = wire.parse();
21475            assert_eq!(
21476                via_parse,
21477                Ok(list),
21478                "`{wire:?}`.parse::<DepList>() must resolve to \
21479                 Ok(DepList::{list:?}) — divergence signals the \
21480                 stdlib `.parse()` short-form has drifted from the \
21481                 lifted `FromStr::from_str` impl"
21482            );
21483        }
21484    }
21485
21486    #[test]
21487    fn dep_list_from_str_rejects_unknown_byte_strings() {
21488        // Rejection witness on the `impl FromStr for DepList` —
21489        // sweeps candidate byte-strings outside the two-arm accept-set
21490        // the sibling [`super::DepList::as_str`] emits (`:deps` /
21491        // `:deps-dev`) and asserts every one lands on `Err(())`, so a
21492        // future accidental widening of the trait impl's accept-set (a
21493        // stray case-fold path, a silent inclusion of a rebrand alias
21494        // like `":packages"`, an English rebrand `":dev-deps"` in
21495        // reverse arm-order that would silently swap the two arms) trips
21496        // at caixa-core test time. Peer of the sibling
21497        // `dep_list_try_from_str_rejects_unknown_byte_strings` rejection
21498        // witness — the two pins together bracket both reverse-projection
21499        // trait impls against the same rejected set.
21500        use std::str::FromStr;
21501        let rejected: &[&str] = &[
21502            "",
21503            " ",
21504            "\t",
21505            "\n",
21506            ":deps ",
21507            " :deps",
21508            ":DEPS",
21509            ":Deps",
21510            ":Deps-Dev",
21511            ":deps_dev",
21512            ":deps-development",
21513            ":dev-deps",
21514            ":packages",
21515            ":packages-dev",
21516            "deps",
21517            "deps-dev",
21518            "Prod",
21519            "Dev",
21520            "prod",
21521            "dev",
21522            "\":deps\"",
21523            "\":deps-dev\"",
21524            ":deps\n",
21525            ":deps-dev\n",
21526        ];
21527        for &input in rejected {
21528            assert_eq!(
21529                <super::DepList as FromStr>::from_str(input),
21530                Err(()),
21531                "FromStr impl on DepList must reject unknown \
21532                 byte-string {input:?} — divergence from \
21533                 DepList::from_wire on the same input signals a silent \
21534                 accept-set widening past the two lifted \
21535                 crate::render::DEP_AUTHOR_KEY_DEPS* wire constants"
21536            );
21537            assert_eq!(
21538                <super::DepList as FromStr>::from_str(input).ok(),
21539                super::DepList::from_wire(input),
21540                "FromStr ok()-projection on {input:?} must byte-equal \
21541                 DepList::from_wire on the same input — divergence \
21542                 signals the FromStr trait path has drifted off the \
21543                 substrate-primitive accessor"
21544            );
21545            let via_parse: Result<super::DepList, ()> = input.parse();
21546            assert_eq!(
21547                via_parse,
21548                Err(()),
21549                "`{input:?}`.parse::<DepList>() must reject the \
21550                 unknown byte-string — divergence signals the stdlib \
21551                 `.parse()` short-form has drifted from the lifted \
21552                 `FromStr::from_str` impl"
21553            );
21554        }
21555    }
21556
21557    #[test]
21558    #[allow(
21559        clippy::too_many_lines,
21560        reason = "cross-axis partition pin folds the substrate-primitive \
21561                  as_str accessor's `.as_bytes()` byte-tail plus the \
21562                  paired str-view (AsRef<str>, Display, as_str) and \
21563                  reverse-projection ({&'static str, String, \
21564                  Cow<'static, str>, Box<str>, std::sync::Arc<str>, \
21565                  std::rc::Rc<str>}) return-shape axes' `.as_bytes()` \
21566                  byte-tails plus a <T: AsRef<[u8]>>-bound-consumer \
21567                  witness plus a blake3::Hasher::update-shape byte-\
21568                  input surface witness into one exhaustive round-trip \
21569                  over DepList::ALL — the accepted line-count cost of \
21570                  opening the byte-view axis keyed to the substrate-\
21571                  primitive as_str accessor at the same test-site"
21572    )]
21573    #[allow(
21574        clippy::needless_borrows_for_generic_args,
21575        reason = "the borrowed-input surface (&variant) is exercised \
21576                  deliberately: the `<T: AsRef<[u8]>>`-bound consumer \
21577                  and the `blake3::Hasher::update`-shape byte-input \
21578                  surface both accept either owned or borrowed input \
21579                  through the standard-library blanket \
21580                  `impl<T: ?Sized + AsRef<[u8]>> AsRef<[u8]> for &T`, \
21581                  and this pin round-trips both input shapes to lock \
21582                  the borrowed-input path load-bearing against a \
21583                  future silent regression"
21584    )]
21585    fn dep_list_as_ref_bytes_routes_through_as_str_accessor() {
21586        // `<T: AsRef<[u8]>>`-bound-consumer witness helper: a generic
21587        // byte-input function accepts a [`super::DepList`] directly
21588        // through the trait bound, without the caller open-coding the
21589        // two-hop `list.as_str().as_bytes()` composition. Lifted to
21590        // the top of the function per `clippy::items_after_statements`.
21591        fn generic_bytes_sink<T: AsRef<[u8]>>(t: T) -> Vec<u8> {
21592            t.as_ref().to_vec()
21593        }
21594        // `blake3::Hasher::update`-shape byte-input surface mock:
21595        // mirrors `blake3::Hasher::update` / `ring::digest::Context::
21596        // update` / `sha2::Sha256::update`'s `impl AsRef<[u8]>`-bound
21597        // `update` signature so a per-caixa BLAKE3 content-address
21598        // closure that composes `hasher.update(list)` on the
21599        // [`crate::Lacre`] closure builder reaches the substrate-
21600        // primitive `as_str` accessor through the [`super::DepList`]
21601        // `AsRef<[u8]>` axis and no other. Lifted to the top of the
21602        // function per `clippy::items_after_statements`.
21603        struct MockHasher(Vec<u8>);
21604        impl MockHasher {
21605            fn new() -> Self {
21606                Self(Vec::new())
21607            }
21608            fn update(&mut self, bytes: impl AsRef<[u8]>) -> &mut Self {
21609                self.0.extend_from_slice(bytes.as_ref());
21610                self
21611            }
21612            fn finalize(self) -> Vec<u8> {
21613                self.0
21614            }
21615        }
21616
21617        // Fail-before-pass-after byte-parity pin on the newly lifted
21618        // `impl AsRef<[u8]> for DepList` — asserts the trait-idiomatic
21619        // byte-view standard-library impl and the substrate-primitive
21620        // [`super::DepList::as_str`] `pub const fn` accessor's
21621        // `.as_bytes()` byte-tail resolve to the same two-arm
21622        // `:`-prefixed kebab-case byte-string emit-set across every
21623        // arm the exhaustive [`super::DepList::ALL`] slice enumerates.
21624        // Extends the substrate-wide trait-idiomatic byte-view axis
21625        // onto the third closed-set fieldless typed enum on the
21626        // caixa-core-internal tier — matching the trajectory the
21627        // sibling [`super::CaixaKind`] first-mover [`AsRef<[u8]>`]
21628        // impl (69d8d86) and [`super::CaixaDialeto`] second-mover
21629        // impl (8151347) walked before it.
21630        for &variant in super::DepList::ALL {
21631            let via_trait: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
21632            let via_method_bytes: &[u8] = variant.as_str().as_bytes();
21633            assert_eq!(
21634                via_trait, via_method_bytes,
21635                "AsRef<[u8]> for DepList impl must byte-equal \
21636                 DepList::as_str().as_bytes() on DepList::\
21637                 {variant:?} — divergence signals a silent detour off \
21638                 the substrate-primitive accessor"
21639            );
21640            // Cross-axis witness against the paired str-view axes'
21641            // `.as_bytes()` byte-tails: [`AsRef<str>`] /
21642            // [`std::fmt::Display`] / [`super::DepList::as_str`] all
21643            // resolve to the same lifted `render::DEP_AUTHOR_KEY_*`
21644            // const roster, and the byte-view axis must byte-equal
21645            // each of their `.as_bytes()` byte-tails by construction
21646            // — locking the str-view and byte-view axes together at
21647            // the substrate-primitive accessor.
21648            let str_view_ref: &str = <super::DepList as AsRef<str>>::as_ref(&variant);
21649            assert_eq!(
21650                via_trait,
21651                str_view_ref.as_bytes(),
21652                "AsRef<[u8]> for DepList and AsRef<str> for DepList \
21653                 must resolve to byte-equal byte-tails on DepList::\
21654                 {variant:?} — divergence signals the byte-view and \
21655                 str-view axes have drifted off the same substrate-\
21656                 primitive as_str accessor"
21657            );
21658            let display_bytes = variant.to_string();
21659            assert_eq!(
21660                via_trait,
21661                display_bytes.as_bytes(),
21662                "AsRef<[u8]> for DepList and \
21663                 <DepList as std::fmt::Display>::to_string must \
21664                 resolve to byte-equal byte-tails on DepList::\
21665                 {variant:?} — divergence signals the byte-view axis \
21666                 and the Display formatter axis have drifted off the \
21667                 same substrate-primitive as_str accessor"
21668            );
21669            // Cross-axis witness against the paired reverse-
21670            // projection axes' `.as_bytes()` byte-tails: every one of
21671            // `{&'static str, String, Cow<'static, str>, Box<str>,
21672            // std::sync::Arc<str>, std::rc::Rc<str>}` allocates (or
21673            // borrows) the same `:`-prefixed kebab byte-string the
21674            // substrate-primitive accessor emits, so the byte-view
21675            // axis must byte-equal each of their `.as_bytes()` byte-
21676            // tails by construction.
21677            let owned_static: &'static str = <&'static str as From<super::DepList>>::from(variant);
21678            assert_eq!(
21679                via_trait,
21680                owned_static.as_bytes(),
21681                "AsRef<[u8]> for DepList and From<DepList> for \
21682                 &'static str must resolve to byte-equal byte-tails on \
21683                 DepList::{variant:?}"
21684            );
21685            let owned_string: String = <String as From<super::DepList>>::from(variant);
21686            assert_eq!(
21687                via_trait,
21688                owned_string.as_bytes(),
21689                "AsRef<[u8]> for DepList and From<DepList> for \
21690                 String must resolve to byte-equal byte-tails on \
21691                 DepList::{variant:?}"
21692            );
21693            let owned_cow: std::borrow::Cow<'static, str> =
21694                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
21695            assert_eq!(
21696                via_trait,
21697                owned_cow.as_bytes(),
21698                "AsRef<[u8]> for DepList and From<DepList> for \
21699                 Cow<'static, str> must resolve to byte-equal byte-\
21700                 tails on DepList::{variant:?}"
21701            );
21702            let owned_box: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
21703            assert_eq!(
21704                via_trait,
21705                owned_box.as_bytes(),
21706                "AsRef<[u8]> for DepList and From<DepList> for \
21707                 Box<str> must resolve to byte-equal byte-tails on \
21708                 DepList::{variant:?}"
21709            );
21710            let owned_arc: std::sync::Arc<str> =
21711                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
21712            assert_eq!(
21713                via_trait,
21714                owned_arc.as_bytes(),
21715                "AsRef<[u8]> for DepList and From<DepList> for \
21716                 std::sync::Arc<str> must resolve to byte-equal byte-\
21717                 tails on DepList::{variant:?}"
21718            );
21719            let owned_rc_str: std::rc::Rc<str> =
21720                <std::rc::Rc<str> as From<super::DepList>>::from(variant);
21721            assert_eq!(
21722                via_trait,
21723                owned_rc_str.as_bytes(),
21724                "AsRef<[u8]> for DepList and From<DepList> for \
21725                 std::rc::Rc<str> must resolve to byte-equal byte-\
21726                 tails on DepList::{variant:?}"
21727            );
21728        }
21729        // `<T: AsRef<[u8]>>`-bound-consumer witness: the generic byte-
21730        // input function `generic_bytes_sink` (lifted above per
21731        // `clippy::items_after_statements`) accepts a [`super::DepList`]
21732        // directly through the trait bound, without the caller open-
21733        // coding the two-hop `list.as_str().as_bytes()` composition.
21734        // This is the shape that reaches the caixa-lacre BLAKE3
21735        // content-address closure's
21736        // `blake3::Hasher::update(impl AsRef<[u8]>)` byte-input surface
21737        // through this impl and no other. Exercised on both owned and
21738        // borrowed input surfaces via the standard-library blanket
21739        // `impl<T: ?Sized + AsRef<[u8]>> AsRef<[u8]> for &T`.
21740        for &variant in super::DepList::ALL {
21741            let via_generic = generic_bytes_sink(variant);
21742            let via_borrowed_generic = generic_bytes_sink(&variant);
21743            let via_method_bytes = variant.as_str().as_bytes().to_vec();
21744            assert_eq!(
21745                via_generic, via_method_bytes,
21746                "generic `<T: AsRef<[u8]>>`-bound consumer on \
21747                 DepList::{variant:?} must yield the same byte-tail \
21748                 DepList::as_str().as_bytes() returns — divergence \
21749                 signals the byte-view axis fails to bridge a generic \
21750                 byte-input trait bound to the substrate-primitive \
21751                 accessor"
21752            );
21753            assert_eq!(
21754                via_borrowed_generic, via_method_bytes,
21755                "generic `<T: AsRef<[u8]>>`-bound consumer on \
21756                 &DepList::{variant:?} must yield the same byte-tail \
21757                 DepList::as_str().as_bytes() returns — the borrowed-\
21758                 input surface must resolve to the same as_str dispatch"
21759            );
21760        }
21761        // `blake3::Hasher::update`-shape byte-input surface witness
21762        // on the caixa-lacre compounding target: the `MockHasher`
21763        // (lifted above per `clippy::items_after_statements`) mirrors
21764        // `blake3::Hasher::update` / `ring::digest::Context::update` /
21765        // `sha2::Sha256::update`'s `impl AsRef<[u8]>`-bound update
21766        // signature and accepts a [`super::DepList`] directly, routing
21767        // its byte-tail through the substrate-primitive `as_str`
21768        // accessor — the shape a future per-caixa BLAKE3 content-
21769        // address closure composes to fold a dep-list discriminator
21770        // byte-tag into the [`crate::Lacre`] closure body so a
21771        // downstream `Lacre` consumer can partition the runtime-
21772        // closure `:deps` from the dev-only-closure `:deps-dev` at
21773        // content-address time.
21774        for &variant in super::DepList::ALL {
21775            let mut owned_hasher = MockHasher::new();
21776            owned_hasher.update(variant);
21777            let owned_folded = owned_hasher.finalize();
21778            assert_eq!(
21779                owned_folded,
21780                variant.as_str().as_bytes(),
21781                "`hasher.update(list)`-shape composition on DepList::\
21782                 {variant:?} must fold the same byte-tail DepList::\
21783                 as_str().as_bytes() returns — the shape a future \
21784                 per-caixa BLAKE3 content-address closure composes to \
21785                 fold a dep-list discriminator byte-tag into the Lacre \
21786                 closure body"
21787            );
21788            let mut borrowed_hasher = MockHasher::new();
21789            borrowed_hasher.update(&variant);
21790            let borrowed_folded = borrowed_hasher.finalize();
21791            assert_eq!(
21792                borrowed_folded,
21793                variant.as_str().as_bytes(),
21794                "`hasher.update(&list)`-shape composition on \
21795                 &DepList::{variant:?} must fold the same byte-tail \
21796                 DepList::as_str().as_bytes() returns — the borrowed-\
21797                 input surface must resolve to the same as_str dispatch"
21798            );
21799        }
21800    }
21801
21802    #[test]
21803    #[expect(
21804        clippy::too_many_lines,
21805        reason = "the byte-owned reverse-projection axis is extended \
21806                  onto DepList here as the third peer on the substrate-\
21807                  wide byte-owned Vec<u8>-output projection family \
21808                  (after the sibling first-mover CaixaKind, b245fd6, \
21809                  and second-mover CaixaDialeto, 4cceaf5), so the pin \
21810                  binds the new impl against every paired byte-view \
21811                  and str-view axis on the same enum plus a generic \
21812                  <T: Into<Vec<u8>>>-bound consumer witness and a \
21813                  std::io::Write::write_all-shape owned-byte-sink \
21814                  surface witness on both owned and borrowed input \
21815                  shapes to lock the whole family against a future \
21816                  silent regression"
21817    )]
21818    fn dep_list_from_into_owned_vec_bytes_routes_through_as_str_accessor() {
21819        // `<T: Into<Vec<u8>>>`-bound-consumer witness helper: a generic
21820        // owned-byte-input function accepts a [`super::DepList`]
21821        // directly through the trait bound, without the caller open-
21822        // coding the three-hop `list.as_str().as_bytes().to_vec()`
21823        // composition. Lifted to the top of the function per
21824        // `clippy::items_after_statements`.
21825        fn generic_owned_bytes_sink<T: Into<Vec<u8>>>(t: T) -> Vec<u8> {
21826            t.into()
21827        }
21828        // `std::io::Write::write_all`-shape owned-byte-sink surface
21829        // mock: mirrors `std::io::Write::write_all` /
21830        // `bytes::BytesMut::extend_from_slice` / any per-arm audit-log
21831        // byte-sink that consumes a `Vec<u8>` payload via
21832        // `Into<Vec<u8>>`, so a future per-caixa per-`:deps`/`:deps-dev`
21833        // audit-log emit reaches the substrate-primitive `as_str`
21834        // accessor through the byte-owned reverse-projection axis and
21835        // no other. Lifted to the top of the function per
21836        // `clippy::items_after_statements`.
21837        struct MockOwnedByteSink(Vec<u8>);
21838        impl MockOwnedByteSink {
21839            fn new() -> Self {
21840                Self(Vec::new())
21841            }
21842            fn write_all(&mut self, bytes: impl Into<Vec<u8>>) -> &mut Self {
21843                self.0.extend_from_slice(&bytes.into());
21844                self
21845            }
21846            fn finalize(self) -> Vec<u8> {
21847                self.0
21848            }
21849        }
21850
21851        // Fail-before-pass-after byte-parity pin on the newly lifted
21852        // `impl From<DepList> for Vec<u8>` and
21853        // `impl From<&DepList> for Vec<u8>` — asserts the trait-
21854        // idiomatic byte-owned reverse-projection standard-library
21855        // impls and the substrate-primitive
21856        // [`super::DepList::as_str`] `pub const fn` accessor's
21857        // `.as_bytes().to_vec()` byte-tail resolve to the same two-arm
21858        // `:`-prefixed kebab-case byte-string emit-set across every
21859        // arm the exhaustive [`super::DepList::ALL`] slice enumerates.
21860        // Extends the substrate-wide trait-idiomatic byte-owned
21861        // reverse-projection axis onto the third closed-set fieldless
21862        // typed enum on the caixa-core-internal tier — matching the
21863        // trajectory the sibling first-mover [`super::CaixaKind`]
21864        // `From<{Self, &Self}> for Vec<u8>` impls (b245fd6) and the
21865        // second-mover [`crate::dialeto::CaixaDialeto`] impls (4cceaf5)
21866        // walked before it on the caixa-core tier of the byte-owned
21867        // axis.
21868        for &variant in super::DepList::ALL {
21869            let via_owned_from: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
21870            let via_borrowed_from: Vec<u8> = <Vec<u8> as From<&super::DepList>>::from(&variant);
21871            let via_method_bytes: Vec<u8> = variant.as_str().as_bytes().to_vec();
21872            assert_eq!(
21873                via_owned_from, via_method_bytes,
21874                "From<DepList> for Vec<u8> impl must byte-equal \
21875                 DepList::as_str().as_bytes().to_vec() on DepList::\
21876                 {variant:?} — divergence signals a silent detour off \
21877                 the substrate-primitive accessor"
21878            );
21879            assert_eq!(
21880                via_borrowed_from, via_method_bytes,
21881                "From<&DepList> for Vec<u8> impl must byte-equal \
21882                 DepList::as_str().as_bytes().to_vec() on DepList::\
21883                 {variant:?} — divergence signals a silent detour off \
21884                 the substrate-primitive accessor"
21885            );
21886            assert_eq!(
21887                via_owned_from, via_borrowed_from,
21888                "From<DepList> for Vec<u8> and From<&DepList> for \
21889                 Vec<u8> must byte-equal each other on DepList::\
21890                 {variant:?} — divergence signals the owned-input and \
21891                 borrowed-input paths have drifted off the same \
21892                 substrate-primitive as_str accessor"
21893            );
21894            // Cross-axis witness against the paired [`AsRef<[u8]>`]
21895            // borrowed byte-view axis: the byte-owned reverse-
21896            // projection axis must byte-equal the paired borrowed
21897            // byte-view axis by construction — locking the byte-view
21898            // and byte-owned axes together at the substrate-primitive
21899            // accessor.
21900            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
21901            assert_eq!(
21902                via_owned_from,
21903                borrowed_bytes.to_vec(),
21904                "From<DepList> for Vec<u8> and AsRef<[u8]> for DepList \
21905                 must resolve to byte-equal byte-tails on DepList::\
21906                 {variant:?} — divergence signals the byte-owned and \
21907                 byte-view axes have drifted off the same substrate-\
21908                 primitive as_str accessor"
21909            );
21910            // Cross-axis witness against the str-owned reverse-
21911            // projection family's `.into_bytes()` / `.as_bytes().to_vec()`
21912            // byte-tails: every one of `{String, Cow<'static, str>,
21913            // Box<str>, std::sync::Arc<str>, std::rc::Rc<str>}`
21914            // allocates (or borrows) the same `:`-prefixed kebab byte-
21915            // string the substrate-primitive accessor emits, so the
21916            // byte-owned axis must byte-equal each of their owned
21917            // byte-tails by construction.
21918            let owned_string: String = <String as From<super::DepList>>::from(variant);
21919            assert_eq!(
21920                via_owned_from,
21921                owned_string.into_bytes(),
21922                "From<DepList> for Vec<u8> and \
21923                 String::from(list).into_bytes() must resolve to byte-\
21924                 equal byte-tails on DepList::{variant:?}"
21925            );
21926            let owned_cow: std::borrow::Cow<'static, str> =
21927                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
21928            assert_eq!(
21929                via_owned_from,
21930                owned_cow.as_bytes().to_vec(),
21931                "From<DepList> for Vec<u8> and From<DepList> for \
21932                 Cow<'static, str> must resolve to byte-equal byte-\
21933                 tails on DepList::{variant:?}"
21934            );
21935            let owned_box: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
21936            assert_eq!(
21937                via_owned_from,
21938                owned_box.as_bytes().to_vec(),
21939                "From<DepList> for Vec<u8> and From<DepList> for \
21940                 Box<str> must resolve to byte-equal byte-tails on \
21941                 DepList::{variant:?}"
21942            );
21943            let owned_arc: std::sync::Arc<str> =
21944                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
21945            assert_eq!(
21946                via_owned_from,
21947                owned_arc.as_bytes().to_vec(),
21948                "From<DepList> for Vec<u8> and From<DepList> for \
21949                 std::sync::Arc<str> must resolve to byte-equal byte-\
21950                 tails on DepList::{variant:?}"
21951            );
21952            let owned_rc_str: std::rc::Rc<str> =
21953                <std::rc::Rc<str> as From<super::DepList>>::from(variant);
21954            assert_eq!(
21955                via_owned_from,
21956                owned_rc_str.as_bytes().to_vec(),
21957                "From<DepList> for Vec<u8> and From<DepList> for \
21958                 std::rc::Rc<str> must resolve to byte-equal byte-\
21959                 tails on DepList::{variant:?}"
21960            );
21961        }
21962        // `<T: Into<Vec<u8>>>`-bound-consumer witness on both owned
21963        // and borrowed input shapes: the generic owned-byte-input
21964        // function `generic_owned_bytes_sink` (lifted above per
21965        // `clippy::items_after_statements`) accepts a
21966        // [`super::DepList`] and a `&DepList` directly through the
21967        // trait bound, without the caller open-coding the three-hop
21968        // `list.as_str().as_bytes().to_vec()` composition.
21969        for &variant in super::DepList::ALL {
21970            let via_generic_owned = generic_owned_bytes_sink(variant);
21971            // Bind the borrowed-input path through an explicit
21972            // `&DepList` local so the generic-consumer witness routes
21973            // through `From<&DepList> for Vec<u8>` (T binds to
21974            // `&DepList`) rather than clippy-collapsing the borrow
21975            // onto the owned-input `From<DepList> for Vec<u8>` peer.
21976            let variant_ref: &super::DepList = &variant;
21977            let via_generic_borrowed = generic_owned_bytes_sink(variant_ref);
21978            let via_method_bytes = variant.as_str().as_bytes().to_vec();
21979            assert_eq!(
21980                via_generic_owned, via_method_bytes,
21981                "generic `<T: Into<Vec<u8>>>`-bound consumer on \
21982                 DepList::{variant:?} must yield the same byte-tail \
21983                 DepList::as_str().as_bytes().to_vec() returns — \
21984                 divergence signals the byte-owned axis fails to \
21985                 bridge a generic owned-byte-input trait bound to the \
21986                 substrate-primitive accessor"
21987            );
21988            assert_eq!(
21989                via_generic_borrowed, via_method_bytes,
21990                "generic `<T: Into<Vec<u8>>>`-bound consumer on \
21991                 &DepList::{variant:?} must yield the same byte-tail \
21992                 DepList::as_str().as_bytes().to_vec() returns — the \
21993                 borrowed-input surface must resolve to the same \
21994                 as_str dispatch"
21995            );
21996        }
21997        // `std::io::Write::write_all`-shape owned-byte-sink surface
21998        // witness: the `MockOwnedByteSink` (lifted above per
21999        // `clippy::items_after_statements`) mirrors
22000        // `std::io::Write::write_all` /
22001        // `bytes::BytesMut::extend_from_slice`'s `impl Into<Vec<u8>>`-
22002        // bound owned-byte input signature and accepts a
22003        // [`super::DepList`] directly on both owned and borrowed input
22004        // shapes, routing its byte-tail through the substrate-
22005        // primitive `as_str` accessor — the shape a future per-caixa
22006        // per-`:deps`/`:deps-dev` audit-log emit composes to fold a
22007        // dep-list discriminator byte-tag into a downstream owned-
22008        // byte-sink surface so a partition of the runtime-closure
22009        // `:deps` from the dev-only-closure `:deps-dev` reaches the
22010        // sink through this axis and no other.
22011        for &variant in super::DepList::ALL {
22012            let mut owned_sink = MockOwnedByteSink::new();
22013            owned_sink.write_all(variant);
22014            let owned_folded = owned_sink.finalize();
22015            assert_eq!(
22016                owned_folded,
22017                variant.as_str().as_bytes(),
22018                "`sink.write_all(list)`-shape composition on DepList::\
22019                 {variant:?} must fold the same byte-tail DepList::\
22020                 as_str().as_bytes() returns"
22021            );
22022            let mut borrowed_sink = MockOwnedByteSink::new();
22023            // Same explicit `&DepList` binding as the generic-consumer
22024            // witness above: routes the owned-byte-sink surface
22025            // through `From<&DepList> for Vec<u8>` (T binds to
22026            // `&DepList`) rather than clippy-collapsing the borrow
22027            // onto the owned-input peer.
22028            let variant_ref: &super::DepList = &variant;
22029            borrowed_sink.write_all(variant_ref);
22030            let borrowed_folded = borrowed_sink.finalize();
22031            assert_eq!(
22032                borrowed_folded,
22033                variant.as_str().as_bytes(),
22034                "`sink.write_all(&list)`-shape composition on \
22035                 &DepList::{variant:?} must fold the same byte-tail \
22036                 DepList::as_str().as_bytes() returns — the borrowed-\
22037                 input surface must resolve to the same as_str dispatch"
22038            );
22039        }
22040    }
22041
22042    #[test]
22043    #[expect(
22044        clippy::too_many_lines,
22045        reason = "the byte-owned reverse-projection axis is extended \
22046                  onto DepList at the Cow<'static, [u8]> corner here \
22047                  (mirroring the trajectory 92a8777 walked on the \
22048                  sibling caixa-core-internal peer CaixaDialeto), so \
22049                  the pin binds both {Self, &Self}-input impls against \
22050                  the substrate-primitive as_str accessor's byte-view \
22051                  on every DepList::ALL arm, discriminates the zero-\
22052                  alloc Cow::Borrowed arm on both input shapes, and \
22053                  cross-witnesses against the paired Vec<u8>, \
22054                  Cow<'static, str>, and AsRef<[u8]> axes so the whole \
22055                  byte-family stays locked to one substrate primitive — \
22056                  the assertion count follows from the closed-set axis \
22057                  fan-out, not from spurious repetition"
22058    )]
22059    fn dep_list_from_into_owned_cow_bytes_routes_through_as_str_accessor() {
22060        // Fail-before-pass-after byte-parity pin on the newly lifted
22061        // `impl From<DepList> for std::borrow::Cow<'static, [u8]>` and
22062        // `impl From<&DepList> for std::borrow::Cow<'static, [u8]>` —
22063        // asserts the trait-idiomatic byte-owned reverse-projection
22064        // standard-library impls and the substrate-primitive
22065        // [`super::DepList::as_str`] `pub const fn` accessor's
22066        // `.as_bytes()` byte-view resolve to the same two-arm
22067        // `:`-prefixed kebab-case byte-string emit-set across every arm
22068        // the exhaustive [`super::DepList::ALL`] slice enumerates.
22069        // Additionally asserts the returned `Cow<'static, [u8]>` binds
22070        // the zero-alloc `Cow::Borrowed` arm on both input shapes,
22071        // because [`super::DepList::as_str`] returns `&'static str` and
22072        // `.as_bytes()` on it preserves the `&'static [u8]` lifetime
22073        // by construction.
22074        //
22075        // Extends the substrate-wide byte-owned reverse-projection
22076        // matrix onto the third caixa-core-internal closed-set
22077        // fieldless typed enum peer at the `Cow<'static, [u8]>` corner,
22078        // mirroring the trajectory the same axis walked on the sibling
22079        // structurally most fundamental peer [`super::CaixaKind`]
22080        // (b3451c8), the M2/M3 slot peers, and the second-mover
22081        // caixa-core-internal peer
22082        // [`crate::dialeto::CaixaDialeto`] (92a8777) before it.
22083        //
22084        // `<T: Into<Cow<'static, [u8]>>>`-bound generic-consumer witness
22085        // helper: a generic owned-byte-input function accepts a
22086        // [`super::DepList`] directly through the trait bound, without
22087        // the caller open-coding the two-hop
22088        // `Cow::Borrowed(list.as_str().as_bytes())` composition. Lifted
22089        // to the top of the function per `clippy::items_after_statements`.
22090        fn generic_cow_bytes_sink<T: Into<std::borrow::Cow<'static, [u8]>>>(
22091            t: T,
22092        ) -> std::borrow::Cow<'static, [u8]> {
22093            t.into()
22094        }
22095        for &variant in super::DepList::ALL {
22096            let via_owned_from: std::borrow::Cow<'static, [u8]> =
22097                <std::borrow::Cow<'static, [u8]> as From<super::DepList>>::from(variant);
22098            let via_borrowed_from: std::borrow::Cow<'static, [u8]> =
22099                <std::borrow::Cow<'static, [u8]> as From<&super::DepList>>::from(&variant);
22100            let via_method_bytes: &'static [u8] = variant.as_str().as_bytes();
22101            assert_eq!(
22102                via_owned_from.as_ref(),
22103                via_method_bytes,
22104                "From<DepList> for Cow<'static, [u8]> impl must byte-\
22105                 equal DepList::as_str().as_bytes() on DepList::\
22106                 {variant:?} — divergence signals a silent detour off \
22107                 the substrate-primitive accessor"
22108            );
22109            assert_eq!(
22110                via_borrowed_from.as_ref(),
22111                via_method_bytes,
22112                "From<&DepList> for Cow<'static, [u8]> impl must byte-\
22113                 equal DepList::as_str().as_bytes() on DepList::\
22114                 {variant:?} — divergence signals a silent detour off \
22115                 the substrate-primitive accessor"
22116            );
22117            assert!(
22118                matches!(via_owned_from, std::borrow::Cow::Borrowed(_)),
22119                "From<DepList> for Cow<'static, [u8]> must bind the \
22120                 zero-alloc Cow::Borrowed arm on DepList::{variant:?} \
22121                 — Self::as_str returns &'static str, so a Cow::Owned \
22122                 arm signals a silent allocation off the substrate \
22123                 primitive"
22124            );
22125            assert!(
22126                matches!(via_borrowed_from, std::borrow::Cow::Borrowed(_)),
22127                "From<&DepList> for Cow<'static, [u8]> must bind the \
22128                 zero-alloc Cow::Borrowed arm on &DepList::{variant:?} \
22129                 — Self::as_str returns &'static str, so a Cow::Owned \
22130                 arm signals a silent allocation off the substrate \
22131                 primitive"
22132            );
22133            let via_into_owned: std::borrow::Cow<'static, [u8]> = variant.into();
22134            let via_into_borrowed: std::borrow::Cow<'static, [u8]> = (&variant).into();
22135            assert_eq!(
22136                via_into_owned.as_ref(),
22137                via_method_bytes,
22138                "Into<Cow<'static, [u8]>>::into on DepList::{variant:?} \
22139                 must byte-equal DepList::as_str().as_bytes()"
22140            );
22141            assert_eq!(
22142                via_into_borrowed.as_ref(),
22143                via_method_bytes,
22144                "Into<Cow<'static, [u8]>>::into on &DepList::{variant:?} \
22145                 must byte-equal DepList::as_str().as_bytes()"
22146            );
22147            assert!(
22148                matches!(via_into_owned, std::borrow::Cow::Borrowed(_)),
22149                "Into<Cow<'static, [u8]>>::into on DepList::{variant:?} \
22150                 must land on the zero-alloc Cow::Borrowed arm"
22151            );
22152            assert!(
22153                matches!(via_into_borrowed, std::borrow::Cow::Borrowed(_)),
22154                "Into<Cow<'static, [u8]>>::into on &DepList::{variant:?} \
22155                 must land on the zero-alloc Cow::Borrowed arm"
22156            );
22157            // Cross-axis witness against the paired byte-owned
22158            // `From<DepList> for Vec<u8>` axis on the same primitive:
22159            // both axes must byte-equal each other because both route
22160            // through `.as_str().as_bytes()` on the same substrate-
22161            // primitive accessor.
22162            let paired_vec: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
22163            assert_eq!(
22164                via_owned_from.as_ref(),
22165                paired_vec.as_slice(),
22166                "From<DepList> for Cow<'static, [u8]> and \
22167                 From<DepList> for Vec<u8> must resolve to byte-equal \
22168                 byte-tails on DepList::{variant:?} — the two byte-\
22169                 owned reverse-projection axes must not drift off the \
22170                 same substrate-primitive as_str accessor"
22171            );
22172            // Cross-axis witness against the paired str-owned
22173            // `From<DepList> for Cow<'static, str>` axis on the same
22174            // primitive: `.as_bytes()` on the str-side Cow must yield
22175            // the same byte-tail the byte-side Cow carries.
22176            let paired_cow_str: std::borrow::Cow<'static, str> =
22177                <std::borrow::Cow<'static, str> as From<super::DepList>>::from(variant);
22178            assert_eq!(
22179                via_owned_from.as_ref(),
22180                paired_cow_str.as_bytes(),
22181                "From<DepList> for Cow<'static, [u8]> and \
22182                 From<DepList> for Cow<'static, str> must resolve to \
22183                 byte-equal byte-tails on DepList::{variant:?} — the \
22184                 byte-side and str-side reverse-projection axes must \
22185                 not drift off the same substrate-primitive as_str \
22186                 accessor"
22187            );
22188            // Cross-axis witness against the paired borrowed byte-view
22189            // `AsRef<[u8]>` axis on the same primitive.
22190            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
22191            assert_eq!(
22192                via_owned_from.as_ref(),
22193                borrowed_bytes,
22194                "From<DepList> for Cow<'static, [u8]> and \
22195                 AsRef<[u8]> for DepList must resolve to byte-equal \
22196                 byte-tails on DepList::{variant:?}"
22197            );
22198        }
22199        for &variant in super::DepList::ALL {
22200            let owned_via_generic = generic_cow_bytes_sink(variant);
22201            let variant_ref: &super::DepList = &variant;
22202            let borrowed_via_generic = generic_cow_bytes_sink(variant_ref);
22203            assert_eq!(
22204                owned_via_generic.as_ref(),
22205                variant.as_str().as_bytes(),
22206                "<T: Into<Cow<'static, [u8]>>>-bound composition on \
22207                 DepList::{variant:?} must fold the same byte-tail \
22208                 DepList::as_str().as_bytes() returns"
22209            );
22210            assert_eq!(
22211                borrowed_via_generic.as_ref(),
22212                variant.as_str().as_bytes(),
22213                "<T: Into<Cow<'static, [u8]>>>-bound composition on \
22214                 &DepList::{variant:?} must fold the same byte-tail \
22215                 DepList::as_str().as_bytes() returns"
22216            );
22217        }
22218    }
22219
22220    #[test]
22221    #[expect(
22222        clippy::too_many_lines,
22223        reason = "the byte-owned reverse-projection axis is extended \
22224                  onto DepList at the Box<[u8]> corner here (mirroring \
22225                  the trajectory 61f5ecb walked on the sibling caixa-\
22226                  core-internal peer CaixaDialeto, c6fee5c on WitShape, \
22227                  b22c283 on RateLimitUnit, fb48599 on PlacementStrategy, \
22228                  and 4f47901 on CaixaKind), so the pin binds both \
22229                  {Self, &Self}-input impls against the substrate-\
22230                  primitive as_str accessor's byte-view on every \
22231                  DepList::ALL arm, adds fit-to-length length-check \
22232                  witnesses on both surfaces, exercises the \
22233                  <T: Into<Box<[u8]>>>-bound generic sink on both input \
22234                  shapes, pins the borrowed-input axis with a \
22235                  `.iter().map(Box::<[u8]>::from)` pipe witness over \
22236                  DepList::ALL, and cross-witnesses against the paired \
22237                  Vec<u8>, Cow<'static, [u8]>, Box<str>, and AsRef<[u8]> \
22238                  axes so the whole byte-family stays locked to one \
22239                  substrate primitive — the assertion count follows from \
22240                  the closed-set axis fan-out, not from spurious \
22241                  repetition"
22242    )]
22243    fn dep_list_from_into_owned_box_bytes_routes_through_as_str_accessor() {
22244        // Fail-before-pass-after byte-parity pin on the newly lifted
22245        // `impl From<DepList> for Box<[u8]>` and
22246        // `impl From<&DepList> for Box<[u8]>` — asserts the trait-
22247        // idiomatic byte-owned reverse-projection standard-library impls
22248        // and the substrate-primitive [`super::DepList::as_str`]
22249        // `pub const fn` accessor's `.as_bytes()` byte-view resolve to
22250        // the same two-arm `:`-prefixed kebab-case wire byte-string
22251        // emit-set across every arm the exhaustive
22252        // [`super::DepList::ALL`] slice enumerates. Additionally asserts
22253        // the returned `Box<[u8]>` is fit-to-length on every arm, because
22254        // `Box::<[u8]>::from(&[u8])` allocates `len` bytes exactly (no
22255        // capacity slack), the property downstream `Box<[u8]>` consumers
22256        // (a `bytes::Bytes::from(Box<[u8]>)` framer at the mesh-ingest
22257        // boundary) rely on to keep the per-arm footprint stable across
22258        // the accept-set.
22259        //
22260        // Extends the substrate-wide byte-owned reverse-projection matrix
22261        // onto the third caixa-core-internal closed-set fieldless typed
22262        // enum peer at the `Box<[u8]>` corner, mirroring the trajectory
22263        // 61f5ecb walked on the sibling second-mover caixa-core-internal
22264        // peer CaixaDialeto, c6fee5c on the third M3 peer WitShape,
22265        // b22c283 on the second M3 peer RateLimitUnit, fb48599 on the
22266        // first M3 peer PlacementStrategy, and 4f47901 on the first-mover
22267        // CaixaKind.
22268        fn generic_box_bytes_sink<T: Into<Box<[u8]>>>(t: T) -> Box<[u8]> {
22269            t.into()
22270        }
22271        for &variant in super::DepList::ALL {
22272            let via_owned_from: Box<[u8]> = <Box<[u8]> as From<super::DepList>>::from(variant);
22273            let via_borrowed_from: Box<[u8]> = <Box<[u8]> as From<&super::DepList>>::from(&variant);
22274            let via_method_bytes: &'static [u8] = variant.as_str().as_bytes();
22275            assert_eq!(
22276                via_owned_from.as_ref(),
22277                via_method_bytes,
22278                "From<DepList> for Box<[u8]> impl must byte-equal \
22279                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22280                 divergence signals a silent detour off the substrate-\
22281                 primitive accessor"
22282            );
22283            assert_eq!(
22284                via_borrowed_from.as_ref(),
22285                via_method_bytes,
22286                "From<&DepList> for Box<[u8]> impl must byte-equal \
22287                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22288                 divergence signals a silent detour off the substrate-\
22289                 primitive accessor"
22290            );
22291            assert_eq!(
22292                via_owned_from.len(),
22293                via_method_bytes.len(),
22294                "From<DepList> for Box<[u8]> must land a fit-to-length \
22295                 boxed byte slice on DepList::{variant:?} — a length \
22296                 mismatch signals a silent slab-header hop off the \
22297                 substrate-primitive accessor"
22298            );
22299            assert_eq!(
22300                via_borrowed_from.len(),
22301                via_method_bytes.len(),
22302                "From<&DepList> for Box<[u8]> must land a fit-to-length \
22303                 boxed byte slice on DepList::{variant:?}"
22304            );
22305            let via_into_owned: Box<[u8]> = variant.into();
22306            let via_into_borrowed: Box<[u8]> = (&variant).into();
22307            assert_eq!(
22308                via_into_owned.as_ref(),
22309                via_method_bytes,
22310                "Into<Box<[u8]>>::into on DepList::{variant:?} must byte-\
22311                 equal DepList::as_str().as_bytes()"
22312            );
22313            assert_eq!(
22314                via_into_borrowed.as_ref(),
22315                via_method_bytes,
22316                "Into<Box<[u8]>>::into on &DepList::{variant:?} must \
22317                 byte-equal DepList::as_str().as_bytes()"
22318            );
22319            // Cross-axis witness against the paired byte-owned
22320            // `From<DepList> for Vec<u8>` axis on the same primitive.
22321            let paired_vec: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
22322            assert_eq!(
22323                via_owned_from.as_ref(),
22324                paired_vec.as_slice(),
22325                "From<DepList> for Box<[u8]> and From<DepList> for \
22326                 Vec<u8> must resolve to byte-equal byte-tails on \
22327                 DepList::{variant:?} — the two byte-owned reverse-\
22328                 projection axes must not drift off the same substrate-\
22329                 primitive as_str accessor"
22330            );
22331            // Cross-axis witness against the paired byte-owned
22332            // `From<DepList> for Cow<'static, [u8]>` axis.
22333            let paired_cow_bytes: std::borrow::Cow<'static, [u8]> =
22334                <std::borrow::Cow<'static, [u8]> as From<super::DepList>>::from(variant);
22335            assert_eq!(
22336                via_owned_from.as_ref(),
22337                paired_cow_bytes.as_ref(),
22338                "From<DepList> for Box<[u8]> and From<DepList> for \
22339                 Cow<'static, [u8]> must resolve to byte-equal byte-\
22340                 tails on DepList::{variant:?} — the two byte-owned \
22341                 reverse-projection axes must not drift off the same \
22342                 substrate-primitive as_str accessor"
22343            );
22344            // Cross-axis witness against the paired str-owned
22345            // `From<DepList> for Box<str>` axis on the same primitive —
22346            // the byte-side and str-side owned-heap axes must byte-agree.
22347            let paired_box_str: Box<str> = <Box<str> as From<super::DepList>>::from(variant);
22348            assert_eq!(
22349                via_owned_from.as_ref(),
22350                paired_box_str.as_bytes(),
22351                "From<DepList> for Box<[u8]> and From<DepList> for \
22352                 Box<str> must resolve to byte-equal byte-tails on \
22353                 DepList::{variant:?} — the byte-side and str-side \
22354                 owned-heap reverse-projection axes must not drift off \
22355                 the same substrate-primitive as_str accessor"
22356            );
22357            // Cross-axis witness against the borrowed byte-view
22358            // `AsRef<[u8]>` axis on the same primitive.
22359            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
22360            assert_eq!(
22361                via_owned_from.as_ref(),
22362                borrowed_bytes,
22363                "From<DepList> for Box<[u8]> and AsRef<[u8]> for DepList \
22364                 must resolve to byte-equal byte-tails on \
22365                 DepList::{variant:?}"
22366            );
22367        }
22368        for &variant in super::DepList::ALL {
22369            let owned_via_generic = generic_box_bytes_sink(variant);
22370            let variant_ref: &super::DepList = &variant;
22371            let borrowed_via_generic = generic_box_bytes_sink(variant_ref);
22372            assert_eq!(
22373                owned_via_generic.as_ref(),
22374                variant.as_str().as_bytes(),
22375                "<T: Into<Box<[u8]>>>-bound composition on \
22376                 DepList::{variant:?} must fold the same byte-tail \
22377                 DepList::as_str().as_bytes() returns"
22378            );
22379            assert_eq!(
22380                borrowed_via_generic.as_ref(),
22381                variant.as_str().as_bytes(),
22382                "<T: Into<Box<[u8]>>>-bound composition on \
22383                 &DepList::{variant:?} must fold the same byte-tail \
22384                 DepList::as_str().as_bytes() returns"
22385            );
22386        }
22387        // `.iter().map(Box::<[u8]>::from)` pipe witness over
22388        // `DepList::ALL` — binds the borrowed-input axis, because the
22389        // iterator over `&'static [DepList]` yields `&DepList`, not
22390        // `DepList`.
22391        let via_iter: Vec<Box<[u8]>> = super::DepList::ALL.iter().map(Box::<[u8]>::from).collect();
22392        let via_method: Vec<Box<[u8]>> = super::DepList::ALL
22393            .iter()
22394            .map(|d| Box::<[u8]>::from(d.as_str().as_bytes()))
22395            .collect();
22396        assert_eq!(
22397            via_iter, via_method,
22398            "`.iter().map(Box::<[u8]>::from)` over DepList::ALL must \
22399             byte-equal the open-coded per-arm composition — the \
22400             borrowed-input axis is what makes the `Box::from` \
22401             composition route through the substrate-primitive \
22402             DepList::as_str accessor without a spurious `.copied()` \
22403             restatement"
22404        );
22405    }
22406
22407    #[test]
22408    #[expect(
22409        clippy::too_many_lines,
22410        reason = "the byte-owned reverse-projection axis is extended \
22411                  onto DepList at the Arc<[u8]> corner here (mirroring \
22412                  the trajectory cca8d7c walked on the sibling caixa-\
22413                  core-internal peer CaixaDialeto, d2976c2 on WitShape, \
22414                  e872c77 on RateLimitUnit, 64cdf90 on \
22415                  PlacementStrategy, and d8872df on CaixaKind), so the \
22416                  pin binds both {Self, &Self}-input impls against the \
22417                  substrate-primitive as_str accessor's byte-view on \
22418                  every DepList::ALL arm, adds fit-to-length length-\
22419                  check witnesses on both surfaces, exercises the \
22420                  <T: Into<Arc<[u8]>>>-bound generic sink on both input \
22421                  shapes, pins the borrowed-input axis with a \
22422                  `.iter().map(Arc::<[u8]>::from)` pipe witness over \
22423                  DepList::ALL, and cross-witnesses against the paired \
22424                  Vec<u8>, Cow<'static, [u8]>, Box<[u8]>, Arc<str>, and \
22425                  AsRef<[u8]> axes so the whole byte-family stays \
22426                  locked to one substrate primitive — the assertion \
22427                  count follows from the closed-set axis fan-out, not \
22428                  from spurious repetition"
22429    )]
22430    fn dep_list_from_into_owned_arc_bytes_routes_through_as_str_accessor() {
22431        // Fail-before-pass-after byte-parity pin on the newly lifted
22432        // `impl From<DepList> for std::sync::Arc<[u8]>` and
22433        // `impl From<&DepList> for std::sync::Arc<[u8]>` — asserts the
22434        // trait-idiomatic byte-owned reverse-projection standard-library
22435        // impls and the substrate-primitive [`super::DepList::as_str`]
22436        // `pub const fn` accessor's `.as_bytes()` byte-view resolve to
22437        // the same two-arm `:`-prefixed kebab-case wire byte-string
22438        // emit-set across every arm the exhaustive
22439        // [`super::DepList::ALL`] slice enumerates, on both the owned-
22440        // input `DepList` and borrowed-input `&DepList` surfaces.
22441        // Additionally asserts the returned `Arc<[u8]>` is fit-to-length
22442        // on every arm, because `std::sync::Arc::<[u8]>::from(&[u8])`
22443        // allocates a slab whose payload is `len` bytes exactly (no
22444        // capacity slack), the property downstream `Arc<[u8]>` consumers
22445        // (a future thread-safe `HashMap::<Arc<[u8]>, _>::from_iter`
22446        // keyed by the wire byte-tail across the lacre closure's per-
22447        // file fan-out cache) rely on to keep the per-arm footprint
22448        // stable across the accept-set.
22449        //
22450        // Extends the substrate-wide byte-owned reverse-projection
22451        // matrix onto the third caixa-core-internal closed-set
22452        // fieldless typed enum peer at the `Arc<[u8]>` corner,
22453        // mirroring the trajectory cca8d7c walked on the sibling
22454        // second-mover caixa-core-internal peer CaixaDialeto, d2976c2
22455        // on the third M3 peer WitShape, e872c77 on the second M3 peer
22456        // RateLimitUnit, 64cdf90 on the first M3 peer
22457        // PlacementStrategy, and d8872df on the first-mover CaixaKind.
22458        fn generic_arc_bytes_sink<T: Into<std::sync::Arc<[u8]>>>(t: T) -> std::sync::Arc<[u8]> {
22459            t.into()
22460        }
22461        for &variant in super::DepList::ALL {
22462            let via_owned_from: std::sync::Arc<[u8]> =
22463                <std::sync::Arc<[u8]> as From<super::DepList>>::from(variant);
22464            let via_borrowed_from: std::sync::Arc<[u8]> =
22465                <std::sync::Arc<[u8]> as From<&super::DepList>>::from(&variant);
22466            let via_method_bytes: &'static [u8] = variant.as_str().as_bytes();
22467            assert_eq!(
22468                via_owned_from.as_ref(),
22469                via_method_bytes,
22470                "From<DepList> for Arc<[u8]> impl must byte-equal \
22471                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22472                 divergence signals a silent detour off the substrate-\
22473                 primitive accessor"
22474            );
22475            assert_eq!(
22476                via_borrowed_from.as_ref(),
22477                via_method_bytes,
22478                "From<&DepList> for Arc<[u8]> impl must byte-equal \
22479                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22480                 divergence signals a silent detour off the substrate-\
22481                 primitive accessor"
22482            );
22483            assert_eq!(
22484                via_owned_from.len(),
22485                via_method_bytes.len(),
22486                "From<DepList> for Arc<[u8]> must land a fit-to-length \
22487                 atomically-refcounted byte slab on \
22488                 DepList::{variant:?} — a length mismatch signals a \
22489                 silent slab-header hop off the substrate-primitive \
22490                 accessor"
22491            );
22492            assert_eq!(
22493                via_borrowed_from.len(),
22494                via_method_bytes.len(),
22495                "From<&DepList> for Arc<[u8]> must land a fit-to-length \
22496                 atomically-refcounted byte slab on DepList::{variant:?}"
22497            );
22498            let via_into_owned: std::sync::Arc<[u8]> = variant.into();
22499            let via_into_borrowed: std::sync::Arc<[u8]> = (&variant).into();
22500            assert_eq!(
22501                via_into_owned.as_ref(),
22502                via_method_bytes,
22503                "Into<Arc<[u8]>>::into on DepList::{variant:?} must \
22504                 byte-equal DepList::as_str().as_bytes()"
22505            );
22506            assert_eq!(
22507                via_into_borrowed.as_ref(),
22508                via_method_bytes,
22509                "Into<Arc<[u8]>>::into on &DepList::{variant:?} must \
22510                 byte-equal DepList::as_str().as_bytes()"
22511            );
22512            // Cross-axis witness against the paired byte-owned
22513            // `From<DepList> for Vec<u8>` axis on the same primitive.
22514            let paired_vec: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
22515            assert_eq!(
22516                via_owned_from.as_ref(),
22517                paired_vec.as_slice(),
22518                "From<DepList> for Arc<[u8]> and From<DepList> for \
22519                 Vec<u8> must resolve to byte-equal byte-tails on \
22520                 DepList::{variant:?} — the two byte-owned reverse-\
22521                 projection axes must not drift off the same substrate-\
22522                 primitive as_str accessor"
22523            );
22524            // Cross-axis witness against the paired byte-owned
22525            // `From<DepList> for Cow<'static, [u8]>` axis.
22526            let paired_cow_bytes: std::borrow::Cow<'static, [u8]> =
22527                <std::borrow::Cow<'static, [u8]> as From<super::DepList>>::from(variant);
22528            assert_eq!(
22529                via_owned_from.as_ref(),
22530                paired_cow_bytes.as_ref(),
22531                "From<DepList> for Arc<[u8]> and From<DepList> for \
22532                 Cow<'static, [u8]> must resolve to byte-equal byte-\
22533                 tails on DepList::{variant:?}"
22534            );
22535            // Cross-axis witness against the paired byte-owned
22536            // `From<DepList> for Box<[u8]>` axis on the same primitive.
22537            let paired_box_bytes: Box<[u8]> = <Box<[u8]> as From<super::DepList>>::from(variant);
22538            assert_eq!(
22539                via_owned_from.as_ref(),
22540                paired_box_bytes.as_ref(),
22541                "From<DepList> for Arc<[u8]> and From<DepList> for \
22542                 Box<[u8]> must resolve to byte-equal byte-tails on \
22543                 DepList::{variant:?} — the atomically-refcounted and \
22544                 the fit-to-length byte-owned reverse-projection axes \
22545                 must not drift off the same substrate-primitive \
22546                 as_str accessor"
22547            );
22548            // Cross-axis witness against the paired str-owned
22549            // `From<DepList> for Arc<str>` axis on the same primitive —
22550            // the byte-side and str-side atomically-refcounted axes must
22551            // byte-agree.
22552            let paired_arc_str: std::sync::Arc<str> =
22553                <std::sync::Arc<str> as From<super::DepList>>::from(variant);
22554            assert_eq!(
22555                via_owned_from.as_ref(),
22556                paired_arc_str.as_bytes(),
22557                "From<DepList> for Arc<[u8]> and From<DepList> for \
22558                 Arc<str> must resolve to byte-equal byte-tails on \
22559                 DepList::{variant:?} — the byte-side and str-side \
22560                 atomically-refcounted reverse-projection axes must not \
22561                 drift off the same substrate-primitive as_str accessor"
22562            );
22563            // Cross-axis witness against the borrowed byte-view
22564            // `AsRef<[u8]>` axis on the same primitive.
22565            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
22566            assert_eq!(
22567                via_owned_from.as_ref(),
22568                borrowed_bytes,
22569                "From<DepList> for Arc<[u8]> and AsRef<[u8]> for \
22570                 DepList must resolve to byte-equal byte-tails on \
22571                 DepList::{variant:?}"
22572            );
22573        }
22574        for &variant in super::DepList::ALL {
22575            let owned_via_generic = generic_arc_bytes_sink(variant);
22576            let variant_ref: &super::DepList = &variant;
22577            let borrowed_via_generic = generic_arc_bytes_sink(variant_ref);
22578            assert_eq!(
22579                owned_via_generic.as_ref(),
22580                variant.as_str().as_bytes(),
22581                "<T: Into<Arc<[u8]>>>-bound composition on \
22582                 DepList::{variant:?} must fold the same byte-tail \
22583                 DepList::as_str().as_bytes() returns"
22584            );
22585            assert_eq!(
22586                borrowed_via_generic.as_ref(),
22587                variant.as_str().as_bytes(),
22588                "<T: Into<Arc<[u8]>>>-bound composition on \
22589                 &DepList::{variant:?} must fold the same byte-tail \
22590                 DepList::as_str().as_bytes() returns"
22591            );
22592        }
22593        // `.iter().map(Arc::<[u8]>::from)` pipe witness over
22594        // `DepList::ALL` — binds the borrowed-input axis, because the
22595        // iterator over `&'static [DepList]` yields `&DepList`, not
22596        // `DepList`.
22597        let via_iter: Vec<std::sync::Arc<[u8]>> = super::DepList::ALL
22598            .iter()
22599            .map(std::sync::Arc::<[u8]>::from)
22600            .collect();
22601        let via_method: Vec<std::sync::Arc<[u8]>> = super::DepList::ALL
22602            .iter()
22603            .map(|d| std::sync::Arc::<[u8]>::from(d.as_str().as_bytes()))
22604            .collect();
22605        assert_eq!(
22606            via_iter, via_method,
22607            "`.iter().map(Arc::<[u8]>::from)` over DepList::ALL must \
22608             byte-equal the open-coded per-arm composition — the \
22609             borrowed-input axis is what makes the `Arc::from` \
22610             composition route through the substrate-primitive \
22611             DepList::as_str accessor without a spurious `.copied()` \
22612             restatement"
22613        );
22614    }
22615
22616    #[test]
22617    #[expect(
22618        clippy::too_many_lines,
22619        reason = "the byte-owned reverse-projection axis is closed \
22620                  onto DepList at the Rc<[u8]> corner here (mirroring \
22621                  the trajectory ae5577b walked on the sibling caixa-\
22622                  core-internal peer CaixaDialeto, 5569794 on WitShape, \
22623                  15d22b1 on RateLimitUnit, 3d8170c on \
22624                  PlacementStrategy, and db8dcc2 on CaixaKind), which \
22625                  means the cross-axis reconciliation witness must \
22626                  bind against the Vec<u8>, Cow<'static, [u8]>, \
22627                  Box<[u8]>, Arc<[u8]>, and Rc<str> axes on every arm \
22628                  the exhaustive DepList::ALL slice enumerates — \
22629                  splitting that witness across a helper would break \
22630                  the fail-before-pass-after contract, because a \
22631                  future silent detour on any one axis must trip at \
22632                  the single pin test that closes this partition"
22633    )]
22634    fn dep_list_from_into_owned_rc_bytes_routes_through_as_str_accessor() {
22635        // Fail-before-pass-after byte-parity pin on the newly lifted
22636        // `impl From<DepList> for std::rc::Rc<[u8]>` and
22637        // `impl From<&DepList> for std::rc::Rc<[u8]>` — asserts the
22638        // trait-idiomatic byte-owned reverse-projection standard-
22639        // library impls and the substrate-primitive
22640        // [`super::DepList::as_str`] `pub const fn` accessor's
22641        // `.as_bytes()` byte-view resolve to the same two-arm
22642        // `:`-prefixed kebab-case wire byte-string emit-set across
22643        // every arm the exhaustive [`super::DepList::ALL`] slice
22644        // enumerates, on both the owned-input `DepList` and borrowed-
22645        // input `&DepList` surfaces. Additionally asserts the returned
22646        // `Rc<[u8]>` is fit-to-length on every arm, because
22647        // `std::rc::Rc::<[u8]>::from(&[u8])` allocates a slab whose
22648        // payload is `len` bytes exactly (no capacity slack), the
22649        // property downstream single-threaded `Rc<[u8]>` consumers (a
22650        // future non-`Send` `HashMap::<Rc<[u8]>, _>::from_iter` keyed
22651        // by the wire byte-tail across the lacre closure's per-caixa
22652        // dependency-classification cache) rely on to keep the per-arm
22653        // footprint stable across the accept-set.
22654        //
22655        // Closes the substrate-wide byte-owned reverse-projection
22656        // matrix on the third caixa-core-internal closed-set fieldless
22657        // typed-enum peer at the [`std::rc::Rc<[u8]>`] corner —
22658        // completing the full `{Vec<u8>, Cow<'static, [u8]>, Box<[u8]>,
22659        // Arc<[u8]>, Rc<[u8]>}` five-corner partition on the same wire
22660        // byte-string, mirroring the trajectory the same axis walked on
22661        // the sibling second-mover caixa-core-internal peer
22662        // CaixaDialeto (ae5577b), on the sibling third M3-mesh-
22663        // primitive-defining WitShape peer (5569794), on the sibling
22664        // second M3-mesh-primitive-defining RateLimitUnit peer
22665        // (15d22b1), on the sibling first M3-mesh-primitive-defining
22666        // PlacementStrategy peer (3d8170c), on the sibling CaixaKind
22667        // structurally most fundamental closed-set fieldless typed-
22668        // enum peer (db8dcc2), and on the M2-OTP-shape
22669        // RestartStrategy peer (2620e42) and RestartPolicy peer
22670        // (6848c05).
22671        fn generic_rc_bytes_sink<T: Into<std::rc::Rc<[u8]>>>(t: T) -> std::rc::Rc<[u8]> {
22672            t.into()
22673        }
22674        for &variant in super::DepList::ALL {
22675            let via_owned_from: std::rc::Rc<[u8]> =
22676                <std::rc::Rc<[u8]> as From<super::DepList>>::from(variant);
22677            let via_borrowed_from: std::rc::Rc<[u8]> =
22678                <std::rc::Rc<[u8]> as From<&super::DepList>>::from(&variant);
22679            let via_method_bytes: &'static [u8] = variant.as_str().as_bytes();
22680            assert_eq!(
22681                via_owned_from.as_ref(),
22682                via_method_bytes,
22683                "From<DepList> for Rc<[u8]> impl must byte-equal \
22684                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22685                 divergence signals a silent detour off the substrate-\
22686                 primitive accessor"
22687            );
22688            assert_eq!(
22689                via_borrowed_from.as_ref(),
22690                via_method_bytes,
22691                "From<&DepList> for Rc<[u8]> impl must byte-equal \
22692                 DepList::as_str().as_bytes() on DepList::{variant:?} — \
22693                 divergence signals a silent detour off the substrate-\
22694                 primitive accessor"
22695            );
22696            assert_eq!(
22697                via_owned_from.len(),
22698                via_method_bytes.len(),
22699                "From<DepList> for Rc<[u8]> must land a fit-to-length \
22700                 single-threaded-refcounted byte slab on \
22701                 DepList::{variant:?} — a length mismatch against \
22702                 DepList::as_str().as_bytes().len() signals the \
22703                 Rc<[u8]> allocator drifted off the substrate \
22704                 primitive's byte-tail"
22705            );
22706            assert_eq!(
22707                via_borrowed_from.len(),
22708                via_method_bytes.len(),
22709                "From<&DepList> for Rc<[u8]> must land a fit-to-length \
22710                 single-threaded-refcounted byte slab on \
22711                 DepList::{variant:?}"
22712            );
22713            let via_into_owned: std::rc::Rc<[u8]> = variant.into();
22714            let via_into_borrowed: std::rc::Rc<[u8]> = (&variant).into();
22715            assert_eq!(
22716                via_into_owned.as_ref(),
22717                via_method_bytes,
22718                "Into<Rc<[u8]>>::into on DepList::{variant:?} must \
22719                 byte-equal DepList::as_str().as_bytes()"
22720            );
22721            assert_eq!(
22722                via_into_borrowed.as_ref(),
22723                via_method_bytes,
22724                "Into<Rc<[u8]>>::into on &DepList::{variant:?} must \
22725                 byte-equal DepList::as_str().as_bytes()"
22726            );
22727            assert_eq!(
22728                via_borrowed_from.as_ref(),
22729                via_owned_from.as_ref(),
22730                "owned and borrowed Rc<[u8]> corners must byte-agree \
22731                 on DepList::{variant:?}"
22732            );
22733            // Cross-axis witness against the paired byte-owned
22734            // `From<DepList> for Vec<u8>` axis on the same primitive.
22735            let paired_vec: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
22736            assert_eq!(
22737                via_owned_from.as_ref(),
22738                paired_vec.as_slice(),
22739                "From<DepList> for Rc<[u8]> and From<DepList> for \
22740                 Vec<u8> must resolve to byte-equal byte-tails on \
22741                 DepList::{variant:?} — the two byte-owned reverse-\
22742                 projection axes must not drift off the same \
22743                 substrate-primitive as_str accessor"
22744            );
22745            // Cross-axis witness against the paired byte-owned
22746            // `From<DepList> for Cow<'static, [u8]>` axis.
22747            let paired_cow_bytes: std::borrow::Cow<'static, [u8]> =
22748                <std::borrow::Cow<'static, [u8]> as From<super::DepList>>::from(variant);
22749            assert_eq!(
22750                via_owned_from.as_ref(),
22751                paired_cow_bytes.as_ref(),
22752                "From<DepList> for Rc<[u8]> and From<DepList> for \
22753                 Cow<'static, [u8]> must resolve to byte-equal byte-\
22754                 tails on DepList::{variant:?}"
22755            );
22756            // Cross-axis witness against the paired byte-owned
22757            // `From<DepList> for Box<[u8]>` axis on the same primitive
22758            // — the two owned byte-slab axes must byte-agree.
22759            let paired_box_bytes: Box<[u8]> = <Box<[u8]> as From<super::DepList>>::from(variant);
22760            assert_eq!(
22761                via_owned_from.as_ref(),
22762                paired_box_bytes.as_ref(),
22763                "From<DepList> for Rc<[u8]> and From<DepList> for \
22764                 Box<[u8]> must resolve to byte-equal byte-tails on \
22765                 DepList::{variant:?} — the two owned byte-slab \
22766                 reverse-projection axes must not drift off the same \
22767                 substrate-primitive as_str accessor"
22768            );
22769            // Cross-axis witness against the paired byte-owned
22770            // `From<DepList> for std::sync::Arc<[u8]>` axis on the
22771            // same primitive — the single-threaded and atomically-
22772            // refcounted byte-slab axes must byte-agree.
22773            let paired_atomic_arc_bytes: std::sync::Arc<[u8]> =
22774                <std::sync::Arc<[u8]> as From<super::DepList>>::from(variant);
22775            assert_eq!(
22776                via_owned_from.as_ref(),
22777                paired_atomic_arc_bytes.as_ref(),
22778                "From<DepList> for Rc<[u8]> and From<DepList> for \
22779                 Arc<[u8]> must resolve to byte-equal byte-tails on \
22780                 DepList::{variant:?} — the single-threaded and \
22781                 atomically-refcounted byte-slab reverse-projection \
22782                 axes must not drift off the same substrate-primitive \
22783                 as_str accessor"
22784            );
22785            // Cross-axis witness against the paired str-side
22786            // `From<DepList> for std::rc::Rc<str>` axis on the same
22787            // primitive — the byte-side and str-side Rc axes must
22788            // byte-agree.
22789            let paired_rc_str: std::rc::Rc<str> =
22790                <std::rc::Rc<str> as From<super::DepList>>::from(variant);
22791            assert_eq!(
22792                via_owned_from.as_ref(),
22793                paired_rc_str.as_bytes(),
22794                "From<DepList> for Rc<[u8]> and From<DepList> for \
22795                 Rc<str> must resolve to byte-equal byte-tails on \
22796                 DepList::{variant:?} — the byte-side and str-side \
22797                 Rc reverse-projection axes must not drift off the \
22798                 same substrate-primitive as_str accessor"
22799            );
22800            // Cross-axis witness against the borrowed byte-view
22801            // `AsRef<[u8]>` axis on the same primitive.
22802            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
22803            assert_eq!(
22804                via_owned_from.as_ref(),
22805                borrowed_bytes,
22806                "From<DepList> for Rc<[u8]> and AsRef<[u8]> for \
22807                 DepList must resolve to byte-equal byte-tails on \
22808                 DepList::{variant:?}"
22809            );
22810        }
22811        for &variant in super::DepList::ALL {
22812            let owned_via_generic = generic_rc_bytes_sink(variant);
22813            let variant_ref: &super::DepList = &variant;
22814            let borrowed_via_generic = generic_rc_bytes_sink(variant_ref);
22815            assert_eq!(
22816                owned_via_generic.as_ref(),
22817                variant.as_str().as_bytes(),
22818                "<T: Into<Rc<[u8]>>>-bound composition on \
22819                 DepList::{variant:?} must fold the same byte-tail \
22820                 DepList::as_str().as_bytes() returns"
22821            );
22822            assert_eq!(
22823                borrowed_via_generic.as_ref(),
22824                variant.as_str().as_bytes(),
22825                "<T: Into<Rc<[u8]>>>-bound composition on \
22826                 &DepList::{variant:?} must fold the same byte-tail \
22827                 DepList::as_str().as_bytes() returns"
22828            );
22829        }
22830        // Source-survival witness on the borrowed-input peer: the
22831        // `From<&DepList>` impl reads through the borrow, so the
22832        // source value must remain reachable after the projection.
22833        for &variant in super::DepList::ALL {
22834            let variant_ref: &super::DepList = &variant;
22835            let _via_borrowed: std::rc::Rc<[u8]> = variant_ref.into();
22836            let via_str_after: &'static str = variant_ref.as_str();
22837            assert_eq!(
22838                via_str_after.as_bytes(),
22839                variant.as_str().as_bytes(),
22840                "borrowed source &DepList::{variant:?} must remain \
22841                 reachable after From<&DepList> for Rc<[u8]> — a \
22842                 silent move-out on the borrowed axis would break the \
22843                 source-survival contract on the borrowed-input peer"
22844            );
22845        }
22846        // `.iter().map(std::rc::Rc::<[u8]>::from)` pipe witness over
22847        // `DepList::ALL` — binds the borrowed-input axis, because the
22848        // iterator over `&'static [DepList]` yields `&DepList`, not
22849        // `DepList`.
22850        let via_iter: Vec<std::rc::Rc<[u8]>> = super::DepList::ALL
22851            .iter()
22852            .map(std::rc::Rc::<[u8]>::from)
22853            .collect();
22854        let via_method: Vec<std::rc::Rc<[u8]>> = super::DepList::ALL
22855            .iter()
22856            .map(|d| std::rc::Rc::<[u8]>::from(d.as_str().as_bytes()))
22857            .collect();
22858        for (i, &variant) in super::DepList::ALL.iter().enumerate() {
22859            assert_eq!(
22860                via_iter[i].as_ref(),
22861                via_method[i].as_ref(),
22862                "`.iter().map(std::rc::Rc::<[u8]>::from)` over \
22863                 DepList::ALL must byte-equal the open-coded per-arm \
22864                 composition on DepList::{variant:?} — the borrowed-\
22865                 input axis is what makes the `Rc::from` composition \
22866                 route through the substrate-primitive DepList::as_str \
22867                 accessor without a spurious `.copied()` restatement"
22868            );
22869        }
22870    }
22871
22872    #[test]
22873    fn dep_list_try_from_bytes_routes_through_from_wire_accessor() {
22874        // Fail-before-pass-after byte-parity pin on the newly lifted
22875        // `impl TryFrom<&[u8]> for DepList` — asserts the trait-
22876        // idiomatic byte-view reverse-projection standard-library impl
22877        // and the substrate-primitive [`super::DepList::from_wire`]
22878        // `Option<Self>` accessor resolve to the same two-arm
22879        // `:`-prefixed kebab-case wire accept-set across every arm the
22880        // exhaustive [`super::DepList::ALL`] slice enumerates. Extends
22881        // the substrate-wide trait-idiomatic byte-view reverse-
22882        // projection axis onto the third caixa-core-internal closed-set
22883        // fieldless typed enum peer — mirror of the paired
22884        // [`TryFrom<&str> for DepList`] str-view reverse-projection
22885        // axis on the same enum, and the byte-view companion of the
22886        // pre-existing byte-owned reverse-projection family
22887        // ([`AsRef<[u8]>`], [`From<DepList> for Vec<u8>`],
22888        // [`From<&DepList> for Vec<u8>`]) on this same enum. Peer of
22889        // the sibling
22890        // [`crate::kind::tests::caixa_kind_try_from_bytes_routes_through_from_wire_accessor`]
22891        // (18d1940) on the first-mover [`crate::CaixaKind`] closed-set
22892        // typed-enum peer and the sibling
22893        // [`crate::dialeto::tests::caixa_dialeto_try_from_bytes_routes_through_from_wire_accessor`]
22894        // (d102cb8) on the second-mover [`crate::CaixaDialeto`] peer —
22895        // tracks the "route through `from_wire` via `std::str::from_utf8`"
22896        // discipline the first-mover established.
22897        //
22898        // Rust's standard library carries no blanket
22899        // `impl<T: for<'a> TryFrom<&'a str>> TryFrom<&[u8]> for T`, so
22900        // a two-hop composition through [`std::str::from_utf8`] + the
22901        // paired [`TryFrom<&str>`] axis is reachable through the pre-
22902        // existing str-view reverse-projection axis alone. But that
22903        // two-hop shape has no compile-time link back to the byte-view
22904        // reverse-projection axis, forces every downstream
22905        // `<T: for<'a> TryFrom<&'a [u8]>>`-bound consumer to open-code
22906        // the composition at every call site, and admits a silent split
22907        // whenever a future call site takes a sibling byte-projection
22908        // axis whose parse arm-set carries no compile-time byte-view
22909        // surface. This impl closes the byte-view reverse-projection
22910        // axis at the substrate-primitive
22911        // [`super::DepList::from_wire`] accessor so every future
22912        // `<T: for<'a> TryFrom<&'a [u8]>>`-bound consumer reaches the
22913        // same two-arm `:`-prefixed kebab-case wire accept-set through
22914        // one trait dispatch.
22915        for &variant in super::DepList::ALL {
22916            let wire_bytes: &[u8] = variant.as_str().as_bytes();
22917            assert_eq!(
22918                <super::DepList as TryFrom<&[u8]>>::try_from(wire_bytes),
22919                Ok(variant),
22920                "TryFrom<&[u8]> impl on DepList must round-trip \
22921                 DepList::{variant:?}.as_str().as_bytes() back to \
22922                 Ok(DepList::{variant:?}) — divergence from \
22923                 DepList::from_wire signals a silent detour off the \
22924                 substrate-primitive accessor"
22925            );
22926            assert_eq!(
22927                <super::DepList as TryFrom<&[u8]>>::try_from(wire_bytes).ok(),
22928                super::DepList::from_wire(variant.as_str()),
22929                "TryFrom<&[u8]> ok()-projection on \
22930                 DepList::{variant:?}.as_str().as_bytes() must \
22931                 byte-equal DepList::from_wire on the paired &str input"
22932            );
22933            // Cross-axis witness: the byte-view reverse-projection axis
22934            // must agree with the paired str-view reverse-projection
22935            // axis ([`TryFrom<&str>`]) on every accepted arm — the two
22936            // reverse paths share one `:`-prefixed kebab accept-set
22937            // through the substrate-primitive `from_wire` accessor.
22938            let via_str: Result<super::DepList, ()> =
22939                <super::DepList as TryFrom<&str>>::try_from(variant.as_str());
22940            let via_bytes: Result<super::DepList, ()> =
22941                <super::DepList as TryFrom<&[u8]>>::try_from(wire_bytes);
22942            assert_eq!(
22943                via_bytes, via_str,
22944                "TryFrom<&[u8]> and TryFrom<&str> reverse-projection \
22945                 axes on DepList must agree on DepList::{variant:?} — \
22946                 divergence signals the byte-view and str-view reverse \
22947                 paths have drifted off the same substrate-primitive \
22948                 from_wire accessor"
22949            );
22950            // Cross-axis witness against the paired [`AsRef<[u8]>`]
22951            // borrowed byte-view axis: feeding the same byte-tail the
22952            // forward byte-view axis emits back through the reverse
22953            // byte-view axis must round-trip to the originating arm —
22954            // locks the forward and reverse byte-view axes together at
22955            // the substrate-primitive accessor.
22956            let borrowed_bytes: &[u8] = <super::DepList as AsRef<[u8]>>::as_ref(&variant);
22957            assert_eq!(
22958                <super::DepList as TryFrom<&[u8]>>::try_from(borrowed_bytes),
22959                Ok(variant),
22960                "TryFrom<&[u8]> fed the AsRef<[u8]>-projected byte-tail \
22961                 of DepList::{variant:?} must round-trip to \
22962                 Ok(DepList::{variant:?}) — divergence signals the \
22963                 forward and reverse byte-view axes have drifted off \
22964                 the same substrate-primitive as_str/from_wire accessor \
22965                 pair"
22966            );
22967        }
22968    }
22969
22970    #[test]
22971    fn dep_list_try_from_bytes_rejects_unknown_and_non_utf8_bytes() {
22972        // Rejection witness on the `impl TryFrom<&[u8]> for DepList` —
22973        // sweeps two rejection paths the byte-view reverse-projection
22974        // axis collapses onto the single unit-error `Err(())` return:
22975        // the invalid-UTF-8 rejection path ([`std::str::from_utf8`]
22976        // returns `Err` before [`super::DepList::from_wire`] runs) and
22977        // the valid-UTF-8-but-unknown-wire rejection path
22978        // ([`super::DepList::from_wire`] returns `None` on a byte-
22979        // string outside the two-arm `:`-prefixed kebab-case accept-
22980        // set). Both must reject, so a future accidental widening of
22981        // the trait impl's accept-set (a case-fold path, a silent
22982        // acceptance of a `":packages"` rebrand alias, a
22983        // `#[serde(rename_all = "…")]` attribute drift that widens the
22984        // parse arm-set silently, a stray fallback that maps invalid
22985        // UTF-8 onto a default arm rather than the trait-idiomatic
22986        // `Err(())`) trips at caixa-core test time. Peer of the sibling
22987        // [`crate::kind::tests::caixa_kind_try_from_bytes_rejects_unknown_and_non_utf8_bytes`]
22988        // (18d1940) on the first-mover [`crate::CaixaKind`] peer and
22989        // the sibling
22990        // [`crate::dialeto::tests::caixa_dialeto_try_from_bytes_rejects_unknown_and_non_utf8_bytes`]
22991        // (d102cb8) on the second-mover [`crate::CaixaDialeto`] peer.
22992        //
22993        // Non-UTF-8 candidates:
22994        //   - a lone 0xFF byte (never valid as a UTF-8 leading byte)
22995        //   - a lone 0x80 continuation byte with no leading byte
22996        //   - a truncated multi-byte sequence (0xC3 without its continuation)
22997        //   - a UTF-16 BOM-style byte pair the UTF-8 validator rejects
22998        //   - a UTF-16 surrogate half rejected by UTF-8
22999        let non_utf8_rejected: &[&[u8]] = &[
23000            &[0xFF],
23001            &[0x80],
23002            &[0xC3],
23003            &[0xFF, 0xFE],
23004            &[0xED, 0xA0, 0x80],
23005        ];
23006        for &input in non_utf8_rejected {
23007            assert_eq!(
23008                <super::DepList as TryFrom<&[u8]>>::try_from(input),
23009                Err(()),
23010                "TryFrom<&[u8]> impl on DepList must reject the non-\
23011                 UTF-8 byte-sequence {input:?} with Err(()) — silent \
23012                 acceptance signals the UTF-8 validation path collapsed \
23013                 onto a default arm rather than the trait-idiomatic \
23014                 unit-error"
23015            );
23016        }
23017        // Valid-UTF-8-but-unknown-wire candidates: the empty byte-
23018        // string, whitespace-only forms, case-folded variants of
23019        // accepted arms, the un-`:`-prefixed bare-kebab
23020        // ("deps"/"deps-dev") the sibling
23021        // [`super::DepList::from_wire`] doc block flags as a
23022        // `:`-prefix-discipline hazard, plausible rebrand aliases the
23023        // sibling `dep_list_try_from_str_rejects_unknown_byte_strings`
23024        // rejection witness (5b828ed) already pins on the str-view
23025        // reverse axis, and whitespace-padded/quoted forms.
23026        let unknown_wire_rejected: &[&[u8]] = &[
23027            b"",
23028            b" ",
23029            b"\t",
23030            b"\n",
23031            b":deps ",
23032            b" :deps",
23033            b":DEPS",
23034            b":Deps",
23035            b":Deps-Dev",
23036            b":deps_dev",
23037            b":deps-development",
23038            b":dev-deps",
23039            b":packages",
23040            b":packages-dev",
23041            b"deps",
23042            b"deps-dev",
23043            b"Prod",
23044            b"Dev",
23045            b"prod",
23046            b"dev",
23047            b"\":deps\"",
23048            b"\":deps-dev\"",
23049            b":deps\n",
23050            b":deps-dev\n",
23051        ];
23052        for &input in unknown_wire_rejected {
23053            assert_eq!(
23054                <super::DepList as TryFrom<&[u8]>>::try_from(input),
23055                Err(()),
23056                "TryFrom<&[u8]> impl on DepList must reject the valid-\
23057                 UTF-8-but-unknown-wire byte-string {input:?} with \
23058                 Err(()) — silent acceptance signals an accept-set \
23059                 widening off the paired DepList::from_wire resolver"
23060            );
23061            // Cross-axis witness: on a byte-string that is valid UTF-8,
23062            // the byte-view reverse-projection axis must agree with the
23063            // paired str-view reverse-projection axis
23064            // ([`TryFrom<&str>`]) — both route through the same
23065            // [`super::DepList::from_wire`] resolver, so the two
23066            // rejection paths align by construction.
23067            if let Ok(s) = std::str::from_utf8(input) {
23068                assert_eq!(
23069                    <super::DepList as TryFrom<&[u8]>>::try_from(input),
23070                    <super::DepList as TryFrom<&str>>::try_from(s),
23071                    "TryFrom<&[u8]> and TryFrom<&str> reverse-\
23072                     projection axes on DepList must agree on the \
23073                     valid-UTF-8 input {input:?} — divergence signals \
23074                     the two reverse paths have drifted off the same \
23075                     substrate-primitive from_wire accessor"
23076                );
23077            }
23078        }
23079    }
23080
23081    #[test]
23082    fn dep_list_try_from_vec_bytes_routes_through_borrowed_byte_view_axis() {
23083        // Fail-before-pass-after byte-parity pin on the newly lifted
23084        // `impl TryFrom<Vec<u8>> for DepList` — asserts the trait-
23085        // idiomatic owned-byte-vec reverse-projection standard-library
23086        // impl and the sibling borrowed-input [`TryFrom<&[u8]>`] axis
23087        // resolve to the same two-arm `:`-prefixed kebab-case wire
23088        // accept-set across every arm the exhaustive
23089        // [`super::DepList::ALL`] slice enumerates. Extends the
23090        // substrate-wide trait-idiomatic byte-owned reverse-projection
23091        // axis onto the third caixa-core-internal closed-set fieldless
23092        // typed enum peer — owned-input mirror of the paired
23093        // [`TryFrom<&[u8]>`] byte-view reverse-projection axis
23094        // (b8f25d5), and byte-owned reverse companion of the pre-
23095        // existing byte-owned *forward*-projection pair
23096        // ([`From<super::DepList> for Vec<u8>`],
23097        // [`From<&super::DepList> for Vec<u8>`]) on this same enum.
23098        // Peer of the sibling first-mover
23099        // [`crate::kind::tests::caixa_kind_try_from_vec_bytes_routes_through_borrowed_byte_view_axis`]
23100        // (99c2849) on the [`crate::CaixaKind`] closed-set typed-enum
23101        // peer and the sibling second-mover
23102        // [`crate::dialeto::tests::caixa_dialeto_try_from_vec_bytes_routes_through_borrowed_byte_view_axis`]
23103        // (83a1526) on the [`crate::CaixaDialeto`] peer — tracks the
23104        // "delegate through `TryFrom<&[u8]>` on the `Vec<u8>::as_slice`
23105        // borrow" discipline the first-mover established.
23106        //
23107        // Rust's standard library carries no blanket
23108        // `impl<T: for<'a> TryFrom<&'a [u8]>> TryFrom<Vec<u8>> for T`,
23109        // so an owned-byte-vec caller otherwise picks between an
23110        // open-coded `<T as TryFrom<&[u8]>>::try_from(bytes.as_slice())`
23111        // at every call site whose type bounds have no compile-time
23112        // link back to the byte-owned reverse-projection axis, or a
23113        // `String::from_utf8(bytes)` two-hop shape whose error surface
23114        // leaks the standard-library `FromUtf8Error` type. This impl
23115        // closes the byte-owned reverse-projection axis at the
23116        // substrate-primitive [`super::DepList::from_wire`] accessor
23117        // so every future `<T: TryFrom<Vec<u8>>>`-bound owned-byte-vec
23118        // consumer reaches the same two-arm `:`-prefixed kebab-case
23119        // wire accept-set through one trait dispatch.
23120        for &variant in super::DepList::ALL {
23121            let wire_bytes: Vec<u8> = variant.as_str().as_bytes().to_vec();
23122            assert_eq!(
23123                <super::DepList as TryFrom<Vec<u8>>>::try_from(wire_bytes.clone()),
23124                Ok(variant),
23125                "TryFrom<Vec<u8>> impl on DepList must round-trip \
23126                 DepList::{variant:?}.as_str().as_bytes().to_vec() \
23127                 back to Ok(DepList::{variant:?}) — divergence from \
23128                 the sibling TryFrom<&[u8]> axis signals a silent \
23129                 detour off the substrate-primitive from_wire accessor"
23130            );
23131            // Cross-axis witness: the owned-byte-vec reverse-projection
23132            // axis must agree with the borrowed byte-slice reverse-
23133            // projection axis on every accepted arm — the two axes
23134            // share one `:`-prefixed kebab-case wire vocabulary
23135            // through the substrate-primitive `from_wire` accessor,
23136            // and the owned-input axis delegates to the borrowed peer
23137            // by design.
23138            let via_owned: Result<super::DepList, ()> =
23139                <super::DepList as TryFrom<Vec<u8>>>::try_from(wire_bytes.clone());
23140            let via_borrowed: Result<super::DepList, ()> =
23141                <super::DepList as TryFrom<&[u8]>>::try_from(wire_bytes.as_slice());
23142            assert_eq!(
23143                via_owned, via_borrowed,
23144                "TryFrom<Vec<u8>> and TryFrom<&[u8]> reverse-projection \
23145                 axes on DepList must agree on DepList::{variant:?} — \
23146                 divergence signals the owned-input and borrowed-input \
23147                 byte-view reverse paths have drifted off the same \
23148                 substrate-primitive from_wire accessor"
23149            );
23150            // Cross-axis witness against the paired str-view reverse
23151            // axis ([`TryFrom<&str>`]) — the three reverse paths (str-
23152            // view, byte-view borrowed, byte-view owned) share one
23153            // substrate primitive.
23154            let via_str: Result<super::DepList, ()> =
23155                <super::DepList as TryFrom<&str>>::try_from(variant.as_str());
23156            assert_eq!(
23157                via_owned, via_str,
23158                "TryFrom<Vec<u8>> and TryFrom<&str> reverse-projection \
23159                 axes on DepList must agree on DepList::{variant:?} — \
23160                 divergence signals the byte-owned and str-view \
23161                 reverse paths have drifted off the same substrate-\
23162                 primitive from_wire accessor"
23163            );
23164            // Four-corner witness: because [`super::DepList`] carries
23165            // no wire-vs-diagnostic split (as_str and from_wire share
23166            // one `:`-prefixed kebab-case byte-vocabulary), the byte-
23167            // owned reverse-projection axis on this enum *does* round-
23168            // trip against the paired byte-owned forward-projection
23169            // pair. Pin every corner of the {owned-input, borrowed-
23170            // input} × {From<Self> → Vec<u8>, From<&Self> → Vec<u8>}
23171            // square onto the same Ok(variant) return so a future
23172            // accident that drops one corner off the substrate-
23173            // primitive accessor trips here.
23174            let owned_forward: Vec<u8> = <Vec<u8> as From<super::DepList>>::from(variant);
23175            let borrowed_forward: Vec<u8> = <Vec<u8> as From<&super::DepList>>::from(&variant);
23176            assert_eq!(
23177                owned_forward, wire_bytes,
23178                "From<DepList> for Vec<u8> forward projection on \
23179                 DepList::{variant:?} must byte-equal \
23180                 variant.as_str().as_bytes().to_vec() — divergence \
23181                 signals the paired forward pair drifted off the \
23182                 substrate-primitive as_str accessor"
23183            );
23184            assert_eq!(
23185                borrowed_forward, wire_bytes,
23186                "From<&DepList> for Vec<u8> forward projection on \
23187                 &DepList::{variant:?} must byte-equal \
23188                 variant.as_str().as_bytes().to_vec() — divergence \
23189                 signals the paired forward pair drifted off the \
23190                 substrate-primitive as_str accessor"
23191            );
23192            assert_eq!(
23193                <super::DepList as TryFrom<Vec<u8>>>::try_from(owned_forward.clone()),
23194                Ok(variant),
23195                "Four-corner round-trip on DepList::{variant:?} \
23196                 through From<DepList> for Vec<u8> then \
23197                 TryFrom<Vec<u8>> for DepList must return \
23198                 Ok(variant) — divergence signals the byte-owned \
23199                 forward pair and the byte-owned reverse axis have \
23200                 drifted apart"
23201            );
23202            assert_eq!(
23203                <super::DepList as TryFrom<Vec<u8>>>::try_from(borrowed_forward),
23204                Ok(variant),
23205                "Four-corner round-trip on DepList::{variant:?} \
23206                 through From<&DepList> for Vec<u8> then \
23207                 TryFrom<Vec<u8>> for DepList must return \
23208                 Ok(variant) — divergence signals the borrowed-input \
23209                 forward corner and the owned-input reverse corner \
23210                 have drifted apart"
23211            );
23212        }
23213    }
23214
23215    #[test]
23216    fn dep_list_try_from_vec_bytes_rejects_unknown_and_non_utf8_bytes() {
23217        // Rejection witness on the `impl TryFrom<Vec<u8>> for DepList`
23218        // — sweeps the same two rejection paths the sibling borrowed
23219        // `TryFrom<&[u8]>` axis collapses onto the single unit-error
23220        // return: the invalid-UTF-8 rejection path (`std::str::from_utf8`
23221        // on the underlying byte-slice returns `Err` before
23222        // [`super::DepList::from_wire`] runs) and the valid-UTF-8-
23223        // but-unknown-wire rejection path
23224        // ([`super::DepList::from_wire`] returns `None` on a byte-
23225        // string outside the two-arm `:`-prefixed kebab-case accept-
23226        // set). Both must reject so a future accidental widening of
23227        // the trait impl's accept-set (a case-fold path, a silent
23228        // acceptance of a `":packages"` rebrand alias, a
23229        // `#[serde(rename_all = "…")]` attribute drift that widens
23230        // the parse arm-set silently, a stray `String::from_utf8_lossy`
23231        // detour that widens the input surface with the U+FFFD
23232        // replacement character, an `Option::unwrap_or_default`-shape
23233        // fallback that maps invalid UTF-8 onto a default arm rather
23234        // than the trait-idiomatic `Err(())`) trips at caixa-core test
23235        // time. Peer of the sibling first-mover
23236        // [`crate::kind::tests::caixa_kind_try_from_vec_bytes_rejects_unknown_and_non_utf8_bytes`]
23237        // (99c2849) on the [`crate::CaixaKind`] peer and the sibling
23238        // second-mover
23239        // [`crate::dialeto::tests::caixa_dialeto_try_from_vec_bytes_rejects_unknown_and_non_utf8_bytes`]
23240        // (83a1526) on the [`crate::CaixaDialeto`] peer.
23241        let non_utf8_rejected: &[&[u8]] = &[
23242            &[0xFF],
23243            &[0x80],
23244            &[0xC3],
23245            &[0xFF, 0xFE],
23246            &[0xED, 0xA0, 0x80], // UTF-16 surrogate half — rejected by UTF-8
23247        ];
23248        for &input in non_utf8_rejected {
23249            let owned: Vec<u8> = input.to_vec();
23250            assert_eq!(
23251                <super::DepList as TryFrom<Vec<u8>>>::try_from(owned),
23252                Err(()),
23253                "TryFrom<Vec<u8>> impl on DepList must reject the \
23254                 non-UTF-8 byte-sequence {input:?} with Err(()) — \
23255                 silent acceptance signals the UTF-8 validation path \
23256                 collapsed onto a default arm rather than the trait-\
23257                 idiomatic unit-error"
23258            );
23259            // Cross-axis witness: the owned-input axis must agree with
23260            // the borrowed-input axis on every rejected input.
23261            assert_eq!(
23262                <super::DepList as TryFrom<Vec<u8>>>::try_from(input.to_vec()),
23263                <super::DepList as TryFrom<&[u8]>>::try_from(input),
23264                "TryFrom<Vec<u8>> and TryFrom<&[u8]> reverse-projection \
23265                 axes on DepList must agree on the non-UTF-8 input \
23266                 {input:?} — divergence signals the owned-input and \
23267                 borrowed-input byte-view reverse paths have drifted \
23268                 off the same substrate-primitive from_wire accessor"
23269            );
23270        }
23271        // Valid-UTF-8-but-unknown-wire candidates: the empty byte-
23272        // string, whitespace-only forms, case-folded variants of
23273        // accepted arms, the un-`:`-prefixed bare-kebab
23274        // ("deps"/"deps-dev") the sibling
23275        // [`super::DepList::from_wire`] doc block flags as a
23276        // `:`-prefix-discipline hazard, plausible rebrand aliases the
23277        // sibling `dep_list_try_from_str_rejects_unknown_byte_strings`
23278        // rejection witness already pins on the str-view reverse
23279        // axis, and whitespace-padded / quoted forms.
23280        let unknown_wire_rejected: &[&[u8]] = &[
23281            b"",
23282            b" ",
23283            b"\t",
23284            b"\n",
23285            b":deps ",
23286            b" :deps",
23287            b":DEPS",
23288            b":Deps",
23289            b":Deps-Dev",
23290            b":deps_dev",
23291            b":deps-development",
23292            b":dev-deps",
23293            b":packages",
23294            b":packages-dev",
23295            b"deps",
23296            b"deps-dev",
23297            b"Prod",
23298            b"Dev",
23299            b"prod",
23300            b"dev",
23301            b"\":deps\"",
23302            b"\":deps-dev\"",
23303            b":deps\n",
23304            b":deps-dev\n",
23305        ];
23306        for &input in unknown_wire_rejected {
23307            let owned: Vec<u8> = input.to_vec();
23308            assert_eq!(
23309                <super::DepList as TryFrom<Vec<u8>>>::try_from(owned),
23310                Err(()),
23311                "TryFrom<Vec<u8>> impl on DepList must reject the \
23312                 valid-UTF-8-but-unknown-wire byte-string {input:?} \
23313                 with Err(()) — silent acceptance signals an accept-\
23314                 set widening off the paired DepList::from_wire \
23315                 resolver"
23316            );
23317            // Cross-axis witness against the borrowed byte-view axis:
23318            // the two paths must agree by construction, since the owned
23319            // axis delegates to the borrowed peer.
23320            assert_eq!(
23321                <super::DepList as TryFrom<Vec<u8>>>::try_from(input.to_vec()),
23322                <super::DepList as TryFrom<&[u8]>>::try_from(input),
23323                "TryFrom<Vec<u8>> and TryFrom<&[u8]> reverse-projection \
23324                 axes on DepList must agree on the valid-UTF-8-but-\
23325                 unknown-wire input {input:?} — divergence signals \
23326                 the owned-input and borrowed-input byte-view reverse \
23327                 paths have drifted off the same substrate-primitive \
23328                 from_wire accessor"
23329            );
23330        }
23331    }
23332
23333    #[test]
23334    fn dep_list_try_from_owned_string_routes_through_borrowed_str_view_axis() {
23335        // Fail-before-pass-after byte-parity pin on the newly lifted
23336        // `impl TryFrom<String> for DepList` — asserts the trait-
23337        // idiomatic string-owned reverse-projection standard-library
23338        // impl and the sibling borrowed-input [`TryFrom<&str>`] axis
23339        // resolve to the same two-arm `:`-prefixed kebab-case wire
23340        // accept-set across every arm the exhaustive
23341        // [`super::DepList::ALL`] slice enumerates. Closes the
23342        // substrate-wide trait-idiomatic string-owned reverse-projection
23343        // family onto the third caixa-core-internal closed-set fieldless
23344        // typed-enum peer — owned-input mirror of the paired
23345        // [`TryFrom<&str>`] str-view reverse-projection axis, and
23346        // string-owned reverse companion of the pre-existing string-
23347        // owned *forward*-projection pair ([`From<super::DepList> for
23348        // String`], [`From<&super::DepList> for String`]) on this same
23349        // enum. Peer of the sibling first-mover
23350        // [`crate::aplicacao::tests::rate_limit_try_from_owned_string_routes_through_borrowed_str_view_axis`]
23351        // (a2e6f02) on the compound [`crate::aplicacao::RateLimit`]
23352        // primitive, and the sibling
23353        // `caixa_kind_try_from_owned_string_routes_through_borrowed_str_view_axis`
23354        // (e7df24f) / `caixa_dialeto_try_from_owned_string_routes_through_borrowed_str_view_axis`
23355        // (9e07f5c) closed-set typed-enum peers — tracks the "delegate
23356        // through `TryFrom<&str>` on the `String::as_str` borrow"
23357        // discipline the compound-primitive opener and closed-set-peer
23358        // first-mover established. This closes the string-owned
23359        // reverse-projection axis on the third and last caixa-core-
23360        // internal closed-set fieldless typed-enum peer, mirroring the
23361        // trajectory the byte-view (b8f25d5) / byte-owned (42091cb) /
23362        // str-view reverse-projection families already walked on this
23363        // same enum.
23364        for &variant in super::DepList::ALL {
23365            let wire_string: String = variant.as_str().to_string();
23366            assert_eq!(
23367                <super::DepList as TryFrom<String>>::try_from(wire_string.clone()),
23368                Ok(variant),
23369                "TryFrom<String> impl on DepList must round-trip \
23370                 DepList::{variant:?}.as_str().to_string() back to \
23371                 Ok(DepList::{variant:?}) — divergence from the \
23372                 sibling TryFrom<&str> axis signals a silent detour \
23373                 off the substrate-primitive from_wire accessor"
23374            );
23375            // Cross-axis witness: the string-owned reverse-projection
23376            // axis must agree with the borrowed `&str` reverse-projection
23377            // axis on every accepted arm — the two axes share one
23378            // `:`-prefixed kebab-case wire vocabulary through the
23379            // substrate-primitive `from_wire` accessor, and the owned-
23380            // input axis delegates to the borrowed peer by design.
23381            let via_owned: Result<super::DepList, ()> =
23382                <super::DepList as TryFrom<String>>::try_from(wire_string.clone());
23383            let via_borrowed: Result<super::DepList, ()> =
23384                <super::DepList as TryFrom<&str>>::try_from(wire_string.as_str());
23385            assert_eq!(
23386                via_owned, via_borrowed,
23387                "TryFrom<String> and TryFrom<&str> reverse-projection \
23388                 axes on DepList must agree on DepList::{variant:?} — \
23389                 divergence signals the owned-`String` and borrowed-\
23390                 `&str` reverse paths have drifted off the same \
23391                 substrate-primitive from_wire accessor"
23392            );
23393            // Cross-axis witness against the paired byte-view reverse-
23394            // projection axis ([`TryFrom<&[u8]>`]) — the four reverse
23395            // paths share one substrate primitive.
23396            let via_byte_slice: Result<super::DepList, ()> =
23397                <super::DepList as TryFrom<&[u8]>>::try_from(wire_string.as_bytes());
23398            assert_eq!(
23399                via_owned, via_byte_slice,
23400                "TryFrom<String> and TryFrom<&[u8]> reverse-projection \
23401                 axes on DepList must agree on DepList::{variant:?} — \
23402                 divergence signals the string-owned and byte-view \
23403                 borrowed reverse paths have drifted off the same \
23404                 substrate-primitive from_wire accessor"
23405            );
23406            // Cross-axis witness against the sibling byte-owned
23407            // reverse-projection axis ([`TryFrom<Vec<u8>>`]) — the two
23408            // owned-input axes share one `:`-prefixed kebab-case wire
23409            // vocabulary.
23410            let via_byte_vec: Result<super::DepList, ()> =
23411                <super::DepList as TryFrom<Vec<u8>>>::try_from(wire_string.as_bytes().to_vec());
23412            assert_eq!(
23413                via_owned, via_byte_vec,
23414                "TryFrom<String> and TryFrom<Vec<u8>> reverse-\
23415                 projection axes on DepList must agree on \
23416                 DepList::{variant:?} — divergence signals the string-\
23417                 owned and byte-owned reverse paths have drifted off \
23418                 the same substrate-primitive from_wire accessor"
23419            );
23420            // Four-corner witness: because [`super::DepList`] carries
23421            // no wire-vs-diagnostic split (as_str and from_wire share
23422            // one `:`-prefixed kebab-case byte-vocabulary), the string-
23423            // owned reverse-projection axis on this enum *does* round-
23424            // trip against the paired string-owned forward-projection
23425            // pair. Pin every corner of the {owned-input, borrowed-
23426            // input} × {`From<Self> → String`, `From<&Self> → String`}
23427            // square onto the same Ok(variant) return so a future
23428            // accident that drops one corner off the substrate-
23429            // primitive accessor trips here. Mirror of the peer four-
23430            // corner witness the sibling
23431            // [`dep_list_try_from_vec_bytes_routes_through_borrowed_byte_view_axis`]
23432            // (42091cb) pins on the byte-owned reverse axis, and the
23433            // [`crate::dialeto::tests::caixa_dialeto_try_from_owned_string_routes_through_borrowed_str_view_axis`]
23434            // (9e07f5c) pins on the peer closed-set enum.
23435            let owned_forward: String = <String as From<super::DepList>>::from(variant);
23436            let borrowed_forward: String = <String as From<&super::DepList>>::from(&variant);
23437            assert_eq!(
23438                owned_forward, wire_string,
23439                "From<DepList> for String forward projection on \
23440                 DepList::{variant:?} must byte-equal \
23441                 variant.as_str().to_string() — divergence signals \
23442                 the paired forward pair drifted off the substrate-\
23443                 primitive as_str accessor"
23444            );
23445            assert_eq!(
23446                borrowed_forward, wire_string,
23447                "From<&DepList> for String forward projection on \
23448                 &DepList::{variant:?} must byte-equal \
23449                 variant.as_str().to_string() — divergence signals \
23450                 the paired forward pair drifted off the substrate-\
23451                 primitive as_str accessor"
23452            );
23453            assert_eq!(
23454                <super::DepList as TryFrom<String>>::try_from(owned_forward.clone()),
23455                Ok(variant),
23456                "Four-corner round-trip on DepList::{variant:?} \
23457                 through From<DepList> for String then \
23458                 TryFrom<String> for DepList must return Ok(variant) \
23459                 — divergence signals the string-owned forward pair \
23460                 and the string-owned reverse axis have drifted apart"
23461            );
23462            assert_eq!(
23463                <super::DepList as TryFrom<String>>::try_from(borrowed_forward),
23464                Ok(variant),
23465                "Four-corner round-trip on DepList::{variant:?} \
23466                 through From<&DepList> for String then \
23467                 TryFrom<String> for DepList must return Ok(variant) \
23468                 — divergence signals the borrowed-input forward \
23469                 corner and the owned-input reverse corner have \
23470                 drifted apart"
23471            );
23472        }
23473    }
23474
23475    #[test]
23476    fn dep_list_try_from_owned_string_rejects_unknown_wire_strings() {
23477        // Rejection witness on the `impl TryFrom<String> for DepList`
23478        // — mirrors the rejection corpus the paired borrowed
23479        // [`TryFrom<&str>`] and owned [`TryFrom<Vec<u8>>`] axes
23480        // already pin on the owned-`String` surface. Every non-`:`-
23481        // prefixed-kebab-case byte-string must land on `Err(())` so a
23482        // future accidental widening of the trait impl's accept-set
23483        // (a stray `_ if s.eq_ignore_ascii_case(":Deps") => Ok(…)`
23484        // case-fold path, a silent inclusion of a rebrand alias like
23485        // `":packages"`, an English rebrand `":dev-deps"` in reverse
23486        // arm-order that would silently swap the two arms, a stray
23487        // `Option::unwrap_or_default`-shape fallback that maps unknown
23488        // inputs onto a default arm rather than the trait-idiomatic
23489        // `Err(())`) trips at caixa-core test time. Sweep mirrors the
23490        // sibling `dep_list_try_from_str_rejects_unknown_byte_strings`
23491        // (b8f25d5) and `dep_list_try_from_vec_bytes_rejects_unknown_and_non_utf8_bytes`
23492        // (42091cb) rejection witnesses on the parallel str-view and
23493        // byte-owned reverse-projection axes.
23494        let rejected: &[&str] = &[
23495            "",
23496            " ",
23497            "\t",
23498            "\n",
23499            ":deps ",
23500            " :deps",
23501            ":DEPS",
23502            ":Deps",
23503            ":Deps-Dev",
23504            ":deps_dev",
23505            ":deps-development",
23506            ":dev-deps",
23507            ":packages",
23508            ":packages-dev",
23509            "deps",
23510            "deps-dev",
23511            "Prod",
23512            "Dev",
23513            "prod",
23514            "dev",
23515            "\":deps\"",
23516            "\":deps-dev\"",
23517            ":deps\n",
23518            ":deps-dev\n",
23519        ];
23520        for &input in rejected {
23521            let owned: String = input.to_string();
23522            assert_eq!(
23523                <super::DepList as TryFrom<String>>::try_from(owned),
23524                Err(()),
23525                "TryFrom<String> impl on DepList must reject the \
23526                 non-wire byte-string {input:?} with Err(()) — silent \
23527                 acceptance signals an accept-set widening off the \
23528                 paired DepList::from_wire resolver"
23529            );
23530            // Cross-axis witness: the owned-`String` axis must agree
23531            // with the borrowed-`&str` axis on every rejected input —
23532            // the two paths share one substrate-primitive resolver by
23533            // construction.
23534            assert_eq!(
23535                <super::DepList as TryFrom<String>>::try_from(input.to_string()),
23536                <super::DepList as TryFrom<&str>>::try_from(input),
23537                "TryFrom<String> and TryFrom<&str> reverse-projection \
23538                 axes on DepList must agree on the non-wire input \
23539                 {input:?} — divergence signals the owned-`String` \
23540                 and borrowed-`&str` reverse paths have drifted off \
23541                 the same substrate-primitive from_wire accessor"
23542            );
23543        }
23544    }
23545}
23546
23547#[cfg(test)]
23548mod dep_source_is_variant_tests {
23549    use super::*;
23550
23551    fn all_variants() -> Vec<(DepSource, &'static str)> {
23552        vec![
23553            (
23554                DepSource::Git {
23555                    repo: "github:pleme-io/caixa-teia".into(),
23556                    tag: Some("v0.1.0".into()),
23557                    rev: None,
23558                    branch: None,
23559                },
23560                "Git",
23561            ),
23562            (
23563                DepSource::Path {
23564                    caminho: "../caixa-teia".into(),
23565                },
23566                "Path",
23567            ),
23568        ]
23569    }
23570
23571    fn predicate_row(s: &DepSource) -> [bool; 2] {
23572        [s.is_git(), s.is_path()]
23573    }
23574
23575    // Fail-before-pass-after pin on the [`gen_platform::IsVariant`]
23576    // derive-generated per-arm predicate partition — for every variant
23577    // in `all_variants()`, the observed 2-slot predicate row must equal
23578    // a one-hot row with the `true` at exactly the same index as the
23579    // variant's declaration order. Expected rows are generated live
23580    // from the enumeration rather than transcribed by hand, so a
23581    // copy-paste flip that reroutes one arm through the wrong predicate
23582    // lane trips at the identity-diagonal assertion the way every peer
23583    // sibling [`DepList`] / [`crate::CaixaKind`] / [`crate::CaixaDialeto`]
23584    // / [`crate::supervisor::RestartStrategy`] / [`crate::supervisor::RestartPolicy`]
23585    // / [`crate::upgrade::UpgradeInstruction`] /
23586    // [`crate::aplicacao::PlacementStrategy`] /
23587    // [`crate::aplicacao::RateLimitUnit`] /
23588    // [`crate::aplicacao::WitTarget`] /
23589    // [`crate::render::PathShapeViolation`] partition pin already does.
23590    #[test]
23591    fn dep_source_is_variant_predicates_partition_the_arm_set() {
23592        let variants = all_variants();
23593        for (idx, (variant, name)) in variants.iter().enumerate() {
23594            let observed = predicate_row(variant);
23595            let mut expected = [false; 2];
23596            expected[idx] = true;
23597            assert_eq!(
23598                observed, expected,
23599                "DepSource::{name} at declaration-order slot {idx} must \
23600                 satisfy exactly one is_* predicate (its own); observed \
23601                 row must equal the one-hot expected row — a drift \
23602                 would silently reroute one `:fonte`-arm consumer \
23603                 through the wrong predicate lane"
23604            );
23605        }
23606    }
23607
23608    // Byte-parity pin on the two field-agnostic `matches!` shapes the
23609    // per-arm arm-discriminator predicates replace at any future
23610    // consumer site (a `:fonte`-shape-only lint rule that flags path
23611    // deps outside dev-caixas via `dep.fonte().is_some_and(DepSource::is_path)`,
23612    // a future admission-webhook that rejects `:fonte` shapes outside
23613    // the `is_git()` accept-set, a caixa-lacre indexing pass that
23614    // dispatches on `s.is_git()` without extracting `repo` / `caminho`).
23615    // Refuses a future accidental split between the derived predicate
23616    // and its `matches!` shape — a hand-rolled shadow impl that
23617    // overrides one path, an accidental rebrand that leaves one
23618    // consumer on the raw `matches!` form — on the two load-bearing
23619    // `:fonte`-arm-discriminator axes every downstream substrate
23620    // consumer of the dep-source axis keys off.
23621    #[test]
23622    fn dep_source_is_git_and_is_path_byte_equal_matches_shape() {
23623        for (variant, name) in all_variants() {
23624            let via_matches_git = matches!(variant, DepSource::Git { .. });
23625            let via_predicate_git = variant.is_git();
23626            assert_eq!(
23627                via_predicate_git, via_matches_git,
23628                "DepSource::{name}.is_git() must byte-equal \
23629                 matches!(_, DepSource::Git {{ .. }}) — otherwise a \
23630                 future converged consumer site would silently \
23631                 disagree with its pre-lift shape"
23632            );
23633            let via_matches_path = matches!(variant, DepSource::Path { .. });
23634            let via_predicate_path = variant.is_path();
23635            assert_eq!(
23636                via_predicate_path, via_matches_path,
23637                "DepSource::{name}.is_path() must byte-equal \
23638                 matches!(_, DepSource::Path {{ .. }}) — otherwise a \
23639                 future converged consumer site would silently \
23640                 disagree with its pre-lift shape"
23641            );
23642        }
23643    }
23644
23645    // Cross-pin against every constructor path that materializes a
23646    // [`DepSource`] shape today (the [`DepSource::default_github`]
23647    // resolver-side fallback that materializes an unpinned
23648    // `github:<org>/<nome>` git shorthand, the [`Dep::git`] author-
23649    // surface constructor that materializes a pinned `:tag`-carrying
23650    // `DepSource::Git`, a hand-rolled `DepSource::Path` the dev-mode
23651    // fixture family builds inline). Every constructor's return must
23652    // satisfy the arm-discriminator predicate the constructor's
23653    // variant name matches — a future constructor addition (an
23654    // in-tree registry-fetch pin, a `DepSource::Feira` variant the
23655    // enclosing docstring already names as a trajectory item) surfaces
23656    // as a build-time failure that names the offending drift when its
23657    // return arm doesn't route through the paired predicate.
23658    #[test]
23659    fn dep_source_constructors_route_through_paired_is_variant_predicate() {
23660        let via_default_github = DepSource::default_github("pleme-io", "caixa-teia");
23661        assert!(
23662            via_default_github.is_git(),
23663            "DepSource::default_github must materialize a Git-arm shape — \
23664             a future constructor that routed through a non-Git arm \
23665             (a registry-fetch pin, a `DepSource::Feira` promotion) \
23666             would silently split the resolver's unpinned-shorthand \
23667             materializer from the sole_pin() precedence cascade"
23668        );
23669        assert!(
23670            !via_default_github.is_path(),
23671            "DepSource::default_github must NOT materialize a Path-arm \
23672             shape — the paired negation pin"
23673        );
23674
23675        let via_dep_git = Dep::git("caixa-teia", "^0.1", "github:pleme-io/caixa-teia", "v0.1.0")
23676            .fonte
23677            .expect("Dep::git materializes a Some(fonte)");
23678        assert!(
23679            via_dep_git.is_git(),
23680            "Dep::git's `:fonte` materialization must land on the Git \
23681             arm — the author-surface pinned-git constructor's return \
23682             must route through the paired predicate"
23683        );
23684        assert!(!via_dep_git.is_path(), "paired negation pin");
23685
23686        let via_path = DepSource::Path {
23687            caminho: "../caixa-teia".into(),
23688        };
23689        assert!(
23690            via_path.is_path(),
23691            "the dev-mode Path-arm materialization must satisfy is_path()"
23692        );
23693        assert!(!via_path.is_git(), "paired negation pin");
23694    }
23695
23696    // ── `dep_nome_axis_reason_ctors!` — the `{ nome: String, <axis>:
23697    //    String, reason: String }` three-slot envelope on `DepError`,
23698    //    strict sibling of the peer `dep_nome_only_ctors!` (792aa92) on
23699    //    the one-slot `{ nome }` envelope, `dep_nome_list_ctors!`
23700    //    (6f5e0cd) on the two-slot `{ nome, list: &'static str }`
23701    //    envelope, `fonte_caminho_ctors!` (f85f145) on the two-slot
23702    //    `{ nome, caminho }` envelope, and `fonte_caminho_byte_ctors!`
23703    //    (0e35793) on the three-slot `{ nome, caminho, byte }` envelope.
23704
23705    #[test]
23706    fn versao_invalid_ctor_matches_struct_literal_wrap() {
23707        assert_eq!(
23708            DepError::versao_invalid("caixa-teia", "^0..1", "invalid comparator".to_string()),
23709            DepError::VersaoInvalid {
23710                nome: "caixa-teia".to_string(),
23711                versao: "^0..1".to_string(),
23712                reason: "invalid comparator".to_string(),
23713            },
23714            "versao_invalid ctor must produce byte-equal \
23715             `DepError::VersaoInvalid` to the pre-lift struct-literal wrap",
23716        );
23717    }
23718
23719    #[test]
23720    fn fonte_repo_shape_ctor_matches_struct_literal_wrap() {
23721        assert_eq!(
23722            DepError::fonte_repo_shape(
23723                "caixa-teia",
23724                "-upload-pack=evil",
23725                "leading dash rejected".to_string(),
23726            ),
23727            DepError::FonteRepoShape {
23728                nome: "caixa-teia".to_string(),
23729                repo: "-upload-pack=evil".to_string(),
23730                reason: "leading dash rejected".to_string(),
23731            },
23732            "fonte_repo_shape ctor must produce byte-equal \
23733             `DepError::FonteRepoShape` to the pre-lift struct-literal wrap",
23734        );
23735    }
23736
23737    #[test]
23738    fn caracteristica_invalid_ctor_matches_struct_literal_wrap() {
23739        assert_eq!(
23740            DepError::caracteristica_invalid(
23741                "caixa-teia",
23742                "bad feature!",
23743                "embedded space rejected".to_string(),
23744            ),
23745            DepError::CaracteristicaInvalid {
23746                nome: "caixa-teia".to_string(),
23747                caracteristica: "bad feature!".to_string(),
23748                reason: "embedded space rejected".to_string(),
23749            },
23750            "caracteristica_invalid ctor must produce byte-equal \
23751             `DepError::CaracteristicaInvalid` to the pre-lift struct-literal wrap",
23752        );
23753    }
23754
23755    #[test]
23756    fn dep_nome_axis_reason_ctors_route_nome_axis_and_reason_through_uniformly() {
23757        // Cross-axis routing pin: sweep the three constructor input axes
23758        // (`nome: &str`, `<axis>: &str`, `reason: String`) through
23759        // distinct-per-axis fixtures against every generated arm in the
23760        // [`dep_nome_axis_reason_ctors!`] macro, so any wrapper-side
23761        // lowercase / trim / truncate on the two `&str` axes — a silent
23762        // field swap between `nome`, the middle `<axis>` field, and
23763        // `reason`, or a `reason` axis silently rerouted through
23764        // `.to_string()` instead of forwarded owned — surfaces here rather
23765        // than at a downstream diagnostic-shape mismatch. Peer of the
23766        // sibling `fonte_caminho_byte_ctors_route_nome_caminho_and_byte_
23767        // through_to_string` (0e35793) cross-axis routing pin on the same
23768        // envelope's `{ nome, caminho, byte }` three-slot family and of
23769        // the peer `dep_nome_list_ctors_route_nome_and_list_through_
23770        // uniformly` (6f5e0cd) pin on the same envelope's two-slot family
23771        // — extended here onto the `{ nome, <axis>: String, reason:
23772        // String }` three-slot envelope so every substrate-primitive ctor
23773        // family in caixa-core's `DepError` envelope guarantees each field
23774        // routes the caller's value verbatim through `.to_string()` (or
23775        // owned-forward for `reason: String`) in declared field order.
23776        // Distinct-per-axis fixtures rule out any two-axis swap
23777        // (`nome` ↔ `<axis>`, `<axis>` ↔ `reason`) that would still pass a
23778        // same-fixture-per-axis pin.
23779        let nome = "sibling-teia";
23780        let axis = "distinct-axis-value";
23781        let reason = "distinct rejection sentence".to_string();
23782        assert_eq!(
23783            DepError::versao_invalid(nome, axis, reason.clone()),
23784            DepError::VersaoInvalid {
23785                nome: nome.to_string(),
23786                versao: axis.to_string(),
23787                reason: reason.clone(),
23788            },
23789            "versao_invalid must route `nome` → `nome`, `axis` → `versao`, \
23790             `reason` → `reason` in declared field order",
23791        );
23792        assert_eq!(
23793            DepError::fonte_repo_shape(nome, axis, reason.clone()),
23794            DepError::FonteRepoShape {
23795                nome: nome.to_string(),
23796                repo: axis.to_string(),
23797                reason: reason.clone(),
23798            },
23799            "fonte_repo_shape must route `nome` → `nome`, `axis` → `repo`, \
23800             `reason` → `reason` in declared field order",
23801        );
23802        assert_eq!(
23803            DepError::caracteristica_invalid(nome, axis, reason.clone()),
23804            DepError::CaracteristicaInvalid {
23805                nome: nome.to_string(),
23806                caracteristica: axis.to_string(),
23807                reason: reason.clone(),
23808            },
23809            "caracteristica_invalid must route `nome` → `nome`, \
23810             `axis` → `caracteristica`, `reason` → `reason` in declared \
23811             field order",
23812        );
23813    }
23814
23815    // ── `dep_nome_axis_ctors!` — the `{ nome: String, <axis>: String }`
23816    //    two-slot envelope on `DepError`, missing rung between
23817    //    `dep_nome_only_ctors!` (792aa92) on the one-slot `{ nome }`
23818    //    envelope and `dep_nome_axis_reason_ctors!` (5621f8a) on the
23819    //    three-slot `{ nome, <axis>: String, reason: String }` envelope.
23820    //    Sibling of `dep_nome_list_ctors!` (6f5e0cd) on the peer
23821    //    two-slot `{ nome, list: &'static str }` envelope (same slot
23822    //    count, `&'static str` axis instead of owned `String` axis).
23823
23824    #[test]
23825    fn fonte_pin_empty_ctor_matches_struct_literal_wrap() {
23826        assert_eq!(
23827            DepError::fonte_pin_empty("caixa-teia", ":tag"),
23828            DepError::FontePinEmpty {
23829                nome: "caixa-teia".to_string(),
23830                pin: ":tag".to_string(),
23831            },
23832            "fonte_pin_empty ctor must produce byte-equal \
23833             `DepError::FontePinEmpty` to the pre-lift struct-literal wrap \
23834             on the same `(&str, &str)` fixture",
23835        );
23836    }
23837
23838    #[test]
23839    fn fonte_pin_ambiguous_ctor_matches_struct_literal_wrap() {
23840        assert_eq!(
23841            DepError::fonte_pin_ambiguous("caixa-teia", ":tag, :rev"),
23842            DepError::FontePinAmbiguous {
23843                nome: "caixa-teia".to_string(),
23844                pins: ":tag, :rev".to_string(),
23845            },
23846            "fonte_pin_ambiguous ctor must produce byte-equal \
23847             `DepError::FontePinAmbiguous` to the pre-lift struct-literal \
23848             wrap on the same `(&str, &str)` fixture",
23849        );
23850    }
23851
23852    #[test]
23853    fn caracteristica_duplicate_ctor_matches_struct_literal_wrap() {
23854        assert_eq!(
23855            DepError::caracteristica_duplicate("caixa-teia", "http"),
23856            DepError::CaracteristicaDuplicate {
23857                nome: "caixa-teia".to_string(),
23858                caracteristica: "http".to_string(),
23859            },
23860            "caracteristica_duplicate ctor must produce byte-equal \
23861             `DepError::CaracteristicaDuplicate` to the pre-lift \
23862             struct-literal wrap on the same `(&str, &str)` fixture",
23863        );
23864    }
23865
23866    #[test]
23867    fn fonte_pin_ambiguous_ctor_matches_owned_string_join_shape() {
23868        // Owned-`String` routing pin: thread the real
23869        // `set.join(", ")` `String` carrier through the ctor's
23870        // `&str`-parameter Deref coercion, so the ambiguity-arm
23871        // wire-up site's actual `&set.join(", ")` shape stays
23872        // byte-equal to a direct `":tag, :rev"` literal. A future
23873        // parameter-shape change silently dropping the Deref
23874        // coercion route (e.g., a switch to `impl Into<String>`)
23875        // surfaces here rather than at the wire-up's compile
23876        // error far from the ctor definition.
23877        let set: Vec<&'static str> = vec![":tag", ":rev"];
23878        let joined: String = set.join(", ");
23879        assert_eq!(
23880            DepError::fonte_pin_ambiguous("caixa-teia", &joined),
23881            DepError::FontePinAmbiguous {
23882                nome: "caixa-teia".to_string(),
23883                pins: ":tag, :rev".to_string(),
23884            },
23885            "fonte_pin_ambiguous ctor must accept an owned-`String` \
23886             `&set.join(\", \")` carrier via Deref coercion — the exact \
23887             shape the ambiguity-arm wire-up site passes into it",
23888        );
23889    }
23890
23891    #[test]
23892    fn dep_nome_axis_ctors_route_nome_and_axis_through_to_string_uniformly() {
23893        // Cross-axis routing pin: sweep the two constructor input axes
23894        // (`nome: &str`, `<axis>: &str`) through distinct-per-axis
23895        // fixtures against every generated arm in the
23896        // [`dep_nome_axis_ctors!`] macro, so any wrapper-side lowercase /
23897        // trim / truncate at codegen time — a silent field swap between
23898        // `nome` and the middle `<axis>` field, or a `<axis>` axis
23899        // silently rerouted through the wrong field on any one variant
23900        // — surfaces here rather than at a downstream diagnostic-shape
23901        // mismatch. Peer of the sibling
23902        // `dep_nome_list_ctors_route_nome_and_list_through_uniformly`
23903        // (6f5e0cd) pin on the same envelope's peer two-slot family
23904        // (`{ nome, list: &'static str }`) and of the sibling
23905        // `dep_nome_axis_reason_ctors_route_nome_axis_and_reason_through_uniformly`
23906        // (5621f8a) pin on the same envelope's three-slot `{ nome,
23907        // <axis>: String, reason: String }` family — extended here onto
23908        // the `{ nome, <axis>: String }` two-slot envelope so the last
23909        // per-`DepError`-two-slot-owned-axis rung on the ctor-family
23910        // ladder guarantees each field routes the caller's value
23911        // verbatim through `.to_string()` in declared field order.
23912        // Distinct-per-axis fixtures rule out any two-axis swap
23913        // (`nome` ↔ `<axis>`) that would still pass a same-fixture-
23914        // per-axis pin.
23915        let nome = "sibling-teia";
23916        let axis = "distinct-axis-value";
23917        assert_eq!(
23918            DepError::fonte_pin_empty(nome, axis),
23919            DepError::FontePinEmpty {
23920                nome: nome.to_string(),
23921                pin: axis.to_string(),
23922            },
23923            "fonte_pin_empty must route `nome` → `nome`, `axis` → `pin` \
23924             in declared field order",
23925        );
23926        assert_eq!(
23927            DepError::fonte_pin_ambiguous(nome, axis),
23928            DepError::FontePinAmbiguous {
23929                nome: nome.to_string(),
23930                pins: axis.to_string(),
23931            },
23932            "fonte_pin_ambiguous must route `nome` → `nome`, `axis` → `pins` \
23933             in declared field order",
23934        );
23935        assert_eq!(
23936            DepError::caracteristica_duplicate(nome, axis),
23937            DepError::CaracteristicaDuplicate {
23938                nome: nome.to_string(),
23939                caracteristica: axis.to_string(),
23940            },
23941            "caracteristica_duplicate must route `nome` → `nome`, \
23942             `axis` → `caracteristica` in declared field order",
23943        );
23944    }
23945
23946    #[test]
23947    fn nome_invalid_ctor_matches_struct_literal_wrap() {
23948        // Equivalence pin: the ctor produces byte-equal
23949        // `DepError::NomeInvalid` to the pre-lift open-coded struct-
23950        // literal that cloned the offending `:deps :nome` verbatim and
23951        // forwarded the [`crate::render::is_dns_1123_label`]-shaped
23952        // owned `reason` payload at the caller site inside
23953        // [`Dep::validate`]. Guards any future field-addition /
23954        // reordering / accessor-return tweak on the variant. Sibling of
23955        // the peer four-slot `fonte_pin_shape` ctor equivalence pins
23956        // (below) and the sibling three-slot
23957        // `dep_nome_axis_reason_ctors_route_nome_axis_and_reason_through_uniformly`
23958        // pin on the same envelope's three-slot `{ nome, <axis>: String,
23959        // reason: String }` family.
23960        let nome = "Caixa-Teia";
23961        let reason = crate::render::is_dns_1123_label(nome).unwrap_err();
23962        let via_ctor = DepError::nome_invalid(nome, reason.clone());
23963        let via_literal = DepError::NomeInvalid {
23964            nome: nome.to_string(),
23965            reason,
23966        };
23967        assert_eq!(
23968            via_ctor, via_literal,
23969            "nome_invalid(nome, reason) must byte-equal the open-coded \
23970             NomeInvalid struct-literal on the same `(nome, reason)` fixture"
23971        );
23972        assert_eq!(
23973            via_ctor.to_string(),
23974            via_literal.to_string(),
23975            "Display byte-string must byte-equal the open-coded struct-literal"
23976        );
23977    }
23978
23979    #[test]
23980    fn nome_invalid_ctor_routes_nome_and_reason_through_to_string_uniformly() {
23981        // Boundary-sweep pin on the ctor's two-slot projection: sweep
23982        // the two ctor input axes (`nome: &str`, `reason: String`)
23983        // through distinct-per-axis fixtures against a representative
23984        // set of DNS-1123-refused `:deps :nome` byte-strings, so any
23985        // wrapper-side silent lowercase / trim / truncate at codegen
23986        // time — a silent field swap between `nome` and `reason`, an
23987        // accidental `nome`-side `.to_lowercase()` shim, or a `.into()`
23988        // divergence on the `reason` axis — surfaces at caixa-core
23989        // build time rather than at a downstream diagnostic consumer
23990        // that reads `err.nome` / `err.reason` back and gets a different
23991        // value than the one it stored. Peer of the sibling
23992        // `dep_nome_axis_ctors_route_nome_and_axis_through_to_string_uniformly`
23993        // (7f7c950) pin on the same envelope's peer two-slot family
23994        // (`{ nome, <axis>: String }`) — extended here onto the
23995        // `{ nome, reason: String }` two-slot rung the sole `NomeInvalid`
23996        // variant carries. Distinct-per-axis fixtures rule out any
23997        // two-axis swap (`nome` ↔ `reason`) that would still pass a
23998        // same-fixture-per-axis pin. The sweep list carries a mixed
23999        // DNS-1123-refused set (uppercase-carrying, underscore-carrying,
24000        // dot-carrying, leading-hyphen, trailing-hyphen, slash-carrying,
24001        // over-63-byte) so a future silent per-input normalization
24002        // surfaces on the arm that diverges.
24003        for nome in [
24004            "Caixa-Teia",
24005            "caixa_teia",
24006            "caixa.teia",
24007            "-caixa-teia",
24008            "caixa-teia-",
24009            "caixa/teia",
24010            &"a".repeat(64),
24011        ] {
24012            let reason = crate::render::is_dns_1123_label(nome)
24013                .expect_err("fixture must be a DNS-1123-refused label");
24014            let via_ctor = DepError::nome_invalid(nome, reason.clone());
24015            let DepError::NomeInvalid {
24016                nome: stored_nome,
24017                reason: stored_reason,
24018            } = via_ctor
24019            else {
24020                panic!("nome_invalid must construct NomeInvalid for {nome:?}");
24021            };
24022            assert_eq!(
24023                stored_nome, nome,
24024                "nome slot must round-trip verbatim through `.to_string()` for {nome:?}"
24025            );
24026            assert_eq!(
24027                stored_reason, reason,
24028                "reason slot must forward the owned `String` verbatim for {nome:?}"
24029            );
24030        }
24031    }
24032
24033    #[test]
24034    fn validate_nome_invalid_arm_routes_through_nome_invalid_ctor() {
24035        // End-to-end pin: the sole in-crate wire-up site
24036        // ([`Dep::validate`]'s DNS-1123 refusal arm) routes through
24037        // [`DepError::nome_invalid`] and the observed `Err` byte-equals
24038        // the ctor's output on the same DNS-1123-refused `:deps :nome`
24039        // fixture, with identical `Display` rendering. A future silent
24040        // de-lift of the wire-up back to the open-coded struct-literal
24041        // trips this test at caixa-core build time rather than at a
24042        // downstream diagnostic consumer far from the wire-up commit.
24043        // Sibling of the peer
24044        // `nome_invalid_diagnostic_carries_offending_name` pattern-match
24045        // pin on the same wire-up — extended here from a `matches!`
24046        // shape check to a byte-identity + Display parity route through
24047        // the ctor.
24048        let d = Dep::simple("Caixa_Teia", "^0.1");
24049        let observed = d.validate().unwrap_err();
24050        let reason = crate::render::is_dns_1123_label("Caixa_Teia")
24051            .expect_err("fixture must be DNS-1123-refused");
24052        let expected = DepError::nome_invalid("Caixa_Teia", reason);
24053        assert_eq!(
24054            observed, expected,
24055            "Dep::validate's DNS-1123 refusal arm must byte-equal \
24056             nome_invalid(nome, reason)"
24057        );
24058        assert_eq!(
24059            observed.to_string(),
24060            expected.to_string(),
24061            "Display byte-string parity"
24062        );
24063    }
24064}