Skip to content

fix: derive the teardown compose path from state for container-less leftovers - #44

Merged
rogerdigital merged 3 commits into
mainfrom
fix/remove-compose-path-from-state
Sep 20, 2026
Merged

rogerdigital merged 3 commits into
mainfrom
fix/remove-compose-path-from-state

Conversation

@rogerdigital

Copy link
Copy Markdown
Owner

The bug

remove --service --purge-data required a compose path read from container labels in both its initial and final ownership checks. With the container gone (the leftover of remove --service without --purge-data, or a manual docker compose down) both checks fail with E_REMOVE_BLOCKED, so fully purging required first resurrecting the runtime with setup — delete-by-first-creating. This was the follow-up deliberately left open in #42.

The fix

When the inspected status has no container, the teardown compose path is derived from the bundle recorded in state (configurationSha256 → config-<sha>/compose.yml), the same derivation repair's recreate-runtime and setup's runtime-recovery use. Ownership requirements are unchanged: the leftover resources must still be labeled as ours (ownership: 'owned'), and without a recorded digest removal still refuses rather than guessing a path. A bundle deleted from disk fails closed through Compose's own file check.

The ownership === 'absent' refusal is unchanged: with nothing left to tear down, the mistake-guard still applies.

Verification

  • Two new unit tests (purge via derived path, refusal without a digest); remove suite 16/16, pnpm verify green.
  • Live acceptance on a real deployment: remove --service (container down, volume kept) → remove --service --purge-data --yes purges the exact owned volume and the managed directory — the sequence that previously failed — and a fresh setup restores a 9/9 healthy instance.

…eftovers

remove --service --purge-data refused to clean up the labeled leftovers
of a container-less deployment because both the initial and final checks
required a compose path read from container labels, forcing an operator
to resurrect the runtime (setup) just to delete it. When the container is
absent, the teardown path now comes from the bundle recorded in state
(configurationSha256); without a recorded digest removal still refuses
rather than guessing.

Verified live: remove --service (container down, volume kept) followed by
remove --service --purge-data --yes purges the volume and managed
directory — a sequence that previously failed with E_REMOVE_BLOCKED — and
a fresh setup restores a 9/9 healthy deployment.
@rogerdigital
rogerdigital merged commit 9b8f544 into main Sep 20, 2026
6 checks passed
@rogerdigital
rogerdigital deleted the fix/remove-compose-path-from-state branch September 20, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant