# Test: `.processes.kill`
Integration test planning for the `.processes.kill` command. See [commands.md](../../commands.md) for specification.
## Test Factor Analysis
### Factor 1: `dry::` (Boolean, optional, default 0)
| absent | Default: real kill | Default behavior |
| 0 | Explicit: real kill | Explicit false |
| 1 | Preview only: no kill | Explicit true |
| 2 | Out-of-range boolean | Invalid: exit 1 |
### Factor 2: `force::` (Boolean, optional, default 0)
| absent | Default: SIGTERM → wait → SIGKILL | Default behavior |
| 0 | Explicit: SIGTERM sequence | Explicit false |
| 1 | SIGKILL directly (no SIGTERM) | Explicit true |
| 2 | Out-of-range boolean | Invalid: exit 1 |
### Factor 3: Interaction: `dry::1` vs `force::1`
| `dry::1` alone | Preview: "no active processes" or "[dry-run] would kill N" |
| `force::1` alone | Real SIGKILL |
| `dry::1 force::1` | dry wins: preview only, no kill |
### Factor 4: Active processes (Environmental — /proc global state)
| none | No claude processes | No-op |
| one or more | Processes found | Kill sequence |
**Note:** Tests cannot control /proc state. All automated tests must handle both empty
and non-empty /proc results gracefully.
### Factor 5: Unknown parameters
| none | No unknown params | Happy path |
| present | e.g. `bogus::x` | Invalid: exit 1 |
---
## Test Matrix
### Positive Tests
| TC-310 | No processes → "no active processes", exit 0 | P | 0 | F1=absent, F4=none | [mutation_commands_test.rs] |
| TC-311 | `dry::1` no processes → "no active processes" | P | 0 | F1=1, F4=none | [mutation_commands_test.rs] |
| TC-312 | `dry::1 force::1` no processes → "no active processes" | P | 0 | F1=1, F2=1, F3, F4=none | [mutation_commands_test.rs] |
### Negative Tests
| TC-465 | `bogus::x` → exit 1 | N | 1 | F5=present | new |
| TC-466 | `dry::2` → exit 1, out-of-range boolean | N | 1 | F1=2 | new |
| TC-467 | `force::2` → exit 1, out-of-range boolean | N | 1 | F2=2 | new |
### Summary
- **Total:** 6 tests (3 positive, 3 negative)
- **Negative ratio:** 50.0% ✅ (≥40%)
- **TC range:** TC-310 to TC-467
---
## Coverage Verification
### Exit Status Coverage
| 0 | Success (kill or no-op) | TC-310, TC-311, TC-312 |
| 1 | Invalid arguments | TC-465 through TC-467 |
| 2 | Kill verification failure (post-kill survivors) | Manual only (FR-09) |
### Kill Sequence Coverage (FR-09)
| No processes (no-op) | TC-310 |
| `dry::1` no processes | TC-311 |
| `dry::1 force::1` (dry wins) | TC-312 |
| Real SIGTERM sequence (with processes) | Manual (requires live processes) |
| `force::1` SIGKILL (with processes) | Manual (requires live processes) |
TC-310 through TC-312 cover the "no processes" path. Real kill sequences require
live claude processes and are manual-only tests.
---
## Test Case Details
### TC-310: No processes → "no active processes"
**Goal:** When no claude processes exist, command reports no-op and exits 0.
**Setup:** No claude processes in /proc (may not be guaranteed).
**Command:** `cm .processes.kill`
**Expected:** Exit 0; stdout contains "no active processes" or similar.
**Verification:** exit code 0.
**Pass Criteria:** Exit 0.
**Note:** TC must accept both "no processes" and "processes killed" outcomes due to global /proc.
---
### TC-311: `dry::1` no processes
**Goal:** Dry-run with no processes shows no-op message without side effects.
**Setup:** None.
**Command:** `cm .processes.kill dry::1`
**Expected:** Exit 0; appropriate message.
**Verification:** exit code 0.
**Pass Criteria:** Exit 0.
---
### TC-312: `dry::1 force::1` → dry wins
**Goal:** `dry::` takes precedence over `force::`.
**Setup:** None.
**Command:** `cm .processes.kill dry::1 force::1`
**Expected:** Exit 0; no kill executed.
**Verification:** exit code 0.
**Pass Criteria:** Exit 0.
---
### TC-465: `bogus::x` → exit 1
**Goal:** Unknown parameter rejected before scan.
**Setup:** None.
**Command:** `cm .processes.kill bogus::x`
**Expected:** Exit 1.
**Verification:** exit code 1.
**Pass Criteria:** Exit 1.
---
### TC-466: `dry::2` → exit 1
**Goal:** Boolean parameter only accepts 0 or 1.
**Setup:** None.
**Command:** `cm .processes.kill dry::2`
**Expected:** Exit 1.
**Verification:** exit code 1.
**Pass Criteria:** Exit 1.
---
### TC-467: `force::2` → exit 1
**Goal:** Boolean parameter only accepts 0 or 1.
**Setup:** None.
**Command:** `cm .processes.kill force::2`
**Expected:** Exit 1.
**Verification:** exit code 1.
**Pass Criteria:** Exit 1.