mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-03 14:13:26 +00:00
* Add self-healing: detect and stop rogue containers Adds the ability to detect and stop "rogue" containers - stacks running on hosts they shouldn't be according to config. Changes: - `cf refresh`: Now scans ALL hosts and warns about rogues/duplicates - `cf apply`: Stops rogue containers before migrations (new phase) - New `--no-rogues` flag to skip rogue detection Implementation: - Add StackDiscoveryResult for full host scanning results - Add discover_stack_on_all_hosts() to check all hosts in parallel - Add stop_rogue_stacks() to stop containers on unauthorized hosts - Update tests to include new no_rogues parameter * Update README.md * fix: Update refresh tests for _discover_stacks_full return type The function now returns a tuple (discovered, rogues, duplicates) for rogue/duplicate detection. Update test mocks accordingly. * Rename "rogue" terminology to "stray" for consistency Terminology update across the codebase: - rogue_hosts -> stray_hosts - is_rogue -> is_stray - stop_rogue_stacks -> stop_stray_stacks - _discover_rogues -> _discover_strays - --no-rogues -> --no-strays - _report_rogue_stacks -> _report_stray_stacks "Stray" better complements "orphaned" (both evoke lost things) while clearly indicating the stack is running somewhere it shouldn't be. * Update README.md * Move asyncio import to top level * Fix remaining rogue -> stray in docstrings and README * Refactor: Extract shared helpers to reduce duplication 1. Extract _stop_stacks_on_hosts helper in operations.py - Shared by stop_orphaned_stacks and stop_stray_stacks - Reduces ~50 lines of duplicated code 2. Refactor _discover_strays to reuse _discover_stacks_full - Removes duplicate discovery logic from lifecycle.py - Calls management._discover_stacks_full and merges duplicates * Add PR review prompt * Fix typos in PR review prompt * Move import to top level (no in-function imports) * Update README.md * Remove obvious comments