Skip to content

perf(typescript): index line lookups once per source - #4635

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/crash-hunt-gnmz68-ts-line-index
Sep 29, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/crash-hunt-gnmz68-ts-line-index

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Summary

Before: TypeScript owner and test extraction found every span's line with paths::line_for_offset, which scanned the file from byte 0 on each of 16 call sites. Extraction was quadratic in file size: a 20,000-line module took 45.9 s to extract owners and a 15,001-line test file took 30.2 s (debug build).

After: the same files take 0.23 s and 0.22 s. Lines are identical.

How: a TypeScript-local SourceText<'a> in typescript/paths.rs holds the source plus the offsets of every \n byte; line_for_offset is 1 + partition_point(|n| n < offset). It derefs to str, so &str helpers are unchanged. It is built once per parse-worker closure at the five entry points (extract_owners, ambient_declaration_lines, detect_owner_extraction_gap, extract_tests, detect_partial_test_extraction). Counting \n bytes matches the old char_indices scan because \n never occurs inside a multibyte UTF-8 sequence: CRLF counts once, lone \r never starts a line, past-end offsets give the last line.

This is the TypeScript counterpart of #4580 (Python, #4495). The types are kept language-local so neither PR depends on the other; merging them into one shared type is a small follow-up once both land.

Swarm / Source Boundary

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

Source-of-truth Links

Governing issue or accepted claim: 0.11 crash/hang hunt (project thread above); sibling of #4495.
Acceptance delta (one sentence): TypeScript fact extraction is linear in file size with identical line numbers.

Candidate Relationships

Candidate branch: claude/crash-hunt-gnmz68-ts-line-index. No equivalent open PR. #4607 changes TypeScript related_tests.rs package-root walks, a different hot spot; both append tests to typescript/tests.rs.

Scope

  • One production behavior: TypeScript line lookup cost.

Non-goals: no change to any extracted fact, verdict or output field.

typescript/tests.rs changes only mechanically: 14 existing calls now pass &SourceText::new(source) because two function signatures changed. No test input or assertion changed.

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo fmt --all                                        # rc 0
cargo test -p ripr --lib typescript                    # 697 passed
cargo test -p ripr --test '*' typescript               # 2 passed
cargo clippy -p ripr --all-targets -- -D warnings      # rc 0
cargo clippy -p xtask --all-targets -- -D warnings     # rc 0
cargo xtask goldens check                              # pass, 269 fixtures
cargo xtask precommit                                  # rc 0

New tests:

  • line_index_matches_reference_scan_on_edge_case_sources: 17 sources (empty, CRLF, lone \r, multibyte, emoji, pseudo-random), every offset 0..len+3 plus u32::MAX/usize::MAX, compared with the old scan kept as a #[cfg(test)] oracle.
  • owner_and_test_extraction_stay_linear_on_a_large_module: asserts 5,000 owners and 5,000 tests with exact last lines, then a 20 s wall-clock bound (old path: 76 s combined).
  • Negative experiment: < changed to <= in partition_point makes both tests fail.
owner lines / test lines old owners old tests new owners new tests
5,000 / 3,751 2.77 s 1.78 s 0.057 s 0.066 s
10,000 / 7,501 11.22 s 7.57 s 0.100 s 0.105 s
20,000 / 15,001 45.85 s 30.22 s 0.233 s 0.218 s

Claim Boundary

May claim: TypeScript line lookup is O(log n) per call after one O(n) index build. Must not claim a general ripr check speedup figure on real repositories; timings are extraction-only, debug build, one machine.

Rollback

Revert the squash commit.

Static Language Check

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

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 clippy -p ripr --all-targets -- -D warnings and -p xtask (package-scoped)
  • policy gates via cargo xtask precommit

🤖 Generated with Claude Code

https://claude.ai/code/session_01FTQw4QPFK98a1kLKHyKTJQ


Generated by Claude Code

TypeScript owner, oracle and test extraction resolved each oxc span to a
line with `line_for_offset`, which counted newlines from byte 0 on every
call. Its 16 production call sites (owners, ambient declaration lines,
owner-extraction gaps, expect/AVA assertions, test registrations and the
partial-test-extraction finder) made extraction O(nodes x file length),
the same shape PR #4580 fixes for Python.

Add a TypeScript-local `SourceText<'a>` in `typescript/paths.rs`: the
source plus the ascending offsets of its `\n` bytes, looked up with
`partition_point`, dereferencing to `str`. Each parse-worker entry point
(`extract_owners`, `ambient_declaration_lines`,
`detect_owner_extraction_gap`, `extract_tests`,
`detect_partial_test_extraction`) builds it once and threads it only
through the functions on the lookup path. The old scan is kept as a
`#[cfg(test)]` reference.

Results are identical under the old conventions: one plus the count of
`\n` bytes strictly before the offset, so CRLF counts once, a lone `\r`
never breaks a line, an offset past the end reports the last line, and
an offset inside a multibyte character counts only earlier newlines
(`\n` never occurs inside a UTF-8 multibyte sequence).

Tests: an equivalence test against the reference scan over every offset
of edge-case and pseudo-random sources (including multibyte interiors,
the offset equal to the length, u32::MAX and usize::MAX), and a scaling
test on a generated 20,000-line module and 15,001-line test file that
first asserts the extracted owners, tests and late-file lines. Debug
timings (owners + tests): old 2.8s+1.8s / 11.2s+7.6s / 45.9s+30.2s at
5k/10k/20k owner lines; new 0.06s+0.07s / 0.10s+0.11s / 0.23s+0.22s.

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

Warning

Review limit reached

Next included review available in 9 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: fd386e57-4db1-4ef9-98ea-d9987bc31e9f

📥 Commits

Reviewing files that changed from the base of the PR and between 2bdc646 and 3f81249.

📒 Files selected for processing (7)
  • crates/ripr/src/analysis/language/typescript/line_index_tests.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/oracle.rs
  • crates/ripr/src/analysis/language/typescript/owners.rs
  • crates/ripr/src/analysis/language/typescript/paths.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • crates/ripr/src/analysis/language/typescript/tests_extract.rs

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

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

Confirmed findings

  • crates/ripr/src/analysis/language/typescript/line_index_tests.rs:114 — Linearity bound is 20s combined for 20,000+15,001 lines. CI noise, future CI slowdowns, or a regression to O(n*log n) (e.g. accidentally rebuilding per-call) would still pass. Recommend either splitting owners vs tests into separate bounds or asserting elapsed < 5s each, and adding a doubling sanity: 5k owners elapsed must be within 2x of 10k owners elapsed, catching a return to quadratic regressions independent of absolute timing.

Verification questions

  • Confirm no clippy/cargo-check receipts ran (heavy/build leases disabled by profile). PR body reports cargo clippy -p ripr --all-targets -- -D warnings rc 0 and cargo xtask precommit rc 0 on the author side, but the lane cannot re-verify. Not a blocker; treat as residual trust gap.

Refuted

  • Counting bytes via text.bytes().enumerate().filter_map would double-count inside multi-byte UTF-8 or miss CRs, breaking line numbers on Windows-style or emoji-heavy sources.; refuted because: is ASCII (single byte 0x0A) and never appears inside a multibyte UTF-8 continuation byte (continuations are 0x80-0xBF). So byte-count == char-count for . CRLF: only indexed, matches old scan's single ' ' match. Lone : byte 0x0D != 0x0A, never indexed, old scan also does not match ' '. Behaviorally identical.

Parked follow-ups

  • Boundary placement: index built once at each of five parse-worker closures; downstream recursion threads &SourceText. No duplication vs the Python PR #4495 by design—types stay language-local pending a small unification follow-up.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Cargo-test sensor receipt is scheduled-late, not yet landed; lane cannot independently confirm 697 passed + 2 passed + goldens check on this branch.

Copy link
Copy Markdown
Member Author

Response to ub-review's timing-bound finding: I'm keeping the single generous 20 s bound, for two reasons.

  • It catches the regression we care about. On this fixture the quadratic path took 76 s and the indexed path takes 0.45 s. An O(n log n) or per-call rebuild would still fail the bound, because rebuilding the index per call is O(n) per lookup, which is the old quadratic cost again.
  • Ratio assertions flake on shared runners. A 5k-vs-10k doubling ratio is sensitive to CI noise. The correctness oracle is the exact equivalence test against the old scan, which uses every offset on 17 sources. The timing bound only guards complexity.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review September 29, 2026 03:17
@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-29T03:19:56.096355Z 3f81249 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.

@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 1 potential issue.

Devin Review

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exact-head self-review of 3f81249 (7 files, all under analysis/language/typescript/). No findings.

  • Semantic owner: typescript/paths.rs::SourceText is built once per parse-worker closure at the five extraction entry points. All 16 former line_for_offset(&str, ..) call sites now use the index. The old scan is #[cfg(test)] only and serves as the test oracle. Helpers that only need &str get it through deref.
  • Equivalence: counting \n bytes matches the old char_indices scan. \n never occurs inside a multibyte sequence, CRLF counts once and a lone \r counts zero. I verified this locally: line_index_matches_reference_scan_on_edge_case_sources runs every offset of 17 sources, plus u32::MAX and usize::MAX, and both new tests pass. The negative experiment (< changed to <=) fails both tests.
  • Test churn: 14 existing test calls in tests.rs now wrap their argument in SourceText::new. No input or assertion changed.
  • Exact-head evidence:
    • CI: Rust gates, Rust-only feature lane, cargo-deny, dependency-review, pr-plan and ub-review all pass.
    • Codex completed with no comments.
    • Devin's one timing-bound note was answered with the 44× headroom (0.45 s against a 20 s bound). ub-review's timing suggestion was answered the same way.
    • Missing reviews: CodeRabbit was rate-limited, Gemini was out of quota, and droid-review was queued.

Disposition: REVIEW_READY for this head.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 7fb7353 into main Sep 29, 2026
30 of 31 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/crash-hunt-gnmz68-ts-line-index branch September 29, 2026 03:20
cursor Bot pushed a commit that referenced this pull request Sep 29, 2026
#4635 gated the free line_for_offset helper behind cfg(test), but production
title_argument still called it. Combined-tree xtask/lib builds then failed
E0425 after this branch merged main for the 0178/0179 index conflict.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Sep 29, 2026
Hosted Ripr Rust Small Result failed cargo fmt --check on the combined
tree: module_entries sorted after line_index_tests. The file matched
main; rustfmt so the required aggregator can run.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
Main fails cargo fmt --check: #4635 and #4526 each reordered
mod declarations in typescript/mod.rs and the squashed combination is
unformatted. Port the one-line rustfmt fix so this PR's Rust gates run;
it no-ops once main carries it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yB4cNGThJWBLhaxNgbSUf
cursor Bot pushed a commit that referenced this pull request Sep 29, 2026
#4635 moved line_for_offset behind cfg(test). Combined-tree CI then
failed to compile tests_extract; call the production line index instead.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Sep 29, 2026
#4609 already shipped the version-table, swarm-queue, and cache-status
docs. Keep nested rerun cache identity at live 1.10/1.16, producer-backed
docs tests, and the #4635 SourceText compile repair. Do not revert receipt,
status, or guide contracts.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>

@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

  • Sharing one SourceText type across Python #4580 and this PR would be cleaner than duplicating it in typescript/paths.rs.; refuted because: Author intentionally kept it language-local so neither PR depends on the other; a shared type is explicitly parked as a small follow-up. Introducing it now widens scope and couples the two PRs, which the smallest-complete-fix boundary deliberately avoids.

Parked follow-ups

  • Linearity test bound (20s combined for 20k+15k lines) is shape-only and would pass under O(n*log n) regression or per-call rebuild; this is a known residual trust gap acknowledged by the author.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
…helper

Main does not build outside cfg(test): #4593 added a computed-title call to
the free line_for_offset(source, ..) helper, which #4635 made test-only when it
moved callers to SourceText::line_for_offset. title_argument takes &str on the
describe path, so count newlines in the prefix directly; computed titles are rare.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yB4cNGThJWBLhaxNgbSUf
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
…only helper

#4635 made line_for_offset(&str) a #[cfg(test)] oracle while #4593 added a
non-test caller in title_argument, so main does not compile outside tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NAFFrPW4WcWsg7fGWfGAS
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015fB1dGecsPvXwSxSuqCNQQ
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
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
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
`main` fails to compile outside `cfg(test)`: #4635 kept the free
`line_for_offset` only as a test oracle while `tests_extract.rs` still
calls it for computed titles. This carries #4739's change verbatim so
this PR's CI builds; it no-ops once #4739 lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011hoZSKinxoMBpo7Js7zymG
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
…ne index

Main at eb3a2e9..current fails 'cargo build -p ripr' (E0425): #4635 made
the free line_for_offset #[cfg(test)] while #4593 added a non-test caller.
Also apply cargo fmt to typescript/mod.rs from main. No-op once main
carries its own fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKNEXpmQUdzF5PrWPScjw
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
Main does not compile: #4635 removed the TypeScript line_for_offset
helper that #4593's computed-title path still calls. This carries PR
4739's two-file change unchanged so this PR's CI can run; it no-ops
once main carries 4739.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AYyUnjaq9zD4WsBujWEUpk
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
 and #4635)

#4593 added a computed-title path calling the free line_for_offset,
which #4635 made test-only in favour of SourceText::line_for_offset.
Each merged green alone; together main does not compile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015fB1dGecsPvXwSxSuqCNQQ
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
…ndex

