Skip to content

fix(accuracy): relate Python dunders through their class; follow same-named Rust fns in the reach walk - #4533

Merged
EffortlessSteven merged 16 commits into
mainfrom
claude/oss-accuracy-round-2-cmtps4
Sep 29, 2026
Merged

EffortlessSteven merged 16 commits into
mainfrom
claude/oss-accuracy-round-2-cmtps4

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Summary

Before: on real OSS bug fixes, Python dunder owners produced wrong signals. LowerBound.__init__ (packaging 55cbf1b) was related to tests that define their own helper class with def __init__ or call super().__init__, so it read static_unknown from an unrelated test's monkeypatch. Cache.__setitem__ and TLRUCache.__setitem__ (cachetools 39b31bc, c0fdf6a) read no_static_path on 21 probes. The projects' own suites kill every mutant of those flagged lines.

After: a dunder owner relates only through a reference to its class. Constructing the class relates __init__, __new__ and __post_init__ as constructor_call (oracle-eligible); other dunders relate as dunder_protocol (uncertain, so at most weakly_exposed). A dunder owner with no related test, whose class or module the tests import, reads static_unknown with the dynamic_dispatch limit. A def name( / class name( header in a test is no longer read as a call of name.

Rust (second commit): the bounded transitive-reach walk that names a limitation on no_static_path findings expanded only the first function of each name. jiter's parser calls decode on a generic decoder and only StringDecoder::decode calls the changed decode_to_tape, so 23 jiter findings (a05dc81, 9c3d0a5) and 6 indexmap findings (ddb0316) read a silent no_static_path. The walk now follows every same-named function; classification is unchanged (RIPR-SPEC-0114), the findings now name the unresolved path and a witness test.

Python (third commit): the reflowed lines of a multi-line def header (self,, key,, *,, ):, ) -> None:) carry no behavior and no longer get a probe. A parameter default or an annotation that calls code keeps its probe. cachetools c0fdf6a drops from 13 to 9 probes.

Review fixes (fourth commit): the owner's class must be imported from the owner's module or a package above it (from pkg import Cache, import pkg; pkg.Cache(), renamed from there, or reached as a module member. A same-named class from another module, or a bare unimported Cache, no longer relates. The header span ends on the first line where brackets balance, ignores trailing comments, and never reaches the body.

Second review round (fifth commit): a module reached by member access must match the owner's module by its full dotted path (from other import cache; cache.Cache( no longer relates), and src alone is not a package. A star import from the owner module binds the class. A test that names the class through an import the adapter does not read (try: from pkg import Cache) gives the dynamic_dispatch limit instead of no_static_path.

Exact-head review (seventh commit): only the owner's own module paths count, never a trailing part of one, so the standard library's collections.OrderedDict no longer relates to a src/mylib/collections.py owner. An owner under another import root (lib/pkg/cache.py) loses its relation and gets the non-actionable limit. Known precision cost: any test that names the class keeps a dunder owner at static_unknown rather than no_static_path (fail-closed direction). The per-owner header span is cached once per file. CodeRabbit's performance finding is fixed (added-line text checked first, lazy span walk); its annotation finding is answered on the thread (#1289 rule).

How: related_test_relation routes dunder method owners to dunder_method_relation, which requires test_references_owner_class (import provenance) before any call shape counts. multi_line_def_header_span, computed once per owner per changed file, gates the diff-mode probe through PythonNoBehaviorContext. implicit_dunder_dispatch_limit is chained after static_limit_for_change in both the diff (classify.rs) and repo (repo/evidence.rs) paths.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Spec: RIPR-SPEC-0028 (Python preview static facts), relation rules updated.
Governing issue or accepted claim: 0.11 accuracy replay round two (project thread above); round-one ledger accuracy/2026-09-28-oss-replay-ledger.md.
Acceptance delta (one sentence): Python dunder owners relate through their class, not through the shared dunder name, and the Rust reach walk no longer drops same-named functions.

Candidate Relationships

Candidate branch: claude/oss-accuracy-round-2-cmtps4. No stack parent. Searched open PRs: #4499 (name-only related tests supplying the discriminator) touches relation strength generally, not dunder routing; no equivalent PR.

Scope

  • Python preview adapter relation and static-limit selection for dunder method owners.
  • Rust transitive-reach walk name resolution (classify/transitive_reach.rs), limitation only.

Scope Classification

  • One production behavior

Production delta: dunder owner relation routing with import provenance; def/class headers are not calls; implicit-dunder dynamic_dispatch limit; no probe for structural multi-line header lines; Rust reach walk follows same-named functions.

Single acceptance criterion: packaging 55cbf1b and cachetools 39b31bc/c0fdf6a no longer report no_static_path or an unrelated-test relation on lines their suites discriminate.

Non-goals: descriptor dunders on private classes no test imports (_DescriptorBase.__get__, cachetools 57d2e48) stay no_static_path; changed defaults inside multi-line def headers (see Claim Boundary); nested-class dunders (ledger P6).

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib analysis::language::python   # 367 passed
cargo test -p ripr --lib analysis                     # 3036 passed (merged head 50b285a)
cargo xtask precommit                                   # rc=0
cargo xtask goldens check                               # pass
cargo xtask fixtures                                    # pass
  • New test given_same_named_functions_then_the_walk_follows_each_of_them fails when the index keeps only the first function per name.
  • New tests: dunder_owner_relates_by_owner_class_not_by_shared_dunder_name, a_def_or_class_header_is_not_a_call_of_that_name, unbound_dunder_owner_is_a_dynamic_dispatch_limit_not_no_static_path, dunder_owner_needs_its_class_imported_from_the_owner_package, structural_lines_of_a_multi_line_def_header_carry_no_behavior, diff_mode_emits_no_probe_for_structural_def_header_lines. Negative experiments: each fails with its production change reverted (the provenance and span tests fail on the third commit's code; the full-path, src and try: cases fail with the fifth commit's clauses removed; the stdlib-shadow and middle-segment cases fail with suffix matching restored).
  • Replays re-run on the merged head 9f86def's binary (main now carries fix(python): no probes on comments, imports and brackets inside a rewritten block (#4752) #4767, which drops probes on quiet lines inside rewritten blocks): packaging 55cbf1b/fe18f13, cachetools 39b31bc/c0fdf6a and attrs 862696a match the table below; classifications on every remaining line are unchanged.
  • OSS replay (ripr at this head, ripr check --base C^ --format json), each confirmed by mutating the flagged line and running the project's suite:
Commit Before After Mutants
packaging 55cbf1b _ranges.py:191-192,253-254 4 static_unknown, related to test_glibc_version_string, test_warn 4 weakly_exposed, related to test_lower_spellings_are_one_bound 4/4 killed by that test
packaging fe18f13 Requirement.__init__ related through test_glibc_version_string 54 tests constructing Requirement not mutated
cachetools 39b31bc Cache.__setitem__ 8 no_static_path 8 static_unknown (dynamic_dispatch) 2/2 killed
cachetools c0fdf6a TLRUCache.__setitem__ 13 no_static_path 7 static_unknown (dynamic_dispatch); 4 structural header lines emit no probe (9 before main's #4767 dropped two more quiet lines) 2/2 killed
attrs 862696a Attribute.__init__ 4 weakly_exposed 3 exposed on the merged head (line 2551 now has no probe after main's #4767) 3 of 4 killed; see Claim Boundary
jiter a05dc81 string_decoder.rs:157-165 14 no_static_path, no limitation 14 no_static_path + rust_integration_public_api_path_unresolved, witness invalid_string_controls line 164 predicate killed
jiter 9c3d0a5 9 silent all 10 named not mutated
indexmap ddb0316 disjoint.rs 6 silent 6 + rust_transitive_reach_unresolved idx >= len → > survives (equivalent: unreachable guard)

Claim Boundary

May claim: dunder owners no longer relate through the shared dunder name, and a class-importing workspace no longer gets no_static_path on its dunders.

Must not claim: exact exposure for multi-line def headers. attrs 862696a line 2513 (alias_is_default=None,, a new parameter default inside a multi-line __init__ header) now reads exposed, but mutating the default to True survives because every test passes the argument. This is the pre-existing multi-line header gap (the changed-default guard only reads one-line headers, for any owner); the constructor relation exposes it on __init__. Recorded in the replay ledger as a follow-up.

Merge note: ed75094 ported #4673's typescript/ rustfmt and lib-build repair while main was broken; after #4673 landed it is a no-op (typescript/ equals main).

Rollback

Revert the squash commit; no schema, output-contract or golden changes.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0028, RIPR-SPEC-0114
  • Tests: crates/ripr/src/analysis/language/python/tests.rs (six tests above), classify/transitive_reach.rs
  • Code: python/related_tests.rs, python/static_limits.rs, python/classify.rs, python/no_behavior.rs, python.rs, python/repo/evidence.rs, classify/transitive_reach.rs
  • Golden outputs: unchanged

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.

Gates

  • cargo fmt --check
  • cargo xtask check-static-language (via precommit)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P

Replaying packaging and cachetools bug fixes against their own suites
found three false signals on dunder owners:

- `LowerBound.__init__` related to tests that define a helper class with
  `def __init__` or call `super().__init__`, and missed the tests that
  construct `LowerBound(None, True)` (packaging 55cbf1b; all four flagged
  mutants killed by test_ranges).
- `Cache.__setitem__` and `TLRUCache.__setitem__` read `no_static_path`
  while `cache[key] = value` through a unittest mixin's `self.Cache`
  kills every mutant (cachetools 39b31bc, c0fdf6a).
- `def name(` in a test body counted as a call of `name`.

A dunder owner now relates only through a reference to its class.
Constructing the class relates `__init__`/`__new__`/`__post_init__` as
`constructor_call`; other dunders relate as uncertain `dunder_protocol`.
A dunder owner with no related test, whose class or module the tests
import, reads `static_unknown` with the `dynamic_dispatch` limit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven self-assigned this Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e96745aa-96f2-4b19-a513-cbfb3d0e4cee

📥 Commits

Reviewing files that changed from the base of the PR and between 7d499c7 and 50b285a.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • crates/ripr/src/analysis/classify/transitive_reach.rs
  • crates/ripr/src/analysis/language/python.rs
  • crates/ripr/src/analysis/language/python/classify.rs
  • crates/ripr/src/analysis/language/python/no_behavior.rs
  • crates/ripr/src/analysis/language/python/related_tests.rs
  • crates/ripr/src/analysis/language/python/repo/evidence.rs
  • crates/ripr/src/analysis/language/python/static_limits.rs
  • crates/ripr/src/analysis/language/python/tests.rs
  • docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md
  • docs/specs/RIPR-SPEC-0114-rust-transitive-reach-limitation.md

Summary by CodeRabbit

  • Bug Fixes
    • Python analysis now links tests to dunder methods through class construction and class or module references, while distinguishing constructor calls from other protocol-related references.
    • Dunder methods without a related test are reported with a dynamic-dispatch limitation when tests import their class or module.
    • Python diff analysis skips structural lines in multiline function headers, while retaining probes for parameter defaults and function-body changes.
    • Rust reach analysis checks all production functions with a matching name when finding a path.

Walkthrough

The PR updates Python analysis for dunder-method test relations, dynamic-dispatch limits, and multiline function headers. It also changes Rust transitive reach to inspect all production functions with a matching name.

Changes

Python analysis

Layer / File(s) Summary
Dunder-method test relations
crates/ripr/src/analysis/language/python/related_tests.rs, crates/ripr/src/analysis/language/python/tests.rs, docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md, CHANGELOG.md
Dunder-method owners use class-aware relations. Constructor calls receive the constructor_call relation; other dunder protocol references receive dunder_protocol. Function and class definitions are not counted as calls.
Dunder dynamic-dispatch limits
crates/ripr/src/analysis/language/python/classify.rs, crates/ripr/src/analysis/language/python/static_limits.rs, crates/ripr/src/analysis/language/python/repo/evidence.rs, crates/ripr/src/analysis/language/python/tests.rs, docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md
When there are no related test candidates, importing the dunder owner’s class or module can produce a static_unknown result with a dynamic_dispatch limit.
Multiline definition-header classification
crates/ripr/src/analysis/language/python.rs, crates/ripr/src/analysis/language/python/classify.rs, crates/ripr/src/analysis/language/python/no_behavior.rs, crates/ripr/src/analysis/language/python/tests.rs, docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md, CHANGELOG.md
Structural lines in multiline def headers do not produce probes when the paired old line is absent or has the same structure. Parameter defaults and behavior-bearing changes retain probes.

Rust transitive reach

Layer / File(s) Summary
Traverse all same-named functions
crates/ripr/src/analysis/classify/transitive_reach.rs, docs/specs/RIPR-SPEC-0114-rust-transitive-reach-limitation.md, CHANGELOG.md
Transitive and macro-reach walks examine every production function with the current callee name. Tests cover paths through one of multiple same-named functions and the case where none reaches the owner.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: 🔵 Low · up to 7d499

Large Python diffs may analyze more slowly, and an edge-case annotation change could be missed by the analyzer. Both are narrow and easy to fix, so this is mergeable with follow-up.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 7d499

The changes improve several inaccurate analysis results, but two new Python analysis paths may respectively omit a behavior-changing edit or overstate test coverage. Neither is a verified security vulnerability, and no deployment or privilege change is shown.

Retained concerns

  • Medium · reliability · inferred: The new multiline-header suppression can discard a finding for an annotation using custom subscription or overloaded union behavior. This weakens visibility into behavior-changing edits when that syntax is treated as inert.
  • Medium · reliability · inferred: An owner-class reference plus constructor-like text on a later line of a multiline string can receive an oracle-eligible constructor relation without an executable construction, potentially overstating test coverage.
Security review details

Security Blast Radius

  • inferred — The independently controllable input is analyzed repository code or tests; affected output is the corresponding analysis finding or test-evidence assessment. No cross-tenant, credential, IAM or deployment effect is established.

Security Findings and Attack Paths

  • inferred — A contributor able to change analyzed Python source could place behavior in an accepted multiline annotation and receive no probe for that line. Whether a security decision depends on the omitted finding is unknown.
  • inferred — A test that genuinely references an owner class but only mentions its construction later inside a multiline string can be assigned an oracle-eligible constructor relation. This is a possible false coverage signal, not a demonstrated security bypass.

Trust Boundaries and Controls

  • observed — Owner-class reference and local-binding checks constrain constructor relations; explicit calls and parameter defaults are excluded from structural-header suppression. These controls do not resolve overloaded annotation operators or quote state across test lines.

Hardening Proposals

  • proposed — Preserve a finding when an annotation can invoke user-defined behavior, and use multiline-aware lexical or parsed-code checks before treating constructor text as executable test evidence.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 8 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly names both main changes: Python dunder relations through their class and Rust reach walks through same-named functions. It is somewhat long, but specific and relevant.
Description check ✅ Passed The description is detailed and covers the summary, scope, acceptance criterion, proof, claim boundary, rollback, traceability, and applicable policy sections. Proposal, ADR, and plan-item links are n…
Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 8 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch claude/oss-accuracy-round-2-cmtps4
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reviews each function in flight
Through dunder paths and headers bright
Same-named Rust calls join the chase
Defaults keep probes in their place
The test paths hop along just right

Comment @coderabbitai help to get the list of available commands.

The bounded walk that names a limitation on `no_static_path` findings
indexed production functions by name with `or_insert`, so only the first
function of each name was expanded. jiter a05dc81/9c3d0a5: the parser calls
`decode` on a generic decoder; `StringDecoder::decode` calls the changed
`decode_to_tape`, but the other `decode` was indexed first, so 23 findings
read a silent `no_static_path`. The suite kills the flagged predicate's
mutant. indexmap ddb0316 had 6 more.

The walk now follows every function with the callee's name. Classification
is unchanged (RIPR-SPEC-0114); the findings now carry the named limitation
and a witness test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
@EffortlessSteven EffortlessSteven changed the title fix(python): relate dunder method owners through their class fix(accuracy): relate Python dunders through their class; follow same-named Rust fns in the reach walk Sep 29, 2026
cachetools c0fdf6a reflowed `TLRUCache.__setitem__`'s signature over
several lines; diff mode probed `self,`, `key,`, `value,` and `):` as
`predicate`, each reported `no_static_path`. Those lines have no behavior
for a test to discriminate.

Diff mode now skips a line inside a multi-line `def` header that only names
a parameter (optionally with an inert annotation) or opens/closes the
header, when the paired old line has the same shape. Parameter defaults,
annotations with calls, trailing comments and `)` closing a call in a body
keep their probe.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
coderabbitai[bot]

This comment was marked as resolved.

A dunder owner related to any bare `Cache(` in a test, so a same-named
class imported from another module, or no import at all, read as a
constructor call. The class must now be imported from the owner's module
or a package above it, renamed from there, or reached as a member of such
a module.

The multi-line def header span now ends on the first line where brackets
balance, ignores trailing comments, and yields no span when that line does
not end in `:`, so it never reaches into the body.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
The member-access branch matched any module whose last segment equals the
owner file's stem, so `from other import cache; cache.Cache(3)` still read
as a constructor call. The dunder path now checks the import's full dotted
module against the owner's module paths (and their suffixes, for import
roots other than the repository root or `src`), and never treats the bare
`src` root as a package.

A star import from the owner module binds the class by name. A test that
names the class through an import the adapter does not read (inside
`try:`) now yields the `dynamic_dispatch` limit rather than a
`no_static_path` claim.

The structural-header check reads the added line's own text first and the
span walk no longer collects every source line (review feedback).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
The diff walk looked up the added line with `lines().nth` and walked the
source from the start for every structural-looking added line. It now
checks the added line's own text and caches the owner's header span in a
map built once per changed file (review feedback).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
origin/main (7fb7353, #4635) leaves typescript/mod.rs unsorted, so
`cargo fmt --check` fails, and calls the test-only `line_for_offset` from
`tests_extract.rs`, so the lib build fails. Same change as #4673's
combined-tree repair: sort `module_entries` and resolve the computed-title
line through `SourceText`. No-op once main carries it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P

Copy link
Copy Markdown
Member Author

CI on cb89f9c failed in Ripr Rust Small / Rust gates (cargo fmt --check), source-of-truth and spec-maintenance-digest. None of this is from this PR's diff. Current main (7fb7353, #4635) leaves typescript/mod.rs with module_entries out of rustfmt order, and it calls the test-only line_for_offset from typescript/tests_extract.rs, so the lib build fails (E0425). I reproduced both locally on the merge with main.

I ported the same repair #4673 carries into ed75094: module_entries is sorted, and the computed-title line resolves through SourceText. The change becomes a no-op once main carries it. After the port, cargo fmt --check, the lib build, cargo xtask precommit and cargo test -p ripr --lib analysis::language (1076 passed) all pass locally.


Generated by Claude Code

The previous commit also accepted trailing parts of the owner's module path,
so `from collections import OrderedDict` (the standard library) related to a
`src/mylib/collections.py` owner as `constructor_call`, and `util.Cache(`
related to `src/pkg/util/cache.py`. Only the owner's own module paths and
their packages count now. An owner under another import root (`lib/`) loses
the relation and falls to the non-actionable `dynamic_dispatch` limit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Np4sJkq1jfbMTLg3Uz7s5P
…ound-2-cmtps4

# Conflicts:
#	crates/ripr/src/analysis/language/python.rs
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T06:55:16.466040Z 50b285a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EffortlessSteven
EffortlessSteven merged commit f4dcc57 into main Sep 29, 2026
26 of 27 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/oss-accuracy-round-2-cmtps4 branch September 29, 2026 06:51

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

Devin Review

Comment on lines +103 to +106
if no_behavior.structural_def_header_line
&& old_line_text.is_none_or(is_structural_def_header_text)
{
return None;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Changed function signatures disappear from analysis

When key, becomes value, in a multi-line signature, structural_def_header_line suppresses the change. Both lines pass is_structural_def_header_text, although callers using key= now fail without a probe.

Learn more

Diff mode classifies added lines after pairing each with an old line at the same new-side position. The structural guard tests each side independently, so two different parameter names both qualify as structural. A signature rename is executable behavior: keyword callers can fail even if the method body never changes. The same issue affects moving parameter names or changing def to async def in a multi-line header.

Example: Change def f(\n key,\n): to def f(\n value,\n):. An existing f(key=1) now raises TypeError, but the changed parameter line produces no probe.

Recommended fix: Compare a parsed old and new signature or their runtime-significant skeletons before suppressing paired header lines. Suppress only truly equivalent signature reflows; retain changes to parameter names, ordering, function names, async status and defaults. Add a diff-mode negative test for a changed keyword parameter.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +352 to +357
if matches!(
owner.name.as_str(),
"__init__" | "__new__" | "__post_init__"
) {
PythonRelationKind::ConstructorCall
} else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Constructor tests falsely expose unexercised defaults

When __init__ changes a default, ConstructorCall can credit exposed from tests passing that argument explicitly. changed_default_overridden_params skips methods, so those tests never exercise the changed default.

Learn more

Constructor relations now make Class(...) an oracle-eligible test of the class's __init__ method. The classifier credits a strong aligned oracle as exposed unless its changed-default check detects that every related call binds the changed parameter. That check exits immediately for methods, so the new constructor relation exposes a gap previously masked by the lack of a constructor link. It also cannot parse a standalone parameter line of a multi-line header as a complete signature.

Example: class C: def __init__(self, flag=False): self.flag = flag changes its default to True; the only test asserts C(flag=False).flag == False. The test passes after mutating the default back to False, yet the constructor relation can credit it as exposed.

Recommended fix: Extend the changed-default gate to constructor-bound __init__ calls and parse complete signatures across lines. Require a strong reaching test that omits the changed argument before crediting default changes. Exercise both one-line and multi-line signatures with an explicitly passed argument in regression tests.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +339 to +342
if contains_call_name(body, &owner.qualified_name)
|| contains_any_attribute_call(body, &owner.name)
{
return Some(PythonRelationKind::SyntacticCall);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Unrelated dunder calls receive direct test credit

When a test references Cache but calls other.__eq__(...), contains_any_attribute_call marks Cache.__eq__ directly related. The receiver never binds to Cache, so unrelated assertions gain oracle credit.

Learn more

The dunder matcher first establishes that the test mentions an imported owner class, then accepts any attribute call sharing the changed method name. That import does not establish the receiver of a later attribute call. PythonRelationKind::SyntacticCall is oracle-eligible, so this path can promote an unrelated test instead of leaving it uncertain.

Example: A test imports Cache, stores it in a registry, then asserts a result from Other().__eq__(x). A change to Cache.__eq__ acquires that test as a syntactic caller even though the explicit call targets Other.

Recommended fix: Require a receiver statically bound to the imported class for direct dunder credit. Keep unresolved explicit attribute calls uncertain rather than promoting them to SyntacticCall; add a test that imports the owner but invokes the same dunder on a different class.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +430 to +433
fn imports_owner_class(import: &PythonImport, owner: &PythonOwner, class: &str) -> bool {
(import.imported == class || import.imported == "*")
&& module_contains_owner(&import.source_module, owner)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Package exports can credit the wrong class

When pkg exports a different Cache, module_contains_owner still treats from pkg import Cache as pkg.cache.Cache. Tests constructing the exported class then credit the changed class's dunder methods.

Learn more

A class imported from an ancestor package need not originate in the owner's module. The new module-prefix check accepts every package above that file without inspecting its initializer. This makes an import of an unrelated same-named class look like a constructor of the changed class, and ConstructorCall is oracle-eligible.

Example: pkg/cache.py defines Cache, while pkg/__init__.py exports Cache from pkg/other.py. A test using from pkg import Cache; Cache() relates to pkg/cache.py::Cache.__init__, which it never calls.

Recommended fix: For ancestor-package imports, use the existing package re-export authority to verify the class binding and refuse ambiguous bindings. Keep a direct from pkg.cache import Cache match without that extra step; test a package exporting a sibling same-named class.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50b285a642

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +103 to +106
if no_behavior.structural_def_header_line
&& old_line_text.is_none_or(is_structural_def_header_text)
{
return None;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve probes for signature-changing parameter lines

Failure mode: when a multi-line signature adds a required parameter or changes key, to item,, the new line is structural and the old line is either absent or also structural, so this branch returns None even though the callable's runtime signature changed. Why here: this silently drops behavior that tests may need to discriminate, contrary to the evidence-promotion requirement to analyze changed behavior first. Fix direction: suppress only unchanged/reflowed signature components by comparing parsed old and new signatures; retain probes for added, removed, renamed, or reordered parameters. Validation: add diff-mode controls for an added parameter and key, → item,, then run cargo test -p ripr --lib analysis::language::python. Confidence: High.

AGENTS.md reference: AGENTS.md:L226-L230

Useful? React with 👍 / 👎.

Comment on lines +430 to +432
fn imports_owner_class(import: &PythonImport, owner: &PythonOwner, class: &str) -> bool {
(import.imported == class || import.imported == "*")
&& module_contains_owner(&import.source_module, owner)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve package re-exports before relating classes

Failure mode: for an owner in src/pkg/cache.py, this accepts from pkg import Cache merely because pkg prefixes the owner module, even when pkg/__init__.py does not re-export that class or binds an unrelated Cache; the resulting constructor_call is oracle-eligible and can falsely promote the method. Why here: the repository already has reexports.rs to verify package identity, and package-name coincidence is not owner identity. Fix direction: accept the defining module directly, but require the containing class's verified re-export metadata for package prefixes. Validation: add an end-to-end fixture where pkg/__init__.py defines another Cache and confirm the test remains unrelated. Confidence: High.

AGENTS.md reference: AGENTS.md:L231-L236

Useful? React with 👍 / 👎.

Comment on lines +352 to +356
if matches!(
owner.name.as_str(),
"__init__" | "__new__" | "__post_init__"
) {
PythonRelationKind::ConstructorCall

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not treat every post_init as a constructor call

Failure mode: ordinary Python construction automatically invokes __new__ and __init__, but __post_init__ is only called when generated behavior such as a dataclass initializer explicitly does so; a plain class can define __post_init__ without Class() ever reaching it. Marking every construction as ConstructorCall makes the relation oracle-eligible and can falsely credit a dormant method. Fix direction: require syntax-backed dataclass/generated-init evidence or an explicit call; otherwise keep the relation uncertain. Validation: add a plain-class fixture that constructs the class but never calls __post_init__, plus a dataclass control, and run the focused Python analyzer tests. Confidence: High.

AGENTS.md reference: AGENTS.md:L231-L236

Useful? React with 👍 / 👎.

Comment on lines +339 to +342
if contains_call_name(body, &owner.qualified_name)
|| contains_any_attribute_call(body, &owner.name)
{
return Some(PythonRelationKind::SyntacticCall);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind explicit dunder calls to the owner receiver

Failure mode: once a test references the owner class anywhere, any call such as other.__eq__(...) satisfies contains_any_attribute_call and becomes a strong SyntacticCall for Owner.__eq__, even though the receiver is unrelated. This can silently supply another owner's oracle. Fix direction: reserve the strong relation for Owner.__eq__(...) or a receiver proven to be constructed/bound from Owner; otherwise retain an uncertain relation. Validation: add a mixed-receiver test that constructs the owner but explicitly calls the same dunder on another class, and assert it is not oracle-eligible. Confidence: High.

AGENTS.md reference: AGENTS.md:L231-L236

Useful? React with 👍 / 👎.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Lane ub-worker-handoff scope (JS-backed memory, async, GC, detach, transfer) does not intersect this PR. All changed surfaces are Rust analyzer code and markdown specs; no JS, no worker boundaries, no transferable objects, no postMessage/structured-clone, no WeakRef/FinalizationRegistry, no ArrayBuffer transfer. Reporting scope-out rather than a no-op approval.
  • OwnerKind restriction in dunder_method_class (Method|ClassMethod only) silently routes free def __init__(...) outside a class to the legacy body_calls_owner path; a free dunder is unusual but not impossible, and the new spec clause says 'dunder method owner' without qualifying. Not exercised by fixtures. Resolved-check: spec text 'dunder method owner' arguably implies a method, so behavior is defensible, but the spec could say so explicitly.

Verification questions

  • Confirm diff_mode_emits_no_probe_for_structural_def_header_lines asserts None/old=key=None only; missing direct assert that old=key, paired with new=key: int, also suppresses (reflow symmetry).

Refuted

  • A dunder owner's class might leak across worker/async boundaries via a captured reference, requiring a structured-clone or transfer-aware analysis.; refuted because: This diff is a static Rust analyzer for Python and Rust source files. There is no JS runtime, no worker postMessage, no transferable buffer, and no async JS boundary. The 'async' in the diff refers to Python's async def keyword, which is parsed as a header-prefix check, not JS event-loop ordering.
  • ReachSweep now retains multiple FunctionSummary references per name; a later push/pop could invalidate the returned slice and cause UAF or OOB reads on FunctionSummary fields.; refuted because: Vec<&'a FunctionSummary> only stores references borrowed from prod_fns, which the walk does not mutate. ReachSweep carries no &mut prod_fns path; the outer API passes prod_fns as &[&'a FunctionSummary] and the BFS reads through immutable refs. No interior mutability, no UnsafeCell, no drop-during-iteration risk.
  • implicit_dunder_dispatch_limit fires for every dunder owner with no related test, inflating static_unknown across all workspaces.; refuted because: Limit is gated by dunder_method_class (dunder + Method|ClassMethod) AND by at least one test whose imports include the owner module/class or whose body names the class. Unrelated-tests control in unbound_dunder_owner_is_a_dynamic_dispatch_limit_not_no_static_path asserts NoStaticPath when no test imports or names the class.

Parked follow-ups

  • PR body Claim Boundary records a known precision cost: attrs 862696a line 2513 default alias_is_default=None, survives every mutation because every test passes the argument. This is the pre-existing one-line multi-default gap; the constructor relation exposes it on init. Parked, not broadened.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants