testsAndMisc/docs/superpowers/contracts/usage-report-main-tests-2026-08-17.json
Krzysztof kuhy Rudnicki ec67387c07 usage_report: cover usage_report.py 47% -> 100%
25 tests in four files, no production change - the module is
byte-identical to HEAD. Lands before the split for the usual reason.

Covers the CLI surface (every default, every flag, main's dispatch), both
run paths including the shared empty-window-means-a-full-day fallback,
_run_since's no-data path and both state-advance branches, the
clipboard/emit side (tool selection, a failing tool, no tool at all),
_preflight's three outcomes, _aggregate_segments with a gap day and with
a present-but-empty log, and _log_descriptions.

Also covers _compute_window, which turns out to be dead: a shim
documented as "kept for backwards import compatibility" with zero callers
anywhere in the repo. Tested rather than deleted here, since removing it
is a behaviour change that does not belong in a coverage commit - but it
is a deletion candidate.

185 stmts / 44 branches, 0 missed. Directory: 179 -> 204 passing.

No suppressions: mypy rejected a `list.append(...) or 0` lambda, replaced
with a real closure; ten ruff S108 findings on hardcoded /tmp paths became
/nonexistent sentinels, which is more accurate anyway since those paths
are never opened.

Written as two files of 273 and 282 lines, then split to four under the
cap before committing - the DropZone lesson from earlier today.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 12:21:21 +02:00

18 lines
1.5 KiB
JSON

{
"title": "Cover usage_report.py before splitting it",
"objective": "usage_report.py is 426 lines against a 250-line cap and sat at 47% coverage, with the uncovered half being the CLI, the two run paths, the clipboard/emit side and the segment aggregation - i.e. most of what a split would move. This commit raises it to 100% line and branch coverage first, so the following split can be verified against tests that predate the seam. No production code changes here.",
"acceptance_criteria": [
"usage_report.py reaches 100% line and branch coverage, from 47%",
"usage_report.py is byte-identical to HEAD - this commit adds tests only",
"The directory test count rises by exactly the number of tests added (179 -> 204) with no existing test altered",
"No suppression of any kind: no noqa, no type: ignore, no lowered threshold",
"Every new test file is under the 250-line cap, so the over-cap total does not rise"
],
"out_of_scope": [
"The split of usage_report.py itself, which is the next commit",
"Deleting the dead _compute_window shim - a behaviour change that does not belong in a coverage commit",
"meta/scripts/optimize_vscode.py and the three transcribe_* files, also over cap and untested"
],
"verifier": "pytest linux_configuration/tests/ --cov=usage_report --cov-branch --cov-report=term-missing for the coverage claim and the test count; pre-commit run --files for lint; bash ~/utils/scripts/check_file_length.sh --all to confirm no new over-cap file."
}