Follow-up from PR #109 author's known-limitations.
Problem
PR #109 added unit tests for the four tombstone helper functions but does NOT cover the three user-facing commands that operate on them: `cmd_broken`, `cmd_revive`, `cmd_discard`. These involve subprocess spawning and filesystem mutations that need integration-style fixtures.
Given PR #56 added both solo-revive and DAG-resume paths, and follow-up issues have identified real bugs in `cmd_revive` (env-var passthrough, double --resume), proper integration coverage is now higher-priority.
Scope
Minimum coverage:
- cmd_broken: list with 0 tombstones, list with N tombstones including stale ones, sort order.
- cmd_revive solo path: trips a fake job, revive, assert subprocess was spawned with correct env + revive override file written.
- cmd_revive DAG path: same but with DAG invocation state present — assert `dag-runner.py --resume ` was invoked.
- cmd_revive stale/missing session: correct error paths.
- cmd_discard: removes tombstones for named job, returns correct count.
Use `unittest.mock.patch` for `subprocess.Popen` to avoid spawning real jobs. Use `tempfile.TemporaryDirectory` + JOBS_DIR patching (same pattern as existing tests).
Acceptance
- Tests isolated from real `~/.clauck` via tempdir + env patching.
- All three command paths covered with positive + negative cases.
- CI green.
Follow-up from PR #109 author's known-limitations.
Problem
PR #109 added unit tests for the four tombstone helper functions but does NOT cover the three user-facing commands that operate on them: `cmd_broken`, `cmd_revive`, `cmd_discard`. These involve subprocess spawning and filesystem mutations that need integration-style fixtures.
Given PR #56 added both solo-revive and DAG-resume paths, and follow-up issues have identified real bugs in `cmd_revive` (env-var passthrough, double --resume), proper integration coverage is now higher-priority.
Scope
Minimum coverage:
Use `unittest.mock.patch` for `subprocess.Popen` to avoid spawning real jobs. Use `tempfile.TemporaryDirectory` + JOBS_DIR patching (same pattern as existing tests).
Acceptance