Skip to content

mine: --jsonl and save FILE.jsonl -- JSON Lines with header, streamed records and footer (0.18.1) - #26

Merged
osick merged 1 commit into
mainfrom
feature/mine-jsonl
Sep 10, 2026
Merged

osick merged 1 commit into
mainfrom
feature/mine-jsonl

Conversation

@osick

@osick osick commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

JSON Lines output for mine results too large to parse as one document.

  • --jsonl: line 1 is the header (material, filter, max), then one object per position, byte-for-byte the record --json puts in positions[] (same optional fields under --themes/--solutions), then a footer {"positions": N, "skipped_saturated": M}. A reader tells the lines apart by their keys (fen / material / positions); jq -c 'select(.fen)' yields the positions.
  • On the command line it streams: each hit is probed, annotated and written as the scan finds it, nothing is held. Measured on KRvkb h#3 with --themes: 115k records written at 16 MB resident. The counts live in the footer because that is when a streaming writer knows them; a missing footer marks a truncated file.
  • Shell: save FILE.jsonl writes the same three parts from the held set, same facet rule as .json.
  • --json and --jsonl are mutually exclusive (exit 3).
  • MineSet: the --json record is now built in one place (position_json) shared by both formats; make_hit/enrich are the streaming building blocks; jsonl_header/jsonl_record/jsonl_footer/to_jsonl.
  • 0.18.1 in the six version files; USAGE (new "JSON Lines output" subsection with a real example), README, CHANGELOG.

Test plan

  • Catch2: to_jsonl header/records/footer with records equal to to_json's positions, the streaming builders agree with the held-set writer, empty set; shell save .jsonl
  • ctest: --jsonl --max 2 line shapes, --max infinity --jsonl = 582 lines with the footer, --json --jsonl rejected
  • make test 335/335, make format-check BASE=main exit 0, make lint clean
  • Real corpus: KRvkb h#3 --max infinity --jsonl --themes, every line parses, constant RSS

🤖 Generated with Claude Code

https://claude.ai/code/session_01DFQB6YogM3gaauunTfMuxW

…ed records, and a footer with the counts (0.18.1)

One object per line for results too large to parse as a document: line 1
the header (material, filter, max), then one record per position exactly as
--json's positions[] element, then {"positions": N, "skipped_saturated": M}.
On the command line the records stream as the scan finds them and nothing is
held, so a --max infinity scan runs in constant memory; the shell's
`save FILE.jsonl` writes the same three parts from the held set. --json and
--jsonl are mutually exclusive. The --json record is now built in one place
(position_json) shared by both formats; MineSet gained make_hit/enrich as the
streaming building blocks.

Version 0.18.1 in VERSION, the three pyproject files, both package __init__
modules and the helpmate-api pin. USAGE (JSON Lines subsection with a real
example), README, CHANGELOG.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFQB6YogM3gaauunTfMuxW
@osick
osick merged commit bd47e20 into main Sep 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant