Skip to content

fix(typescript): pair uneven replacement blocks by content and move the sibling guards onto it (#7524) - #7554

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/project-thread-svy0f3-uneven
Oct 13, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/project-thread-svy0f3-uneven

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Before: in a replacement block where the removed and added line counts differ, only the block's first added line found an old line, and that old line was the block's first removed line, often a comment. Deleting or adding a comment beside a message-only throw change therefore hid that change from the RIPR-SPEC-0243 rule 4 guard. A chai to.throw("blank") that passes on both messages read exposed. The annotation-only and new-declaration guards still matched only by coordinate.

After: an uneven block pairs lines by content, so that throw reads weakly_exposed. The adapter's old-line lookup, the annotation-only guard and the new-declaration guard all read one pairing.

How: ChangedFile::aligned_counterparts (analysis/diff/model.rs) pairs lines in one of three ways.

When content pairs the run's first added line with nothing, that line keeps main's coordinate match unless another removed line matches it better. A tie therefore never loses a guard that fired on main. The new-declaration guard treats a counterpart that does not look like the line as no counterpart. Work is bounded in three ways: blocks of at most 65,536 cells, lines of at most 256 tokens, and a sorted-merge intersection over tokens computed once per line. replacement_counterparts, which the Rust probes use, is unchanged.

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-0243 rule 4 (example 14); RIPR-SPEC-0245 (TypeScript corpus)
Governing issue or accepted claim: #7524 follow-ups (the sibling guards and uneven blocks)
Acceptance delta (one sentence): a message-only throw change in an uneven replacement block meets the error-payload guard, and both sibling guards read the same pairing.

Candidate Relationships

Candidate branch: claude/project-thread-svy0f3-uneven
Builds on: #7529 (merged as 38b0eae)

Scope

  • Three corpus cases in authored-ts-mocha-ledger, labeled by running npx mocha on the edited package:
    • mocha-label-throw-uneven-shorter-block: two removed lines, one added. Gap.
    • mocha-label-throw-uneven-longer-block: two removed lines, three added. Gap.
    • mocha-title-throw-uneven-shorter-block: the control. The test pins the old message, so the expected verdict is credited.
  • ChangedFile::aligned_counterparts and lines_look_alike.
  • The TypeScript adapter's three guards now read that pairing.

Non-goals:

  • Python's adapter has the same coordinate lookup.
  • added_run_start on the Rust probe path is unchanged.

Proof

cargo xtask precommit                                    # exit 0
cargo test -p ripr --lib -- typescript diff              # 1491 passed
cargo xtask verdict-corpus check --language typescript   # 106 cases, 6/106 false, no drift
cargo xtask verdict-corpus check                         # Rust: 365 cases, no drift

Corpus. I committed the cases first (3aa1c88) and scored them on main's adapter. Both label cases read credited/exposed, which is false exposed: 8/106. After the fix both read gap, giving 6/106. The control stays ideal, and no other row moves.

Negative experiments:

  • With main's adapter, all four new behavior tests fail:
    • the two uneven throw tests;
    • the annotation-only change on a later line;
    • the new function that replaces three comment lines.
  • With the new-declaration precondition reduced to "has a counterpart", the even-block new-function test fails.
  • The cap test pairs 255 lines at 257×255 cells and only the coordinate line at 258×255.

Review

Two independent agent reviews (correctness and edge cases; tests, corpus and contract) found two blockers, both fixed before publication:

  1. The per-cell token matching had no bound. A minified one-line bundle plus a source-map line could take minutes.
  2. The cap test passed without the cap.

Their other findings were also applied:

  • The ambiguity filter now refuses any equal-or-better rival.
  • Ties keep main's coordinate match.
  • The uneven tests now check how the fixture parsed.
  • An annotation control was added.
  • The changelog wording was corrected.

Claim Boundary

May claim: a message-only throw change inside an uneven replacement block reaches the rule 4 guard when the old throw is the single best match. Must not claim: ambiguous blocks, or blocks above the caps.

Rollback

Revert the squash commit and re-bless the TypeScript corpus.

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U7GbrVC98fTYnLnhe3vhFM


Generated by Claude Code

…replacement block (#7524)

Two removed lines meeting one added line, and two meeting three: the
substring check passes on both messages, so the truth is
not_discriminated, but main pairs the added throw with the removed
comment (or with nothing) and reads exposed. A title control pins the
old message. TypeScript false verdicts on main: 8/106.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U7GbrVC98fTYnLnhe3vhFM
…he sibling guards onto it (#7524)

ChangedFile::aligned_counterparts pairs an even block by position, an
uneven block by mutual single-best match on code tokens (string
literals and comments left out, crossing pairs dropped), and an
interrupted run by coordinate. When content pairs the run's first added
line with nothing, it keeps main's coordinate match unless another
removed line matches it better. Work is bounded by a 65,536-cell and a
256-token cap, with a sorted-merge token intersection.

The TypeScript adapter's old-line lookup, annotation-only guard and
new-declaration guard all read this one pairing. The new-declaration
guard now treats a counterpart that does not look like the line as no
counterpart. replacement_counterparts (Rust probes) is unchanged.

Corpus: mocha-label-throw-uneven-{shorter,longer}-block move from false
exposed to ideal gap; TypeScript false verdicts 8/106 -> 6/106; the
title control and every other TypeScript and Rust row hold.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U7GbrVC98fTYnLnhe3vhFM
@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 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 278710bd-3141-4cd7-a423-072b1eb3122b
📥 Commits

Reviewing files that changed from the base of the PR and between ffac8a6 and 96d9c82.

📒 Files selected for processing (18)
  • changelog.d/7524-ts-replaced-block-pairing.md
  • changelog.d/7524-ts-uneven-block-pairing.md
  • crates/ripr/src/analysis/diff/mod.rs
  • crates/ripr/src/analysis/diff/model.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/new_declaration_tests.rs
  • crates/ripr/src/analysis/language/typescript/replaced_block_tests.rs
  • fixtures/rust-verdict-corpus/expected/rows/spec0115-no-test-reaches-owner.json
  • fixtures/typescript-verdict-corpus/SPEC.md
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-longer-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-longer-block.json
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-shorter-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/cases/mocha-title-throw-uneven-shorter-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-title-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-label-throw-uneven-longer-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-label-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-title-throw-uneven-shorter-block.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a772e44b-3ca8-4a3d-9c35-c42b0eac7807
📥 Commits

Reviewing files that changed from the base of the PR and between a5b590c and ffac8a6.

📒 Files selected for processing (17)
  • changelog.d/7524-ts-replaced-block-pairing.md
  • changelog.d/7524-ts-uneven-block-pairing.md
  • crates/ripr/src/analysis/diff/mod.rs
  • crates/ripr/src/analysis/diff/model.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/new_declaration_tests.rs
  • crates/ripr/src/analysis/language/typescript/replaced_block_tests.rs
  • fixtures/typescript-verdict-corpus/SPEC.md
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-longer-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-longer-block.json
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-shorter-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-label-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/cases/mocha-title-throw-uneven-shorter-block.diff
  • fixtures/typescript-verdict-corpus/cases/mocha-title-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-label-throw-uneven-longer-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-label-throw-uneven-shorter-block.json
  • fixtures/typescript-verdict-corpus/expected/rows/mocha-title-throw-uneven-shorter-block.json
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Summary by CodeRabbit

  • Bug Fixes
    • TypeScript change analysis now more accurately pairs modified lines across equal-length and uneven replacement blocks. This improves detection of declaration changes, annotation-only edits, and runtime behavior changes, including cases where comments or other lines are added or removed.
    • Updated error-message examples clarify when broad assertions still pass after a message change and when tests detect the change.

Walkthrough

The diff model now aligns lines in replacement blocks using position or content matches. TypeScript analysis uses aligned lines in its guards and classification. Tests and verdict-corpus fixtures cover equal-length and uneven replacement cases.

Changes

TypeScript Replacement Pairing

Layer / File(s) Summary
Replacement line alignment
crates/ripr/src/analysis/diff/model.rs, crates/ripr/src/analysis/diff/mod.rs
The diff model records replacement runs and pairs equal-length runs by position. For uneven uninterrupted runs, it uses unique mutual best content matches, subject to similarity and size limits. Tests cover ties, fallbacks, crossing matches, tokenization, and alignment limits.
TypeScript guards and verdict validation
crates/ripr/src/analysis/language/typescript/mod.rs, crates/ripr/src/analysis/language/typescript/*tests.rs, fixtures/typescript-verdict-corpus/*, changelog.d/7524-ts-*.md
TypeScript guards and classification use aligned counterpart lines. Tests and corpus records cover changed throws, new declarations, annotation-only edits, and uneven replacements.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ChangedFile
  participant TypeScriptAdapter
  participant ProbeClassification
  TypeScriptAdapter->>ChangedFile: Request aligned counterparts
  ChangedFile-->>TypeScriptAdapter: Return added and removed line pairs
  TypeScriptAdapter->>ProbeClassification: Supply aligned old-line text
  ProbeClassification-->>TypeScriptAdapter: Return classification
Loading
Merge Risk: ⚪ Minimal · up to ffac8

The replacement-line pairing change is mergeable after normal checks; no unresolved issue was established.

Security architecture risk: 🟡 Moderate · up to ffac8

A single-file diff can make the new matching logic perform billions of comparisons despite its stated work limit, potentially stalling an analysis run. The demonstrated exposure is analysis availability; no credential access or privilege escalation was identified.

Retained concerns

  • Medium · security · inferred: The cell limit does not bound matching work. An uneven block with 65,536 removed lines and one added line passes the limit. If each removed line has a qualifying match to that added line, the mutual-best check scans all 65,536 rows for every row, even when equal scores ultimately produce no content pairs. A caller able to supply such a diff to TypeScript analysis can force approximately 4.29 billion score visits. The inspected parser limits changed-file count rather than hunk size. This introduces an availability weakness relative to the base, scoped to the analysis process; deployment-wide impact is unestablished.
Security review details

Security Blast Radius

  • inferred — The supported attack scope is CPU consumption in a TypeScript-enabled analysis run processing a supplied diff. Exploitation requires control of diff content reaching that run. Cross-tenant effects or shared-service exhaustion depend on deployment and isolation details not established here.

Security Findings and Attack Paths

  • inferred — A valid single-file hunk containing many similarly scoring removed lines and one added line reaches the new alignment loop. Each row selects the sole column, whose best-match search then traverses every row. Equal scores do not stop that traversal, creating quadratic CPU amplification before pairing terminates.

Trust Boundaries and Controls

  • observed — The parser applies a changed-file-count limit. Alignment separately caps matrix cells and token counts. These controls constrain input scope and similarity construction, but do not constrain repeated column scans at the permitted cell limit.

Hardening Proposals

  • proposed — Compute each row's and column's best-match result once, preserving tie semantics, so mutual matching stays proportional to the permitted matrix size. Alternatively, enforce a total-operation budget that covers repeated searches, not just matrix allocation.
Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description explains the behavior change, scope, source-of-truth references, proof results, claim boundary, rollback, and static-language check. It omits several template sections, including Scope… Complete the missing template sections. Mark non-applicable sections explicitly, such as CI Economics for an ordinary PR, and record the required checks, traceability, engineering attestations, policy impact, and support-tier impact.
Passed Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 88.37% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 5 files. (12 skipped: 1…
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 and concisely describes the main change: content-based pairing for uneven TypeScript replacement blocks and migration of sibling guards.
Full details: Description check

Explanation

The description explains the behavior change, scope, source-of-truth references, proof results, claim boundary, rollback, and static-language check. It omits several template sections, including Scope Classification, Support-tier Impact, Policy Impact, Spec-Test-Code Traceability, CI Economics, Engineering Check, and Gates.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I’m a rabbit; I hop through each line,
Pairing old code with new when they align.
Uneven blocks get a content-based match,
While ties and long lines stay outside the patch.
The tests keep the rules in sight,
And I nibble the changelog tonight.

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

Copy link
Copy Markdown
Member Author

Review of record — head 83e55d7

Angles (two independent agent reviewers, read-only, exact working tree before publication):

  1. Correctness and edge cases: pairing semantics, DP or alignment, panics and multibyte text, wrong-actionable risk per consumer, interrupted-run parity, time bounds.
  2. Tests, corpus truth and contract: whether each diff applies to the stored subject, anchors, mocha labels, expected rows, whether tests discriminate, changelog accuracy and static language.

Findings and resolutions:

# Severity Finding Resolution
1 Blocking Per-cell token matching was unbounded, so a minified one-line bundle plus a source-map line meant minutes of work Each line is tokenized once, into sorted tokens. Intersection is a merge. Lines over 256 tokens never pair by content. Blocks are capped at 65,536 cells. Covered by a_very_long_line_does_not_pair_by_content.
2 Blocking a_large_uneven_block_pairs_nothing_by_content passed without the cap, because every cell tied Replaced with content_pairing_stops_at_the_block_size_cap. It uses one-to-one fixtures and checks both sides of the boundary: 255 pairs at 257×255 cells, only the coordinate line at 258×255.
3 Nit The ambiguity filter dropped only exact ties, so a strictly better rival kept a wrong pair The DP is replaced by mutual single-best matching with crossing pairs dropped. Covered by a_better_match_elsewhere_wins_over_order_and_coordinate and crossing_pairs_are_dropped.
4 Nit A tie dropped the pair, losing the demotion that main's first-line match gave When content pairs the run's first added line with nothing, it keeps main's coordinate match unless another removed line matches better. Covered by a_tie_keeps_the_coordinate_match.
5 Nit The new-declaration guard now skips more opening lines Judged correct: it still requires that no removed line names the owner, a plain signature and added body probes. Stated in the changelog. Controls: renamed_function_in_an_uneven_block_keeps_probe, plus a negative experiment.
6 Nits Uneven adapter tests didn't check how the fixture parsed; the annotation test had no control; changelog punctuation and overstatement; SPEC wording; doc wording about tokens; a comment reflow All applied. Added behavior_change_on_a_later_line_of_a_block_keeps_probe.

Verified by the reviewers:

  • replacement_counterparts behaves exactly as before.
  • Interrupted-run pairing is identical to main's .find fallback.
  • code_tokens slices only on character boundaries.
  • The 0246 and 0248 consumers only demote.
  • All three corpus diffs apply to the stored subject, and their labels are correct.

Proof on this head:

  • Precommit exits 0.
  • cargo test -p ripr --lib -- typescript diff: 1491 passed.
  • TypeScript corpus: 6/106 false. The two new label cases moved from false exposed to ideal; no other row moved.
  • Rust corpus: 365 cases, no drift.

Missing: hosted CI and external bot reviews. I'll add an addendum if they find anything.


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.

Confirmed findings

  • The PR claim 'ambiguous blocks pair nothing' is enforced by 'tied = true' in single_best, but the code does not have a unit test for an exact row-column symmetry tie (e.g., two removed lines each exactly matching two added lines). The 'a_better_match_elsewhere_wins' test covers similar shape but not symmetric tie. Functional correctness likely fine via the tied guard; test gap is the only concern.
  • crates/ripr/src/analysis/language/typescript/replaced_block_tests.rs:217 — Regression coverage for the wide commentary claim (4 negative experiments on main) is not encoded as a sibling test. Add a test that asserts replacement_counterparts() (or temporary old code path) yields None for the uneven throw so a regression on main would surface in CI rather than only in the PR description.

Verification questions

  • Confirm all added tests target the proposed behavior, none proves the previous behavior would have failed: PR description claims 4 negative experiments on main, but no test asserts that main produced a different verdict for the same fixture.
  • Confirm even block / even interrupt / uneven block paths are disjoint in aligned_counterparts; the coordinate fallback only fires when content pairing leaves the first added line unmapped AND first_removed is unpaired AND no later removed line scores strictly higher.

Refuted

  • Box::from(slice) allocation failure does not return None; recoverable fallback claims are dropped.
  • Stale Vec in similarity matrix could alias tokens if ChangedLine.text mutates between construction and use; refuted because: Removed/added slices and their token Vec<&str> live only for the align_by_content call; no mutation of ChangedLine text occurs on this path; aliasing risk is theoretical and not exercised by the diff.
  • PR #7554 introduces or affects a JS-backed worker handoff, transferable, detach, SharedArrayBuffer, or postMessage boundary.; refuted because: Diff changes are confined to ripr (Rust) analysis/diff model, the TypeScript analysis adapter, its unit tests, and verdict-corpus fixtures + SPEC.md prose. No JS/TS runtime, worker, or message-channel surface is added; crate ripr has no such bindings. aligned_counterparts/replacement_runs/lines_look_alike operate synchronously on owned slices/strings and are pure (no async, no threads, no FFI).

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • Park, do not broaden: Python, JavaScript, and Java adapters reuse the same new-side-coordinate lookup the PR fixes for TypeScript. Each is a separate accepted-track follow-up against #7524, mirroring the same aligned_counterparts swap when those languages need it.
  • TypeScript is the only adapter wired to aligned_counterparts; Python/JS/Java old_line_text lookups still key on removed_lines.iter().find(...new_side_line == added.line) and remain vulnerable to the same coordinate-only defect #7524 describes. By PR design these are out of scope; park as one tracked follow-up per language.
  • code_tokens skips strings/comments but does not handle regex literals (/.../) or template ${...} interpolation; a throw whose only change is ${label} is blank -> ${label} must not be blank tokens are identical and still pair, which is fine. Park regex-literal coverage as a separate scan rather than broadening this PR.
  • replacement_counterparts (the unchanged Rust probe entry point) still maps by position only and bails on uneven/interrupted blocks; PR keeps it intentionally untouched. Park the question of unifying replacement_counterparts with aligned_counterparts rather than broadening this PR.

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

Copy link
Copy Markdown
Member Author

Addendum to the review of record for the automated review on 83e55d7, new head bdc85d7.

  • Symmetric tie test gap: fixed in bdc85d7. a_symmetric_tie_pairs_nothing_by_content covers two identical removed lines against two equally close added lines. Only the coordinate match remains.
  • "Encode main's behavior as a regression test": already covered. The uneven tests assert that replacement_counterparts() is None for the line (see uneven_block_keeps_the_first_line_match). They also assert that the content pairing finds the removed throw before checking the verdict. The four behavior tests fail on main's adapter, so a regression shows up in CI.
  • Disjoint paths: confirmed. The interrupted, even and uneven branches are an if / else if / else in aligned_counterparts. The coordinate fallback runs only in the uneven branch.
  • Other adapters: only Python shares the coordinate lookup (python.rs:803, :823). Filed as python: later lines of a replacement block find no old line (coordinate-only lookup, as #7524 was for TypeScript) #7556. JS goes through the TypeScript adapter, and Java has no such lookup.
  • Regex literals and template interpolation, and unifying with replacement_counterparts: not taken. A regex literal only blurs the similarity score. Keeping the Rust probe path unchanged is deliberate.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 12, 2026 23:19
@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!

@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 2 potential issues.

Devin Review

Comment thread crates/ripr/src/analysis/diff/model.rs Resolved
Comment thread crates/ripr/src/analysis/diff/model.rs Resolved

@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

  • align_by_content's single_best refuses ties via tied=true but only checks score equality; a tie where two added rows score identically high but the removed row has a strictly higher third candidate is still a real tie. Existing a_symmetric_tie_pairs_nothing_by_content covers the symmetric case; a 3-removed × 3-added row-column tie variant is not encoded.
  • PR body claim that even/interrupted/uneven branches are disjoint (if/else if/else in aligned_counterparts) is asserted by the author and visible in the diff, but no unit test pins the disjointness; the three regression tests cover each branch independently.

Verification questions

  • Confirm a_very_long_line_does_not_pair_by_content uses elapsed<2s wall-clock guard; CI runners (especially under sandbox/cgroup pressure) can flake this. Test is medium-value (proves MAX_ALIGNED_TOKENS short-circuits), but timing is orthogonal to correctness.

Refuted

  • Resizable/active view (ArrayBuffer/TypedArray resize/detach/transfer) is at risk in this diff.; refuted because: Diff adds no ArrayBuffer, no TypedArray, no Vec-backed buffer with detached/reattached semantics, no SharedArrayBuffer, no &mut [u8] over a resizable region, no wasm memory. align_by_content owns Vec<Vec> similarity built locally and dropped at function return. lines_look_alike and code_tokens take &str only. No JS/WASM FFI surface added.
  • The new align_by_content similarity matrix or single_best closures could leak memory across worker handoffs because Vec<Vec> is large (65,536 cells).; refuted because: similarity is a local Vec<Vec> in align_by_content, dropped at function return; no cross-thread sharing, no transfer of ownership. Bounded by MAX_ALIGNED_CELLS=65_536.

Parked follow-ups

  • Python adapter shares the coordinate-only lookup pattern (python.rs:803, :823 per the author's addendum); not in the diff but parked as #7556.
  • Python adapter (same coordinate-lookup shape as TS pre-fix) is out of scope but explicitly tracked as #7556; merge landing without that follow-up risks Python parity drift noted in the PR body.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

…ertion; scan each line once in the fallback (#7524)

Review of #7554: `+comment -old +new` skipped the run, so the new line lost
the old line main's coordinate match gave it; and the first-line fallback
re-tokenized a long added line per removed line. Wall-clock guards in the
bound tests loosened to 10 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U7GbrVC98fTYnLnhe3vhFM
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 12, 2026 23:55
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 12, 2026 23:55
@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!

Copy link
Copy Markdown
Member Author

Addendum 2 to the review of record, head ffac8a6

Devin found two problems, both confirmed and fixed:

  1. Pure insertion at the start of a run (regression vs main). In +comment -old +new, the new line lost the old line that main's coordinate match gave it. A run that starts with a pure insertion now counts as interrupted. Covered by a model regression and an adapter regression; the model test fails with the old skip restored.
  2. Long-line rescans in the first-line fallback. The fallback tokenized the first added line again for each removed line. It now uses precomputed keys. Covered by a 1 MB-literal × 1,000-removed-line regression.

github-actions review:

  • The wall-clock guards could flake on a loaded runner, so I loosened them to 10 s. The token cap makes the real cost sub-second.
  • I didn't add a separate test for a 3×3 tie. single_best treats ties the same at any size, and the symmetric test already pins the behavior.
  • The three branches are a single if / else if / else and are each tested.

Checks on this head:

  • Precommit: exit 0.
  • typescript / diff lib tests: pass.
  • TypeScript corpus: 6/106 false, no drift.
  • Rust corpus: 365 cases, no drift.

Nothing blocking remains open from any review. Toggled Draft→Ready for the required check.


Generated by Claude Code

Main was red on this row: #6716 counts no_static_path_with_related_tests
only when a listed test calls the owner, and the row was never
re-blessed. Same one-row change #6792 and #7563 carry; no-ops once one
of them lands. Verdict unchanged.

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

Copy link
Copy Markdown
Member Author

Ripr Rust Small on GitHub Hosted / Rust gates was red on ffac8a6, and the failure is not this PR's. The failing step is verdict-corpus check-all, with drift on one Rust row, spec0115-no-test-reaches-owner: its no_static_path_with_related_tests contradiction disappears.

It reproduces on current main (a0b531d) without this PR. #6716's rule counts that contradiction only when a listed test calls the owner, and the row was never re-blessed after it.

Fix, ported:

Next I'll toggle Draft→Ready for the required check.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 13, 2026 00:40
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 13, 2026 00:40
@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!

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

Confirmed findings

  • Strengthen the Python parity sibling: PR restriction to TS only is principled, but the aligned_counterparts effect on Python probe candidates is not measured. A regression test or corpus row mirroring the mocha-label-throw-uneven-* cases under a Python subject would make parity visible. Park #7556 covers the open sibling, but no plan reuses the corpus mechanism across languages.
  • Wall-clock guards (started.elapsed() < Duration::from_secs(10)) in two long-line tests can flake on loaded CI sandboxes. Author widened from 2s to 10s in addendum; still timing-dependent for what is a structural bound. Not a correctness gap, just a noise source.
  • No secret-material handling, network, FFI, or new unsafe surfaces introduced. TypeScript corpus re-labelling and Rust spec0115 re-bless are non-security and bounded by their own corpora. No public security regression expected from this PR.
  • crates/ripr/src/analysis/diff/model.rs:462 — a_long_first_line_beside_many_removed_lines_stays_bounded checks elapsed<10s and map.len()==1 but never asserts the first-line fallback path was exercised. If a future refactor routes that block through coordinate-only matching the timing test still passes. Pin which branch fed the single pair.
  • crates/ripr/src/analysis/diff/model.rs:363 — align_by_content's crossing filter operates after mutual single-best; if removal rows 0..=k all single-best-match added columns 0..=k in reverse order, all crossings drop and the run pairs nothing, including the run's first added line. This is by design, but the only test covering crossing pairs is crossing_pairs_are_dropped. Consider adding a 3x3 mutual-best crossing case (mutual single-best, reversed) to pin the no-crossing invariant.
  • Python adapter still uses the shared new-side coordinate match alone for added lines inside replacement blocks (file:python.rs:803, :823). Same coordinate-only flaw this PR fixes for TypeScript could surface in Python. Author filed #7556; out of scope here.

Verification questions

  • Confirm eight model unit tests plus four adapter tests target aligned_counterparts and the three guards; every behavior test is described as failing on the main adapter.
  • Confirm test asymmetric: only one control (uneven-shorter pinned) for two uneven labels; uneven-longer has no control sibling to pin fault.
  • Confirm repository new function 'helper' replacing 3 comment lines expects even-block pairing by position to keep it from probing the opening line; that pairing only tests the even branch, not content. The three siblings (even/interrupted/uneven) are tested independently but disjointness is asserted, not pinned.

Refuted

  • Tokens/lines carrying tokens leak secret material to a sink or log.; refuted because: code_tokens returns &[&str] over the same line buffers; no copy, no allocator growth past the bounded Vec, no fmt/println/log added. lines_look_alike is inlined by adapter callers, no I/O.

Evidence gaps

  • awaiting late cargo-test receipt; lib typescript diff tests 1491 passed claimed in body but receipt not in this packet.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Final addendum to the review of record. Head 96d9c82 is green: Ripr Rust Small Result and GitHub Hosted Rust gates both pass. The merge state is clean, and no review thread is open.

The latest github-actions review raised only suggestions, with nothing marked blocking. Here is how each one is handled:

Suggestion Handling
A Python parity corpus row Tracked in #7556, whose fix sketch already starts with Python corpus cases scored on main
The wall-clock guards Kept at 10 s. The token cap returns after 257 tokens, so the real cost is far below the bound
Pin that the long-line test goes through the fallback Already pinned. Content pairing returns nothing above the cell cap (1,000 × 70), so the single pair can only come from the fallback
A 3×3 reversed crossing case Not added. The crossing filter compares pairs and doesn't depend on block size, and crossing_pairs_are_dropped pins it
The uneven-longer case has no control The pinned title control covers the same guard; the longer case changes only how the throw is found, which its own parse assertion checks

Merging under the thread's merge authority.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 3eef453 into main Oct 13, 2026
32 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-svy0f3-uneven branch October 13, 2026 01:19
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