Skip to content

fix(tsconfig): dedupe project reference dependencies#284

Open
CPunisher wants to merge 4 commits into
mainfrom
codex/dedupe-tsconfig-reference-deps
Open

fix(tsconfig): dedupe project reference dependencies#284
CPunisher wants to merge 4 commits into
mainfrom
codex/dedupe-tsconfig-reference-deps

Conversation

@CPunisher

@CPunisher CPunisher commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Store tsconfig file dependencies in insertion-ordered sets so extended configs and project references are deduplicated without rebuilding a temporary set on each merge.
  • Precompute flattened transitive project references while loading tsconfig references, preserving the existing nested-reference-first resolution order.
  • Make TsConfig::resolve iterate the flattened reference list directly, removing per-resolve recursive traversal and visited-set hashing.

Verification

  • cargo fmt --check
  • cargo test tsconfig_project_references --lib

cargo test --lib was also run; non-tsconfig PnP tests fail in this local environment (src/tests/pnp.rs), while 143 other tests pass.

Local downstream validation

Earlier in this investigation, built a local Rspack binding against the resolver fix and verified the ccweb Platform build with:

NAPI_RS_NATIVE_LIBRARY_PATH=/Users/bytedance/Projects/rspack/crates/node_binding/rspack.darwin-arm64.node DEBUG=1 IS_OVERSEA=true BUILD_TYPE=online emo run build --filter platform --skip-cache

Result: exit 0, peak RSS around 12.6 GB. Before the dependency dedupe fix, the same validation still hit exit 137 / memory pressure after only adding the reference traversal visited set.

Copilot AI review requested due to automatic review settings June 30, 2026 08:01
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@CPunisher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bfefbcf-1826-4c27-824b-c0075adccb48

📥 Commits

Reviewing files that changed from the base of the PR and between a94f6ea and 7a8f251.

📒 Files selected for processing (2)
  • src/lib.rs
  • src/tsconfig.rs
📝 Walkthrough

Walkthrough

TsConfig now stores file dependencies in an IndexSet-backed FileDependencies alias, inserts config paths into that set during parsing, and merges dependencies through a new crate-visible helper. resolve and find_reference_paths now carry a visited set to stop recursive traversal on repeated tsconfig paths. load_references uses the helper, and a new unit test checks deduplication and ordering.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: deduplicating tsconfig project reference dependencies.
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.
Description check ✅ Passed The description accurately summarizes the tsconfig dependency deduplication and resolution changes, matching the code changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/dedupe-tsconfig-reference-deps

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.

@codspeed-hq

codspeed-hq Bot commented Jun 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing codex/dedupe-tsconfig-reference-deps (7a8f251) with main (b50ffec)

Open in CodSpeed

Copilot AI 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.

Pull request overview

This PR improves tsconfig project-reference resolution by preventing redundant work and growth in tracked tsconfig dependency lists, reducing repeated traversals and memory pressure when resolving transitive project references.

Changes:

  • Deduplicate TsConfig.file_dependencies when merging extended configs and project references via a shared helper.
  • Add a visited set to TsConfig::find_reference_paths to avoid re-walking already-seen reference nodes during transitive traversal.
  • Add a regression unit test to ensure dependency deduplication behavior is preserved.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/tsconfig.rs Adds file-dependency dedupe helper and a visited-set guard for reference-path traversal to prevent repeated walking.
src/lib.rs Switches project-reference dependency merging to the new dedupe helper.
src/tests/tsconfig_project_references.rs Adds a regression test verifying file dependency deduplication.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CPunisher CPunisher force-pushed the codex/dedupe-tsconfig-reference-deps branch 2 times, most recently from ee0b90d to 7ead072 Compare June 30, 2026 10:02
@CPunisher CPunisher force-pushed the codex/dedupe-tsconfig-reference-deps branch from 7ead072 to d8610fa Compare June 30, 2026 10:02
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