1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//! Workspace-canonical finalizer keys the tatara controllers stamp on
//! their owned CRDs to gate cascade-delete + orphan-reap on graceful
//! teardown.
//!
//! # Family
//!
//! The reconciler binaries in this workspace own three top-level CRDs
//! that participate in the K8s garbage-collection contract via the
//! `metadata.finalizers` list:
//!
//! - [`PROCESS`] — the [`crate::prelude::Process`] reconciler's
//! finalizer key. Stamped by
//! `tatara-reconciler::phase_machine::handle_pending` via
//! [`crate::patch::ensure_finalizer`]; stripped by `handle_reaped`
//! via `remove_finalizer`.
//! - [`ALLOCATION`] — the [`crate::prelude::EphemeralAllocation`]
//! controller's finalizer key. Reserved by
//! `tatara-pool-reconciler::controller_allocation::reconcile` for
//! the future Bound → Releasing → Released cascade-delete gate.
//! - [`POOL`] — the [`crate::prelude::EphemeralPool`] controller's
//! finalizer key. Reserved by
//! `tatara-pool-reconciler::controller_pool::build_member_process`
//! for the future member-Process orphan-reap gate.
//!
//! [`ALL`] enumerates the three consts in stable declaration order so
//! downstream sweeps (a fleet-wide finalizer audit binary, an ops
//! diagnostic dumping every tatara-owned finalizer on a cluster, a
//! per-key coverage report) iterate through ONE substrate slice
//! rather than three hand-typed literals.
//!
//! # Peer axes
//!
//! Peer to [`crate::annotations`] on the "K8s metadata key that pins
//! a reconciliation contract" axis-family — where [`crate::annotations`]
//! owns keys the reconciler READS or WRITES on OWNED resources
//! (FluxCD `HelmRelease`, `Kustomization`, member `Process` on a pool
//! member), this module owns keys the reconciler stamps on the CRDs
//! IT OWNS (the [`crate::prelude::Process`],
//! [`crate::prelude::EphemeralAllocation`],
//! [`crate::prelude::EphemeralPool`] `metadata.finalizers` list).
//! Both families carry the same `tatara.pleme.io/<slug>` wire-form
//! shape; the finalizer family additionally carries the shared
//! `<owner>-finalizer` suffix — a convention pinned by
//! [`tests::all_carry_finalizer_suffix`] so a future addition to the
//! family cannot silently drift the suffix.
//!
//! # Compounding
//!
//! Pre-lift the three wire-form finalizer literals were spread across
//! three files (the [`crate::PROCESS_FINALIZER`] top-level const at
//! [`crate`] + private `POOL_FINALIZER` / `ALLOC_FINALIZER` consts in
//! `tatara-pool-reconciler`), with no cross-owner coherence pin
//! binding the shared `tatara.pleme.io/<x>-finalizer` shape. A future
//! rename that shifted (e.g.) the group segment to `v2/` or the
//! per-owner suffix to `-guard` had to be applied at three separate
//! files coherently — a partial edit would silently orphan or
//! double-finalize whichever owner missed the update. Post-lift the
//! three consts live at ONE substrate owner + one closed [`ALL`]
//! slice + four family-invariant pins (per-key wire-form parity,
//! per-key `-finalizer` suffix, per-key `tatara.pleme.io/` prefix,
//! cross-key uniqueness).
//!
//! Theory grounding: THEORY.md §VI.1 (generation over composition —
//! the `tatara.pleme.io/<owner>-finalizer` wire-form shape recurred
//! at THREE hand-authored declaration sites past the ★★
//! PRIME-DIRECTIVE ≥ 2 duplication threshold; lifted to ONE
//! per-owner const + ONE `ALL` slice + four family-invariant pins
//! here). THEORY.md §II.1 invariant 5 (composition preserves proofs
//! — the invariant pins bind the family shape at fail-before-pass-
//! after granularity; a future rename that drifted the group prefix
//! or the suffix at ONE arm surfaces at [`tests::all_share_group_prefix`]
//! or [`tests::all_carry_finalizer_suffix`] rather than as silent
//! operator-facing skew at whichever owner's finalizer no longer
//! matches the K8s-side registered wire form).
/// Finalizer key stamped on the [`crate::prelude::Process`]
/// `metadata.finalizers` list by
/// `tatara-reconciler::phase_machine::handle_pending`. The reconciler
/// blocks K8s garbage collection until it has emitted the terminal
/// [`crate::prelude::ProcessAttestation`] receipt and stripped the
/// finalizer at `handle_reaped`.
///
/// Re-exported at the crate root as [`crate::PROCESS_FINALIZER`] for
/// consumers that predate this module.
pub const PROCESS: &str = "tatara.pleme.io/process-finalizer";
/// Finalizer key reserved for the
/// [`crate::prelude::EphemeralAllocation`] controller
/// (`tatara-pool-reconciler::controller_allocation`). Once the Bound
/// → Releasing → Released cascade is wired the controller will
/// stamp/strip this key through the same
/// [`crate::patch::ensure_finalizer`] / `remove_finalizer` primitives
/// the Process reconciler already routes through for [`PROCESS`].
pub const ALLOCATION: &str = "tatara.pleme.io/allocation-finalizer";
/// Finalizer key reserved for the [`crate::prelude::EphemeralPool`]
/// controller (`tatara-pool-reconciler::controller_pool`). Once the
/// member-Process orphan-reap gate is wired the controller will
/// stamp/strip this key at pool birth + pool teardown through the
/// same [`crate::patch::ensure_finalizer`] / `remove_finalizer`
/// primitives.
pub const POOL: &str = "tatara.pleme.io/pool-finalizer";
/// Closed family of tatara-owned finalizer keys in declaration
/// order: [`PROCESS`], [`ALLOCATION`], [`POOL`]. Downstream sweeps
/// (a per-owner coverage report, a fleet-wide finalizer audit
/// binary, an ops diagnostic dumping every tatara-owned finalizer
/// on a cluster) iterate through this ONE slice rather than
/// re-listing the three consts by hand.
///
/// Pinned to length 3 by [`tests::all_matches_declared_family`] so
/// a future addition to the family cannot slip past the coherence
/// harness without landing here first.
pub const ALL: & = &;
/// Shared group prefix every finalizer key in the [`ALL`] family
/// carries — the same `tatara.pleme.io/` group segment every
/// tatara-owned CRD annotation + finalizer key rides through, matching
/// the `#[kube(group = "tatara.pleme.io", …)]` derive slot on the CRD
/// structs. Pinned across every arm by
/// [`tests::all_share_group_prefix`] so a future rename of the group
/// (a shift to `v2/` under a migration, a per-fleet override) lands
/// at ONE substrate const here + the paired CRD derive slots rather
/// than at three independent finalizer wire forms.
pub const GROUP_PREFIX: &str = "tatara.pleme.io/";
/// Shared owner-suffix every finalizer key in the [`ALL`] family
/// carries — the convention `<owner>-finalizer` distinguishes a
/// finalizer key from a signal/label/annotation key on the same
/// group. Pinned across every arm by
/// [`tests::all_carry_finalizer_suffix`].
pub const FINALIZER_SUFFIX: &str = "-finalizer";