Files
automaton/tasks/complete/add-outputs-retention/CODE_REVIEW.md
T

25 lines
1.0 KiB
Markdown

# Code Review: add-outputs-retention
## SPEC coverage
| Requirement | Status |
|-------------|--------|
| R1 — `_get_retention` helper from `outputs.retention` | ✓ |
| R2 — GC executes on every tick (post-write) | ✓ step 10.5 inside `_loop_lock` |
| R3 — Retention = 0 means no GC | ✓ `if retention <= 0: return` |
| R4 — GC failure doesn't crash tick | ✓ OSError caught → WARNING log + swallow |
| R5 — No new pip deps | ✓ stdlib only |
## Cross-script impact
- `scripts/loop-runner.py`: pure addition; no existing function changed.
- `templates/loops/self-improvement/loop.json`: new `outputs.retention: 20` field.
- `scripts/status.py`: no changes needed (create-loop template provides the default; runner reads, not status.py).
## Off-by-one fix
GC formula was `cutoff = max_seen - retention` (kept retention+1 groups). Found during test execution when `test_gc_keeps_recent_deletes_old` showed 21 remaining instead of 20. Fixed to `cutoff = max_seen - retention + 1`. Good test coverage.
## Verdict
PASS — proceed to bug_find.