Repository navigation
Knowledge: puzzle selection, a random order, a quality filter and facets (draft-1, cjus/chessgui#575) - #30
Merged
Merged
Conversation
…ets (draft-1, cjus/chessgui#575) knowledge/puzzles takes order (easiest or random), seed and quality (reliable); the answer names the seed and the thresholds used. knowledge/puzzleFacets counts puzzles by theme and rating band, so a client can offer a choice without finding out that a combination is empty. New capability puzzleSelection. All optional: a node without it, or a request that doesn't send it, is unchanged. The design is measured, not guessed: on the real Lichess puzzles file (6,193,530 puzzles, chessdb main) a hash sort of the filtered set took 0.8 to 6.2 s and a random offset up to 6.9 s, while a forward scan from a random start took 0.1 to 1 ms for common themes. So random is a scan from a seeded start in the node's storage order, wrapping, and the spec says it is not a shuffle. Facets take 68 to 78 s to group at request time, so the spec has them kept as the node imports. Spec, types (cnp::knowledge) and a conformance session (knowledge-selection) change together. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
Author
|
chessdb has now served this: cjus/chessdb#41 (draft, pinned to this branch's
I'll mark this ready for review and merge it once you've looked at the design decisions in the description (the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29. Part of cjus/chessgui#575 (the puzzle trainer). Draft until chessdb has served it (below).
What changes
spec/knowledge.md,cnp::knowledgeand a conformance session change together (rule 1):puzzleSelection: offers the three fields and the operation below. A client sends none of them to a node without it.knowledge/puzzlestakesorder(easiest, the default, orrandom),seed(0 to 4294967295, only withrandom) andquality(reliable). The answer says theseedit used and, when asked, thequalitythresholds.knowledge/puzzleFacets(new): the node's ratingbands, thetotalin each, and each theme'scountsper band, optionally underquality.conformance/knowledge/selection.jsonl(requires: knowledge.puzzleSelection): a random pass names its seed and repeats from it, the seed range, quality's thresholds, facets, and six refusals.Versioning (rule 2): only optional fields, a method and a capability, so no new major version and no new contract name;
contractstaysdraft-1.Why this shape (measured, #29)
On the real file (6,193,530 puzzles, imported by chessdb
main, 20-row pages, warm cache, one machine):OFFSETSo
randomis a scan from a seeded start in the node's storage order, wrapping, not a sort. The spec says it is not a shuffle and why (a page is neighbours in storage order; the start is only even over matches when they aren't clustered, which holds for Lichess's file, ordered by an id unrelated to rating and theme: I read that from its first rows, I haven't tested the evenness).reliableleaves the thresholds to the node and the answer names them; chessdb's are measured at plays >= 100, popularity >= 80 and rating deviation <= 110 (70.7% of the puzzles).Decisions I made, for review
quality: "reliable") rather than three threshold fields, so a node can tune it; the answer carries the numbers.seedis au32, so a JSON number is exact in every client.Checks (run locally on this commit)
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test(the knowledge spec's examples parse, and every session file reads and sends valid messages),RUSTDOCFLAGS=-D\ warnings cargo doc --workspace --no-deps,cargo deny check: all pass.Not done / why this is a draft
🤖 Generated with Claude Code