Skip to content

Knowledge: puzzleFacets answers openings even when empty - #34

Merged
cjus merged 1 commit into
mainfrom
claude/facets-openings
Nov 17, 2026
Merged

cjus merged 1 commit into
mainfrom
claude/facets-openings

Conversation

@cjus

@cjus cjus commented Nov 17, 2026

Copy link
Copy Markdown
Owner

What

spec/knowledge.md (knowledge/puzzleFacets) ties openings to the puzzleFilters capability: a node that offers it answers with openings, and without it the field is absent. conformance/knowledge/filters.jsonl expects openings on an empty library, which matches the spec. But cnp::knowledge::FacetsResult::openings was a Vec with skip_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::openings is now Option<Vec<OpeningCounts>>: Some (even empty) from a node with puzzleFilters, None (absent) without it.
  • Spec: one sentence in the bullet saying an empty library answers "openings": [], plus a Changes entry recording the clarification.
  • Session: only the comment changed. Its expectation was already right.
  • Tests: the existing facets test now uses the 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 .openings need a small edit when they bump their pin (chessdb's knowledge/service.rs wraps the list in Some(…), and Solrac's puzzle trainer reads openings.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-deps and cargo deny check all passed locally.

🤖 Generated with Claude Code

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>
@cjus
cjus marked this pull request as ready for review November 17, 2026 04:20
@cjus
cjus merged commit 9e4a4f3 into main Nov 17, 2026
2 checks passed
@cjus
cjus deleted the claude/facets-openings branch November 17, 2026 04:21
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