Skip to content

fix(python): a trailing-comment or spacing-only edit emits no probe (#10706) - #11210

Merged
EffortlessSteven merged 5 commits into
mainfrom
claude/python-trailing-comment-noop
Oct 30, 2026
Merged

EffortlessSteven merged 5 commits into
mainfrom
claude/python-trailing-comment-noop

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman — Python follow-through thread.

Governing issue or accepted claim: #10706 (Python half; the TypeScript half stays open)
Acceptance delta (one sentence): A Python line whose only change is a trailing # comment or spacing between tokens emits no finding, so no gap id or discriminator can embed comment text.

What changed

A Python edit like return price to return price # fallback produced a weakly_exposed finding with a gap id containing the comment text. A new guard in classify_change_full (is_comment_or_whitespace_only_change in no_behavior.rs) lexes the old and new line and compares each token's source spelling, so it fails closed:

  • A # inside a string, a respelling (0x1 to 1, a requoted string), a changed token and a changed indentation are all still edits.
  • A line that does not lex alone (part of a multi-line construct) stays analyzed.
  • A comment-only line is left to the existing no-behavior guard.

Proof

  • Three unit tests in trailing_comment_tests.rs: no probe for comment/whitespace edits, a probe kept for changed tokens, and the predicate's negatives.
  • Two new fixtures, python_noop_trailing_comment and python_noop_trailing_whitespace, expected empty findings. Negative experiment: with the guard removed, both flip to exposed; with it, the goldens check shows no drift for them.
  • 1867 Python-area lib tests pass locally. Local precommit's golden check fails only on owner_return_pin_* fixtures that need network-fetched dependencies this sandbox cannot download; hosted CI covers those.
  • Spec RIPR-SPEC-0028, .ripr/traceability.toml and changelog.d/10706-python-trailing-comment-noop.md updated.

Not in this PR: the TypeScript trailing-comment and trailing-whitespace cases.


Generated by Claude Code

@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 Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 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 3 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 147 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: ccaf4e10-a02e-482d-989d-9be15386620c
Commits

Reviewing files that changed from the base of the PR and between f74791a and b97fa08.

Files selected for processing: 32
  • .gitattributes
  • .ripr/traceability.toml
  • changelog.d/10706-python-trailing-comment-noop.md
  • 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/trailing_comment_tests.rs
  • docs/specs/RIPR-SPEC-0028-python-preview-static-facts.md
  • fixtures/python_noop_trailing_comment/SPEC.md
  • fixtures/python_noop_trailing_comment/diff.patch
  • fixtures/python_noop_trailing_comment/expected/CHANGELOG.md
  • fixtures/python_noop_trailing_comment/expected/check.json
  • fixtures/python_noop_trailing_comment/expected/human.txt
  • fixtures/python_noop_trailing_comment/input/ripr.toml
  • fixtures/python_noop_trailing_comment/input/src/pricing.py
  • fixtures/python_noop_trailing_comment/input/tests/test_pricing.py
  • fixtures/python_noop_trailing_whitespace/SPEC.md
  • fixtures/python_noop_trailing_whitespace/diff.patch
  • fixtures/python_noop_trailing_whitespace/expected/CHANGELOG.md
  • fixtures/python_noop_trailing_whitespace/expected/check.json
  • fixtures/python_noop_trailing_whitespace/expected/human.txt
  • fixtures/python_noop_trailing_whitespace/input/ripr.toml
  • fixtures/python_noop_trailing_whitespace/input/src/pricing.py
  • fixtures/python_noop_trailing_whitespace/input/tests/test_pricing.py
  • fixtures/python_trailing_whitespace_in_multiline_string/SPEC.md
  • fixtures/python_trailing_whitespace_in_multiline_string/diff.patch
  • fixtures/python_trailing_whitespace_in_multiline_string/expected/CHANGELOG.md
  • fixtures/python_trailing_whitespace_in_multiline_string/expected/check.json
  • fixtures/python_trailing_whitespace_in_multiline_string/expected/human.txt
  • fixtures/python_trailing_whitespace_in_multiline_string/input/ripr.toml
  • fixtures/python_trailing_whitespace_in_multiline_string/input/src/q.py
  • fixtures/python_trailing_whitespace_in_multiline_string/input/tests/test_q.py
  • 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 new fixtures assert empty findings, but they do not contain a red/green old-versus-new comparison that would demonstrate the changed behavior is observationally equivalent.
  • Confirm the Rust unit test verifies finding presence but does not assert the discriminator, gap-id content, or that old and new versions produce equivalent observable behavior.
  • Confirm the classifier invokes the token-equality guard before structural Python analysis, so only comment/spacing-only changes reach the new early return.
  • Confirm the helper preserves changed-token behavior by comparing token source spelling rather than normalized values, and fails closed on lexer errors.
  • Confirm the PR claims broad Python behavior coverage, but the supplied evidence does not demonstrate sibling classifier entry points or a successful repository-wide test run.
  • Confirm the helper compares raw source-spelled token lists, so the claimed whitespace-only equivalence depends on lexer token boundaries being stable; the added tests do not cover whitespace inserted between adjacent token characters.
  • Confirm indentation equality is checked as a raw byte prefix, so equivalent visual indentation using different whitespace is treated as changed, while any identical byte prefix is accepted even when token semantics depend on indentation.

Refuted

  • The fixtures provide end-to-end proof that the new guard suppresses findings.; refuted because: The fixtures contain expected zero-finding outputs and the PR describes negative experiments, but the ripr sensor failed and the cargo-test receipt is absent in the available packet.
  • The new guard is documented as covering whitespace between tokens, but the tests exercise only trailing spaces/tabs and one spacing-only rewrite of a call.

Evidence gaps

  • The fixture goldens are static expected outputs and the reported ripr sensor failed; cargo-test is scheduled late, so execution evidence for the new fixture behavior is currently unavailable.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Independent fresh-context review of the PR (read-only agent, two passes) at head 0b68fc6f5:

  • Pass 1 found one real hole: a spacing or comment-looking edit on a line inside a multi-line string was treated as a no-op, which hides a real value change. Fixed by a whole-file lex that marks lines inside strings crossing a line break (and fails closed when the file does not lex), with a new fixture python_trailing_whitespace_in_multiline_string (finding retained) and a unit test.
  • Pass 2 on the fix: first/last lines sharing code with a string, backslash-continued, f-string, bytes, implicit concatenation, CRLF and the fail-closed direction all behave correctly. Its performance note (rescan per string token) is fixed with a single running line count. Two residuals are left as is: the old side is not checked for string context (no realistic repro; the old source is not available at that call site), and lone-\r line endings.
  • Not covered by the reviewers: hosted CI and the full golden check. Locally, the Python lib suite passes (1868), clippy with -D warnings is clean, and the golden check shows no drift outside the known owner_return_pin_* fixtures that need network-fetched dependencies. Requesting hosted qualification for this exact head.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 30, 2026 17:25
@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!

…m diff --check (#10706)

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

@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

  • The tests do not distinguish token changes from comment/spacing changes.; refuted because: The Rust unit test covers both outcomes: None for comment/spacing edits and Some for changed-token edits.
  • The PR body says a line that does not lex alone stays analyzed, but the implementation uses the new-file whole-file lex to identify multiline strings; this is a safer superset but the wording understates that behavior.
  • The new no-op behavior needs a separate architecture-level abstraction rather than a localized classifier guard.; refuted because: Rejected: the helper is confined to the Python preview adapter, consumes existing context, and avoids cross-language or public API changes.

Evidence gaps

  • The PR's broader correctness and merge-readiness claims depend on repository-wide test/golden evidence, while the ripr sensor failed and the scheduled cargo-test receipt was not available in this lane packet.
  • Model proof intent was rejected by deterministic validation.
  • Repository-wide success remains unproven because the ripr sensor failed and cargo-test evidence was only scheduled at packet time.
  • Repository-wide execution evidence is unavailable because ripr failed with exit code 2; the fixtures provide route expectations, but a successful late cargo-test receipt is still needed before relying on the claimed suite result.
  • Repository-wide test success is not currently established by the review packet because the ripr sensor failed and cargo-test is only scheduled late.

Copy link
Copy Markdown
Member Author

CI on 0b68fc6f5: Ripr Rust Gates failed at precommit's git diff --check because fixtures/python_noop_trailing_whitespace/input/src/pricing.py carries the trailing spaces that are the fixture's subject. This PR's own change, not a base failure. Fixed in 579dbb617 by exempting that one fixture input in .gitattributes (the same mechanism the repo already uses for fixtures/*/diff.patch); git diff --check against current main is clean. Qualification re-requested on the new head.


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 reviewer attention before upstream: findings remain.

Confirmed findings

  • The no-op guard checks multiline-string membership only on the new side, so an old string-content line that becomes ordinary code can be suppressed as a whitespace/comment-only edit.

Verification questions

  • Confirm the new early return is reachable from classify_change_full and compares old/new token spellings, but it can suppress a change when the old line was multiline-string content and the current source does not identify that context.
  • Confirm the token predicate fails closed for standalone lexical errors, while the separate whole-file string-range helper returns None on whole-file lex errors; the current-file range is the only protection against multiline-string false negatives.

Refuted

  • The new helper changes token values or treats string content as comments.; refuted because: Rejected: token source spellings are compared, and lexer failures return false; the string-content path is handled separately by the whole-file range check.
  • The guard should be generalized into a cross-language abstraction.; refuted because: Rejected: the behavior is Python-preview-specific, and the helper remains confined to the Python adapter without public API changes.
  • The change weakens changed-token detection by comparing token values rather than source spelling.; refuted because: The implementation compares each token's original source slice, preserving distinctions such as 0x1 versus 1 and differing quote styles; changed-token and indentation cases have direct negative tests.

Parked follow-ups

  • The implementation protects only against the new-file string context; an old-side-only multiline-string context could still be misclassified.

Evidence gaps

  • Repository-wide test and golden success is not established by this packet.
  • Model proof intent was rejected by deterministic validation.
  • Repository-wide success is not established in the supplied packet: ripr failed, and cargo-test was scheduled rather than available during lane review.
  • Repository-wide correctness remains unproven because the required ripr sensor failed and cargo-test was scheduled rather than available.

Copy link
Copy Markdown
Member Author

Addressing the github-actions review finding (old-side string context, also my own reviewer's residual #1): b97fa08c0 now also tests the paired old line against the reconstructed old source, and the guard is skipped if the old source cannot be reconstructed or lexed. I could not construct a valid-Python diff that exercises the old-side-only case (the new file would not lex, which already fails closed), so no new fixture; the Python lib suite (1868) and the golden check (no drift outside the known owner_return_pin_* offline fixtures) still pass. Spec text updated. The "ripr sensor failed" and "cargo-test scheduled" evidence gaps in that review are packet timing, not a failing test on this head; the required check is the judge. Qualification re-requested on b97fa08c0.


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 reviewer attention before upstream: findings remain.

Confirmed findings

  • The shared review packet lacks successful repository-wide execution evidence; the failed ripr sensor should be explained before treating the change as fully verified.

Refuted

  • The new guard bypasses established structural Python analysis or broadens a cross-language abstraction.; refuted because: It is a localized Python-preview early return after existing no-op guards, with no public API or cross-language change.
  • The helper must compare normalized token values, which could incorrectly treat respellings as no-ops.; refuted because: The implementation compares source spelling strings from lexer ranges, so 0x1 versus 1 and requoted strings remain different; the unit test explicitly covers these negatives.
  • The no-op behavior needs a separate shared architecture-level abstraction rather than a localized Python classifier guard.; refuted because: Rejected: the behavior is preview-language-specific, confined to the Python adapter, uses existing context, and does not alter shared or public interfaces.
  • The helper treats changed tokens, respellings, string contents, or indentation changes as equivalent.; refuted because: Token source spellings are compared exactly, indentation is checked, and lex failures return false; unit tests cover these negatives.

Parked follow-ups

  • The change adds a local classifier policy and helper rather than a reusable cross-language abstraction, limiting scope but leaving equivalent no-op semantics to be implemented independently elsewhere.

Evidence gaps

  • Repository-wide success is not established by this packet: the ripr sensor exited with code 2 and cargo-test evidence was scheduled rather than present when the lane packet was assembled.
  • Model proof intent was rejected by deterministic validation.
  • Repository-wide success is not yet established by available deterministic receipts.
  • Repository-wide correctness and merge-readiness are not established by this packet because the ripr sensor failed and cargo-test remained scheduled rather than receipted.
  • Repository-wide test success is not established by the available evidence.

Copy link
Copy Markdown
Member Author

CI on b97fa08c0: shard 3 of 4 failed on analysis::diff::model::tests::added_run_start_on_a_long_run_is_bounded, a wall-clock scale test (testing/scale.rs: "growth exceeded 3x plus 10ms: 139ms -> 481ms"). That test is in the diff model, which this PR does not touch, and the run fell over mid-suite ("Cancelling due to test failure"), so this is a timing flake on a loaded runner, not this change. I could not re-run the failed jobs yet because the workflow run is still in progress (403 "already running"); I'll re-run once it finishes, and a second failure would be treated as real. No existing issue tracks this test.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Update on b97fa08c0: after the re-run every test job passed (all four shards, shard verify, gates). Ripr Rust Small Result then failed in 4 seconds on the live eligibility step (REASON: runner_api_failed, RUNNER_QUERY: failed), an infrastructure failure of the runner-availability query with every implementation job green (GITHUB_RESULT and GITHUB_TESTS_RESULT both success). Not this PR's. I re-ran the failed jobs again to re-evaluate eligibility against the passed jobs; if that fails the same way I'll re-request qualification with a fresh label rather than push a no-op.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 586a0d8 into main Oct 30, 2026
112 of 117 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/python-trailing-comment-noop branch October 30, 2026 23:28
EffortlessSteven added a commit that referenced this pull request Oct 31, 2026
…g human verify line (#11210)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzUDFA3cS1NVbf3sPQL
EffortlessSteven added a commit that referenced this pull request Oct 31, 2026
…re-bless (#11210)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzUDFA3cS1NVbf3sPQL
EffortlessSteven added a commit that referenced this pull request Oct 31, 2026
…g verify-command line (#11210) (#11301)

* test(goldens): re-bless python_trailing_whitespace_in_multiline_string human verify line (#11210)

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

* docs(goldens): record python_trailing_whitespace_in_multiline_string re-bless (#11210)

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
EffortlessSteven added a commit that referenced this pull request Oct 31, 2026
…crete literals (#11255) (#11284)

* fix(typescript): all-literal object and array expected values are concrete literals (#11255)

An expected object or array built only from scalar literals, nested objects and
nested arrays (including [] and {}) is a concrete expected value for Jest/Vitest
toEqual, toStrictEqual and toMatchObject. One identifier, call, spread, hole,
computed or shorthand key, accessor, template or wrapped expression keeps it
dynamic. Empty or all-zero containers do not witness a field update, an object
expectation is a dead witness against scalar branches and arms, and a nested
container earns no rejection-literal credit. The shared packet validator is
unchanged.

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

* test(typescript): avoid panic-family macro in literal container test (#11255)

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

* fix(typescript): gate the literal-container packet tests on lang-typescript (#11255)

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

* test(goldens): re-bless python_trailing_whitespace_in_multiline_string human verify line (#11210)

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

* docs(goldens): record python_trailing_whitespace_in_multiline_string re-bless (#11210)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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