Expand description
Substrate primitive over the K8s metav1.Condition.type wire-
form axis every writer + reader in this workspace hand-authored
as a bare &'static str literal on the ProcessStatus.conditions[]
wire. Sibling on the same wire-form axis-family to
crate::k8s_condition::K8sConditionStatus — that primitive
owns the closed set of the status slot ("True" / "False"
/ "Unknown"); THIS primitive owns the closed set of the
type slot ("Ready" / "Attested") every
crate::status::ProcessCondition carries.
§Why the substrate lives here
Pre-lift the two type wire-form literals were hand-authored at
FOUR production sites across two crates past the ★★ PRIME-
DIRECTIVE ≥ 2 duplication threshold — each writer + reader pair
silently coupled by exact-case ASCII agreement on the type slot:
crate::status::ProcessCondition::ready— writer,type_: "Ready".into()on theReadyrow emitted whenever the reconciler observes a Process running.crate::status::ProcessCondition::not_ready— writer,type_: "Ready".into()on the same row emitted withstatus: "False"whenever the reconciler observes a Process failing.crate::status::ProcessCondition::attested— writer,type_: "Attested".into()on theAttestedrow emitted whenever a three-pillar attestation lands.tatara-reconciler::ssapply::ready_condition_value— reader,if typ != "Ready" { continue; }filter that isolates theReady-typed condition out of every FluxCD / Deployment / HelmRelease / Kustomization / StatefulSet resource’sstatus.conditions[]list before classifying itsstatusslot throughcrate::k8s_condition::K8sConditionStatus::from_wire_str.
Every site restated the SAME &'static str byte-literal
("Ready" × 3 or "Attested" × 1). A copy-paste that lower-cased
one letter ("ready" — silently invalid; the K8s API server does
NOT case-normalize condition types, and every observer that
selects by exact case would silently miss the drifted row),
swapped the semantic slot (a writer that emitted "Attested" on
the Ready row would silently drift the reconciler’s
ready_condition_value observer to always-Unknown on that
resource), or introduced an alternate spelling drifts the wire-
form at ONE end and leaves the other end unable to classify the
condition — the reader falls through to ReadyState::Unknown and
every Flux / Deployment readiness gate silently reports “not
observed” for the remainder of the resource’s life. Post-lift
each writer composes with ProcessConditionType::<V>.as_wire_str()
and the reader binds through ProcessConditionType::from_wire_str (...); the wire-form literal lives at ONE substrate owner and a
drift at either end becomes unrepresentable at the closed-set
level.
§Closed-set completeness
ProcessCondition is the crate-owned condition type — the K8s
API does NOT dictate the type slot’s closed set (unlike the
status slot’s three-value set at
crate::k8s_condition::K8sConditionStatus); each CRD owns its
own type alphabet. Every ProcessCondition constructor in
crate::status pre-lift wrote exactly one of the two literals
"Ready" or "Attested"; the enum below IS that closed set.
A future ProcessCondition constructor that adds a third condition
type (e.g. "Reconverging" for the SIGHUP re-convergence path,
"Terminated" for the Zombie/Reaped gate) would land as ONE new
variant at this ONE substrate owner AND ONE new
ProcessCondition::<constructor> at crate::status AND (if
the reader wants to classify it) ONE new arm at
ssapply::ready_condition_value — exhaustively checked by the
compiler at every downstream consumer that pattern-matches on
the closed set.
§Byte-shape parity
as_wire_str returns the EXACT-CASE ASCII byte-shape every pre-
lift site restated inline — pinned bytewise at
[tests::as_wire_str_matches_pre_lift_literals_bytewise] against
a hand-authored fixture table of the pre-lift strings. A
regression that lower-cased a variant, added a whitespace prefix,
or reshaped the byte-form under a future #[derive(Serialize)]
serde(rename = "…") drift surfaces at the pin rather than as
silent operator-facing wire-form skew across every
ProcessCondition writer + ready_condition_value reader in the
workspace.
from_wire_str is the invertible partner — a round-trip through
from_wire_str(v.as_wire_str()) yields Some(v) for every
variant, pinned at
[tests::wire_form_round_trip_holds_for_every_variant]. Any
input outside the closed set (case-drift, whitespace, empty
string, unrelated K8s condition-type literals) returns None;
the closed-set nature is pinned at
[tests::from_wire_str_rejects_case_drift_and_unknown].
§Naming — as_wire_str, not as_str
Same discipline as the crate::k8s_condition::K8sConditionStatus
sibling — the method signals that the returned &'static str is
the K8s WIRE FORM (the exact byte-shape the API server accepts on
the type slot of a metav1.Condition), not a debug-print or
Display projection. A caller that reads .as_wire_str()
immediately understands the return value is safe to write into a
JSON payload without any further normalization; a call spelled
.as_str() reads as a generic string projection and invites
callers to reach for .to_lowercase() / .trim() normalizations
that would break the wire form.
§#[must_use] on as_wire_str
Every consumer feeds the returned &'static str into either a
String::from(...) composition (writer side, going into
ProcessCondition.type_) or a pattern-match / equality arm
(reader side, filtering status.conditions[]). Dropping the
return means the wire-form projection was computed for no
observable reason — the attribute surfaces that as a warning at
every consumer site.
Theory anchor: THEORY.md §II.1 invariant 5 (composition preserves
proofs — the wire-form literal at ONE substrate owner means the
writer + reader sides of the K8s status.conditions[].type wire
agree bytewise by construction; a drift at either end becomes
unrepresentable at the closed-set level, not “detected at
runtime by a mismatched observer log line”). THEORY.md §III
(typescape — the ProcessCondition type slot’s closed set is a
first-class Rust enum, not a stringly-typed wire-form).
THEORY.md §VI.1 (generation over composition — the two-literal
closed set recurred at FOUR hand-authored sites past the ★★
PRIME-DIRECTIVE ≥ 2 duplication trigger, and is lifted to ONE
substrate owner here on the K8s-Condition type wire-form axis).
Enums§
- Process
Condition Type - The closed set of
metav1.Condition.typevalues everycrate::status::ProcessConditionconstructor emits and every downstreamstatus.conditions[]classifier filters against. Wire-form is the exact-case ASCII literal ("Ready","Attested"); a case-drifted variant would silently miss the reader’s byte-exact filter.