Deduplicate package manager and CLI command helpers#32022
Open
alii wants to merge 5 commits into
Open
Conversation
Member
Author
|
@robobun adopt |
Collaborator
|
Audit done: the diff is behavior-preserving (three edge-path notes documented in the PR body), local runs of all touched suites show no regressions against the base build, and hermetic tests pin the consolidated error exits. Build 61709 finished with only unrelated red: the streams-leak.test.ts flake on one Linux baseline lane (file untouched by this PR, also flaked on the base PR build) and two darwin 14 aarch64 test jobs that expired waiting for agents. Retrying those jobs in Buildkite should go green. |
Collaborator
|
Updated 3:17 AM PT - Jun 10th, 2026
❌ @robobun, your commit fbe8f1a has 1 failures in 🧪 To try this PR locally: bunx bun-pr 32022That installs a local version of the PR into your bun-32022 --bun |
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.
What this does
Consolidates duplicated blocks across the package manager and CLI commands (
bun install/add/update/link/unlink/outdated/update --interactive/pack/bunx/create/run --filter|--parallel|--sequential/repl): shared workspace enumeration (src/runtime/cli/workspace_helpers.rs), shared run-process plumbing (src/runtime/cli/run_processes_shared.rs), the workspace package.json load-or-exit helper, and hosted_git_info/npm/yarn dedups. Net -1.2k lines (+2223/-3430).Stacked on #32000 (foundations), merge that first. Split from #31912 (whole-repo simplification pass, closed in favor of module-scoped splits). This PR only moves and removes code, zero intended behavior change.
Behavioral equivalence
Audited hunk by hunk against the base: error messages, log-flush order, and exit semantics are byte-identical at every call site, with three reviewed edge-path exceptions:
/. On Windows the probe string changes bytes but names the same file:which_wintakes the absolute-path branch and every consumer (exists check, stat,CreateProcessW) accepts both separators.get_with_path_or_exitandload_lockfile_or_crashhelpers ignore a failedLog::printto stderr where two of the replaced sites propagated it with?. That error path is unreachable: the writer behindOutput::error_writer()deliberately discards fd write failures and always returnsOk(adapter_write_allinsrc/sys/lib.rs), so the old?was dead code.bun update --interactivewith--filternow routesWorkspaceFilter::initallocation failure throughbun_core::handle_oom(matchingbun outdated) instead of.expect("OOM").Where the original duplicates genuinely differed (trusted-deps lockfile gating in PackageInstaller, the per-backend Windows walkers, the two PackageManager init paths, gitlab's distinct URL extractor), the helpers parameterize the difference instead of collapsing it.
Verification
Debug-build runs of the touched suites: hosted-git-info, yarn-lock migration, bun-install, bun-add/remove/update, bun-patch + bun-install-patch, bun-pack, bun-link, bunx, bun-create, isolated-install, bun-workspaces, lifecycle scripts, outdated, update-interactive, bun-run, filter-workspace + multi-run, repl. Every failure reproduces identically on the released bun or on a base-branch debug build (network-dependent fixtures, sandbox registry setup, and debug-only artifacts such as the install-failure trace dump and 5s timeouts on chains of debug-binary startups).
CI build 61502: the only failing test is bunx "should handle package that requires node 24", which fails identically on the base branch build (61499), is tracked in CI: bunx.test.ts fails on all platforms — @angular/cli@latest now requires Node >= 24.15.0, bun reports 24.3.0 #31797 (live
@angular/cli@latestrequires a newer Node than bun reports), and has a pending fix in test: pin @angular/cli version in bunx node-version test #31820. The flaky-retry annotations are on files this PR does not touch.New hermetic tests pin the consolidated error exits: package.json name validation shared by
bun link/bun unlink(bun-link.test.ts), the pack package.json parse failure (bun-pack.test.ts), and the missing-lockfile error shared bybun outdatedandbun update --interactive(bun-install-registry.test.ts, update_interactive_install.test.ts).