Files
ledger cd3b285a66 spark: repair Q125 line-counter verifier and land its graders
verify_line_counter.sh pinned the pre-Q125 tool at a host path
(/root/.hermes/wizard-outputs/spark/line_counter.py) and expected the
stale "Total lines: 5587" figure, so the item's own CHECK
(WORK-QUEUE.md:13377) reddened: usage-line output, rc 1.

Repair (confined to wizard-work/spark):
- verify_line_counter.sh resolves line_counter.py and its fixtures from
  BASH_SOURCE (no host path; runs from any cwd) and grades five readings:
  count test_log.txt == wc -l == 10; csv test_data.csv == csv-module
  field count == 5; count test_blank.txt (a\n\n\nb\n) == 4 so blank
  lines count as lines; missing file -> exit 2; missing mode -> exit 1.
- test_line_counter.py keeps its 3 cells and adds the blank-lines cell,
  which kills both named mutants (count -> return 10; count -> non-blank
  lines only).
- test_blank.txt: new fixture, exactly printf 'a\n\n\nb\n' (4 lines).
- README.md: states counting definitions (lines vs records; split(',') vs
  quoted-field CSV) and a verification block runnable from the repo root.
- VERIFICATION.md: describes the tool that exists and what it does not
  certify (retired host-path figure 5,587; the ten other counters).

Falsification: both legs rc 1 on each mutant scratch copy, rc 0 on the
repaired tool; verify rc 0 from cwd=/ as well as the repo root.
Q125's own CHECK exits 0 at this HEAD.
2026-10-31 17:55:11 +00:00

2.4 KiB

Line Counter Verification Report (Q125)

Artifact

wizard-work/spark/line_counter.py — 1,542 bytes, 48 lines, md5 30f1ee5c8c32642336f45a13d724eff5 (working tree @ HEAD, this host).

Purpose

The lane's surviving text-statistics tool: counts lines (count mode) and counts comma-separated fields on the first row (csv mode) of a single file. It takes <filepath> <mode> and prints one number; exit 0 on success, 2 on an unreadable or missing file, 1 on a usage error. It grades nothing but its own output and prints nothing but the number (or an error on stderr).

Counting definitions (stated in the tool's README section)

  • count <file>: one count per line yielded by iterating the file as text — every \n-terminated line, plus one final count for an unterminated trailing fragment. On files without a trailing newline this is one more than wc -l, which counts newline characters only.
  • csv <file>: fields in the first row via str.split(','). Quoted commas are not unescaped: "a,b",c reads 3 fields, not 2. Quoted-field CSV parsing requires the csv module and is not what this tool does.

What this verification certifies

bash wizard-work/spark/verify_line_counter.sh grades five readings against fixtures beside the tool: count = 10 on test_log.txt, csv = 5 on test_data.csv, count = 4 on test_blank.txt (blank lines are lines), missing file -> exit 2, missing mode -> exit 1. python3 wizard-work/spark/test_line_counter.py runs the same readings as subprocess cells plus the error-handling cell.

What this verification does NOT certify

  • The retired host-path artifact at /root/.hermes/wizard-outputs/spark/line_counter.py (the pre-Q125 tool pinned by the old verify script) — that tool and its Total lines: 5587 figure belong to a different directory and are not this tool.
  • Any of the ten other counters in the lane (count_python.py, count_python_lines.py, py_loc.py, lwc_counter.py, linecount_pycount.py, text_stats.py, word_stats.py, file_stats.py, code_stats.py, loc_counter.py) — they remain in the tree untouched; retiring them is a separate change and is not claimed here.
  • Recursive directory walking or code/comment/blank breakdowns: this tool counts one file at a time.

Test command (runnable from the repo root)

cd /root/troupe-standup
python3 wizard-work/spark/test_line_counter.py
bash wizard-work/spark/verify_line_counter.sh