Skip to main content

qualified_process_ref

Function qualified_process_ref 

Source
pub fn qualified_process_ref(ns: &str, name: &str) -> String
Expand description

Substrate-primitive composer for the canonical namespace-qualified process reference — the <ns>/<name> string every consumer that grepped, keyed, or annotated a Process by “which cluster location owns it” hand-authored as format!("{ns}/{name}") at scattered sites across the workspace. Lifted onto tatara-process (from its prior home at tatara_reconciler::ssapply::qualified_process_ref) so callers BELOW the reconciler layer — tatara-export-worker (which does NOT depend on tatara-reconciler) and tatara-pool-reconciler — reach the SAME composer the reconciler-side sites do, closing the previously-open substrate corner where a downstream consumer re-authored the shape by hand rather than routing through the ONE primitive.

The <ns>/<name> shape is the workspace-wide convention for “how to name a namespaced K8s resource in a single string” — the same shape the K8s API server itself uses in OwnerReference pretty-printing, in the holder slot of crate::table::ClaimRecord, and in the tatara.pleme.io/process annotation every reconciler-emitted resource carries. Callers with a live crate::prelude::Process compose through crate::prelude::Process::coordinates_or_defaults + Self (this function); callers with bare (ns: &str, name: &str) params (CLI-arg driven binaries, metadata-agnostic composers) call this directly.

The 2-arg signature encodes the invariant “the qualified reference is EXACTLY <ns>/<name>, in that order, joined by a single / separator” at the type level — a caller cannot accidentally swap the two axes (which would produce <name>/<ns> and silently break every downstream grep) nor omit either half, the way a pre-lift hand-authored format!("{name}/{ns}") or format!("{ns}-{name}") typo would.

A future change to the reference shape — a <ns>/<name>@<gen> multi-generation variant for attestation grepping, a <cluster>/<ns>/<name> cross-cluster form, a normalization (case-fold, unicode-safe collation) that must apply everywhere — lands at ONE substrate function here and every downstream composer (annotation seed, ProcessTable claim key, label selector, owner metadata, export-worker run-id fallback, receipt-owner filter) inherits the upgrade mechanically.

Theory anchor: THEORY.md §VI.1 (generation over composition — the <ns>/<name> shape recurred at hand-authored sites past the ★★ PRIME-DIRECTIVE ≥ 2 duplication trigger, and is lifted onto the ONE workspace-wide owner here). THEORY.md §II.1 invariant 5 (composition preserves proofs — a regression that swapped the two axes or the separator at ONE site surfaces at [qualified_process_ref_tests::qualified_process_ref_joins_ns_and_name_with_slash] rather than as silent drift at every downstream annotation seed / claim key / label selector / run-id / receipt-owner filter).