claude_version 1.6.1

Claude Code version manager: install, upgrade, and session lifecycle
Documentation
# Test: `count::`

Edge case coverage for the `count::` parameter. See [param/readme.md](../../../../docs/cli/param/readme.md) and [feature/001_version_management.md](../../../../docs/feature/001_version_management.md) for specification.

### Scope

- **Purpose**: Edge case tests for the `count::` parameter.
- **Responsibility**: Boundary values, invalid inputs, type violations, and default behavior for `count::`.
- **Commands:** `.version.history`
- **In Scope**: Single-parameter edge cases, validation errors, type checking.
- **Out of Scope**: Command integration (→ `../command/`), group interactions (→ `../param_group/`).

## Test Case Index

| ID | Test Name | Category |
|----|-----------|----------|
| EC-12 | `count::3` → ≤3 version entries in output | Nominal |
| EC-1 | `count::0` → empty output, exit 0 | Boundary: minimum |
| EC-13 | `count::1 v::0` → exactly 1 bare line | Boundary: min useful |
| EC-2 | Absent `count::` → default 10 entries | Default Behavior |
| EC-3 | `count::100` → all available (capped by data) | Boundary: max |
| EC-14 | `count::0 format::json` → empty array `[]` | Boundary: empty JSON |
| EC-4 | `count::-1` → parse error → exit 1 | Invalid: negative |
| EC-15 | `v::abc` → exit 1 (type mismatch) | (companion: v:: type) |
| EC-5 | `count::abc` → exit 1 (type mismatch) | Invalid: type |
| EC-8 | `count::0` exits 0 (empty is not an error) | Empty vs Error |
| EC-9 | `count::` (empty) → exit 1 | Empty Value |
| EC-10 | `count::` only accepted by `.version.history` | Command Scope |
| EC-11 | Very large count (`count::9999`) → capped at data size | Boundary: very large |
| EC-6 | `count::18446744073709551615` (u64::MAX) → exit 1 | Overflow: above i64::MAX |
| EC-7 | `count::9223372036854775807` (i64::MAX) accepted → exit 0 | Boundary: i64::MAX |

## Test Coverage Summary

- Nominal: 1 test
- Boundary (0, 1, 100): 4 tests
- Default Behavior: 1 test
- Invalid (negative, type, empty): 3 tests
- Empty vs Error distinction: 1 test
- Command Scope: 1 test
- Very large boundary: 1 test
- Overflow (above i64::MAX): 1 test
- Boundary (i64::MAX accepted): 1 test

**Total:** 15 edge cases

**Behavioral Divergence Pair:** EC-1 (`count::0` → empty output, exit 0) ↔ EC-2 (absent → default 10 entries, exit 0)

---

### EC-1: `count::0` → empty output, exit 0

- **Given:** Network available (or ignored if zero truncates before fetch).
- **When:** `clv .version.history count::0`
- **Then:** exit 0; stdout is empty.; valid-empty
- **Exit:** 0
- **Source:** [feature/001_version_management.md]../../../../docs/feature/001_version_management.md

---

### EC-2: Absent → default 10

- **Given:** Network available.
- **When:** `clv .version.history`
- **Then:** ≤10 version lines.; default applied
- **Exit:** 0
- **Source:** [param/readme.md — count:: default: 10]../../../../docs/cli/param/readme.md

---

### EC-3: `count::100` → all available

- **Given:** Network available; API has ~66 releases.
- **When:** `clv .version.history count::100 v::0`
- **Then:** exit 0; >10 lines (more than default).; data capped at available count
- **Exit:** 0
- **Source:** [feature/001_version_management.md]../../../../docs/feature/001_version_management.md

---

### EC-4: `count::-1` → exit 1

- **Given:** clean environment
- **When:** `clv .version.history count::-1`
- **Then:** exit code 1 (adapter rejects negative as type error).
- **Exit:** 1
- **Source:** [param/readme.md — count:: type: u64]../../../../docs/cli/param/readme.md
**Note:** Negative integers cannot be stored in u64; unilang adapter exits 1 on parse failure.

---

### EC-5: `count::abc` → exit 1

- **Given:** clean environment
- **When:** `clv .version.history count::abc`
- **Then:** exit code 1.
- **Exit:** 1
- **Source:** [feature/005_cli_design.md]../../../../docs/feature/005_cli_design.md

---

### EC-8: `count::0` is valid-empty (not an error)

- **Given:** Network available.
- **When:** `clv .version.history count::0`
- **Then:** exit 0; stdout empty; no stderr.; empty stdout; no error message
- **Exit:** 0
- **Source:** [feature/001_version_management.md]../../../../docs/feature/001_version_management.md

