Skip to content

Conversation

@Artur-
Copy link

@Artur- Artur- commented Oct 21, 2025

Resolves the issue where different override contexts (like Vaadin's $@vaadin/react-components vs $@vaadin/react-components-pro) were incorrectly treated as conflicts by structural comparison.

Fixes #8688

The override conflict detection added in b9225e5 is overly
conservative and produces false positives in two scenarios:

1. Peer dependencies: These resolve to nodes in different parts
   of the tree with legitimately different override contexts.

2. Reference overrides ($syntax): Different override sets using
   references (e.g., $@vaadin/react-components vs
   $@vaadin/react-components-pro) are structurally different but
   functionally equivalent when they resolve to the same versions.

This fix removes the override conflict check entirely from edge
validation. The check was redundant because:
- Version satisfaction is already validated by satisfiedBy()
- Any actual version conflicts in dependencies are caught during
  normal dependency resolution in the build/reify phase
- The check caused false positives that prevented valid
  dependency configurations from working

Fixes: npm#8688
@Artur- Artur- requested a review from a team as a code owner October 21, 2025 15:32
…ation

because it caused false positives with reference overrides ($syntax) that
resolve to functionally equivalent versions. Real conflicts are caught during
the build/reify phase. See issue npm#8688 and the fix in edge.js
Replace the test 'should find inconsistency between the edge's override set
and the target's override set' which was testing the override conflict
detection code that was intentionally removed.

The new test 'edges with different override contexts to same node should be
valid' is a regression test for issue npm#8688. It verifies that edges remain
valid when the edge and target node have different override contexts, as long
as the version requirements are satisfied.

The override conflict check (from b9225e5) was causing false positives,
especially with reference overrides ($syntax) that resolve to functionally
equivalent versions despite being structurally different.

The fix removes this check because:
1. satisfiedBy() already validates version requirements
2. Real conflicts are caught during build/reify phase
3. The check compared override sets structurally, not functionally
@Artur-
Copy link
Author

Artur- commented Oct 28, 2025

This really needs to be resolved before Node 24 becomes LTS. Basic functionality like npm ls does not work in the lastest npm release

@Artur- Artur- mentioned this pull request Oct 28, 2025
@wraithgar
Copy link
Member

I'm not sure that removing the check altogether is what we need here. Shouldn't the fix be in the set detection itself? This seems like just ignoring a thing that's giving us an error to make the error go away, rather than fixing the part that's making it error.

@Artur-
Copy link
Author

Artur- commented Oct 28, 2025

I am not familiar enough with the code to comment but if you can give some pointers, I can try to make the fix better

…arison

Instead of removing override conflict detection entirely, enhance
it to use semantic comparison of version requirements rather than pure
structural equality checking.
@Artur-
Copy link
Author

Artur- commented Oct 28, 2025

So doOverrideSetsConflict only checks if one of the override sets contains the other - which is not the case here , where there are two distinct override sets that define the same version number for a common dependency. I update the PR, please check if you think this is a better version. Becomes a bit more complex

@Artur- Artur- changed the title fix(arborist): remove overly strict override conflict detection fix(arborist): improve override conflict detection with semantic comparison Oct 29, 2025
@Artur-
Copy link
Author

Artur- commented Oct 29, 2025

Maybe @owlstronaut who did the original PR has some comments?

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.

[BUG] ERESOLVE overriding peer dependency in 11.2.0 and newer

2 participants