Files
troupe-standup/wizard-work/spark
ledger 46b6282296 spark: the six files that only graded or documented a retired counter (Q125)
A scan of wizard-work/spark for every remaining reference to the 25 paths
retired in a979e63 turns up six files, and each exists only to exercise or
describe one of them. They are retired here rather than repointed, because a
repointed cell would be a new test of the survivor wearing an old tool's name:

  check.py                 imported count_words from word_counter.py through a
                           sys.path.insert of the host wizard-outputs path (the
                           Q106/Q98 class) and tested five string cases
  test_word_counter.py     the same five cases against word_counter.py
  test_wordcount.py        ran wordcount.py and compared to `wc -w`
  verify_snippets.py       the lane's "snippet verification", whose one check was
                           word_counter.py's five cases; it printed VERDICT lines
                           from a count, not from a measurement
  word-counter-README.md   documented word-counter.py's interface and a
                           7-word example, i.e. prose for a file that is gone
  scratch_word_counter.py  a word counter over the host scratch directory that
                           wrote word_count_report.json to a fixed host path

What replaces them: wizard-work/spark/test_line_counter.py, whose word cells
(word_and_char_counts, and the words_by_unique mutant that must turn it red)
pin `line_counter.py --words` on a fixture that is in the tree. check.py's and
test_word_counter.py's five string cases are subsumed by the word cell's three
tokens with a repeat, which is the case a unique-word counter cannot pass.

Not retired, and deliberately: word_count_report.json and the fixtures
test_words.txt / test-input.txt / test-empty.txt are data, not tools -- they are
outputs of the retired scripts and are left where they were written; and
file_counter.py, file-counter.py, count_functions.py, json_key_counter.py,
count_verified_skills.py, verify_count.py, passwd_lines.py and generate_stats.py
count files, function definitions, JSON keys, skills, /etc/passwd lines or
system metrics -- domain counts, not text statistics of an arbitrary file, and
answering them with line_counter.py would be a different tool. The boundary is
stated in the Q125 record.

Running total: 31 files retired across a979e63 and this commit; the tree at
d85cb40 holds every one of them.
2026-10-29 00:12:41 +00:00
..
2026-10-28 05:56:06 +00:00
2026-10-28 05:56:06 +00:00
2026-10-28 05:56:06 +00:00
2026-10-28 05:56:06 +00:00
2026-10-28 05:56:06 +00:00
2026-10-28 05:56:06 +00:00

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

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"


line_counter.py - the lane's one text-statistics tool

The line/word/char counters this lane accumulated are retired: their last revisions are in git and every path is paired with the commit that removed it in WORK-QUEUE.md under Q125. What survives is one CLI whose output names the question it answered, because the retired tools disagreed only on this and the disagreement was invisible.

What each figure means

key definition
lines newline-terminated lines: the number of \n bytes, identical to wc -l
records lines plus one final unterminated fragment, so the two differ by exactly the files whose last row carries no trailing newline
blank / comment / code .py files only, lexically: blank is whitespace only; comment is a line whose first non-space character is #; code is every other line, so docstring interiors and continuations count as code. A target with no .py file prints - rather than an uncounted 0
fields --fields: the first record parsed with the csv module, so "a,b",c is 2 fields where split(',') reads 3
words / chars --words: len(text.split()), and characters of the decoded text -- not bytes (wc -c is the byte question). Bytes decode as UTF-8 with errors replaced, so a latin-1 log reads as replacement characters instead of raising

Usage

python3 line_counter.py PATH            # lines, records, .py breakdown
python3 line_counter.py --fields PATH   # CSV fields, quoted separators honoured
python3 line_counter.py --words PATH    # words and characters
python3 line_counter.py --json PATH     # any of the above as JSON

PATH may be a file or a directory (walked recursively, sums reported). Exit codes: 0 report produced, 1 usage error, 2 unreadable target. The tool refuses rather than reporting a partial total: an unreadable file inside a walk stops the run and names the path.

Worked example

$ python3 wizard-work/spark/line_counter.py wizard-work/spark/test_log.txt
files: 1
lines: 9
records: 10
blank: -
comment: -
code: -

test_log.txt holds ten rows of text and nine newlines -- the case where lines and records disagree, which is why both are printed.

Files

  • line_counter.py - the surviving tool
  • test_data.csv - fixture: one record, five fields
  • test_log.txt - fixture: ten rows, nine newlines
  • test_line_counter.py - the cell: 13 checks plus 5 applied mutants
  • verify_line_counter.sh - second, independent shell leg

Verification

Both legs run from the repo root (each resolves its own directory):

python3 wizard-work/spark/test_line_counter.py
bash wizard-work/spark/verify_line_counter.sh

The first drives the tool as a subprocess and pins whole-output strings, including the cells that kill a counter returning a constant, a counter counting non-blank lines only, a records == lines variant, a split(',') field count and a unique-word count; it then applies those five mutations to scratch copies and requires each to turn the suite red. The second re-reads the same figures in shell, so a cell that agrees with the tool by sharing its arithmetic shows up.

VERDICT: one text-statistics tool, its counting definitions stated and pinned by cells that die on the five mutations the old suite survived

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