Skip to content

fix: prevent tsconfig cache pollution with separate raw and built caches#970

Merged
Boshen merged 2 commits intomainfrom
fix-tsconfig-cache-pollution
Jan 14, 2026
Merged

fix: prevent tsconfig cache pollution with separate raw and built caches#970
Boshen merged 2 commits intomainfrom
fix-tsconfig-cache-pollution

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jan 14, 2026

Summary

Test plan

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 88.23529% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.17%. Comparing base (f6fbb23) to head (941cb0f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/tsconfig.rs 57.14% 3 Missing ⚠️
src/cache/cache_impl.rs 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #970      +/-   ##
==========================================
- Coverage   94.36%   94.17%   -0.20%     
==========================================
  Files          17       17              
  Lines        3321     3346      +25     
==========================================
+ Hits         3134     3151      +17     
- Misses        187      195       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

CodSpeed Performance Report

Merging this PR will improve performance by 4.38%

Comparing fix-tsconfig-cache-pollution (941cb0f) with main (f6fbb23)

Summary

⚡ 1 improved benchmark
✅ 11 untouched benchmarks
⏩ 5 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
complex_real 22.9 µs 21.9 µs +4.38%

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

sapphi-red and others added 2 commits January 14, 2026 16:32
Fixes #963

The cache previously stored tsconfigs keyed only by path, which caused
pollution when the same tsconfig was loaded with different `root` values.

This change:
- Adds `should_build` flag to TsConfig to control path normalization
  separately from the `root` flag
- Splits the tsconfig cache into two:
  - `tsconfigs_raw`: stores tsconfigs after callback but before build
  - `tsconfigs_built`: stores tsconfigs after callback and build
- For root=true (resolution): uses built cache
- For root=false (extending): uses raw cache

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Boshen Boshen force-pushed the fix-tsconfig-cache-pollution branch from a6fb3e8 to 941cb0f Compare January 14, 2026 08:33
@Boshen Boshen enabled auto-merge (squash) January 14, 2026 08:34
@Boshen Boshen merged commit 13638c3 into main Jan 14, 2026
16 checks passed
@Boshen Boshen deleted the fix-tsconfig-cache-pollution branch January 14, 2026 08:35
Comment on lines +299 to +301

// NOTE: should remove this line before merging as it's not thread safe
std::env::set_current_dir(&f2).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

@Boshen I think you want to remove this as it may cause flaky failures.

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.

tsconfig cache mixes root: true and root: false causing incorrect resolution

2 participants