Skip to content

fix(arborist): prefer direct dependency bins - #9875

Open
sanjayamaharjancodes wants to merge 1 commit into
npm:latestfrom
sanjayamaharjancodes:fix/direct-bin-precedence
Open

fix(arborist): prefer direct dependency bins#9875
sanjayamaharjancodes wants to merge 1 commit into
npm:latestfrom
sanjayamaharjancodes:fix/direct-bin-precedence

Conversation

@sanjayamaharjancodes

Copy link
Copy Markdown

Summary

  • prioritize root and workspace direct dependencies when root-level bins collide
  • preserve the existing depth/path order as the deterministic fallback
  • cover direct aliases, workspace-root dependencies, and all-transitive collisions

Why

Hoisted direct and transitive packages can have the same physical depth. The previous depth/path sort could therefore let a lexically earlier transitive package claim a bin requested from a direct dependency.

This changes only bin-link ordering; lifecycle script ordering is unchanged.

Fixes #9868

Testing

  • targeted Arborist rebuild suite
  • complete Arborist test suite
  • Arborist lint and template checks
  • git diff --check

@sanjayamaharjancodes
sanjayamaharjancodes requested review from a team as code owners August 14, 2026 15:12
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] Direct dependency's bin can be overwritten by a transitive dependency based on lexical package name

1 participant