Repository navigation
fix(python): withhold probe for no-op class-header (object) edit - #11941
EffortlessSteven wants to merge 2 commits into
Conversation
…11888) `class X(object):` <-> `class X:` has no Python 3 behavior delta; add a closed allow-list guard beside the def-header annotation guard. Other base, multi-base and metaclass changes keep their probe. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVdGzQvtpKrgEnbdSoyCd8
|
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 47 minutes. View limit details
|
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Independent review of head aeb89ab (diff/source reading, no blockers): the guard accepts only a one-line header where both sides share the name and indentation and exactly one side has a sole bare Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- A module that rebinds
objectcould makeclass X(object):semantically different fromclass X:, while the new guard suppresses the probe.
Verification questions
- Confirm only the direct classifier route was established; the packet does not prove that every public/sibling Python entry point reaches the new guard.
- Confirm the negative controls prove that common base and metaclass changes retain probes, but they do not directly exercise a same-hunk class-body edit.
- Confirm the direct tests exercise the advertised no-op, a changed-base negative control, and conservative variants including multiple bases, metaclass, rename, and malformed syntax.
- Confirm the parser and classifier tests cover the intended allow-list, but no end-to-end fixture demonstrates the claimed
exposedsuppression through the public analysis route. - Confirm the tests do not cover a same-hunk class-body edit, so they cannot detect a future guard that suppresses probes for unrelated body changes in the class header's hunk.
- Confirm the conservative parser tests omit class X(): and trailing-comma forms, leaving ambiguity about whether these syntactic variants should be treated as no-ops or fail closed.
- Confirm the implementation does not cover related Python no-op forms such as class X(): versus class X:, trailing-comma variants, or same-hunk body edits; the seeded thread records these as follow-ups rather than current blockers.
- Confirm the new classifier test asserts the no-op header yields no finding, but does not assert that the old classifier would have yielded a finding.
Evidence gaps
- No cargo-test completion receipt is present in the supplied evidence, leaving the claimed focused behavior without an available late-phase witness.
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- The new helper recognizes only one-line class headers and rejects multi-base, metaclass, renamed, and malformed forms; these cases remain probe-bearing rather than being broadly suppressed.
EffortlessSteven
left a comment
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head f427a7c): REPAIR_REQUIRED
Inspected:
- Subject: PR #11941, head
f427a7c74dd04c6162086ead478fa9e615aa0c4d, base56444f1605fa1431054375f9b232c37f72ede436, 5 files, +137/-1. Governed by issue #11888. - Cluster for #11888: three PRs claim it. #11932 is merged (merge commit
62a2c41cb3b6635b1d86f5948307c10286a53998, merged_at 2026-10-31T23:17:27Z, body "Closes #11888"). #11941 is this PR. #11933 is open. - Semantic owner:
crates/ripr/src/analysis/language/python/classify.rs(the probe-suppression guard stack, lines 255-322) andcrates/ripr/src/analysis/language/python/no_behavior.rs.
Blocking:
- The governing issue is already delivered, and this PR's base contains the delivery. #11932 landed
is_object_base_only_class_change(no_behavior.rs:303) and wired it intois_annotation_only_def_change(no_behavior.rs:363-377).compare 62a2c41c...56444f16reportsstatus=ahead, ahead=21, behind=0, so62a2c41cis an ancestor of this PR's base. #11932's own acceptance delta already covers this claim's scope and more: "a single-line class header change that only toggles the legacyobjectbase or empty()". What this PR proposes is a second implementation of behavior already on main, and the repo rule is explicit that upstream delivery wins over duplicate conflict work. - The new guard cannot change any outcome: it is unreachable. classify.rs:301-306 (
is_noop_class_header_change) is evaluated after classify.rs:293-298 (is_annotation_only_def_change), and the two carry identical preconditions -old_line_textisSomeandsame_indentation(old, line_text). The earlier predicate returnstruefirst for every input the new one accepts, becauseis_annotation_only_def_changenow begins withif is_object_base_only_class_change(old_line, new_line) { return true; }(no_behavior.rs:364-366). The merged recognizer is a strict superset of the new one: it also acceptsclass X():<->class X:throughempty_parens_class_header_only_change(no_behavior.rs:332-351), and it parses the header withrustpython_parser(legacy_class_header_shape, no_behavior.rs:271) instead of scanning it as text (class_header_parts, no_behavior.rs:382). I walked the new recognizer's accepted set against the merged one:class X(object):<->class X:, the reverse, and every spelling the text scanner admits are all accepted by the merged parser too; the merged parser additionally acceptsclass X (object):,class X(object):with a trailing space, and a digit-leading or Unicode class name, all of which the text scanner rejects. The only production caller of the new predicate is classify.rs:303, so no input reaches it with a true result. - No test in this PR discriminates this PR's change.
noop_class_header_object_base_emits_no_probeassertsfinding.is_none()forclass X(object):->class X:; the merged guard already producesNone, so the assertion holds identically with the new code removed.changed_class_base_still_gets_a_probelikewise passes without the change.noop_class_header_detection_is_conservativecalls the helper directly, so it would still pass if the helper were never called from the production path. The product contract asks whether the current tests contain a discriminator that would notice if the changed behavior were wrong; here no test distinguishes "the new guard works" from "the new guard is absent", because the merged guard produces the same outcome for every case.
Cluster disposition - survivor: #11932 (merged). #11941 is a redundant, unreachable second guard. #11933 is not viable at its head: crates/ripr/src/analysis/language/python/no_behavior.rs defines is_object_base_only_class_change twice in the same module, once at line 303 (the merged #11932 version, private fn) and again at line 446 (pub(super) fn). I read both definitions at that head, and hosted CI confirms it independently: error[E0428]: the name is_object_base_only_class_change is defined multiple times plus error[E0603]: function is_object_base_only_class_change is private, on ubuntu, windows, macos and the Linux wheel build (jobs 124692412209, 124692412358, 124692412483, 124692540347 of runs 41253737066 and 41253733970). It reports mergeable_state=blocked. Recommended action: close #11941 and #11933 as duplicates of merged #11932 rather than repairing either.
Non-blocking:
- No spec amendment and no traceability registration. The three new test functions in
crates/ripr/src/analysis/language/python/tests.rsare absent from.ripr/traceability.toml, so the new discriminator is unlinked from the spec that owns the behavior. The sibling #11933's body states it carries a "RIPR-SPEC-0028 amendment, traceability rows, changelog fragment"; this PR carries only the changelog fragment. - The changelog fragment announces a fix main already has. #11932 merged without one, so there is no duplicate-file collision, but landing this fragment would publish a second entry for behavior that shipped in #11932.
- Undisclosed false-negative limit: neither recognizer checks that
objectis the builtin rather than a module-local rebinding, soclass X(object):whereobjectis a user-defined class is treated as a no-op although it changes the base class. This PR's body has no "Known limits" section and does not mention it; #11933 discloses it explicitly. - PR body / hosted-evidence mismatch: the body's "Proof" line reports the failure set as one python-lib failure (
compare_literal_values_fails_open_on_undecoded_literals). The hosted lane at this head fails three different tests and none of them is that one. A reader of the body alone would not know what is red at this head. - Efficiency: neutral for this PR.
class_header_partsscans one header line with twosplit_oncesubstrings;is_noop_class_header_changeshort-circuits on the first failed parse; it is evaluated at most once per candidate line, and only after the earlier guard has already returned for most inputs. No new I/O, no process spawning, no cache added, invalidated or mis-keyed, no collection growth, and no previously short-circuited computation is now always run. For contrast the merged recognizer is the heavier one - it invokesrustpython_parsertwice per candidate header - but that cost is main's, not this PR's. - Corroborates the
github-actions[bot]COMMENTED review ataeb89ab5on the general shape; the bot's questions do not reach the merged-#11932 overlap, which is the finding that decides this PR.
Not run:
- No Rust toolchain on this host (
rustc,cargo,rustupare absent from PATH).cargo xtask precommit,cargo test -p ripr --libandcargo xtask check-traceabilitywere not executed and no local Rust receipt is claimed. The reachability argument is established by reading source at this head - guard order and preconditions in classify.rs, the first statement ofis_annotation_only_def_change, and both recognizer bodies - not by execution. - Hosted Rust gates at this exact head are still in progress: "Merge-ready request f427a7c" (run 41252215727), job "Ripr Rust Small on GitHub Hosted / Rust gates" (id 124688659733). No superseded run was read as this head's result.
- The "CI" workflow at this head is red, and the red is inherited from the base. Attribution rests on a base comparison plus a direct source-level chain:
-p ripr --test cli_smoke:check_worktree_drill_in_commands_reach_the_uncommitted_findingandselector_location_misses_explain_syntax_and_preserve_retry_scope. The base commit itself - 56444f1, "fix(explain): suggest check --format json in selector hints (#11570 item 4) (#11844)" - changed the explain hint from--jsonto--format jsonincrates/ripr/src/app/explain.rsand did not updatecrates/ripr/tests/cli_smoke.rs, which pins the old spelling. The observed message carries--format jsonwhere the test expects--json.-p ripr --lib:lsp::backend::list_actionable_items_tests::list_actionable_items_names_gaps_the_actionable_profile_hidesfails on an exact ordering assertion -left: ["probe:pricing:94:predicate", "probe:pricing:98:predicate"]against the expected["probe:pricing:98:predicate", "probe:pricing:94:predicate"]. The list order comes fromcanonical_group_membersincrates/ripr/src/lsp/diagnostics.rs, whose bucket keys arecanonical:,raw:and - added by main commit 927e92a, "fix(lsp): collapse same-site gap diagnostics with one missing discriminator (#11796) (#11862)" -site-missing:. 927e92a is an ancestor of this PR's base (compare 927e92aeb...56444f16givesahead=5, behind=0) and is not an ancestor of 3229707, where the same test passed in a completed green run (job 124679977754 of PR #11823's CI run 41249542061). This PR touches nolsp/and noapp/file.- The base push run for 56444f1 (CI id 41252096978) was cancelled before any job reported, so there is no green base lane to compare against directly; the attribution rests on the source-level chain above plus the green run at ca39083.
- The parse behaviour of
rustpython_parseron the header spellings was not executed here; the recognizer comparison is from reading the merged implementation at the base.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head f427a7c74dd04c6162086ead478fa9e615aa0c4d. Not an approval.
|
Closing as superseded: #11932 (merged 62a2c41) already delivers #11888, with a strict superset recognizer. This PR's guard is unreachable behind it and its tests don't discriminate. The independent review's finding is verified. Generated by Claude Code |
Governing issue or accepted claim: #11888
Acceptance delta (one sentence): a Python
class X(object):<->class X:header edit no longer produces a probe (so no falseexposed), while any other base/metaclass change keeps its probe.Adds
is_noop_class_header_change(closed allow-list: same name, single-line headers, sole bareobjectbase vs no bases) inpython/no_behavior.rs, wired inclassify.rsbeside the def-header annotation guard. Unit tests: issue repro yields no finding;Base->Otherstill probes;object, BasevsBase,Base, object, metaclass, rename, multi-line are not no-ops.Proof:
cargo xtask precommitpass; python lib tests 1707 pass, 1 pre-existing unrelated failure (compare_literal_values_fails_open_on_undecoded_literals, numeric literal compare; not touched here).Generated by Claude Code