Skip to content

fix(python): boundary gate declines reversing flips and rebound operands (#9426) - #9726

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/py-fix-boundary-shadow
Oct 22, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/py-fix-boundary-shadow

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #9426 (parent #9412)
Acceptance delta (one sentence): Python verdict corpus rows py-hostile-builtin-name-shadow and py-shapes-generator-bound move from false actionable gap to credited, removing both known-false rows.

Change

Owner: crates/ripr/src/analysis/language/python/boundary.rs (predicate boundary gate).

  • Reversing flip (<<->>, <=<->>=, same operands, same order): when a strong call places both operands at statically unequal literals, the equality-boundary requirement is not applied (every unequal pair differs). Calls that only place the operands equal or unresolved fall through to the existing rules.
  • Rebound operand: when a compared operand that is an owner parameter is rebound inside the owner body (start -= 1, assignment, for target, walrus), the boundary downgrade is declined (activation unresolved, no missing-boundary repair target). Condition headers ending in : are not treated as annotations; derived locals (age = int(text)) are not parameters and keep the gap.
  • Reuses the shared rebinding scan in guard_activation.rs (name_rebound_in_owner); no rescoring.

Tests

Positive and discriminating negatives in classify/tests.rs: reversing flip with unequal inputs credited; adjacent flip >->>= with unequal inputs stays a gap; rebound loop operand declines; unrebound operand, parameter used only in if headers, and derived local keep the gap.

Corpus rows moved (bless --language python, only these two)

  • py-hostile-builtin-name-shadow: gap -> credited (reversing flip >->< on unequal inputs 2, 9).
  • py-shapes-generator-bound: gap -> credited (start rebound by start -= 1; boundary unknown, not missing).
    Known-false files for both deleted under fixtures/python-verdict-corpus/known-false/. A first draft also moved py-idioms-raises-boundary (local age = int(text)); fixed by restricting the rebound check to parameters, so that row is unchanged.

Not fixed

Nothing in scope left. Note: a reversing flip proven only by an equal-pair call is still credited via the existing equality observation (pre-existing behavior, unchanged).

Verification

cargo xtask verdict-corpus check --language python (false verdicts 15/194), cargo xtask precommit exit 0, python unit tests 838 passed.


Generated by Claude Code

…y-shadow

# Conflicts:
#	fixtures/python-verdict-corpus/spec-coverage.toml
…y-shadow

# Conflicts:
#	fixtures/python-verdict-corpus/spec-coverage.toml
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Md92nb17wXfHAmQNvaWYu3
@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 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 107 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: 9c17ba87-e1d0-4694-abdf-19ebca820c32
📥 Commits

Reviewing files that changed from the base of the PR and between c724a95 and 08df735.

📒 Files selected for processing: 9
  • changelog.d/9426-python-boundary-flip-rebound.md
  • crates/ripr/src/analysis/language/python/boundary.rs
  • crates/ripr/src/analysis/language/python/classify.rs
  • crates/ripr/src/analysis/language/python/classify/tests.rs
  • crates/ripr/src/analysis/language/python/guard_activation.rs
  • fixtures/python-verdict-corpus/expected/rows/py-hostile-builtin-name-shadow.json
  • fixtures/python-verdict-corpus/expected/rows/py-shapes-generator-bound.json
  • fixtures/python-verdict-corpus/known-false/py-hostile-builtin-name-shadow.toml
  • fixtures/python-verdict-corpus/known-false/py-shapes-generator-bound.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Verification questions

  • Confirm the source is threaded into boundary classification, but name_rebound_in_owner scans the whole owner source including nested scopes, so an inner-function rebinding can conservatively downgrade an outer parameter's boundary evidence.
  • Confirm the implementation uses textual rebinding detection and has no focused adversarial tests for multiline targets, annotations, comprehensions, or semicolon-separated bindings.

Evidence gaps

  • ripr sensor failed (exit 2) so no direct self-witness from the changed crate; cargo-test receipt is scheduled-late only and the two corpus row flips are unverified by sensor.
  • Model proof intent was rejected by deterministic validation.
  • The failed ripr sensor provides no positive compiler receipt for the modified Rust source.

Copy link
Copy Markdown
Member Author

Review of record, head 08df735

Angles: correctness and edge cases, tests and regressions, spec and contract.

  • Correctness: the reversing-flip relaxation applies only when a strong call places both operands at statically unequal literals, so every unequal pair differs and the equality-boundary requirement is moot; equal-pair or unresolved calls fall through to the existing rules. The rebound check is restricted to owner parameters, which is why py-idioms-raises-boundary (derived local) is unchanged. Any shape the scan cannot read declines to Unresolved, so errors move toward abstention, not toward a gap.
  • Tests: positive plus discriminating negatives (adjacent >→>= with unequal inputs stays a gap, unrebound operand, parameter used only in if headers, derived local). Hosted Rust Small Result is green on this head; no unresolved or outdated review threads.
  • Spec/contract: only the two target rows moved (py-hostile-builtin-name-shadow, py-shapes-generator-bound, gap → credited) and their known-false files are deleted; no rescoring.
  • Bot review (github-actions, 15:33Z): the nested-scope over-downgrade is the conservative direction and acceptable; the textual rebinding scan has no adversarial tests for multiline targets, annotations, comprehensions or semicolon bindings. Both are accepted as non-blocking and noted for the Python: boundary gap fires on a comparison flip and on a loop-carried operand #9426 follow-up.

Merging with expected head 08df735.


Generated by Claude Code

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