Label Bun transitive devDependencies via graph hydration - #1737
Draft
zlav wants to merge 2 commits into
Draft
Conversation
The Bun lockfile strategy assigned each package's environment by name-membership in the set of directly-declared devDependencies and never ran graph hydration. A dependency reachable only transitively through a devDependency was labeled EnvProduction and survived dev-dependency filtering. Adopt the label-direct-then-hydrate pattern used by the other Node strategies: label only direct roots with their declared environment, then run hydrateDepEnvs so environments propagate down the edges. A dep reachable only via dev deps becomes EnvDevelopment; a dep also reachable from a prod dep keeps EnvProduction. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The Bun lockfile strategy never ran graph hydration, so a dependency reachable only transitively through a devDependency was labeled production and survived dev-dependency filtering. This adopts the label-direct-then-hydrate pattern the other Node strategies use.
Problem:
BunLock.buildGraphset each package's environment by name-membership in the set of directly-declared devDependencies. A transitive dep not itself listed in any workspace'sdevDependenciesfell through toEnvProductionand was not filtered.Fix:
EnvDevelopment, prod/optional →EnvProduction); non-direct nodes carry no env label.hydrateDepEnvsso environments propagate to transitive successors. A dep reachable only via dev deps becomesEnvDevelopment; a dep also reachable from a prod dep keepsEnvProduction.Testing plan
test/Bun/testdata/transitive-dev/bun.lock+ specs: a transitive dep of a dev dep isEnvDevelopment(regression), a transitive dep of a prod dep staysEnvProduction, and a dep reachable from both roots keeps production.dependenciesspec (semverviatypescriptis now dev, not prod).make test-cabal ARGS="Bun"→ 42 examples, 0 failures.References
Checklist
Changelog.mdunder an## Unreleasedsection.