Skip to content

test: integration coverage for cmd_broken / cmd_revive / cmd_discard #124

@CoreyRDean

Description

@CoreyRDean

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:

  1. cmd_broken: list with 0 tombstones, list with N tombstones including stale ones, sort order.
  2. cmd_revive solo path: trips a fake job, revive, assert subprocess was spawned with correct env + revive override file written.
  3. cmd_revive DAG path: same but with DAG invocation state present — assert `dag-runner.py --resume ` was invoked.
  4. cmd_revive stale/missing session: correct error paths.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions