Skip to content

fix(python): see through coroutine runners and read comprehension filters as boundaries (#9414) - #9600

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-s3tp41
Oct 22, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-s3tp41

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • asyncio.run, anyio.run, trio.run and <receiver>.run_until_complete are transparent wrappers: they return the awaited result, so a strong exact assertion on asyncio.run(owner(..)) is credited instead of reading as not observing the owner. Matching is on the whole callee; a bare run(..) or task.run(..) stays opaque.
  • That alone exposes a latent false exposed: a changed comprehension filter (sum(p for p in prices if p > 1)) was a return-value probe, credited by any exact oracle. It is now a predicate boundary. The rule is exposed only when a strong test passes a literal list/tuple/set whose element meets the bound; otherwise it fails closed to weakly_exposed. A clause with several comparisons, a computed operand or a non-name iterable stays a return-value probe.
  • Corpus: py-shapes-async-default moves gap to credited (correct; the test fails under the mutant), and py-shapes-async-filter-boundary stays gap (correct; no element hits the bound). False verdicts on the Python corpus improve by one. py-shapes-async-default leaves the known_false ledger.

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-0238 (Python preview verdict behavior); boundary activation per RIPR-SPEC-0028
Governing issue or accepted claim: #9414 (parent #9412)
Acceptance delta (one sentence): An asyncio.run-driven exact assertion credits the owner it awaits, and a changed comprehension filter is credited only when a test input meets its bound.

Verification

  • cargo xtask precommit passes.
  • 813 Python unit tests pass, including three new ones: runner transparency with a boundary-hit and a boundary-miss control, runner lookalikes (run(..), task.run(..)) staying opaque, and which comprehension filters become predicate lines.
  • cargo xtask verdict-corpus check --language python moves exactly the two rows named above on this change.
  • Known and not caused here: on plain main the Python corpus check also fails on four unlisted py-grid-* false verdicts from test(corpus): Python operator grid, arithmetic/constant/delete/returns #9508 (py-grid-arithmetic-property, py-grid-arithmetic-table, py-grid-delete-helper, py-grid-returns-property); they are untouched by this PR.

Generated by Claude Code


Devin Review

…ters as boundaries (#9414)

asyncio.run, anyio.run, trio.run and loop.run_until_complete return the
awaited result, so they no longer hide an owner call from a strong exact
assertion (matched on the whole callee; a bare run() stays opaque). Making
them transparent exposed a latent false exposed: a changed comprehension
filter (sum(p for p in prices if p > 1)) was a return-value probe, credited
by any exact oracle. It is now a predicate boundary, observed only when a
test passes a literal list holding an element at the bound.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVJ2F1oh39juHJ8AZR5fS3
The case now credits: asyncio.run is a transparent wrapper, so the exact
assertion on the awaited default is seen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVJ2F1oh39juHJ8AZR5fS3
@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!

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 103 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 47ad6e6d-f0be-4b77-8b46-4ed59f67c444
📥 Commits

Reviewing files that changed from the base of the PR and between f039726 and c68b456.

📒 Files selected for processing: 10
  • changelog.d/9414-python-async-runner-and-filter-boundary.md
  • crates/ripr/src/analysis/language/python.rs
  • crates/ripr/src/analysis/language/python/boundary.rs
  • crates/ripr/src/analysis/language/python/classify.rs
  • crates/ripr/src/analysis/language/python/guard_activation.rs
  • crates/ripr/src/analysis/language/python/probe_shape.rs
  • crates/ripr/src/analysis/language/python/tests.rs
  • crates/ripr/src/analysis/language/python/wrapped_call.rs
  • fixtures/python-verdict-corpus/expected/rows/py-shapes-async-default.json
  • fixtures/python-verdict-corpus/spec-coverage.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown
Member Author

Review of record, head a413a32. Self-review from four angles; hosted providers are rate-limited, so they are missing, not clean.

  • Correctness. is_transparent matches runners on the whole callee (asyncio.run, anyio.run, trio.run) plus <receiver>.run_until_complete; a bare run( and task.run( stay opaque (control test). The comprehension rule requires exactly one relational comparison with simple operands and a plain-name iterable, so and-joined clauses, len(p) > 1 and load() iterables keep their prior return-value family (test table). Element capture only accepts displays whose every element is a scalar literal; one computed element drops the whole list, which fails closed to the old unresolved path.
  • Fail-closed. Resolved elements with none at the bound give weakly_exposed with the observed list in the reason; an unresolved iterable keeps today's unresolved limitation. Elements live in a separate CallRow map, so no existing consumer of scalar bindings (term and guard activation) sees them.
  • Corpus. Exactly two rows move or are re-checked: py-shapes-async-default gap to credited (truth: discriminated), py-shapes-async-filter-boundary stays gap (truth: not discriminated). The known_false entry for the first is removed as the ledger check demands. Python false verdicts improve by one.
  • Not this PR's. The Python corpus check also fails on plain main on four unlisted py-grid-* rows from test(corpus): Python operator grid, arithmetic/constant/delete/returns #9508; I reproduced that on a clean main worktree and asked the Python corpus thread who owns it.
  • Proof. cargo xtask precommit passes; 813 Python unit tests pass.

No blocking findings in this diff. Required check pending.


Generated by Claude Code

@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

…nging (#9414)

Review found three holes in the comprehension-element rule: a parametrized
list argument was never expanded into elements, an edit to the yielded
element under an unchanged filter was asked for an input at the bound, and
a filter with a further guard (`p > 1 and False`) was read as one
comparison. Parametrize cases now carry their list elements, the predicate
shape applies only when the filter differs from the old line, and the
comparison must be the whole clause.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVJ2F1oh39juHJ8AZR5fS3

Copy link
Copy Markdown
Member Author

Review of record, head 7d43c47 (supersedes the a413a32 note). Devin found three real defects my first self-review missed, plus one note:

  • Parametrized lists. Case values were read only as scalars, so a parametrized list argument left the rule unresolved and any exact oracle was credited. parametrize_case_row now reads list elements; hit and off-bound cases are tested.
  • Unchanged filter, edited yield. The predicate shape applied whenever a filter was present, so p * 2 to p * 3 under an unchanged if p > 1 demanded an input at the bound. This was a regression from my change. The shape now applies only when the filter differs from the old line; an exact-result control is tested.
  • Extra guard. if p > 1 and False was read as one comparison. The comparison must now be the whole clause; table-tested.
  • run_until_complete receiver (info). Left as is, reasoning on the thread.

Python corpus: no row moves beyond the two already described; the four py-grid-* false verdicts from #9508 still fail the check on plain main and are not touched. 816 Python unit tests and cargo xtask precommit pass on this head. merge-ready re-applied. No other blocking findings.


Generated by Claude Code

EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member Author

Correction to my earlier read: the first red Ripr Rust Small Result (run 39753264697) was for the superseded head a413a32. The newer push's run cancelled it, so it was a concurrency cancellation and not a runner failure. My label toggle then cancelled the newer run (39756363746) in turn, which is the second red result. Neither is a source failure. The live run for the current head 7d43c47 is 39756639002 (in progress); I am keeping the PR watched until it finishes.


Generated by Claude Code

@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 one verification check before upstream.

Verification questions

  • Confirm the implementation relies on heuristic lexical parsing rather than a Python AST, so unsupported syntax can silently fall back to opaque behavior or be parsed incorrectly.

Refuted

  • The new element/argument handling could rely on mutable or resizable backing-store views and stale length snapshots.; refuted because: Reviewed changed code: values are Rust-owned Strings/BTreeMaps/Vectors, and filter iteration consumes the current collected Vec. There is no JS buffer, unsafe slice, shared mutable view, resize, detach, or transfer path.
  • The prior unchanged-filter, extra-guard, and parametrized-list findings remain material.; refuted because: The current diff contains targeted source restrictions plus regression tests for all three: unchanged predicates retain ReturnValue, compound clauses remain ReturnValue, and parametrized list elements participate in boundary resolution.

Parked follow-ups

  • Custom objects with run_until_complete can still invalidate the runner-transparency assumption.
  • Transparent runner matching may over-credit an arbitrary custom receiver named run_until_complete.
  • The broad receiver-based run_until_complete policy can classify a custom receiver as transparent, but seeded discussion explicitly accepted this tradeoff to preserve loop.run_until_complete spellings.
  • Runner matching is conservative for bare and unrelated receivers but intentionally broad for method-based run_until_complete.
  • Comprehension recognition is intentionally limited to simple identifiers, literal scalar elements, and exactly one relational clause.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

The Ripr Rust Small Result failure on 7d43c47 was one test, known_false::wiring_accepts_the_committed_ledger_against_blessed_rows. It reported three Rust ledger entries (shape-op-add-impl, shape-drop-impl-side-effect, shape-dyn-trait-method-exact) that are no longer false verdicts. This diff does not touch the Rust corpus; main reconciled those entries in #9588 while this branch was behind.

Fix: merged main into the branch (clean, no conflicts) and pushed c68b456. On that head cargo xtask precommit exits 0, the Python corpus check passes (it previously failed on the four py-grid-* rows, which #9588 also reconciled), and the Rust corpus check passes. Re-applied merge-ready once; the earlier cancelled runs were label/concurrency cancellations. Review of record for 7d43c47 still applies to the PR's own changes, since the merge brought in only main's changes. I'll re-confirm the current-head result before merging.


Generated by Claude Code

@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.

Refuted

  • Could CallRow.elements alias state across rows and yield dangling references?; refuted because: Elements map is a freshly owned BTreeMap<String, Vec> constructed per row in bind_call_arguments and cloned into parametrize_case_row; bindings/elements never share &str references into source text. No borrows escape the local function scope.
  • Parametrized list elements could be exposed through a mutable or resizable backing-store view.; refuted because: Each list, tuple, or set display is parsed into owned Strings and collected into an owned Vec before CallRow use; subsequent parametrize handling clones that Vec and iterates the clone.
  • Parametrized list inputs bypass filter evidence and create false exact-oracle credit.; refuted because: The diff adds literal element extraction for direct and parametrized arguments, and tests assert hit and off-bound parametrized cases produce exposed and weakly_exposed respectively.
  • Prior parametrized-list, unchanged-filter, and extra-guard oracle holes remain open.; refuted because: The current diff contains focused controls for each and routes all three away from the incorrect verdict path; this lane found no remaining oracle gap there.
  • New list-element storage could expose a UAF or OOB through mutable/resizable backing-store views.; refuted because: Values are copied into owned Rust Strings, BTreeMaps, and Vecs; iteration consumes the current collected Vec and no slice, pointer, resize, detach, or transfer path is present.

Parked follow-ups

  • Python comprehension-filter recognition is intentionally conservative but lexical; unusual syntax without covered regression cases may receive the fallback ReturnValue treatment rather than a dedicated proof.
  • Corpus truth is updated to credited, but the expected row is static expected output and does not itself establish the mutant-red/original-green oracle pair.
  • Runner transparency is recognized for asyncio/anyio/trio.run and any dotted run_until_complete receiver, but arbitrary custom receivers can still return unrelated values.
  • The broad run_until_complete receiver match intentionally admits custom receivers, so runner transparency is heuristic rather than universally sound.
  • Filter-boundary handling covers direct list/tuple/set displays and pytest parametrized lists, while computed or nested elements deliberately fall back to unresolved behavior.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit b8ad136 into main Oct 22, 2026
47 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-s3tp41 branch October 22, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants