From 5ea3866d54db1aab6ad42e9ff3a2db8349464719 Mon Sep 17 00:00:00 2001 From: Alexey Streltsov Date: Fri, 4 Dec 2026 01:28:29 +0000 Subject: [PATCH 1/2] docs: record final GigaChess 0.3.1 acceptance evidence --- docs/search-validation.md | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/search-validation.md b/docs/search-validation.md index 45debaf..b82904c 100644 --- a/docs/search-validation.md +++ b/docs/search-validation.md @@ -204,3 +204,43 @@ CBVAULT_TEST_DB_2CBH="/path/to/Database.2cbh" \ --cli target/release/cbvault \ --report /path/to/gate-b-report.json ``` + +## Revalidation with GigaChess 0.3.1 + +The upstream White null-move counter correction was published in Rust GigaChess +0.3.1 and adopted in CBVault commit `beff433`. The search counter remains +branch-local so FEN-relative and record-relative numbering do not depend on a +particular replay entry point. + +Fresh validation of this dependency upgrade: + +- All 20 synthetic position-search integration tests passed in mapped and + positioned I/O on aiserver (40 executions). All 15 Python acceptance-tool + unit tests and strict OpenSpec validation passed. +- Functional GitHub CI passed all six jobs on `beff433`: + [run 47240221280](https://github.com/itshak/cbvault/actions/runs/47240221280). +- Licensed Mega 2026 Gate A: 22/22 checks over 1,213 stratified records. + Gate B: 66/66 exact discrepancy-accountability checks, with the same + independently collected reference lists and no unaccounted memberships. +- Full database verification: 11,743,083 records, 933,185,514 total plies, + including 3,084 null moves; zero failures. + +Three alternating timed repetitions per executable on the same licensed +snapshot, four workers, positioned I/O. Exact ordered result memberships +agreed in every comparison: + +| Query | GigaChess 0.3.0 median | GigaChess 0.3.1 median | +|---|---:|---:| +| Pe2, Last=1 | 0.490084 s | 0.466586 s | +| Bh7, default window | 9.777245 s | 9.765316 s | +| Kg1, First=10, Last=10, relative | 2.550084 s | 2.561676 s | + +These are internal search times, not wall-clock times; the three workloads +show no meaningful measured regression. This is an upstream dependency +comparison, not a new exhaustive benchmark of every supported search option. + +The supplemental server-side public-corpus audit reached verified fixture +fingerprints after the targeted Rust tests but exceeded its 300-second +execution budget; it is not recorded as a pass. The hosted native-corpus +checks remain the final public benchmark gate. No private source data or +membership fingerprints are published. From 3ce3c52b0f64ff228735ff9099fc84627b1d034d Mon Sep 17 00:00:00 2001 From: Alexey Streltsov Date: Fri, 4 Dec 2026 01:31:03 +0000 Subject: [PATCH 2/2] release: CBVault 0.4.0 and archive accepted position search --- CHANGELOG.md | 11 ++++ Cargo.lock | 10 ++-- Cargo.toml | 8 +-- README.md | 4 +- docs/search-validation.md | 9 +++- .../2026-12-04-search-position}/proposal.md | 0 .../specs/cbvault/spec.md | 0 .../2026-12-04-search-position}/tasks.md | 2 +- openspec/specs/cbvault/spec.md | 53 +++++++++++++++++++ 9 files changed, 83 insertions(+), 14 deletions(-) rename openspec/changes/{search-position => archive/2026-12-04-search-position}/proposal.md (100%) rename openspec/changes/{search-position => archive/2026-12-04-search-position}/specs/cbvault/spec.md (100%) rename openspec/changes/{search-position => archive/2026-12-04-search-position}/tasks.md (93%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2abb530..78b1528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,21 @@ The project is pre-1.0. ## [Unreleased] +## [0.4.0] - 2026-12-04 + +### Breaking + +- Exhaustive `GameDataQuery` struct literals must include the new `position` and `record_scope` fields (or use `..Default::default()`). See [the search guide](docs/search.md). Existing header-only defaults are preserved. + ### Added - **Canonical "Position" search.** `GameDataQuery::position` takes a `PositionQuery`: "Look for", "Or" and "Exclude" boards of men (a piece, or a colour-specific joker), horizontal and vertical mirrors, bounded inclusive `First..=Last` move windows, consecutive-position `Length`, `MoveNumbering` (`Fen` or `Relative`), and optional branch-local `include_variations`. `GameDataQuery::record_scope` (`RecordScope::Games`, `Analysis`, or `GamesAndAnalysis`) controls playable record eligibility. The fragment compiles to bitboards and is evaluated in the same single replay pass as mate, stalemate and check, stopping early once settled. "Sacrifice" is refused as unsupported. `cbvault search` gains `--look-for`, `--or`, `--exclude`, `--mirror`, `--first-move`, `--length`, `--last-move`, `--move-numbering`, `--include-variations`, and `--records`; `parse_fragment` reads the same board text (`Kg1 Rf1 Pf2g2h2 bh7`). Also fixes White null-move move-number tracking in position replay and updates GigaChess to 0.3.1, which corrects the upstream fullmove counter. +### Validation and contributors + +- Position search originates from [Tulio Vianna's PR #11](https://github.com/itshak/cbvault/pull/11), integrated with maintainer improvements in PR #12. +- Canonical semantics and independent validation are documented in [ADR-009](openspec/adr/009-canonical-chess-search-semantics.md) and [search validation](docs/search-validation.md). Both native formats have public synthetic regression coverage; the private Mega acceptance uses independently collected ChessBase references and exact discrepancy fingerprints. + ## [0.3.0] - 2026-11-30 ### Breaking diff --git a/Cargo.lock b/Cargo.lock index a026c8d..bf76411 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,7 +43,7 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cbvault" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cbvault-chess", "cbvault-fixtures", @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "cbvault-chess" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cbvault-fixtures", "cbvault-format", @@ -65,7 +65,7 @@ dependencies = [ [[package]] name = "cbvault-cli" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cbvault", "cbvault-chess", @@ -76,7 +76,7 @@ dependencies = [ [[package]] name = "cbvault-fixtures" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cbvault-chess", "cbvault-format", @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "cbvault-format" -version = "0.3.0" +version = "0.4.0" dependencies = [ "cbvault-fixtures", "memmap2", diff --git a/Cargo.toml b/Cargo.toml index c110c90..2a1d11c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.3.0" +version = "0.4.0" edition = "2024" license = "MIT" rust-version = "1.88" @@ -17,9 +17,9 @@ readme = "README.md" [workspace.dependencies] gigachess = "0.3.1" -cbvault-format = { version = "0.3.0", path = "crates/cbvault-format" } -cbvault-chess = { version = "0.3.0", path = "crates/cbvault-chess" } -cbvault = { version = "0.3.0", path = "crates/cbvault" } +cbvault-format = { version = "0.4.0", path = "crates/cbvault-format" } +cbvault-chess = { version = "0.4.0", path = "crates/cbvault-chess" } +cbvault = { version = "0.4.0", path = "crates/cbvault" } # Path-only on purpose. `cbvault-fixtures` is `publish = false`, so it will never # exist on crates.io — and a dev-dependency that carries a version requirement # makes cargo resolve it from the registry when preparing a package for upload, diff --git a/README.md b/README.md index d297f1e..73e2dcb 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Unlike a workflow that requires importing an entire collection into a new databa Requires **Rust 1.88+**. ```bash -cargo add cbvault@0.3.0 -cargo install cbvault-cli --version 0.3.0 +cargo add cbvault@0.4.0 +cargo install cbvault-cli --version 0.4.0 ``` Open a database with Rust. Pass either a classic `.cbh` file, a modern `.2cbh` file, or an unambiguous database base path: diff --git a/docs/search-validation.md b/docs/search-validation.md index b82904c..de140c8 100644 --- a/docs/search-validation.md +++ b/docs/search-validation.md @@ -241,6 +241,11 @@ comparison, not a new exhaustive benchmark of every supported search option. The supplemental server-side public-corpus audit reached verified fixture fingerprints after the targeted Rust tests but exceeded its 300-second -execution budget; it is not recorded as a pass. The hosted native-corpus -checks remain the final public benchmark gate. No private source data or +execution budget; it is not recorded as a pass. Hosted native-corpus checks subsequently passed on `671014d`: +[native smoke and extreme](https://github.com/itshak/cbvault/actions/runs/47241618143) +(96/96 position benchmark configurations, 46/46 independent fragment checks +and 24/24 full 25,000-game exact-key configurations); +[functional CI](https://github.com/itshak/cbvault/actions/runs/47241618350) +passed all six jobs. PR #12 merged into main at `eb3e8a3` with the +contributor commits preserved. No private source data or membership fingerprints are published. diff --git a/openspec/changes/search-position/proposal.md b/openspec/changes/archive/2026-12-04-search-position/proposal.md similarity index 100% rename from openspec/changes/search-position/proposal.md rename to openspec/changes/archive/2026-12-04-search-position/proposal.md diff --git a/openspec/changes/search-position/specs/cbvault/spec.md b/openspec/changes/archive/2026-12-04-search-position/specs/cbvault/spec.md similarity index 100% rename from openspec/changes/search-position/specs/cbvault/spec.md rename to openspec/changes/archive/2026-12-04-search-position/specs/cbvault/spec.md diff --git a/openspec/changes/search-position/tasks.md b/openspec/changes/archive/2026-12-04-search-position/tasks.md similarity index 93% rename from openspec/changes/search-position/tasks.md rename to openspec/changes/archive/2026-12-04-search-position/tasks.md index bf584ad..df71c53 100644 --- a/openspec/changes/search-position/tasks.md +++ b/openspec/changes/archive/2026-12-04-search-position/tasks.md @@ -40,4 +40,4 @@ - [x] 5.11 Verify public cross-generation ordered fragment memberships, independent PGN matcher (44 case/format checks), full 25,000-game exact-key oracle (24 configurations) and public audit tooling. - [x] 5.12 Run synthetic external-ID, divergent-export, and Gate B exact-discrepancy-identity negative controls in CI (`test-query-private-acceptance.py` 9/9 PASS, `test-position-audit.py` PASS). -- [ ] 5.13 Revalidate final integration against published GigaChess 0.3.1 (public CI, private Gate A/B, database verification, paired measurements). +- [x] 5.13 Revalidate against published GigaChess 0.3.1: 8/8 hosted jobs, 40/40 server position tests, private Gate A 22/22, Gate B 66/66, whole-database verification zero failures, exact-membership paired upgrade measurements. PR #12 merged at eb3e8a3. diff --git a/openspec/specs/cbvault/spec.md b/openspec/specs/cbvault/spec.md index a41e90e..6ff0d90 100644 --- a/openspec/specs/cbvault/spec.md +++ b/openspec/specs/cbvault/spec.md @@ -1371,3 +1371,56 @@ a FEN, or a sequence of SAN or UCI moves) and `book verify`, each with a stable - **WHEN** `cbvault book verify` is run on a book with damaged pages, undecodable keys, invalid positions, key mismatches, illegal moves, unknown move bytes, or missing children when `--children` is requested - **THEN** the command exits with a non-zero exit status - **AND** the counts of damaged pages, unknown moves, or missing children are reported + +### Requirement: Canonical ChessBase-style "Position" search + +The library SHALL answer ChessBase-style partial-position searches combined +with the "Game data" fields over a classic (`.cbh`) or 2CBH (`.2cbh`) +database: a "Look for", an "Or" and an "Exclude" board of men on squares +(piece of a colour or colour-specific joker); horizontal and vertical mirrors; +a bounded inclusive move window `First..=Last`; consecutive-position +persistence `Length`; configurable move numbering (`MoveNumbering::Fen` or +`MoveNumbering::Relative`); configurable playable record eligibility +(`RecordScope::Games`, `RecordScope::Analysis`, or +`RecordScope::GamesAndAnalysis`); and optional variation traversal +(`include_variations`). The results SHALL be independent of physical format, +search indexes, I/O mode, and worker thread count, and SHALL match an +independent canonical oracle. + +#### Scenario: Boards and jokers +- **WHEN** the "Look for" board holds men, the "Or" board alternatives and the "Exclude" board men +- **THEN** a position holds the fragment when every "Look for" man stands on its square, at least one "Or" man (if any) stands on its square, and no "Exclude" man does +- **AND** a joker matches any man of its colour, and squares left empty are unconstrained. + +#### Scenario: Mirrors +- **WHEN** "Horizontal" is set +- **THEN** the fragment reflected across the horizontal axis (ranks 1↔8), with the colours swapped, also matches +- **AND** with "Vertical" set, the fragment reflected across the vertical axis (files a↔h) also matches. + +#### Scenario: Bounded First, Length and Last +- **WHEN** First, Length and Last are given +- **THEN** only positions whose assigned move number lies in the bounded inclusive interval `First..=Last` are counted (including initial and final positions when their move number lies in `First..=Last`) +- **AND** `Last` is never silently expanded to `First + 1`, nor is an extra White move beyond `Last` searched +- **AND** the fragment must hold in `Length` consecutive counted positions within `First..=Last` (a persistence run cannot begin before `First` or extend past `Last`) +- **AND** `MoveNumbering::Fen` (default) labels positions from the initial board's FEN fullmove number while `MoveNumbering::Relative` labels the start position and first move as move 1, advancing the next move number only after Black moves (including null moves). A reached board is labelled with the move just played, not the next move in its FEN; e.g. both boards after 1.e4 and 1...e5 belong to move 1. + +#### Scenario: Record eligibility +- **WHEN** `record_scope` is `Games` (default), `Analysis`, or `GamesAndAnalysis` +- **THEN** only live records of the selected playable kind(s) are searched +- **AND** deleted records and guiding texts are excluded from position searches +- **AND** missing metadata on analysis records does not silently satisfy header filters that require it. + +#### Scenario: Mainline and variations +- **WHEN** `include_variations` is `false` (default) +- **THEN** a fragment standing only in a variation does not match +- **AND** when `include_variations` is `true`, variations are evaluated with branch-local move numbering and persistence state so persistence never spans unrelated branches, and matching game IDs are deduplicated and ordered. + +#### Scenario: Unanswerable pages are refused +- **WHEN** "Sacrifice" is set +- **THEN** the query is refused with `QueryError::Unsupported` +- **AND** empty boards, two men on one "Look for" square, First after Last, or combining `text_records` with a non-default `record_scope` are refused with `QueryError::Invalid`. + +#### Scenario: The replay stops early +- **WHEN** the answer is known before the end of the line +- **THEN** the replay of that game stops, unless a matching fragment still needs the final main-line position checked +- **AND** a validated initial board is evaluated before decoding the first move; a corrupt unneeded suffix does not invalidate a settled answer.