amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

2.9 KiB

Ledger text and console protocol

The tool accepts ordinary readable files. Input is bytes. A valid record has a lowercase ASCII key of 1 to 16 letters, one ASCII space, and a signed decimal integer from -9999 through 9999. The sign is optional; a leading + and any number of leading zeros are valid. Records end with LF; the final record may omit LF. An empty file has zero records. CR, TAB, blank lines, NUL, other separators, and extra bytes after a number make the record invalid. At most 100000 records are accepted. The full file is inspected, even if a tail request selects zero records.

Commands:

  • ledger-inspect summary FILE computes statistics over every record.
  • ledger-inspect tail FILE K shows the last K records in input order. K is an ASCII decimal token from 0 through 100000, with optional leading + and arbitrary leading zeros. A negative K, underscore, surrounding whitespace, or missing argument is invalid. K above the record count selects all records.

A successful summary writes exactly one ASCII line to stdout:

OK COUNT SUM MIN MAX FIRST LAST\n

COUNT is the record count; SUM is the arithmetic sum of values. MIN and MAX are the smallest and largest values. FIRST and LAST are the first and last keys. An empty ledger prints OK 0 0 0 0 - -\n. Decimal numbers in output use ordinary base ten with no plus or extra leading zeros.

A successful tail writes OK COUNT SELECTED\n followed by SELECTED lines of KEY VALUE\n, where COUNT is the full record count, SELECTED is the number selected, and VALUE uses normalized decimal formatting. With K=0 only the header is emitted.

Any input record error, including more than 100000 records, writes INVALID\n to stdout. An unavailable file or read error writes IO_ERROR\n. Wrong command name, wrong argument count, or invalid K writes USAGE\n. All documented responses exit 0; the response token distinguishes normal results from errors. Diagnostics may be written to stderr; stderr content has no protocol meaning. No command may emit partial result output after an input or read failure.

ledger-inspect groups FILE is a third inspection view. On success it writes OK COUNT GROUPS\n followed by one line per distinct key in ASCII lexicographic order: KEY COUNT SUM MIN MAX FIRST_INDEX LAST_INDEX\n. Indexes are zero based input positions. An empty file prints OK 0 0\n. Its error behavior matches summary.

ledger-inspect top FILE K selects up to K records in descending numeric value order, breaking ties by earlier zero-based input index. It writes OK COUNT SELECTED\n followed by INDEX KEY VALUE\n for each selected record. K has the same syntax and range as in tail; invalid inputs and errors follow the same rules.

ledger-inspect filter FILE KEY selects every record with the supplied lowercase ASCII key (1 to 16 letters). It writes OK COUNT MATCHES\n, then INDEX VALUE\n for each match in input order. An invalid KEY is a usage error. Input errors follow the other modes.