Skip to content

feat: evolve opening explorer into chess database api - #11

Merged
Nerver-zip merged 22 commits into
mainfrom
feat/chess-database-api
Nov 26, 2026
Merged

Nerver-zip merged 22 commits into
mainfrom
feat/chess-database-api

Conversation

@Nerver-zip

@Nerver-zip Nerver-zip commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Chess Database API

  • Adds game, position, player and event discovery, stable-ID metadata, snapshot-bound pagination and exact filtered Opening Explorer statistics. SQLite metadata and compact postings are derived from immutable canonical snapshots.
  • Uses the Chess Database API workspace and chess-database CLI. The previous CLI, environment fallbacks, image tag, network aliases, and Compose service and mount defaults remain available. Canonical and legacy environment samples render identical default and named-volume configurations. Corpus and local Gigabase helpers accept --chess-database and retain --opening-explorer as an alias. GitHub now uses Nerver-zip/chess-database-api and redirects the former slug. Both published releases retain their IDs and distribution asset digests.
  • Reconciles the API reference, architecture, roadmap, examples, QA strategy, search guidance, and deployment and naming procedures. The validation gate now checks fresh Stage A results without replacing the benchmark record.

Production evidence

Snapshot Canonical games Search occurrences Derived bytes CPI audit positions
Masters OTB R3 D40 3,284,429 130,852,249 5,572,790,358 741
Elite Online R1 D30 429,150 13,191,619 560,486,143 789

Both enriched snapshots passed deep verification with their canonical artifacts intact. The Elite companion install reproduced its checksums, and Masters recovery removed an abandoned stage while preserving the active snapshot. The Elite full-depth workflow verified ply 60 continuation and a terminal board at ply 97 against canonical replay.

Masters request Previous candidate Hardened candidate Serial p95
Initial position, both ratings at least 2200 5/5 HTTP 422 5/5 HTTP 200 1,195 ms
Sicilian, both ratings at least 2400 5/5 HTTP 422 5/5 HTTP 200 230 ms
20-ply Ruy Lopez, min_plies=0 5/5 HTTP 422 5/5 HTTP 200 34 ms

The ordinal scan supports common exact rating, date and year predicates within a separate bounded posting budget. Complex predicates can still return 422. The no-op ply filter uses CPI and returned the exact legacy body. Canonical replay verified every W/D/L and continuation count, including 2,903,599 at the filtered initial position, 183,790 at the rating-filtered Sicilian and 486,306 at the Sicilian using either the year filter or the equivalent ISO date filter.

With four simulated users and two search workers, autocomplete, metadata, position search and latest-board navigation each passed 40/40. Broad rating and date filters each passed 24/40, with 16 busy responses. All 300 legacy probes passed in separate deliberate overload traffic. One aggregation slot leaves a worker available for interactive search.

Legacy compatibility

CGB3, CPI v2, games.idx, stable IDs, canonical PGNs, immutable release IDs and legacy HTTP contracts are preserved. The final paired legacy runs matched canonical artifact inventories, response bodies and same-snapshot ETags. The warm timing gate passed. The eviction-advised sequential p50 was 1.408 ms versus 1.305 ms on main (+7.9%, above the 5% threshold). Sequential p95 was +1.4%, concurrent p95 −3.8%, and concurrent throughput +2.9%. In a five-pair confirmation, sequential p50 was −0.9% and sequential p95 was +6.7%, above the 5% threshold. Concurrent p95 improved 1.8% and throughput rose 3.4%. A second five-pair confirmation paused the QEMU guest. Sequential p50 and p95 passed at −2.3% and −1.0%. Concurrent p95 rose 12.2%, p99 rose 13.7%, and throughput fell 5.5%, failing the existing gate. An additional five-pair control used the identical candidate executable in both arms. It passed the directional gate and still measured 13.9% lower concurrent p95 in the second arm, showing variation at the scale of the observed differences. Median concurrent server CPU rose 7.8% in the paused-guest baseline comparison and fell 7.4% in the identical-binary control. The failed baseline comparisons and all raw repetitions remain in the linked reports.

Serving revision 3518a8e7f38b4497a5491dca926b54440da57848, native release binary SHA-256 0436ed664d6305b0d3d01dc79bec92a48fb7833b1b190d2cdf832e1941c38c31.

Operational acceptance

Default startup and reload rehash recorded artifact digests, verify identity, headers and accounting, and walk every CPI block. Promotion requires deep verification. Operators can repeat it at serving time using CHESS_DATABASE_DEEP_VALIDATE_ON_STARTUP=true.

Completed Elite-only Docker checks in a local QEMU guest used 512 MiB and two CPUs, verified normal serving and feature disablement, and saw zero OOMs in the serving cgroup. The recorded live rollback took 7.8 seconds and all 214 Explorer and PGN probes succeeded across the swap. The cold deep check was stopped before readiness. Native constrained Docker is unavailable in this workspace because the cgroup mount is read-only and KVM is unavailable.

With both collections mounted, the pinned runtime with the hardened native executable reached readiness after 1,006 seconds under QEMU at 512 MiB and two CPUs. This missed the 600-second window. The first ready sample recorded 1,023 CPU seconds, a 536,875,008-byte cgroup memory peak and zero OOM events. All 480 legacy requests passed in partially overlapping interactive workloads. The broad Masters rating request returned 22 deadlines and 98 busy responses. Both discovery-to-PGN flows ultimately passed. The initial concurrent Masters probe returned search_busy. An additional 240 legacy requests passed while reload verification was active. Both collections remained ready at 606 seconds. The reload client reached its 900-second deadline without a response. After the guest resumed following native benchmarking, the server logged successful completion for both versions and the cgroup still recorded zero OOM events. The pause prevents a continuous reload duration from that timestamp.

The repository Dockerfile built successfully at 5b94bbe. With both enriched snapshots, default serving settings, 512 MiB and two CPUs, the full image reached /ready after 549 seconds in the guest. Docker reported healthy. The cgroup used 550 CPU seconds and recorded a 536,875,008-byte peak and zero OOM events. The Elite discovery flow passed. All 720 legacy requests passed across mixed traffic and SIGHUP verification. The three Elite filters completed 259 of 360 requests before reload and 228 of 360 during reload. The remaining requests returned HTTP 429. The same-snapshot SIGHUP reload completed in 536.41 seconds. Collection versions and capabilities matched afterward. Final cgroup totals were 1,209 CPU seconds, a 536,879,104-byte peak, zero OOM events and zero restarts. Full repository image report

On the unconstrained native host, a same-snapshot reload of both enriched versions took 14.84 seconds under mixed traffic. All 80 legacy requests and 160 interactive discovery requests passed. Representative cold startup and reload of the full image under the target cap still require a native owner-host run. The acceptance procedure compares collection versions before and after loading the alternate Elite snapshot.

The updated worktree passed all eight stages of ./scripts/validate.sh, including 217 Python cases with eight environment-dependent skips. The lightweight reproduction runner, both native discovery workflows and the fresh full Masters replay passed. Hosted CI for the code changes (644043b)

Reproduce and review

@Nerver-zip
Nerver-zip marked this pull request as ready for review November 26, 2026 02:18
@Nerver-zip
Nerver-zip merged commit 5e8dc18 into main Nov 26, 2026
2 checks passed
@Nerver-zip
Nerver-zip deleted the feat/chess-database-api branch November 26, 2026 02:24
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