Repository navigation
fix(python): a unit-stepped while counter reaches its bound from an input past it (#9412) - #9720
EffortlessSteven wants to merge 3 commits into
Conversation
…nput past it (#9412) countdown(3) never binds `start` to 0, but `while start > 0` with `start -= 1` evaluates the bound at 0 inside the loop. When the counter has one unconditional unit step and the body cannot exit early, an input on the far side of the bound counts as placing the operand on it. py-shapes-generator-bound moves from gap to credited and leaves the known_false ledger. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVJ2F1oh39juHJ8AZR5fS3
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 58 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
- loop_walk is a new module with a narrow text-parsing surface. Only one public-API-adjacent call site (python_boundary_evidence). No public re-exports, no semver impact. Sibling walker paths (comprehensions, for-loops, async for) are not addressed by this PR and remain unwalked; this is consistent with the PR's stated scope (unit-stepped while counter).
- An exception-capable generator can bypass the inferred boundary and still be classified as exposed.
- The walk may ignore the fact that yielded work can be interleaved with updates from another coroutine or thread.
Verification questions
- Confirm the advertised verification results are not substantiated by the supplied packet. Late cargo-test evidence is not available, and ripr failed, so the change should not be treated as fully verified until the deterministic test receipt lands or the failure is explained.
- Confirm python_boundary_evidence gains owner_source: Option<&str> and line: usize. Only classify.rs (classify_change_for_owner) threads them; both are optional/positional and the new behavior is gated on owner_source.is_some() and operators.len()==1. Other callers (if any in sibling language modules) of the python boundary helper are unchanged because this signature is per-language.
Refuted
- The missing cargo-test receipt proves the new tests fail.; refuted because: It only prevents independent verification; the source-level assertions are directionally consistent with the PR claim, while the supplied sensor record does not provide a contradictory test result.
- body-EXITS tokenization could be fooled by string/comment contents on a real Python statement line; refuted because: The matcher trims a physical line and splits on non-word chars; any 'break'/'return' inside a string or comment on the same line as a statement would be on a separate physical line, and a same-line string 'return' does not contain the bare keyword as a token in a way that would alter control flow. Worst case is conservative (gap instead of exposed).
- Text-based EXITS list treats any line whose words include one of break/return/continue/raise/try/nonlocal/global/await/async/del as disqualifying, including substrings like
nonlocal_xorawait_via identifier split. Walker returns None, classification stays weakly_exposed (fail-closed). Substring tokens are not Python keywords so the false positive is harmless; verified by EXITS=const&words() split on non-alnum/underscore.
Evidence gaps
- The PR body claims 830 Python tests and verdict-corpus verification pass, but the shared packet reports cargo-test as scheduled-late with no receipt and ripr failed.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- loop_walk parser is text-based, not AST-based. It walks lines from owner_source using indentation and trimmed tokens, matching 'while ', ':', '-= 1', '+= 1' and an EXITS keyword list. This is a sibling-path concern: a future change that introduces an AST-based python walker (e.g., rustpython_parser) would supersede this; not a blocker but a known route divergence.
- Fail-closed controls cover step-of-two, conditional update, break, double update, and rebinding cases, but do not explicitly include every syntax accepted by python_loop_step.
|
Review of record, head 94b0996. Angles: correctness of the walk, fail-closed coverage, corpus truth, bot findings.
No findings to fix. CodeRabbit and Gemini are quota-limited (missing, not clean). Generated by Claude Code |
…-s3tp41 # Conflicts: # fixtures/python-verdict-corpus/spec-coverage.toml
|
Head moved to d16046f: merged main, which moved the Generated by Claude Code |
|
Superseded for the corpus row by #9726, which merged the same value ( Generated by Claude Code |
Summary
def countdown(start): while start > 0: yield start; start -= 1with the editstart >= 0: a testlist(countdown(3)) == [3, 2, 1]kills the mutant, because the loop evaluatesstartat 0. The boundary rule only looked at call arguments, saw no input equal to 0, and called the changeweakly_exposed.loop_walk.rs: when the compared operand is a parameter with exactly one body update,name -= 1(or+= 1for</<=), at the body's own indentation, and the body has nobreak/return/continue/raise/try/await/del/global/nonlocal, an input past the bound also places the operand on it. Anything else (step of two, conditional step, early exit, a second update, a rebind) stays unwalked and fails closed toweakly_exposed. An input below the bound is not walked either.py-shapes-generator-boundmoves gap to credited (correct, the test fails under the mutant) and leaves theknown_falseledger. It is the only row that moves.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0238 (Python preview verdict behavior); boundary activation per RIPR-SPEC-0028
Governing issue or accepted claim: #9412 (
py-shapes-generator-boundknown_false row)Acceptance delta (one sentence): A changed
whilebound is credited when an exact test drives a unit-stepped counter through it, and the row leaves the known_false ledger.Verification
cargo xtask precommitpasses.countdown(3)exposed), a below-bound control (countdown(-2)weak) and five fail-closed controls (step of two, conditional step, break, double update, rebind).cargo xtask verdict-corpus check --language pythonpasses on this tree.Generated by Claude Code