pub fn ci_declared_edge_count(ci: &CiRun) -> usizeExpand description
Substrate-canonical per-Acao declared-edge-count projection every
consumer of a borrowed canteiro_types::CiRun that needs the total
number of author-declared deps edges across every
canteiro_types::CiNode keys off — returns the plain usize sum
ci.nodes.iter().map(|n| n.deps.len()).sum() verbatim, without
running canteiro_types::decompose again (the count is a property
of the borrowed run’s shape, not of the owned
canteiro_types::CanteiroDag the sibling decompose_ci returns
— an author-declared cycle carries the same edge count as an
author-declared linear DAG of the same node-and-dep list).
The declared-edge-count axis carries the “how many deps edges did
this repo’s CI author write?” projection every per-Acao consumer
downstream fans on: the caixa_actions::RenderedAcao::edge_count
artifact the M0 renderer’s validate returns (paired with the
topological node-name list from cd.topo_order()), the deferred
sui-supercacheci::canteiro::emit_gha workflow renderer’s
per-workflow jobs.<job>.needs count reconciliation pass (each
needs entry maps 1:1 to a deps edge, so a renderer that emits N
edges must have consumed exactly declared_edge_count needs
entries across the fan-out), a future feira lint --acao per-caixa
admission verb’s per-repo declared-edge summary, a future M4
acao.pleme.io/v1alpha1/Acao CR materializer’s admission webhook
spanning the declared edge count against a per-tenant complexity cap.
Prior to this lift the ci.nodes.iter().map(|n| n.deps.len()).sum()
expression was inlined at two sites — caixa_actions::validate’s
edge_count field construction at caixa-actions/src/lib.rs:159
(the M0 per-Acao renderer’s sole production consumer) and its own
require_acao_view byte-parity pin at caixa-actions/src/lib.rs:735
(which reconstructs the same sum through the compound helper’s
returned &CiRun to pin that the two paths agree) — two open-coded
arithmetic expressions that expressed no compile-time link back to
the typed canteiro_types::CiRun axis, so a future refactor of
the declared-edge-count shape (a promotion of the plain usize
sum to a {intra_workspace, cross_workspace} split once
canteiro_types::CiNode grows a workspace-scoped edge kind, a
per-:ci deps-edge-canonicalization pass that collapses duplicate
edges once the canteiro-types axis grows a set-shaped deps
representation, a per-env-class edge-weight overlay once the M4
EnvClass axis grows a per-edge cost model) would have had to be
threaded through both open-coded copies in lockstep or the M0
renderer’s edge_count artifact would silently disagree with its
own byte-parity pin. Lifting the projection to a typed method on the
substrate primitive means every downstream consumer of the Acao’s
declared-edge-count surface reaches for exactly one typed
dispatch — the resolver’s accept-set migrates as a unit on any
future axis addition.
The docstring on require_acao_view already named this expression
verbatim (“the borrowed run for per-canteiro_types::CiNode axes
(ci.nodes.iter().map(|n| n.deps.len()).sum() for the declared edge
count …)”) but the substrate carried no primitive for it — the
citation was documentation-only, and the two open-coded call sites
re-expressed the arithmetic each time. This lift closes that gap:
the docstring now cites the substrate primitive by name and every
consumer reaches for the same ci_declared_edge_count one-liner.
Peer of the sibling require_ci / decompose_ci /
require_acao_view per-Acao primitives on the substrate’s
per-kind renderer entry-gate surface, extended onto the “borrowed
canteiro_types::CiRun scalar projection” axis (the two prior
primitives return borrowed / owned structural artifacts; this one
returns a plain usize scalar over the borrowed run’s node-list
shape). Same “one typed dispatch on the substrate primitive, thin
projections at each consumer” discipline the peer per-Aplicacao
crate::aplicacao::AplicacaoSpec::port_for_destination scalar
projection carries on the per-Aplicacao :entrada port-resolution
axis, extended onto the per-Acao :ci declared-edge-count axis.
Named ci_declared_edge_count (rather than declared_edge_count)
to keep the substrate-side helper namespace explicit that the input
axis is a :ci slot — matching the peer require_ci /
decompose_ci ci_-prefix-shaped naming convention the sibling
per-Acao substrate primitives already carry, so a caller reading
caixa_core::ci_declared_edge_count(ci) sees the axis at the
helper name rather than at a lifted-out use alias.