pub fn kube_root_bool_field(value: &Value, field: &str) -> Option<bool>Expand description
Read a top-level <field>: scalar-boolean leaf-toggle on a K8s
custom resource or helm-values-shaped YAML document as
Option<bool> — the composed scalar-boolean root-axis accessor
that folds the shape value.get(field).and_then(|v| v.as_bool())
onto one substrate-primitive method call the caller reads as
intent (kube_root_bool_field(<value>, <FIELD>) — “read this
document’s top-level <FIELD>: boolean scalar”) rather than as a
two-hop readback → shape-gate chain.
Structural mirror of the sibling kube_spec_bool_field (4f6fc93)
on the sub-spec.<field> axis and the value-level kube_bool
(4785e45) primitive one altitude down: the three peers all fold
the trailing .as_bool() shape-gate closure onto the axis’s
scalar-Value accessor primitive, differing only in which outer
walk the axis carries (kube_spec_field’s two-hop spec → as_mapping → get(<field>) on the spec-anchored peer, the direct
one-hop value.get(field) on the root-anchored peer here, the
same value.get(field) on the value-level primitive). Peer of
the shape-gated root-axis siblings kube_root_str_field
(ae83f4e) on the string-scalar arity, kube_root_map_field
(723f6d7) on the sub-mapping arity, and kube_root_seq_field
(d61e46e) on the sequence arity: the four together close the
root-axis {str, seq, map, bool} four-arity shape-gate family to
structural parity with the sub-spec: {str, seq, map, bool}
four-arity family already closed at the sub-axis level
(c4fe21d — str; fc64ed7 — seq; 27fc2ee — map;
4f6fc93 — bool). The root-level variant needs no outer shape
gate on value itself — serde_yaml::Value::get already
short-circuits to None on non-Mapping outer values — so the
composition folds on one hop rather than the two hops the
spec-anchored peer closes.
Returns None on any of the three short-circuit arms folded
through the underlying composition: the outer value itself
carries a non-Mapping YAML type (the kube_root_field
Value::get outer-arm short-circuit — Value::Null,
Value::String, Value::Sequence, Value::Number,
Value::Bool, Value::Tagged — serde_yaml::Value::get
gates the outer shape without a separate .as_mapping()
closure), the requested top-level <field>: axis-key is absent
from the outer Mapping (the kube_root_field trailing
Value::get none-arm — a legally-omitted top-level scalar-
boolean sub-block per the document’s shape contract), or the
top-level <field>: value is present but carries a non-boolean
YAML type (the trailing .as_bool() shape-gate short-circuit —
a schema-invalid top-level sub-block per the CR’s OpenAPI
schema but tolerated here as None so the readback stays a
total function, mirroring the sibling
kube_root_str_field / kube_root_seq_field /
kube_root_map_field posture). The returned bool is a fresh
primitive value (booleans carry no underlying borrow the way the
sibling string / sequence / mapping accessors preserve) — the
caller decides whether to assert_eq!(_, Some(<expected>)) for
a determinism pin, .expect(...) for a load-bearing toggle
identity, or .unwrap_or(<default>) for a substrate-side
default fallback.
The field axis stays parametric (rather than pinned to a
specific canonical scalar-boolean top-level axis-key as a
separate helper) so the same lift closes every top-level
scalar-boolean sub-block a future per-CR emitter surfaces: the
forecast future Flux-controller CR’s top-level paused: toggle
the sibling kube_root_field docstring at
caixa-core/src/render.rs:21472 already forecasts, a top-level
disabled: opt-out on a future feature-flag envelope shape,
the hypothetical enabled: mode-gate on a per-cluster helm-
values-shaped envelope the future M4 aggregator materializes —
each new top-level scalar-boolean axis reaches this helper with
a new [KUBE_KEY_<AXIS>] const, not a fresh per-arity helper.
Every future top-level <field>: scalar-boolean readback the
M3.x + M4 renderer set materializes (the forecast top-level
paused: / disabled: / enabled: toggles above, the future
mesh.pleme.io/v1alpha1/Aplicacao CR materializer’s top-level
scalar-boolean navigation MESH-COMPOSITION §III.2 #5 admits, the
app-operator’s per-Aplicacao CR reader for a top-level
scalar-boolean toggle, every future test-side top-level
<field>: boolean-scalar probe the caixa-flux / caixa-mesh /
caixa-helm crates add) reaches this one accessor primitive by
construction — no per-consumer two-hop-plus-shape-gate re-inline,
no per-consumer axis-key drift, no coordinated rewrite across
every top-level scalar-boolean readback on a future
serde_yaml surface rebrand or shape-gate shift. Closes the
four-arity shape-gate closure on the top-level axis to
structural parity with the sub-spec.<field> four-arity closure
established at 4f6fc93.