Repository navigation
Conversation
sakinu
reviewed
Nov 25, 2026
sakinu
left a comment
Contributor
There was a problem hiding this comment.
Both expected values check out (31 and 2499), and 10,000 is the stated upper bound. The open point is the .some(...) thread above, which lets either new case be deleted without failing; the label comment matters once cases are pinned by label.
s4512138
reviewed
Nov 26, 2026
s4512138
left a comment
Contributor
There was a problem hiding this comment.
I ran the targeted Sudoku regression on Windows with Node v24.22.0 and checked the counterexamples with CodeTrial’s checkAnswer. The new cases have the expected results. The inline comments cover last-row and last-column indexing and a positive case for a completely filled valid board.
RyanJ2002
force-pushed
the
puzzle-grid-single-rule-cases
branch
from
November 26, 2026 06:47
ac8cefd to
afc88cb
Compare
Puzzle Grid Save Check let a solution pass that never checks columns, and one that never checks rows: the case labeled duplicate in column also repeats its 8 inside the top-left box, and the case labeled duplicate in row also repeats its 5 down column 8, so each is refused by a rule the solution kept. Eight cases derived from the valid partial board case close that and the gaps next to it. Four repeat a digit in one row or column only, in the first and the last of each, so loops that start at 1 or stop at 8 are refused along with a skipped rule. Two repeat a digit inside one box only, the bottom-right box and the top middle one, since the one box case repeats inside the top-left box and a check of that box alone, or of the diagonal or corner boxes, passed. Two expect true: a 1 that repeats nowhere but leaves the board without a completion, because the contract does not ask for solvability and both earlier true cases were solvable, and a completed board, because every earlier true case had a blank cell. A test in tests/browser/compiler-explorer.test.js checks every expected value against a check of all three rules, requires each single-unit case, looked up by label, to reject the wrong check that misses its unit, requires the completed board to reject a check that wants a blank cell, and the board without a completion to reject a check that also asks for one, using a small backtracking solver. It fails against the five cases on main. The labels join the tricky-case list in tests/web/contract.rs, web/judges/puzzle-grid-save-check.json is regenerated, and the valid-sudoku digest in tests/golden/task-posed.json is recomputed the way tests/test_task_package.py computes it. Close sysprog21#855 Change-Id: Ia8a6ecbec3c6dbcacc80e77af1be00ab9825d9ac
RyanJ2002
force-pushed
the
puzzle-grid-single-rule-cases
branch
from
November 26, 2026 09:52
afc88cb to
035d4b7
Compare
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.
Problem
Puzzle Grid Save Check (valid-sudoku) let two wrong solutions pass all five built-in cases: one that never checks columns and one that never checks rows. The case labeled
duplicate in columnalso repeats its8inside the top-left box, andduplicate in rowalso repeats its5down column 8, so each is refused by a rule the solution kept. Only the box rule had a case of its own, and that one repeats inside the top-left box (#855).Change
Eight cases built from the
valid partial boardcase are appended, so the variant's example index still points at the same case and the existing five are unchanged. Each of the first six repeats a digit in one unit only and expectsfalse:duplicate in first column only: a4at (8,0) repeats the4at (4,0) down column 0.duplicate in first row only: a7at (0,8) repeats the7at (0,4) along row 0.duplicate in last column only: a1at (0,8) repeats the1at (4,8) down column 8.duplicate in last row only: a9at (8,0) repeats the9at (8,8) along row 8.duplicate in far box only: a7at (6,8) repeats the7at (8,7) inside the bottom-right box.duplicate in edge box only: a7at (2,3) repeats the7at (0,4) inside the top middle box.With repeats in the first and the last row and column, loops that start at 1 or stop at 8 are refused along with a skipped rule, a check of the top-left box alone is refused by the far box, and a check of only the diagonal or the corner boxes, such as a loop that steps through the boxes by three, by the edge box. Two more expect
true:consistent but unsolvable: a1at (0,2) repeats nowhere but leaves the board without a completion. The contract does not ask for solvability, and both earliertruecases were solvable, so a validator that also solved the grid passed.fully filled board: a valid completion ofvalid partial board. Every earliertruecase has a blank cell, so a validator that wanted one passed.Reading order:
problem-bank/judges.jsonfor the eight boards, then the new test at the end of the judge tests intests/browser/compiler-explorer.test.js. It checks every expected value against a check of all three rules, then requires each single-unit case, looked up by label and including the existingduplicate in box only, to reject the wrong check that misses its unit (a skipped rule, loops from 1 or to 8, or only the top-left, diagonal or corner boxes),fully filled boardto reject a check that wants a blank cell, andconsistent but unsolvableto reject a check that also asks for a completion, found by a small backtracking solver in the test.web/judges/puzzle-grid-save-check.jsonis thescripts/gen-problems.pyoutput for the same boards (856 of the 1111 added lines), the labels join the tricky-case list intests/web/contract.rs, and the valid-sudoku digest intests/golden/task-posed.jsonis recomputed the waytests/test_task_package.pycomputes it.Validation
node --test --test-name-pattern="valid-sudoku cases reject" tests/browser/compiler-explorer.test.jspasses. It fails withthe built-in cases must keep "duplicate in far box only"against the cases on main, and with"duplicate in first column only" must reject a check that skips the first row and columnwhen that case is given the last-column board, and with"consistent but unsolvable" must reject a check that requires a completionwhen that board is made solvable with a 4 at (0,2). Of 45 wrong checks (a skipped rule, loops from 1 or to 8, only the top-left, diagonal or corner boxes, a skipped first or last box, three wrong box numberings, a required blank cell, a required completion, always true or false, and each single row, column or box skipped), all fail at least one of the thirteen cases except those that skip one middle row, column or box, which a loop bound does not produce, and a backtracking solver confirmsconsistent but unsolvablehas no completion.python3 scripts/gen-problems.py --checkpasses, and so dopython3 -m unittest tests.test_gen_problems tests.test_task_package(94 tests),npx prettier --checkandnpx eslinton the test file../scripts/test.sh rustpasses on macOS arm64 with GNU coreutils first onPATH. Without it,tasks::defense::attempt_tests::a_model_is_only_one_its_task_builtfails on main as well, because its script runstouch -d tomorrow, which the BSDtouchrefuses; that is unrelated to this change. Not run:cargo-deny(not installed), 3 browser tests that need Playwright, and the portable lane in full on that machine (jqwas missing there); the Python and Node checks above cover the files this change touches.Close #855