Skip to content

fix(config): linear duplicate detection for ripr.toml path lists (#11560) - #11615

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/hostile-cfg-quadratic
Oct 31, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/hostile-cfg-quadratic

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #11560

Acceptance delta (one sentence): A ripr.toml listing tens of thousands of generated_file_patterns, handwritten_files or bun_ub.test_roots entries parses in linear time instead of stalling ripr check for tens of seconds.

Summary

parse_generated_file_patterns, parse_handwritten_files and parse_bun_ub_profile (crates/ripr/src/config.rs) detected duplicates with Vec::contains / iter().any, which is O(n^2). Black-box on the prebuilt binary, generated_file_patterns with 5k / 20k / 50k entries took 0.5 s / 4.7 s / 28.6 s, and 100k did not finish in 60 s. This switches the three checks to a HashSet at the same semantic owner; error wording, ordering and acceptance are unchanged.

Tests

  • New config::tests::large_path_lists_parse_in_linear_time_and_still_reject_duplicates: 60k entries for each of the three lists parse under a 10 s bound, and a duplicate appended at the end is still rejected with the existing wording. Passes with the fix (1.7 s in debug). Against the pre-fix config.rs the same test did not finish inside a 15 minute window (it exercises the quadratic path), so it fails before the fix.
  • cargo fmt --check -p ripr clean.
  • Local cargo xtask precommit not run here: the shared target dir is serialised across several agents (one -p ripr test build took ~29 min of lock wait), so it is left to hosted CI.

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!

@coderabbitai

coderabbitai Bot commented Oct 31, 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 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 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: 08f04baf-9a28-4d94-becd-2578fe73e7e7
Commits

Reviewing files that changed from the base of the PR and between 264db59 and 1a18c14.

Files selected for processing: 3
  • changelog.d/11560-config-path-list-linear-duplicates.md
  • crates/ripr/src/config.rs
  • crates/ripr/src/config/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 test's fixed 10-second timeout can fail on an overloaded CI runner even when the implementation is linear.
  • Confirm the duplicate oracle verifies the existing error wording for generated patterns, but does not directly compare duplicate detection across the other two changed path-list parsers.
  • Confirm the test exercises successful parsing of all three large lists, but duplicate rejection is asserted only for generated_file_patterns.
  • Confirm the PR states duplicate detection is linear for three path-list fields, while the repository-wide route scan available to this lane does not prove that no sibling parsers retain quadratic membership checks.
  • Confirm the test's 10-second elapsed-time bound can be flaky on heavily loaded CI, despite the implementation's algorithmic improvement.

Refuted

  • The optimization could preserve accepted values while changing duplicate semantics.; refuted because: Each changed parser still appends the same normalized value to its output vector and rejects on the first repeated membership result; the test confirms the generated-pattern error identifies the duplicate, while the PR states ordering and wording are unchanged.
  • The PR claims duplicate detection is linear, but HashSet operations are expected/amortized rather than strict worst-case linear.
  • The test could hang indefinitely on the pre-fix quadratic implementation, making red-green validation impractical.; refuted because: The PR body explicitly reports that the pre-fix test did not finish within 15 minutes, so the pre-fix failure is evidenced externally rather than by this review lane.

Evidence gaps

  • The PR's pre-fix noncompletion claim is not independently witnessed in the available seeded thread or sensor receipts.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record, head ccbd95e5856300dfd7d7f37024cccffb33f7a5a7.

Angle 1: correctness / edge cases. The three sites (parse_generated_file_patterns, parse_handwritten_files, parse_bun_ub_profile) only change how "seen before" is decided. Keys compared are the same strings as before (trimmed for patterns/roots, the normalized path for handwritten files), so which entry is reported as the duplicate and the error wording are identical; first-occurrence order and the sort_unstable for handwritten files are untouched. The . rejection and relative-path validation still run before the set insert. parse_languages_enabled still uses Vec::contains but is bounded by the closed set of language ids. production_like_targets was already fast (4.6 s at 300k entries before this change; not quadratic).

Angle 2: tests / contract. New test builds 60k entries per list through parse_config (valid shapes, so it proves the success path rather than an early rejection), asserts lengths, a 10 s bound, and that a duplicate appended at the end is still named. Passes with the fix (1.7 s in debug). Fail-before: the same test against the pre-fix config.rs did not finish within a 15 min cargo timeout, and the prebuilt binary measured 28.6 s at 50k and >60 s at 100k. The time bound is generous so it does not flake on a loaded runner. No schema/doc/output change; changelog fragment added. cargo fmt --check clean; cargo xtask precommit not run locally (shared-target lock contention), left to hosted CI.

Findings: none. No open blockers.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 31, 2026 14:41
@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!

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

Copy link
Copy Markdown
Member Author

Review of record, head 1a18c14

Angles: behavior preservation, complexity, tests, and exact-head CI.

  • Three duplicate checks in config.rs (generated_file_patterns, handwritten_files, profiles.bun_ub.test_roots) now use a HashSet instead of a linear scan of the accepted list, so a hostile ripr.toml with tens of thousands of entries no longer costs O(n²). The accept/reject decision, the entry order of the parsed list and the error text are unchanged: the set is checked at the same point the old scan ran.
  • config/tests.rs adds regression coverage for the large-list case and for duplicate detection in each of the three fields.
  • CI: run 41225445888 on this head passed all four shards, the shard verifier and the required Result. Main's earlier failures (fix(repair): unbreak main after #11596 (role-authority sniff, stale refusal assertions) #11734) are gone from this run.
  • Findings: none blocking. Merging at the expected head.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 784aca2 into main Oct 31, 2026
61 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/hostile-cfg-quadratic branch October 31, 2026 18:31
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