Skip to content

esm: fix source phase identity bug due to loadCache eviction#62415

Open
guybedford wants to merge 1 commit intonodejs:mainfrom
guybedford:source-phase-identity
Open

esm: fix source phase identity bug due to loadCache eviction#62415
guybedford wants to merge 1 commit intonodejs:mainfrom
guybedford:source-phase-identity

Conversation

@guybedford
Copy link
Contributor

This fixes a bug where ensurePhase() upgrading a cache source phase job to an evaluation phase job calling link -> syncLink will hit the finally block of syncLink clearing the entry from the loadCache per the cycle handling convention assuming reinsertion.

When hitting this error an ERR_MODULE_LINK_MISMATCH was being thrown by the new test added here.

The fix here is to avoid deleting in finally in syncLink when an existing entry exists.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Mar 23, 2026
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.70%. Comparing base (2263b4d) to head (a9b2501).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62415      +/-   ##
==========================================
+ Coverage   89.68%   89.70%   +0.01%     
==========================================
  Files         676      676              
  Lines      206710   206717       +7     
  Branches    39584    39586       +2     
==========================================
+ Hits       185398   185432      +34     
+ Misses      13441    13432       -9     
+ Partials     7871     7853      -18     
Files with missing lines Coverage Δ
lib/internal/modules/esm/module_job.js 96.56% <100.00%> (+0.04%) ⬆️

... and 39 files with indirect coverage changes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants