Skip to content

Knowledge: import downloaded puzzles, evaluations and test positions (draft-1) - #27

Merged
cjus merged 1 commit into
mainfrom
claude/knowledge-import
Nov 13, 2026
Merged

cjus merged 1 commit into
mainfrom
claude/knowledge-import

Conversation

@cjus

@cjus cjus commented Nov 13, 2026

Copy link
Copy Markdown
Owner

For cjus/chessdb#2 (chessdb's knowledge library, cjus/chessdb#36).

What

A proposed draft-1 extension, knowledge/…, the import half:

  • knowledge/import: the client hands the node a file it downloaded (absolute path + manifest: source, release, URL, retrieval date, SHA-256, SPDX licence, attribution). Answers at once; the import runs on.
  • knowledge/status: where each import is (verifying, importing, complete, cancelled, failed), with committed counts.
  • knowledge/cancel: stops at the next batch; what is committed stays.

Kinds: lichess-puzzles, lichess-evals, sts-epd.

Design choices (for review)

  • The node doesn't download. The client does, where it can show licence, size and progress; the node verifies the checksum before reading a record, so a damaged or swapped file is failed: checksum, not imported.
  • A job, not a long request. Imports take minutes to hours; a blocking request would hold the connection. One import at a time (Busy otherwise); preferences, games and backups stay responsive.
  • Identity = kind + checksum. Repeating an import is safe: complete → nothing re-read; running → its state; cancelled/failed → resumes after the last committed record.
  • Counts are committed records, so progress shown survives a crash.
  • Variants (STS files, puzzle releases) are separate sources; scores are never converted.
  • Knowledge is rebuildable, so not in backups.
  • Error codes: reuses -32013, -32022, -32025; adds -32027 (file unreadable).

Not in draft 1: reading the knowledge (puzzles by theme/rating, analyses of a position), progress notifications, reading rejected records, Lumbra games.

Checks

cargo fmt --check, clippy --workspace --all-targets -D warnings, cargo test --workspace (76 pass; 6 new, one checks the spec's JSON examples against the types), RUSTDOCFLAGS=-D warnings cargo doc, cargo deny check all pass locally. New conformance session knowledge/import-refusals; the example node skips it (14 passed, 59 skipped, 0 failed).

🤖 Generated with Claude Code

…les, evaluations and test positions (cjus/chessdb#2)

knowledge/import starts an import of a file the client downloaded and answers at once; knowledge/status reports imports; knowledge/cancel stops one. The node verifies the manifest's checksum before reading a record; imports resume and repeat safely. Spec, cnp::knowledge types, tests, and a conformance session.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cjus
cjus marked this pull request as ready for review November 13, 2026 21:36
@cjus
cjus merged commit 78d911c into main Nov 13, 2026
2 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