You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(lifecycle): marker-scoped environment teardown — delete what a stack owns in an env, statelessly #1222
Filed for review. Scope and approach not yet confirmed.
Tear down everything a stack owns in one environment, from live markers alone — no build artifacts, no source for that environment, no snapshot required.
Finding
Owned-only deletes exist today only inside ApplyOp prune, which needs the current build (it deletes what is owned and no longer declared). There is no verb for "this environment is over": when the source that produced an environment is gone (a merged branch's review copy, a retired experiment), nothing can enumerate and delete its resources. The ownership marker already carries everything needed — managed-by, stack, env — on the live resource, and describeResources() can read it.
Want
1. chant lifecycle teardown <env>
Sweep each configured lexicon via its observation capability, select resources carrying the chant marker for this stack + env, and delete them through the target's native delete path (same paths ApplyOp prune uses), in reverse dependency order where the target needs it.
Owned-only by construction. Unmarked resources are never candidates. A different stack's marker is never a candidate.
Plan first. Default prints the would-delete set and exits; --yes (or a gate when run as an Op) executes. Refuse to run when <env> is not in environments, and require an explicit extra confirmation for an env named prod/production.
Stateless. Reads live markers only — works with an empty snapshot branch and no dist/.
2. Op form
A TeardownOp composite (temporal lexicon) wrapping the same activity so CI can run it gated, with the existing gate/compensation grammar.
Acceptance
Against an emulator env (Floci): deploy stack A env x and env y, plus a foreign unmarked resource; teardown x deletes exactly env x's resources; y and the foreign resource untouched. E2E-style test, Docker-gated.
Plan output lists resource, type, marker identity; exit 0 with empty set is loud ("nothing owned in "), not silent.
Unobserved kinds (no reader, read failed) are reported as holes and never treated as absent.
Docs page under lifecycle; cross-linked from drift-detection's orphan section.
Scope confirmed (build). Verified against current code; two claims adjusted, one dependency dissolved.
Adjustments: (a) readOwnership (stack+env extraction) exists but is unused — every read path checks only the managed-by key, and the k8s prune selector excludes env; marker-env-scoped selection exists nowhere and is the first thing to build. (b) aws describeResources carries no tags, so aws teardown is stack-level (DeleteStack over the env's stacks from stacks[] or the env-named default, after verifying stack tags carry the marker) — not per-resource selection. (c) The #1221 dependency dissolved: #1396 settled the shape — teardown keys on the marker env, never on parsing physical names.
V1 = chant lifecycle teardown <env>. Plan by default (resource, type, marker identity; loud on empty), --yes executes, refuses envs not in environments (pattern entries per #1221 count), extra confirmation for prod-like names. Selection is marker-scoped by construction: managed-by + this project's stack + <env>. Enumeration/deletion via a new optional teardownOwned lexicon capability so each lexicon reuses its prune primitives; unreadable kinds report as holes (#1089 discipline), never as absent. Stateless: live markers only, no build, no snapshot. Also exported as a function so #1224's harness can call it in afterAll.
Naming: the existing teardown Op builder (npm run teardown) keeps its name; the new activity/builder is envTeardown. CLI verb as filed.
Activity
lex00 commentedon Aug 24, 2026
Scope confirmed (build). Verified against current code; two claims adjusted, one dependency dissolved.
Adjustments: (a)
readOwnership(stack+env extraction) exists but is unused — every read path checks only the managed-by key, and the k8s prune selector excludes env; marker-env-scoped selection exists nowhere and is the first thing to build. (b) awsdescribeResourcescarries no tags, so aws teardown is stack-level (DeleteStack over the env's stacks fromstacks[]or the env-named default, after verifying stack tags carry the marker) — not per-resource selection. (c) The #1221 dependency dissolved: #1396 settled the shape — teardown keys on the marker env, never on parsing physical names.V1 =
chant lifecycle teardown <env>. Plan by default (resource, type, marker identity; loud on empty),--yesexecutes, refuses envs not inenvironments(pattern entries per #1221 count), extra confirmation for prod-like names. Selection is marker-scoped by construction: managed-by + this project's stack +<env>. Enumeration/deletion via a new optionalteardownOwnedlexicon capability so each lexicon reuses its prune primitives; unreadable kinds report as holes (#1089 discipline), never as absent. Stateless: live markers only, no build, no snapshot. Also exported as a function so #1224's harness can call it inafterAll.Naming: the existing
teardownOp builder (npm run teardown) keeps its name; the new activity/builder isenvTeardown. CLI verb as filed.Out (v1): global reverse-dependency ordering (per-lexicon ordering + bounded retry, failures reported), azure emulator E2E (floci-az drops tags; unit-test selection), gcp/helm implementations (follow-on), ever deleting unmarked or foreign-stack resources, snapshot/ledger integration.
Plan: PR 1 core
ResourceMetadata.markerpopulated fromreadOwnership+ conformance checks (M); PR 2 capability type + plan-only CLI verb (M); PR 3 execution:--yes, prod guard, k8s + fly implementations, retry pass, k3d/mudflaps tests (M-L); PR 4 aws stack-level path + floci E2E (M); PR 5 temporalenvTeardownactivity/builder + docs (S).feat(core): surface ownership marker identity on ResourceMetadata (#1222
feat(lifecycle): teardown <env> — marker-scoped enumeration and plan …
feat(lifecycle): teardown <env> — marker-scoped enumeration and plan …
feat(lifecycle): teardown --yes executes the marker-scoped sweep (k8s…
feat(ops): envTeardown activity and builder for environment teardown (#…
feat(aws): stack-level environment teardown with marker-verified Dele…
test(forgejo): runtime E2E for the per-PR preview loop — deploy on op…