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

5.7 KiB

Spark Output: Snippet Summarizer Artifacts

Generated: 2026-10-12T13:03:03 UTC

Files Produced

  1. snippet-summarizer.py (3,137 bytes)

    • Python utility that scans directories for Python source files
    • Extracts metadata: line count, character count, file size
    • Outputs structured JSON report
    • Usage: python snippet-summarizer.py <directory> [--output <file>]
  2. report.json (16,156 bytes)

    • Generated report scanning /root/.hermes/profiles/spark/
    • 50 Python snippets found
    • 11,713 total lines of code
    • 430.78 KB total size
    • Average 234.26 lines per file

Verification

The report.json file is valid JSON and contains:

  • Complete file listing with paths
  • Per-file statistics
  • Extension-based grouping
  • Aggregate statistics

JSON Validator (New Addition)

A Python CLI tool for validating JSON files with detailed error reporting.

Files

  1. json_validator.py - Main validation script
  2. sample_valid.json - Test file (valid object)
  3. sample_array.json - Test file (valid array)
  4. sample_scalar.json - Test file (valid string scalar)
  5. sample_bad.json - Test file (invalid JSON)

Usage

python3 json_validator.py <file.json> [file2.json ...]

Verified Tests

✓ VALID: sample_valid.json - Object with 3 keys, 73 bytes
✓ VALID: sample_array.json - Array with 3 elements, 141 bytes
✓ VALID: sample_scalar.json - Scalar value: str, 21 bytes
✗ INVALID: sample_bad.json - Missing quotes error
✗ INVALID: nonexistent.json - File not found error

quick_stats.py - File Statistics Utility

A simple file statistics utility that reports line count, word count, byte size, and top 5 most common words.

Files

  • quick_stats.py - Main script (1,458 bytes)

Usage

python3 quick_stats.py <file1> [file2 ...]

Verified Test

$ python3 quick_stats.py test_input.txt

=== test_input.txt ===
Bytes:     118
Lines:     5
Words:     22
Unique:    13
Top words: [('hello', 3), ('world', 2), ('the', 2), ('this', 1), ('is', 1)]

Verification

Check: python3 /root/.hermes/wizard-outputs/spark/quick_stats.py /root/.hermes/wizard-outputs/spark/test_input.txt && echo "PASS"


syshealth.py - System Health Check Utility

A Python utility that collects system metrics: disk usage, memory info, load average, and process count.

Files

  • syshealth.py - Main script (1,697 bytes)
  • system-report.json - Generated report with all metrics

Usage

python3 syshealth.py

Verified Test

$ python3 /root/.hermes/wizard-outputs/spark/check_syshealth.py
PASS: Valid JSON with all required keys
Process count: 422

Verification

Check: python3 /root/.hermes/wizard-outputs/spark/check_syshealth.py && echo "PASS"


JSON Schema Validator (NEW)

A command-line tool for validating JSON files against JSON Schema.

Files

  1. json_schema_validator.py - Main validation script (46 lines)
  2. test_schema.json - Test schema (requires name: string, age: integer >= 0)
  3. test_data_valid.json - Valid test data, passes validation
  4. test_data_invalid.json - Invalid test data (age < 0)
  5. test_data_missing.json - Missing required field test

Usage

python3 json_schema_validator.py <schema_file.json> <data_file.json>

Verified Tests

✓ VALID: test_data_valid.json passes against test_schema.json (exit 0)
✗ INVALID: test_data_invalid.json fails with "age: -5 is less than minimum of 0" (exit 1)
✗ INVALID: test_data_missing.json fails with "'age' is required" (exit 1)

Verification

Check: python3 /root/.hermes/wizard-outputs/spark/json_schema_validator.py test_schema.json test_data_valid.json && echo "PASS"


URL Title Extractor

A Python utility to extract HTML page titles from URLs with optional caching.

Files

  • url_title_extractor.py - Main script (121 lines)
  • test_url_title_extractor.py - Test suite

Usage

python3 url_title_extractor.py <url1> <url2> ...

Options

  • --no-cache - Disable caching of results
  • --clear-cache - Clear the title cache

Examples

python3 url_title_extractor.py https://example.com
python3 url_title_extractor.py --no-cache https://example.com

Tested Results

PASSED: TitleParser - Correctly extracts title from HTML
PASSED: Cache directory - Verified writable location

Verification

Check: python3 /root/.hermes/wizard-outputs/spark/test_url_title_extractor.py && echo "PASS"

Line counter (Q125 — surviving text-statistics tool)

wizard-work/spark/line_counter.py is the lane's surviving text-statistics tool. It counts one file at a time and prints one number.

Counting definitions (stated, not argued):

  • count <file>: one count per line produced by iterating the file as text — every \n-terminated line, plus one final count for an unterminated trailing fragment. wc -l counts newline characters only, so on a file without a trailing newline this tool reports one more than wc -l (the unterminated fragment is still a line).
  • 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 mode does.

Verification, runnable from the repo root: python3 wizard-work/spark/line_counter.py wizard-work/spark/test_log.txt count # -> 10 python3 wizard-work/spark/line_counter.py wizard-work/spark/test_data.csv csv # -> 5 python3 wizard-work/spark/line_counter.py wizard-work/spark/test_blank.txt count # -> 4 bash wizard-work/spark/verify_line_counter.sh # -> rc 0 python3 wizard-work/spark/test_line_counter.py # -> rc 0