# REF-2167: Evolve-Run-20260401-085641

**Applies to:** FXA project
**Last updated:** 2026-04-01
**Last reviewed:** 2026-04-01
**Status:** Active

---

## What Is It?

Run log for Evolve-CLI (SOP-2149) execution on 2026-04-01.

---

## Signals

### Test Failures
None. 395 tests passed in 4.43s.

### Code Quality (ruff)
Zero issues. Clean output.

### Coverage Gaps
Overall: 95%. Key gaps:
- `status_cmd.py` 89% — empty docs JSON path (lines 22-30) untested
- `create_cmd.py` 91% — 22 lines uncovered (spec mode validation, error paths)
- `fmt_cmd.py` 92% — 19 lines uncovered (edge cases in table formatting)
- `plan_cmd.py` 93% — 8 lines uncovered (raw section fallback, malformed doc path)
- `validate_cmd.py` 92% — 11 lines uncovered
- `parser.py` 99% — 2 lines uncovered (lines 194, 287)

### Source Analysis
15 findings (5 medium, 10 low). Key medium findings:
1. **Duplicate phase formatting** in plan_cmd.py (lines 72-125): `_format_phase_llm` and `_format_phase_human` share ~80% logic
2. **Duplicate validation** in create_cmd.py: prefix/ACID callbacks (lines 28-43) duplicated in spec mode (lines 323-342)
3. **Broad exception handling** in 6 locations across _helpers.py, validate_cmd.py, fmt_cmd.py, search_cmd.py, read_cmd.py
4. **Dead code in fmt_cmd.py**: redundant `while` loop padding and `num_cols` guards (num_cols always 3)
5. **Redundant branch in parser.py** (lines 219-228): else branch has unreachable condition

### SOP vs Code Gap
No actionable gaps found. CLI implements all core SOPs (create, read, update, list, search, validate, fmt, where, guide, plan, status, index, changelog, setup, spec).

---

## Candidates

| # | Target | Change | Evidence |
|---|--------|--------|----------|
| C1 | plan_cmd.py | Deduplicate `_format_phase_llm`/`_format_phase_human` into parameterized function | Source analysis: 80% code overlap |
| C2 | create_cmd.py | Reuse validation callbacks in spec mode | Source analysis: duplicate validation |
| C3 | parser.py | Simplify HistoryRow parsing redundant branch | Source analysis: unreachable condition |
| C4 | fmt_cmd.py | Remove dead code guards in table formatting | Source analysis: num_cols always 3 |
| C5 | tests/test_status_cmd.py | Add test for empty docs JSON output path | Coverage: status_cmd.py 89% |
| C6 | Multiple files | Narrow broad exception handlers | Source analysis: 6 locations |

---

## Evaluation

Weights: Test verifiability 35% / Scope restraint 30% / Backward compat 20% / Necessity 15%

| # | TV (35%) | SR (30%) | BC (20%) | N (15%) | Score | Pass? |
|---|----------|----------|----------|---------|-------|-------|
| C1 | 9 | 9 | 10 | 7 | **8.90** | YES |
| C2 | 7 | 6 | 8 | 7 | **6.90** | NO |
| C3 | 8 | 9 | 9 | 6 | **8.20** | YES |
| C4 | 7 | 8 | 9 | 5 | **7.40** | YES |
| C5 | 10 | 10 | 10 | 7 | **9.55** | YES |
| C6 | 6 | 4 | 7 | 6 | **5.60** | NO |

**Discarded:** C2 (6.90 < 7.0), C6 (5.60 < 7.0)
**Passing:** C1 (8.90), C3 (8.20), C4 (7.40), C5 (9.55)

---

## Implementation

### C1: Deduplicate plan_cmd formatters — IMPLEMENTED

- **Issue:** frankyxhl/alfred#10
- **Branch:** `chore/10-evolve-cli-20260401`
- **PRP:** FXA-2168 (R2: Codex 9.2, Gemini 9.6)
- **CHG:** FXA-2169
- **TDD:** 8 snapshot tests added, `_format_phase_llm` + `_format_phase_human` → `_format_phase`, 403 tests pass
- **Code review:** Codex 9.85, Gemini 9.7
- **Hard gate:** pytest 100%, ruff clean

### C3 + C5: Batch implementation — IMPLEMENTED

- **Issue:** frankyxhl/alfred#12
- **PRP:** FXA-2170 (R4: Codex 9.3, Gemini 9.6)
- **CHG:** FXA-2171
- **TDD:** C3 parser simplify + 1 edge-case test, C5 two empty-docs tests via mock, 406 tests pass
- **Code review:** Codex 9.9, Gemini 9.7
- **Hard gate:** pytest 100%, ruff clean

### C4 — DROPPED

Codex R1 correctly identified that `fmt_cmd.py` guards are defensive handling for malformed documents where `num_cols` is derived at runtime from the actual header. Not dead code.

---

## Change History

| Date | Change | By |
|------|--------|----|
| 2026-04-01 | Initial version | — |
