Repository navigation
Description
ApplyOp({ target: "arm", delete: "owned-only" }) issues an ARM deployment in
Complete mode, which deletes every resource in the resource group that is not in
the template — including resources chant does not own and never applied.
The claim
lexicons/temporal/src/op/activities/apply.ts:179-181:
* Apply declared source to the cloud via the target's native mechanism.
* Deletes (when enabled) are limited to chant-owned orphans by construction —
* every delete path is scoped to the ownership marker.
And :46-48:
* - `owned-only` — deletes only chant-owned orphans, via the target's native
* prune/complete mechanism scoped to the ownership marker.
The docs repeat it. guide/reconciling-lifecycle.mdx: "Deletes ride the native
delete path scoped to the ownership marker, so they only ever touch
chant-owned orphans."
What the arm branch does
:113-127:
export function applyCommand(
target: ShellApplyTarget,
env: string,
output: string,
deleteMode: DeleteMode,
): string {
const deletes = deleteMode !== "never";
switch (target) {
case "cloudformation":
return `aws cloudformation deploy --template-file ${output} --stack-name ${env} …`;
case "arm": {
const mode = deletes ? " --mode Complete" : " --mode Incremental";
return `az deployment group create --resource-group ${env} --template-file ${output}${mode}`;
}
}
}No tag filter, no marker, no scoping of any kind. ARM Complete mode's contract is
resource-group-wide: it removes everything in the group that the template does
not declare. managed-by: chant does not enter into it.
So for the arm target, owned-only and gated are both
"delete everything in this resource group that isn't in my template."
The CloudFormation branch is fine — the stack genuinely is the boundary, and a
resource outside it is untouched. The kubectl branch is fine — #1075 moved it to
the k8s lexicon's server-side apply with a marker-scoped prune. ARM is the one
target where the native mechanism's blast radius is the whole container and
nothing narrows it.
The test encodes it as correct
apply.test.ts:13-14:
test("arm uses Complete mode only when deleting", () => {
expect(applyCommand("arm", "rg", "t.json", "owned-only")).toContain("--mode Complete");So the behaviour is asserted, and the assertion is what makes the guarantee
false. Any fix has to change this test, not satisfy it.
chant already has the safe version and ApplyOp doesn't use it
azApply (lexicons/azure/src/op/activities/az-apply.ts) applies per-resource
ARM PUTs and prunes through pruneArmOrphans (:410), which filters on
isChantOwned(tags) (:363) before issuing any delete. That is the marker-scoped
delete the docblock describes. nativeApply shells out to az deployment instead
and never reaches it.
#1204 recorded the transport correction for exactly this reason — #707 shipped as
per-resource ARM PUT, not az deployment, because floci-az has no deployments
provider. The applier moved; ApplyOp did not follow.
Note also that azApply's own docblock (:352) says floci-az drops resource
tags, so its owned-only prune is inert against the emulator and only takes effect
against real Azure. Whichever path this lands on, that caveat needs to be a test,
not a comment.
Options
- Route the arm target through
azApply. The delete becomes marker-scoped
by construction, andApplyOpstarts using the applier that shipped. Largest
change, correct outcome, and it is the same move feat(k8s): server-side apply — chant field manager + conflict surface #1075 made for kubectl. - Refuse the combination.
target: "arm"withdeleteother thannever
fails at build time with a message naming the reason. Honest and small;
removes a capability people may be using. - Keep Complete mode, drop the guarantee. Document that
armdeletes at
resource-group scope and is not marker-scoped, and require an explicit
acknowledgement flag. Cheapest, and it makesowned-onlymean two different
things depending on target, which is worse than either of the above.
(1) is the right end state and (2) is a defensible stopgap while it lands.
(3) should not ship — a delete mode whose scope depends on the target is exactly
the kind of thing the ownership model exists to prevent.
Verification
- A test asserting that an
armapply withdelete: "owned-only"does not issue
a delete against a resource in the group carrying no chant marker. Assert on
the transport, not on the returned command string. - The existing
apply.test.ts:13assertion is replaced, not kept.
Related
- feat(core): applier conformance harness + shared write-path contract #1446 — the write-path contract; assertion 4 of the proposed conformance suite
("owned-only prune deletes exactly the owned orphan and never issues a delete
against the foreign one, asserted on the transport") is the general form of the
test this needs. - chore: verify + close GCP/Azure appliers (#706/#707) #1204 / chant has no Azure apply path: add an Azure applier (per-resource ARM PUT → floci-az / real ARM) #707 — the Azure transport correction that
ApplyOpdidn't follow. - feat(k8s): server-side apply — chant field manager + conflict surface #1075 — the kubectl branch making this same move.
Activity
lex00 commentedon Aug 3, 2026
The general form of this is #1446 (shared write-path contract + conformance harness) — its assertion 4 asserts owned-only prune on the transport rather than on a returned command string. Routing option 1 here is the same change #1449 proposes for every non-kubectl target.
docs(apply): deletes are bounded by the target's mechanism, not by th…
docs(apply): deletes are bounded by the target's mechanism, not by th…
lex00 commentedon Aug 3, 2026
Docs corrected on main in #1453 (37751bc) — the guarantee no longer appears anywhere, and
guide/ops.mdxnow states the per-target delete scope in a table with a caution naming the workaround.That is documentation only. The behaviour is unchanged and this issue stays open:
applyCommandstill emits--mode Completefor bothowned-onlyandgated, andapply.test.ts:13still asserts it. Replacing that assertion belongs to whichever routing option lands here.fix(temporal): route the arm apply target through azApply, so owned-o…
docs(apply): the arm target is owned-only now, so stop documenting th…
fix(temporal): route the arm apply target through azApply, so owned-o…
lex00 commentedon Aug 3, 2026
Decision: option 2 now, option 1 as the follow-up.
Ship the build-time refusal first so the destructive combination cannot be reached by accident, then route
armthroughazApply— which is also half of #1449.So this issue becomes the refusal, and the routing is tracked separately. Taking it now.
feat(core): an apply contract and conformance harness, so an applier …
fix(fly,azure): stop dropping a plan entry and a prunable orphan on t…
feat: finish #1446 — ownership through core, and every applier on the…