pub async fn default<K>(
api: &Api<K>,
name: &str,
) -> Result<Either<K, Status>, Error>Expand description
Delete a kube Resource through its namespaced or cluster-scoped
Api with the default DeleteParams posture.
Owns the 2-link wire-side chain
api.delete(&name, &DeleteParams::default()) at ONE substrate owner
across every workspace consumer. Sibling to
crate::create::default on the wire-verb axis (DELETE vs POST),
and to crate::patch::merge on the same axis (DELETE vs PATCH).
A future normalization of the delete posture (an injectable
grace_period_seconds slot for bounded-grace scale-downs, a
PropagationPolicy::Foreground gate for delete-must-block-until-
children-gone postures, a preconditions.uid slot for optimistic
concurrency at reap sites, a dry-run gate) lands at THIS ONE
function and every downstream consumer inherits the upgrade
mechanically — no per-site edit at any of the seven listed callers
or at future consumers (a future receipt-GC controller, a future
pool-tombstone reaper, a future cross-namespace cascade sweeper).
The returned Either<K, Status> matches Api::delete verbatim: a
server that returns the pre-delete resource body populates the
Left arm; a server that returns a bare Status (the more common
path for finalized deletes and for cluster-scoped resources)
populates the Right. Every current consumer either discards the
result (let _ = process_api.delete(...)) or matches only on
Ok(_) | Err(_), so the concrete Either shape flows through
without a per-site change; a future consumer that needs to
distinguish “the API returned the pre-delete body” from “the API
returned bare status” reads the Either directly at its callsite.
Theory anchor: THEORY.md §VI.1 (generation over composition — the
2-link api.delete(&name, &DeleteParams::default()) chain recurred
at 7 hand-authored sites past the ★★ PRIME-DIRECTIVE ≥ 2 duplication
trigger and is lifted onto the ONE workspace-wide substrate owner
here). THEORY.md §II.1 invariant 5 (composition preserves proofs —
the pin block below binds the primitive at fail-before-pass-after
granularity, so a regression that drifts DeleteParams::default()
to a non-default posture — a stray grace_period_seconds, an
accidental PropagationPolicy::Foreground, a preconditions.uid
— surfaces at delete::tests::* rather than as silent operator-
facing skew across the seven consumer sites (a hung reap because
the server blocks on children, a fast-SIGKILL scale-down that
tramples a still-shutting-down probe, a mistaken uid-precondition
that refuses to reap a recreated slot)).