Repository navigation
Conversation
The patterns end in $, which also matches before a final newline, so a rational or a 64-hex digest with one trailing newline was accepted. The parsed value was still the intended token. The call sites now use fullmatch, and the tests fail if a site goes back to match.
ahrazzle
left a comment
There was a problem hiding this comment.
Content review by grk-proof, posted unchanged by grk-ship.
ahrazzle/soko #68 review
PR: #68
Reviewer: grk-proof (content review; cloud agent bc-655a6a4a)
Head: 9ccc9f489a28f3673da012a55e2d7226dffb6269
Base: 41b6f9ca54cc24954adcd3e88149c2371a4478e6
Parent of the head is the base. Python 3.12.3. [verified]
- The targeted bad inputs pass on the base and fail on the head.
re.matchof both$patterns succeeds and stops before one trailing\n(endis the token length).fullmatchdoes not.int('3\n')andint('4\n')both return the integer, so the regex is the only gate. [verified]
PYTHONPATH=/tmp/soko-base python3 /tmp/review/probe68.py
FRACTION '3/4\n': ACCEPTED Fraction(3, 4)
FRACTION '3\n': ACCEPTED Fraction(3, 1)
FRACTION '-5\n': ACCEPTED Fraction(-5, 1)
AUDIT witness_newline: passed=True status=VERIFIED rules=[]
AUDIT pin_newline: passed=True status=VERIFIED rules=[]
PYTHONPATH=/tmp/soko-68 python3 /tmp/review/probe68.py
FRACTION '3/4\n': REJECTED ValueError
FRACTION '3\n': REJECTED ValueError
FRACTION '-5\n': REJECTED ValueError
AUDIT clean: passed=True status=VERIFIED rules=[]
AUDIT witness_newline: passed=False status=REJECTED rules=['F08_INVALID_WITNESS_SHA256']
AUDIT pin_newline: passed=False status=REJECTED rules=['F03_TCB_MANIFEST_UNLOCKED']
ZFRAC '3/4\n': dollar_fullmatch=False Zmatch=False
- Known-answer tests pass at the head, including under
-O. [verified]
cd /tmp/soko-68 && python3 -m unittest tests.test_anchored_fullmatch -v
cd /tmp/soko-68 && python3 -O -m unittest tests.test_anchored_fullmatch -v
Ran 3 tests in 0.000s
OK
3/4 parses as Fraction(3, 4) and -5 as -5. The clean 64-hex certificate stays passed=True. [verified]
- Restoring the base sources and keeping the new tests fails the two new checks. The canonical parse still passes.
-Odoes not hide it, because the checks areassertRaisesand a raisedAssertionError, notassertstatements. Restored afterward;git diffwas empty andfullmatchwas back at the three call sites. [verified]
git show 41b6f9ca54cc24954adcd3e88149c2371a4478e6:experiments/landmark_dual_bounds/hero_assignment_bounds.py > experiments/landmark_dual_bounds/hero_assignment_bounds.py
git show 41b6f9ca54cc24954adcd3e88149c2371a4478e6:mde_soko/domain_oracle.py > mde_soko/domain_oracle.py
python3 -m unittest tests.test_anchored_fullmatch -v
python3 -O -m unittest tests.test_anchored_fullmatch -v
FAILED (failures=2)
AssertionError: ValueError not raised
AssertionError: trailing newline on the witness digest was accepted: {'passed': True, 'epistemic_status': 'VERIFIED', ...}
- Full suite,
python3 -m unittest discover -s tests -v. Same three failures on the base and the head. They are clang missing<algorithm>in three pre-existing C++ compile tests. Not this diff. [verified]
base: Ran 434 tests in 301.244s FAILED (failures=3, skipped=6)
head: Ran 437 tests in 320.613s FAILED (failures=3, skipped=6)
The three new tests are ok inside the head suite. The extra three tests are exactly this PR. Skips are DRAT_TRIM and original-engine HTML env vars, same six on the base. [verified]
- Gaps. No other call site of
_STRICT_FRAC_REorSHA256_64_RE.soko_mcp/integrity.pyalready usesfullmatchonsplitlines(), so a manifest newline is not part of the token. [verified]
$ left in the pattern is not a remaining hole under fullmatch on 3.12.3: fullmatch and \Z both reject 3/4\n. .match still accepts it, and the new tests fail if a site goes back. [verified]
Already rejected on the base, so this PR does not change them: a second newline, \r, \r\n, a space, a leading space, +3/4, 3/04, uppercase hex, a short digest. [verified]
[0-9] blocks 3/4 on both sides, even though int('3') is 3. [verified]
The new fraction test only feeds 3/4\n. 3\n and -5\n take the same fullmatch and are rejected, but nothing in the suite names them. [verified]
Line-oriented $ plus re.M in the CNF and catalog parsers is a different use: the newline is the line separator, and p cnf 1 2 extra does not match. Those patterns use \d, which does match 1. They are not certificate tokens and this PR does not touch them. [verified]
#69 still accepts a witness digest plus \n, because that fix is not in this commit. git merge-tree --write-tree of the two heads exits 0, and the merged tree has both fullmatch and F00_STATUS_ABSENT. #70 is test-only and merges clean as well. No overlap that drops a fix. [verified]
Verdict: APPROVE
Reasons: The trailing-newline inputs (3/4\n, 3\n, -5\n, and a witness or pin digest followed by \n) are accepted on the base and rejected at the head. The three new tests fail when the base sources are restored, also under -O. The full suite has the same three failures on the base and the head: the three existing C++ compile tests can't find <algorithm>, and they don't touch this diff. Non-blocking: add 3\n and -5\n to the test, and drop the leftover $ in the patterns. This fix and #69 merge cleanly, and each head still has the other's bug until both land.
|
Ready to mark ready. grk-proof approved this PR at |
Fixes #65
parse_strict_fractionand the certificate digest checks now usefullmatch.The patterns already ended in
$.re.matchstill accepted one trailing newline.3/4plus a newline parsed as 3/4, and a 64-hex digest plus a newline passed the audit. Canonical values still pass. The tests fail if a call site returns tomatch, including underpython3 -O.Validation
3 tests, OK, both runs.