Skip to content

fix(arborist): run dependency hooks for changed local links#9757

Closed
ychampion wants to merge 1 commit into
npm:latestfrom
ychampion:fix/local-link-dependencies-script
Closed

fix(arborist): run dependency hooks for changed local links#9757
ychampion wants to merge 1 commit into
npm:latestfrom
ychampion:fix/local-link-dependencies-script

Conversation

@ychampion

Copy link
Copy Markdown

Summary

  • rerun dependency lifecycle scripts when a direct local link's dependency metadata changes
  • keep unchanged links and legacy lockfile upgrades on their existing behavior

Why

Arborist refreshes a linked target and its lock metadata without producing a root diff child, so the root dependencies hook was skipped even though the local dependency graph changed.

Closes #8984

Validation

  • ../../node_modules/.bin/tap - 59 test files passed with 100% coverage
  • node . run lint --workspace @npmcli/arborist - passed
  • patched CLI smoke - a changed local dependency ran the hook once; the following no-op did not rerun it

Detect dependency-graph changes that do not appear as reify diff children.

Constraint: Compare dependency metadata without hashing arbitrary linked package contents.
Rejected: Run hooks for every unchanged link | preserves no-op lifecycle behavior.
Confidence: high
Scope-risk: narrow
Directive: Keep link comparison limited to dependency graph fields and pre-reification lock data.
Tested: all 59 Arborist test files with 100% coverage; all 112 reify tests; Arborist lint/template checks; changed/no-op CLI smoke; diff checks.
@ychampion ychampion requested review from a team as code owners July 12, 2026 19:18
@ychampion

Copy link
Copy Markdown
Author

I found edge cases in lockfile-free and workspace-filtered installs that make this approach unreliable. I'm withdrawing it rather than asking maintainers to review a partial fix.

@ychampion ychampion closed this Jul 12, 2026
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] dependencies hook is not triggered when dependencies change for a local dependency

1 participant