feat(#192): Phase 5 — --fail-if-out-of-sync + HK_ACCEPT_01 acceptance test
The dogfood phase: adds the exact flag musehub#192's plan specified for wiring agent-config drift detection into a real pre-commit hook, and proves the whole mechanism (Phases 1-5) end-to-end against this session's actual incident.
Added: - muse/cli/commands/agent_config.py: `muse agent-config status --fail-if-out-of-sync` — exits 1 only when an adapter that actually exists on disk is out of sync with .museagent.md (out_of_sync_count > 0). Never fails on missing/unconfigured adapters -- this checks for drift, not completeness, matching the exact incident this ticket exists to prevent (a real, generated AGENTS.md silently going stale). Opt-in: the flag's absence never changes exit code, so existing scripts relying on `status` always exiting 0 are unaffected. - tests/test_cmd_commit_hooks_acceptance.py (HK_ACCEPT_01): reproduces this session's real .museagent.md drift incident end-to-end against a real disposable repo -- init, agent-config init/set/sync, commit, wire up the dogfood hook (`muse agent-config status --fail-if-out-of-sync`), install it, edit .museagent.md without re-syncing an embed adapter, confirm the commit is blocked (naming the exact failing command), confirm --no-verify still gets it through visibly, then confirms re-syncing before committing is what actually fixes it (not just bypassing the check). Runs the hook against *this checkout's* source via a PATH shim + PYTHONPATH, not the separately installed stable `muse` binary -- otherwise the hook would silently exercise old code lacking the new flag (confirmed by first running this without the shim: it failed with "unrecognized arguments: --fail-if-out-of-sync" against the real installed CLI, which is exactly the muse-vs-muse-dev distinction this same ticket's investigation surfaced).
Tests: tests/test_cmd_agent_config.py::TestFailIfOutOfSync (6 tests, HK_40) -- exits 0 when nothing configured/in sync, exits 1 only on a real embed-adapter drift (not a plain missing adapter), --json still prints before the failing exit, flag's absence never changes exit code. Both written and confirmed red (argparse "unrecognized arguments") before implementation.
Full regression: tests/test_cmd_agent_config.py + test_agent_config_envelope.py (144 tests) + all hooks test files + tests/test_app.py = 244/244 passed.
This closes out the muse-side implementation of musehub#192. Remaining work: wire .musehooks.toml + `muse hooks install` into the real ~/ecosystem and ~/ecosystem/musehub repos (not test fixtures) as the actual dogfood deployment, and close the ticket.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
23 symbols
Files Changed
+1
~2
1184 in snapshot
0 comments
muse hub commit comment sha256:4407cfcab2133159237fd72a5d5fb98724ef53e6d36324695c3885626e3797c0 --body "your comment"
No comments yet. Be the first to start the discussion.