Repository navigation
fix(python): abstain on pytest.approx bands and caplog.text membership - #9544
Conversation
#9424, #9428) A pytest.approx call with an explicit rel/abs band, and an `in caplog.text` check on the changed log call, now abstain with static_unknown (unsupported_syntax) instead of reading a weak gap. RIPR-SPEC-0238 rules 21 and 22. Four idioms corpus rows and the python_pytest_oracle_shapes golden move with stated reasons. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
|
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 52 seconds. View limit details
Comment |
…ng approx spreads Review findings on #9544: the caplog word overlap read the whole assertion, so scaffolding words (assert, text) could trigger an abstention; a spread in the first position of pytest.approx now counts as a possible band. The repair-card inventory pin drops from 27 to 26 because the abstained caplog finding no longer carries a card. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
There was a problem hiding this comment.
Decision
- Needs one verification check before upstream.
Verification questions
- Confirm focused coverage does not establish that all equivalent approx/caplog syntaxes traverse the newly matched routes; unusual attribute, qualified-call, multiline, or membership-expression variants remain a parser-coverage risk.
Refuted
- Adding the two limits inside static_limit_for_focused_change duplicates evaluation across unrelated_candidates loops and risks redundant work; refuted because: each limit is gated by distinct, narrow conditions (digit presence + approx band; logging-call literal + caplog overlap), and the new code reuses select_relevant_assertion rather than re-walking candidates. No duplication beyond the unavoidable per-candidate filter pattern already in the file.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- No cargo-test receipt yet (ripr sensor failed exit 2, cargo-test scheduled-late); the new rules' behavior is only proven by in-tree unit tests, not the integration corpus suite.
Review of record, head 28da2edAngles: (1) correctness and edge cases, (2) spec and test grip, (3) bot findings (Devin x3, github-actions verification question). Findings and resolutions
Not blocking: a digit anywhere in the changed line (identifier, string) plus an approx band abstains on a non-numeric edit. Fail-open, noted in the rule. Result: no blocking findings remain. Merging on green Generated by Claude Code |
Resolves the python_pytest_oracle_shapes golden conflict with #9055 (typed miss rows): CHANGELOG keeps both entries, check.json and human.txt are re-blessed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
…/caplog abstentions (#9424, #9428) Merges main (#9446 ledger) and removes py-idioms-caplog-message, py-idioms-caplog-level and py-idioms-approx-constant-within-tolerance, which are no longer false verdicts on this head. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Sensor evidence is thin: ripr failed exit 2, cargo-test scheduled-late, no in-tree integration corpus receipt yet. The PR body claims
verdict-corpus check-allandcargo xtask precommitpass on head, but the UB packet only shows tokmd + ast-grep receipts. - approx_call_has_band and changed_logging_call_literal each have one consumer in static_limits.rs; sibling routes (parameterized fixtures, asyncio, numpy.testing approx) are not enumerated. Rule text in RIPR-SP-0238 says "not read by this rule" for caplog.records/messages, but no other scope-test asserts the boundary.
- crates/ripr/src/analysis/language/python/static_limits.rs:772 — changed_logging_call_literal slices to the first matching quote; an f-string
"text {x}"or("a", "b")tuple is not the adapter's stated scope but a log literal containing a stray apostrophe"it's done"would truncate. Cheap to gate the call on the literal not containing an unmatched quote before storing, or skip whenbody.find(quote)is None.
Verification questions
- Confirm caplog rule restricts to one literal per call; multi-line f-strings or concatenated literals fall through
body.find(quote)on first quote — plausible scope gap. - Confirm equivalent approx/caplog syntax coverage is not established beyond the displayed unit and corpus cases; unusual multiline, qualified, or membership-expression forms remain parser risk.
- Confirm focused unit tests cover explicit-rel/abs, positional 2nd arg, *spread, **spread, default tolerance, nan_ok, exact equality, overlapping caplog word, unrelated caplog text, and a scaffolding-word control. However, devin's verification question about qualified-call (np.testing.approx) and multiline-attribute call shapes is not directly exercised; the existing call_arglists_with_offsets helper has limited parser coverage.
- Confirm fixtures/python-verdict-corpus/expected/rows/py-idioms-approx-constant-outside-tolerance.json:0 — The corpus row now marks
outcome=abstainedfor a row whosetruth=discriminated, ideal_verdict=credited. The pre-PR row was already marked ideal; the move to abstained drops one credited reading. Confirm verdict-corpus check-all is green and that the abstained bucket is allowed for this case, since the prioroutcome=idealis replaced by an abstention rather than a credited finding.
Refuted
- Adding the two limits inside static_limit_for_focused_change duplicates evaluation across unrelated_candidates loops and risks redundant work or duplicate verdicts.; refuted because: Each limit is gated by distinct, narrow conditions (digit presence + approx band; logging literal + caplog overlap) and reuses select_relevant_assertion rather than re-walking candidates. No duplication beyond the per-candidate filter pattern already in the file.
Parked follow-ups
- Word-overlap heuristic in rule 22 only matches alphanumeric tokens >=3 chars; %-formatted parameter substitutions that share a substring (not a word) with the assertion literal will not trip the limit and will keep the old (weak) verdict until #9412 lands.
Evidence gaps
- ripr sensor failed exit 2 on this head; cargo-test is scheduled-late only. The new rules are proven by in-tree unit tests, not the verdict-corpus integration suite, so the corpus row changes are asserted but not freshly executed by this packet.
- Model proof intent was rejected by deterministic validation.
|
Response to the github-actions review on c1dc4a4, finding by finding.
No change needed on this head. Generated by Claude Code |
Resolves the repair-card inventory pin against #9429 (direct 8, no-strong 26 with the caplog finding now abstained) and the Python known_false ledger against #9550/#9583 (keeps main's list minus the three rows fixed here). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Ripgrep coverage of
in caplog.textin the new rule text is single-pattern:split_once(" in caplog.text")will missassert "x" in caplog.text(multi-space),assert ("x" in caplog.text), orassert "x" in caplog.text, "msg"(pytest assertion rewrite + message). Out-of-scope for rule 22 per spec, but the spec does not enumerate variants, so future corpus rows with rewritten messages may silently fall back to weakly_exposed.
Verification questions
- Confirm changed_logging_call_literal's first-quote slice is a parser-coverage gap (stray apostrophe, f-string body, tuple log arg). It can only shorten a literal -> fewer words -> fewer abstentions, never the reverse, so the rule is fail-open by construction. The caplog gate's evidence-side risk is bounded.
- Confirm the approx band rule is gated on trimmed.chars().any(is_ascii_digit) so non-numeric edits never spuriously abstains; the caplog arm is gated on changed_logging_call_literal returning Some, so only true logging calls trigger.
Evidence gaps
- No in-tree integration corpus (verdict-corpus check-all) receipt in the UB packet; ripr sensor failed exit 2, cargo-test scheduled-late. The PR body's claim that the corpus and precommit pass on head is unverified by the lane receipts.
- Model proof intent was rejected by deterministic validation.
- Sensor evidence is thin: ripr exit 2, cargo-test scheduled-late; rules proven only by in-tree unit tests, not the integration verdict-corpus receipt in this packet.
Python known_false list: keep main's entries minus the three py-idioms rows fixed here. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm the caplog route matches only the literal byte-normalized substring " in caplog.text", so equivalent assertion layouts can bypass rule 22.
- Confirm the caplog route recognizes only an exact one-space
in caplog.textsuffix, so equivalent asserted syntax can miss the typed limit.
Evidence gaps
- The PR packet lacks a successful deterministic cargo-test/corpus receipt despite changed Rust behavior and expected JSON goldens.
- Model proof intent was rejected by deterministic validation.
- Current-head integration proof is still absent from the packet despite the PR claiming precommit and corpus checks pass.
- The packet has no fresh cargo-test receipt; ripr itself failed with exit 2.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJm1ic5tVeaxnwQM8c6xmr
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- The rule misses semantically equivalent membership layouts because
split_once(" in caplog.text")requires one exact space sequence and the selected assertion is already reduced to gate text. A multiline or parenthesized assertion can retain the false weak-gap verdict this change is meant to eliminate. Parse/normalize the checked expression and receiver, or explicitly document/test that these layouts are unsupported and ensure they abstain or are excluded from rule 22. (crates/ripr/src/analysis/language/python/static_limits.rs:789).
Verification questions
- Confirm caplog matching recognizes only an exact
in caplog.textsubstring; multiline, parenthesized, or extra-whitespace layouts can still fall through to the old weak-gap verdict. - Confirm focused tests do not enumerate equivalent caplog membership layouts or multiline/qualified logging-call forms; these remain bounded syntax-route coverage risks.
- Confirm caplog recognition is an exact substring route (
in caplog.text) and logging literals use first-quote slicing; valid equivalent layouts may bypass rule 22, while malformed/complex literals fail open rather than over-abstain. - Confirm approx recognition delegates to
call_arglists_with_offsetsfor bare/qualified attribute forms, but no broad sibling-route coverage demonstrates equivalent multiline or alternate call spellings consistently reach rule 21. - Confirm caplog.text recognition requires the exact substring " in caplog.text", so equivalent spacing, parenthesization, or assertion-message layouts bypass the typed abstention.
Refuted
- Adding approx and caplog limits in static_limit_for_focused_change duplicates evaluation across unrelated_candidate loops.; refuted because: The two checks are mutually independent, share the already-selected candidate/focus inputs, and each returns immediately with a distinct limit; no new repeated candidate traversal is introduced.
Parked follow-ups
- Exact textual recognition of
in caplog.textis intentionally narrower than equivalent Python layouts; this is residual parser-coverage risk rather than a smaller-complete-fix violation in the stated rule.
Evidence gaps
- Changed Rust behavior and corpus expectations lack a completed current-packet cargo-test receipt; ripr exited 2.
- Model proof intent was rejected by deterministic validation.
- The PR's claimed integration proof is not established by this packet: ripr failed with exit 2 and cargo-test was only scheduled-late.
Summary
pytest.approx(..., rel=/abs=)with an explicit band now abstains (static_unknown,unsupported_syntax) instead of reading as a weak gap, because the adapter does not evaluate the tolerance (RIPR-SPEC-0238 rule 21, closes Python:pytest.approxis credited as an exact-value oracle for a within-tolerance edit #9428). Default-toleranceapproxis unchanged.assert "<text>" in caplog.textwhere the changed log call shares a word with the checked text now abstains (rule 22, closes Python: caplog text assertions pin log messages, but are graded weak #9424). The adapter does not evaluate the logged text.py-idioms-approx-constant-outside-tolerance,py-idioms-approx-constant-within-tolerance,py-idioms-caplog-level,py-idioms-caplog-message(all now limited/abstained, inside the acceptable set), and thepython_pytest_oracle_shapesgolden (weakly_exposed to static_unknown).Source-of-truth Links
Spec: RIPR-SPEC-0238
Governing issue or accepted claim: #9412 (closes #9424, closes #9428)
Acceptance delta (one sentence): Python approx-band and caplog.text membership checks no longer produce false weak-gap verdicts.
Scope
python/static_limits.rs), unit tests, spec rules 21/22, four corpus rows, one golden, changelog fragment.cargo xtask precommitandverdict-corpus check-allpass on this head.Generated by Claude Code