Review on #4739: the inline newline scan repeated per computed title what
#4635's SourceText index removed. Both callers already hold &SourceText, so
thread it through describe_body_from_statement and title_argument.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018NAFFrPW4WcWsg7fGWfGAS
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
Resolves conflicts with #4593 (loop-declared tests), #4526 (module
entries) and #4635 (SourceText line index). Ports #4739's build fix for
title_argument so this head compiles while main is red; it no-ops once
#4739 lands. Non-literal describe titles now use #4593's computed-title
placeholder.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Le3JWHtB92kcA89G5bpPGi
EffortlessSteven added a commit that referenced this pull request Sep 29, 2026
…pair (#4520)

* ux(0.11): name one gap with one word across check, pilot and agent repair

`ripr check` reported a gap as `weakly_exposed` and `ripr pilot` reported
the same gap as `weakly_gripped`, and the repair packet said "extend the
nearest related test" while pilot named a new test to add. Both classes are
published schema values, so the values stay. Human lines now lead with the
plain word the check summary already uses (weak, unrevealed, no path,
unknown) and keep the value beside it. The actionability reason text now
matches the recommended new test.

Goldens: 213 human.txt files re-blessed, formatting-only drift on the
Static exposure and Why lines.

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

* Pilot ranked rows and the targeted test brief lead with the plain word

Devin review on #4520: the pilot Markdown ranked list and the targeted
test brief still led with the bare schema value. Both now read
'weak (`weakly_gripped`)' / '- weak, weakly_gripped'; JSON fields keep the
schema value alone.

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

* Port fix for main's non-test build: title_argument uses SourceText line index

Main at eb3a2e9..current fails 'cargo build -p ripr' (E0425): #4635 made
the free line_for_offset #[cfg(test)] while #4593 added a non-test caller.
Also apply cargo fmt to typescript/mod.rs from main. No-op once main
carries its own fix.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
EffortlessSteven added a commit that referenced this pull request Sep 29, 2026
…#4739)

* style(typescript): order module_entries after the line-index test module

cargo fmt --check fails on main since #4635 and #4526 landed together; every
PR that merges main then fails Rust gates.

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

* fix(typescript): count a computed test title's line without the test-only helper

#4635 made line_for_offset(&str) a #[cfg(test)] oracle while #4593 added a
non-test caller in title_argument, so main does not compile outside tests.

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

* perf(typescript): read a computed title's line from the file's line index

Review on #4739: the inline newline scan repeated per computed title what
#4635's SourceText index removed. Both callers already hold &SourceText, so
thread it through describe_body_from_statement and title_argument.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
EffortlessSteven added a commit that referenced this pull request Sep 29, 2026
…tes, toolchain exec, /dev/zero reads, workflow gate inputs) (#4763)

* fix(security): refuse committed symlinks at repo-default output paths

ripr pilot and several other writers used std::fs::write or File::create,
which follow a leaf symlink. A cloned repository could commit
target/ripr/pilot/pilot-summary.md -> ~/any-file and ripr pilot replaced
that file. Route these writes through output::file_write (no-follow,
regular-file validation) and open predictable temporary files with
create_exclusive.

Closes #4719

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

* fix(lsp): bound the saved-digest read of client-named documents

didOpen admitted any absolute path, and the saved digest read it whole:
file:///dev/zero grew until OOM and a FIFO or /dev/stdin blocked with
the document store lock held. Digest only a regular file no larger than
one LSP message.

Closes #4729

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

* fix(diff): refuse option-shaped base refs before git diff

An explicit or LSP baseRef such as --output=/path reached
git diff <base>...HEAD unverified whenever the rev-parse probe could not
run. Refuse a range starting with '-' at the diff sink, name the failure
in resolve_effective_base, and give it no base identity.

Closes #4730

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

* fix(init): harden the generated GitHub workflow against PR-controlled input

`ripr init --ci github` writes a workflow that runs ripr over PR content
with pull-requests: write and security-events: write. Harden it:

- checkout sets `persist-credentials: false`. No later step fetches or
  pushes (fetch-depth: 0 already fetches the base); `gh` steps take
  GH_TOKEN from env, so the token need not sit in .git/config.
- New "Remove checked-in RIPR artifacts" step (`rm -rf target/ripr
  target/ci`) after the rust-cache restore and before Install ripr. The
  gate, ledger and policy steps read sarif-policy, agent-verify,
  agent-receipt, recommendation/mutation calibration and coverage-summary
  only "when present", and no generated step writes them, so a PR could
  commit forged copies with `git add -f`. It runs after rust-cache because
  a restored target/ can also carry stale target/ripr files. No documented
  path has users commit files under target/; durable user inputs live in
  .ripr/ and are untouched.
- Existing-comment capture keeps only comments with
  `.user.login == "github-actions[bot]" and .user.type == "Bot"`. The
  publish steps always post with `github.token`, so that identity is exact;
  the login check blocks humans and the type check blocks a user account
  named like the bot. A custom-token variant would fail open to duplicate
  cards rather than to suppression or PATCHing another author's comment,
  which is the safer direction.
- Log lines that print repository-derived text (blocked plan messages,
  update/keep dedupe keys) fold CR/LF in jq so a crafted path cannot start
  a `::` workflow-command line.
- .github/actions/ripr-check passes inputs through env and quotes them
  instead of interpolating `${{ inputs.* }}` into `run:`.

Tests pin each property and replay the capture and cleanup steps against
forged fixtures (a human and a third-party bot carrying a valid marker;
committed gate inputs under target/ripr and target/ci).

Closes #4731
Closes #4732
Closes #4733

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

* fix(security): never spawn a repository-selected Rust toolchain path

rustup's cargo/rustc proxies execute <path>/bin/cargo for a
rust-toolchain.toml [toolchain] path, and /proc/self/cwd/... points that
into the checkout. ripr doctor and the cargo metadata probe spawned the
toolchain in the analysis root, so a cloned repository ran its own code.
Refuse to spawn when the nearest toolchain file pins a path, unless
RUSTUP_TOOLCHAIN overrides it.

Closes #4740

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

* fix(doctor): probe every language runtime outside the checkout

pnpm --version in a checkout fetched and ran the release the project's
packageManager named; version managers read project files too. Probe all
runtimes from the temp directory, as yarn already was.

Closes #4742

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

* fix(git): disable repository core.fsmonitor on ripr's git calls

core.fsmonitor names a program git runs on index refresh. Pass
-c core.fsmonitor=false through the shared git_command authority and the
direct spawns that run arbitrary subcommands.

Closes #4744

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

* fix(config): keep [perl].cache_dir inside the repository

A repository ripr.toml could point cache_dir at any absolute or ..
path, and managed Perl mode created, wrote and renamed files there.
Validate it with the shared repository-relative path rule.

Closes #4745

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

* fix(analysis): discover only regular Rust source files

A committed src/zero.rs -> /dev/zero symlink was discovered as source and
read until out of memory in both diff and repo mode. Require a regular
file (DirEntry::file_type does not follow links), matching the Python and
TypeScript readers.

Closes #4751

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

* fix(typescript): port #4739 so main's build compiles on this branch

origin/main (e9ec4a4) fails to compile outside tests: #4635 made
line_for_offset test-only while #4593 used it in tests_extract. This is
#4739's change verbatim (the module order was already restored by rustfmt
here); it no-ops once #4739 merges.

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

