fix(state): record (compose, overlay) pairs — stop reconstructing compose paths from overlay filenames#23
Merged
Conversation
…enames at teardown Teardown reconstructed each overlay's compose file by splitting the overlay filename on its last hyphen — ambiguous for hyphenated slugs. A root overlay 'feat-worker.yml' in a repo that also has worker/docker-compose.yml was torn down against the wrong compose file, leaving services running. Sessions now persist explicit (compose, overlay) pairs in a compose_overlays field, written at bring_up and used directly by bring_down. Legacy fields are still written so older binaries can tear down new sessions, and state files without the new field fall back to the old filename-based path, so existing sessions keep working. Fixes #9 https://claude.ai/code/session_017UcuvzMKHVfyBCcq8ipAko
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9
Problem
State recorded overlay file paths only; at teardown, the compose file each overlay belongs to was reconstructed by parsing the overlay filename (
compose_file_for_overlaysplits on the last hyphen and treats the suffix as a subdirectory). Slugs contain hyphens, so this is ambiguous:feat-worker, root overlayfeat-worker.yml, repo containsworker/docker-compose.yml(exactly the multi-compose layout this code serves) → the root overlay is torn down againstworker/docker-compose.yml; the actual services keep runningfeat-foodoes contain a hyphen — it returnsNoneonly becauseroot/foo/doesn't exist in the fixtureFix
Stop encoding semantics in filenames.
Sessiongains:bring_up(container + hybrid, both group-loop and single-compose paths) records each pair as it brings the group upbring_downiterates the pairs directly:compose down -f <compose> -f <overlay>, then removes the overlay fileCompatibility, both directions:
overlay_file/overlay_filesfields are still written, so an older binary can tear down sessions created by this versioncompose_overlays(older sessions) fall back to the legacy filename-based path, now clearly marked as legacy-only inmodes/mod.rsTests
compose_overlays_roundtrip,legacy_state_without_compose_overlays_defaults_to_empty(serde compat)bring_down_uses_recorded_pairs_and_removes_overlays— the ambiguous fixture from the issue (slugfeat-worker+ realworker/subdir with its own compose file); asserts pair-driven teardown end-to-end throughContainerMode::bring_down. Verifying the-farguments against a live docker daemon is part of the docker-gated suite proposed in Integration tests cover host mode only — docker/tmux/rollback paths have no end-to-end coverage despite 95% line-coverage mandate #16.cargo fmt --check,cargo clippy -- -D warnings,cargo test(372 + 18) green.https://claude.ai/code/session_017UcuvzMKHVfyBCcq8ipAko
Generated by Claude Code