---

### EC-9: `count::` (empty) → exit 1

- **Given:** clean environment
- **When:** `clv .version.history count::`
- **Then:** exit code 1.
- **Exit:** 1
- **Source:** [feature/005_cli_design.md]../../../../docs/feature/005_cli_design.md

---

### EC-10: `count::` only for `.version.history`

- **Given:** clean environment
- **When:** `clv .version.list count::3`
- **Then:** exit code 1; unknown parameter.
- **Exit:** 1
- **Source:** [feature/005_cli_design.md]../../../../docs/feature/005_cli_design.md

---

### EC-11: Very large `count::9999` → capped at data size

- **Given:** Network available.
- **When:** `clv .version.history count::9999 v::0`
- **Then:** exit 0; ~66 lines (current API data size, not 9999).; line count equals API data size
- **Exit:** 0
- **Source:** [feature/001_version_management.md]../../../../docs/feature/001_version_management.md

---

### EC-6: `count::18446744073709551615` (u64::MAX) → exit 1

- **Given:** clean environment
- **When:** `clv .version.history count::18446744073709551615`
- **Then:** exit code 1; error message mentions `count::`, NOT "fit in target type".; error is user-friendly (no internal unilang message)
- **Exit:** 1
- **Source:** [feature/005_cli_design.md]../../../../docs/feature/005_cli_design.md

---

### EC-7: `count::9223372036854775807` (i64::MAX) accepted → exit 0

- **Given:** Network available (command proceeds past validation; data caps at API size).
- **When:** `clv .version.history count::9223372036854775807 v::0`
- **Then:** exit code 0; output lines ≤ API data size.; (command succeeds; validation does not reject the boundary value)
- **Exit:** 0
- **Source:** [feature/005_cli_design.md]../../../../docs/feature/005_cli_design.md

---

### EC-12: `count::3` → ≤3 version entries in output

- **Given:** network available
- **When:** `clv .version.history count::3`
- **Then:** exit 0; stdout contains at most 3 version entries
- **Exit:** 0
- **Source:** [command/version.md — .version.history]../../../../docs/cli/command/version.md

---

### EC-13: `count::1 v::0` → exactly 1 bare line

- **Given:** network available
- **When:** `clv .version.history count::1 v::0`
- **Then:** exit 0; stdout has exactly 1 line in `{semver}  {YYYY-MM-DD}` bare format
- **Exit:** 0
- **Source:** [command/version.md — .version.history]../../../../docs/cli/command/version.md

---

### EC-14: `count::0 format::json` → empty array `[]`

- **Given:** network available (or irrelevant if zero truncates before fetch)
- **When:** `clv .version.history count::0 format::json`
- **Then:** exit 0; stdout is exactly `[]` (empty JSON array)
- **Exit:** 0
- **Source:** [command/version.md — .version.history]../../../../docs/cli/command/version.md

---

### EC-15: `v::abc` → exit 1 (type mismatch)

- **Given:** clean environment
- **When:** `clv .version.history v::abc`
- **Then:** exit 1; error references type mismatch for Integer parameter
- **Exit:** 1
- **Source:** [param/04_v.md — type validation]../../../../docs/cli/param/04_v.md

---

### Source Functions

| Function | File |
|----------|------|
| `tc426_version_history_count_3` | `integration/read_commands_test.rs` |
| `tc427_version_history_count_0_empty` | `integration/read_commands_test.rs` |
| `tc432_version_history_count_1_json` | `integration/read_commands_test.rs` |
| `tc433_version_history_count_1_v0` | `integration/read_commands_test.rs` |
| `tc434_version_history_count_1_v2` | `integration/read_commands_test.rs` |
| `tc435_version_history_default_count_le_10` | `integration/read_commands_test.rs` |
| `tc436_version_history_count_100_all` | `integration/read_commands_test.rs` |
| `tc446_version_history_negative_count_exits_1` | `integration/read_commands_test.rs` |
| `tc448_version_history_count_abc_exits_1` | `integration/read_commands_test.rs` |
| `tc487_count_u64_max_rejected_with_clear_error` | `cli_args_test.rs` |
| `tc488_count_i64_max_accepted` | `cli_args_test.rs` |
| `count_ec12_count_3_at_most_3_entries` | `integration/count_param_test.rs` |
| `count_ec13_count_1_v0_exactly_one_line` | `integration/count_param_test.rs` |
| `count_ec14_count_0_json_empty_array` | `integration/count_param_test.rs` |
| `count_ec15_v_abc_type_mismatch_exits_1` | `integration/count_param_test.rs` |