Repository navigation
Knowledge: puzzleFacets answers openings even when empty - #34
Merged
Merged
Conversation
spec/knowledge.md ties knowledge/puzzleFacets' openings to the puzzleFilters capability, and conformance/knowledge/filters.jsonl expects it on an empty library, but FacetsResult left an empty list out, so a node built on the type failed the session (found running the sessions against chessdb). openings is now Option<Vec<_>>: Some from a node with puzzleFilters, empty or not, None (absent) without. The wire is unchanged for clients; the spec says so in a clarification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
spec/knowledge.md(knowledge/puzzleFacets) tiesopeningsto thepuzzleFilterscapability: a node that offers it answers withopenings, and without it the field is absent.conformance/knowledge/filters.jsonlexpectsopeningson an empty library, which matches the spec. Butcnp::knowledge::FacetsResult::openingswas aVecwithskip_serializing_if = "Vec::is_empty", so a node built on the type left the field out when it had no openings, and the session failed. This was found running the conformance sessions against chessdb.The spec and the session were right, and the type was wrong.
Change
FacetsResult::openingsis nowOption<Vec<OpeningCounts>>:Some(even empty) from a node withpuzzleFilters,None(absent) without it."openings": [], plus a Changes entry recording the clarification.Option, and a new test checks that empty openings round-trip as[].Compatibility
Nothing changes on the wire for clients: a missing field still deserializes (to
None), and every payload a client could receive before still parses. The Rust field's type does change, so nodes and clients that use.openingsneed a small edit when they bump their pin (chessdb'sknowledge/service.rswraps the list inSome(…), and Solrac's puzzle trainer readsopenings.as_deref().unwrap_or_default()).Checks
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test,RUSTDOCFLAGS=-D\ warnings cargo doc --workspace --no-depsandcargo deny checkall passed locally.🤖 Generated with Claude Code