* chore: satisfy static-language, local-context and process-policy gates

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

* fix(security): address exact-head review of the untrusted-input fixes

- toolchain pin: when rust-toolchain and rust-toolchain.toml share a
  directory rustup can pick either, so a path pin in either now counts
  (Devin review; reproduced with rustup 1.29).
- file_write: aarch64 Linux used x86_64's O_NOFOLLOW value (0x20000 is
  O_LARGEFILE there), so leaf symlinks were followed on that release
  target. Use the asm-generic 0x8000.
- before-phase lock: validate the destination and open without truncation
  instead of the no-follow writer, whose Windows share mode would turn a
  held lock into a sharing violation before try_lock can name it.
- temp files: remove a stale pid-named temporary before create_exclusive
  so an interrupted run cannot block later runs.

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

* fix(config): resolve the Perl facts cache under the analyzed root

A validated relative [perl].cache_dir still resolved against the process
directory, so ripr check --root <checkout> from elsewhere could create
it outside the checkout (Codex review). Join it, and the default, to the
analyzed root.

Refs #4745

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
EffortlessSteven pushed a commit that referenced this pull request Sep 29, 2026
…this branch's #4770 commits

Main landed the same per-source line index for TypeScript and Python
while this branch was in review. Conflicting TypeScript and Python files
take main's version; this branch's line_index module and changelog entry
are dropped. The minified-bundle test line is reapplied on main's
tests.rs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sjk8YiTg59NQQUJYaPd15
EffortlessSteven added a commit that referenced this pull request Sep 29, 2026
…minator (#4486) (#4499)

* fix(analysis): keep name-only related tests from supplying the discriminator

When another related test calls the changed code, a test related only
because its name shares a changed word can no longer supply the credited
oracle or confirm observation. Before, a test pinning
ParseError::MalformedSource == ParseError::MalformedSource without calling
try_parse made an uncaught mutation read exposed (#4486). Same-file and
same-module tests keep crediting: they commonly reach private helpers
through the module's entry point. Adds fixture
proximity_name_oracle_not_credited and its honesty-corpus case.

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

* fix(analysis): treat owner-named tests without a call as name-only

An owner_named_test relation fires only when the test name contains the
owner's name and no call, helper chain or assertion affinity ties it to
the owner, so like weak_token_substring it cannot supply the credited
oracle when another related test reaches the change. Exact-head review
reproduced exposed with try_parse_variant_is_distinct; the fixture now
carries that test.

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

* fix(analysis): count only reach-bearing relations when withholding name-only oracles

A same-file or same-module neighbour carries no reach (reach.rs treats it as
proximity), so it no longer switches the name-only rule on. Share
is_proximity_only with reveal.rs and add assertionless bystander controls.
Document the rule in RIPR-SPEC-0094 and map its unit test.

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

* style: order typescript module declarations as rustfmt expects

Main fails cargo fmt --check: #4635 and #4526 each reordered
mod declarations in typescript/mod.rs and the squashed combination is
unformatted. Port the one-line rustfmt fix so this PR's Rust gates run;
it no-ops once main carries it.

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

* fix(typescript): count the computed-title line without the test-only helper

Main does not build outside cfg(test): #4593 added a computed-title call to
the free line_for_offset(source, ..) helper, which #4635 made test-only when it
moved callers to SourceText::line_for_offset. title_argument takes &str on the
describe path, so count newlines in the prefix directly; computed titles are rare.

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

* test: re-bless name-only fixture human output after #4520's gap-name wording

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
EffortlessSteven added a commit that referenced this pull request Sep 29, 2026
… header words (#4777)

* ux(0.11): name one gap with one word across check, pilot and agent repair

`ripr check` reported a gap as `weakly_exposed` and `ripr pilot` reported
the same gap as `weakly_gripped`, and the repair packet said "extend the
nearest related test" while pilot named a new test to add. Both classes are
published schema values, so the values stay. Human lines now lead with the
plain word the check summary already uses (weak, unrevealed, no path,
unknown) and keep the value beside it. The actionability reason text now
matches the recommended new test.

Goldens: 213 human.txt files re-blessed, formatting-only drift on the
Static exposure and Why lines.

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

* Pilot ranked rows and the targeted test brief lead with the plain word

Devin review on #4520: the pilot Markdown ranked list and the targeted
test brief still led with the bare schema value. Both now read
'weak (`weakly_gripped`)' / '- weak, weakly_gripped'; JSON fields keep the
schema value alone.

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

* Port fix for main's non-test build: title_argument uses SourceText line index

Main at eb3a2e9..current fails 'cargo build -p ripr' (E0425): #4635 made
the free line_for_offset #[cfg(test)] while #4593 added a non-test caller.
Also apply cargo fmt to typescript/mod.rs from main. No-op once main
carries its own fix.

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

* ux(0.11): short human output by default for agent repair; plain check header words

agent repair printed 9 to 13 KB of JSON to stdout on every phase. Each
phase now prints a short human summary naming the seam, the movement and
where the packet, receipt and verify documents were written; --json
prints the previous stdout document unchanged, matching agent status.
check's Analysis outcome and State lines lead with plain words and keep
the id in parentheses. 339 check goldens re-blessed (formatting_only).

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

* agent repair summaries name root-resolved files; before summary waits for publication

Codex and Devin on #4777: the default after-phase summary printed
target/ripr/... relative to the caller's cwd, not --root. Both phases now
print root-resolved paths. The before-phase summary moves after attempt
publication, so a refused publication never shows 'Repair prepared';
--json keeps printing the packet where it did. New cli_smoke test runs
both phases from outside --root without --json.

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

* Re-bless python_generated_file_excluded after main; pin new outcome header in preview test

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

* ux(0.11): Limitation lines lead with plain words (#4323)

The analysis-outcome Limitation line printed kind, stage and recovery
as bare snake_case tokens. Each now leads with plain words and keeps the
token in parentheses; the path moves to '; file: <path>'. JSON unchanged.
7 goldens re-blessed (formatting_only).

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

* Re-bless proximity_name_oracle_not_credited from main with the plain-word lines

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

* Re-bless rust_pyo3_cross_language_limit from main with the plain-word lines

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

* Re-bless ts_return_ternary_boundary from main with the plain-word lines

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

* test(agent): pass --json where a journey test parses the before-phase packet

main added prepared_packet_continuation_cannot_resume_a_later_attempt_for_the_same_seam,
which parses agent repair's before-phase stdout as the packet JSON. On this
branch that document is behind --json, so the test now asks for it.

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

* Re-bless two fixtures from main with the plain-word lines

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

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants