Skip to content

Fix visit-cap test invariants for terminal leaves - #1258

Open
22nsuk wants to merge 2 commits into
lightvector:masterfrom
22nsuk:codex/upstream-terminal-visit-cap
Open

22nsuk wants to merge 2 commits into
lightvector:masterfrom
22nsuk:codex/upstream-terminal-visit-cap

Conversation

@22nsuk

@22nsuk 22nsuk commented Oct 5, 2026

Copy link
Copy Markdown

The visit-cap checker in runNNLessSearchTests() currently requires a snapshot whenever a capped node reaches its visit cap. A terminal leaf can exceed that cap without a snapshot: terminal playouts record the outcome and return before NN evaluation or child expansion, so there is no child distribution to freeze.

This patch distinguishes those terminal leaves from nonterminal nodes. Before accepting an absent snapshot, the checker replays the root-to-node path and verifies that the position is finished, the player matches, the node is not forced nonterminal, and it remains unevaluated with no child capacity. Tree-search mode and unique parents are asserted for the replay. The existing snapshot and distribution checks for nonterminal nodes remain intact.

A deterministic pass/pass fixture exercises a capped terminal leaf beyond three times its cap. The fixture is silent and retains all assertions, so it does not add a line to the recorded output. This changes only cpp/tests/testsearchnonn.cpp; production search behavior is unchanged.

Validation

  • Native positive and negative controls: the fixture fails with the original checker, passes with this correction, and deleting an evaluated nonterminal root's snapshot still triggers the required assertion.
  • Final-source validation: Eigen Release build, runtests, the repository's cpp/runoutputtests.sh, and five additional runoutputtests repetitions passed for 0750698f6a12ee6e2b5f9adc5ce30a9cf33f4833. Linux/Windows ONNX CPU and Windows DirectML jobs also passed at that source revision.
  • Build and Test: all six platform jobs passed.
  • The full final output was compared with five saved unmodified-upstream runs and was byte-identical. The tracked transcript has an unrelated pre-existing task-parsing message discrepancy; this patch leaves that snapshot unchanged.

The branch is based directly on d91ea855110dae533f0aada947b2b7d78cc8a4e1 and contains only this test correction.

Validate terminal positions by replay before accepting absent snapshots. Preserve nonterminal snapshot checks and add a deterministic pass/pass regression. Port the isolated test-only fix from the fork without search or near-end changes.
Keep the deterministic terminal regression silent; all assertions remain active without adding an unrecorded line to runoutputtests.sh output.

This branch has not been deployed

No deployments
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