GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix Bun restore ignoring user registry config (#1276) by mikolalysenko · Pull Request #1283 · SocketDev/socket-patch Conversation
|
| Issue case | Test | Without fix | With fix |
|---|---|---|---|
#1276 scope + token only in ~/.npmrc |
registry::bun_remove_reads_registries_set_only_in_the_user_npmrc |
exit 1, cannot restore … |
pristine lock |
#1276 ~/.bunfig.toml [install.scopes] |
registry::bun_remove_reads_registries_set_only_in_the_global_bunfig |
exit 1 | pristine lock |
$XDG_CONFIG_HOME/.npmrc / .bunfig.toml beat ~ decoys |
registry::bun_remove_reads_the_xdg_config_home_npmrc_and_bunfig |
exit 1 | pristine lock |
v2 lock: global bunfig beats project .npmrc (Bun 1.4) |
registry::bun_remove_on_a_v2_lock_takes_bunfig_over_npmrc |
upstream_registry_fallback |
pristine lock, no fallback |
v1 lock, .npmrc vs bunfig disagree |
registry::bun_remove_refuses_when_npmrc_and_bunfig_disagree_on_a_v1_lock |
exit 0, guessed | refused, pin kept |
Real Bun: scope only in $XDG_CONFIG_HOME/.npmrc, scan → rollback → fresh frozen install |
e2e_redirect_bun_build::bun_redirect_rollback_reads_a_scope_set_only_in_the_user_npmrc |
HTTP 404 Not Found from the default registry (the issue's symptom) |
byte-exact lock, original bytes installed |
The integration tests are in crates/socket-patch-cli/tests/in_process_vendor_bun_takeover/registry.rs. Core unit tests in npm.rs:
bun_user_config_paths_follow_bun_s_lookupbun_layers_take_each_key_from_the_highest_file_that_sets_itbun_user_files_expand_any_variable_project_files_only_token_onesbun_refuses_a_registry_the_lock_s_bun_version_would_decideThe existing #992 tests still pass unchanged.
in_process_vendor_bun_takeover's runner now also removes XDG_CONFIG_HOME, so a developer's user config can't steer the fixtures. HOME was already pinned to a stand-in.
cargo fmt --all -- --check: ok.cargo clippy --locked --workspace --all-features -- -D warnings: ok. --all-targets reports nothing in the changed files; its other findings are in files this PR doesn't touch.cargo test -p socket-patch-cli --all-features --test in_process_vendor_bun_takeover: 40/40.cargo test -p socket-patch-core --lib redirect::upstream: 119/119.SOCKET_PATCH_BUN_E2E_REQUIRED=1 SOCKET_PATCH_BUN_E2E_VERSION=1.4.2 cargo test -p socket-patch-cli --all-features --test e2e_redirect_bun_build -- --include-ignored: 36/36. The 1.1.45 / 1.2.23 / 1.3.14 legs run in CI.cargo test --workspace --all-features --no-fail-fast: 13 failures, all environmental and none in Bun or redirect code:
covgap_commands_vendor, repair, copy_tree, vlt_heal, vendor::pypi_*, in_process_redirect write-failure cases). The sandbox runs as uid 0, which ignores chmod 0o555.mode_migration_pypi::pipenv_hosted_to_vendored…, which fails fetching https://pypi.org through the sandbox's TLS-inspecting proxy (the Every HTTPS call fails behind a TLS-inspecting proxy because the clients trust only bundled webpki roots #1107 shape).npm/, pypi/ and gem/ only dispatch to the binary, so they need no change.::__archiveUrl= binding when the registry comes from npmScopes, YARN_NPM_REGISTRY_SERVER, ~/.yarnrc.yml or a parent-dir .yarnrc.yml (#908 fix covers only the project rc's top-level key) #1017 is the yarn berry twin (berry_lookup_registry ignores ~/.yarnrc.yml, npmScopes registries and YARN_NPM_REGISTRY_SERVER). It's a separate reader, so it's left for its own PR.🤖 Generated with Claude Code
Note
Medium Risk
Changes hosted lockfile restoration and private-registry lookup (including credentials), but ambiguity is refused and behavior is heavily tested; v0/v1 locks with conflicting project npmrc/bunfig now fail restore where npmrc-first guessing used to succeed.
Overview
Hosted Bun unwinds (rollback, remove, and hosted → vendored takeover) now resolve each package’s registry the way Bun does, not only from .npmrc / bunfig.toml beside the lock.
The upstream restore loads layered config: project then user .npmrc ($XDG_CONFIG_HOME/.npmrc or ~/.npmrc), project then global bunfig.toml, plus env registry overrides. Keys merge per Bun’s precedence (project beats user/global; Bun ≥ 1.4 prefers bunfig over .npmrc, ≤ 1.3 the opposite). On lockfileVersion 2 restores use bunfig-first; on v0/v1 bun.lock or bun.lockb it refuses pins when the two orders would pick different registries or credentials, instead of guessing.
Credential handling matches Bun: user-owned config may expand any ${VAR}; project files still only expand NPM_TOKEN / NODE_AUTH_TOKEN / BUN_AUTH_TOKEN. Refusal messages expose registry bases only.
Docs (CLI_CONTRACT.md, docs/ecosystems.md) and tests cover user-only scopes, XDG paths, v2 bunfig-over-npmrc, v1 conflicts, and e2e rollback with scope in user .npmrc.
Reviewed by Cursor Bugbot for commit f637b68. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A hosted Bun rollback, remove or takeover restore looked up each package's registry only in the .npmrc and bunfig.toml beside the lock. A private scope set in ~/.npmrc or the global bunfig, where scope tokens usually live, was looked up on the public registry instead. The restore then failed, or wrote "" plus a same-name public package's integrity and exited 0 (#1276). The restore now reads the files Bun reads, measured on Bun 1.1.39 to 1.4.2: $XDG_CONFIG_HOME/.npmrc when it exists, else ~/.npmrc, and the global bunfig at $XDG_CONFIG_HOME/.bunfig.toml when XDG_CONFIG_HOME is set, else ~/.bunfig.toml. A key set in the project's file wins over the user's file of the same kind. The user's own files expand any variable, as Bun does; the project's still expand only the npm token variables. Bun 1.4 also flipped which kind wins a key both set: a bunfig over an .npmrc, where Bun 1.3 and older did the reverse. A lockfileVersion 2 bun.lock is only ever Bun 1.4's, so it takes the bunfig. On an older bun.lock (Bun 1.4 keeps it as is) or a bun.lockb, a package the two kinds disagree on is refused with the checkout remedy, not guessed. Fixes #1276 Assisted-by: Claude Code:claude-opus-5-5
Adds a real-Bun leg where the scoped package's registry is set only in the user's $XDG_CONFIG_HOME/.npmrc, the usual home of a private scope. Hosted scan, then rollback, must restore bun.lock byte for byte, with the scope registry's tarball URL in the slot. A fresh frozen install with the same user config must then land the original bytes (#1276). Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
A FIFO or device at $XDG_CONFIG_HOME/.bunfig.toml (picked without an is_file check) or ~/.npmrc blocked the hosted restore. Read both user files through read_regular_to_string, as the project files already are. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EUw5kpF3tzHQGxmpTQzo5S
There was an error while loading. Please reload this page.
A token-only [install.scopes] entry in the user's bunfig took the configured default registry, even when the project's .npmrc or bunfig.toml named it. A repository could then pick the host that received the user's scope credential on rollback, remove or the bun.lockb takeover. Attach that token only to a default registry from the user's own files, or npmjs when they set none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EUw5kpF3tzHQGxmpTQzo5S
There was an error while loading. Please reload this page.
|
This PR only changes how Bun registry config is read on the hosted restore paths ( The Bun workflow passed on No fix exists in the repo for this. I'll re-run the failed jobs once after these runs finish, and compare against Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Update on the red Bun checks: I've re-run the failed jobs once on both of this PR's runs (37952898642 and 37952898726). The rest of CI on f637b68 is green (169/172 jobs), and the PR has no merge conflict. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f637b68. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] Picked this PR up because its heartbeat was stale. On f637b68 it's green except for three checks, and none of them come from this PR:
Next: once #1301 or #1302 merges, merge Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review at
Labeled Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Resolve conflicts with #1026 (credential redaction) and #1283 (Bun restore user registry config): - vendor/{cargo,composer_lock,gem,golang,npm_common,npm_dir,pypi, service_fetch}.rs: keep this branch's Result-based service fast paths and route the vendor_prebuilt_downloaded advisory through main's single VerifiedArchive::downloaded_warning builder. - patch/redirect/upstream/bun_lockb.rs: keep by_uuid/refuse_all_in from upstream/mod.rs (where this branch moved them) and import main's BunConfigOrder from upstream/npm.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Resolve conflicts with #1319 (berry implicit node-gyp) and #1283 (Bun user registry config): - NpmDist carries both `bin` (#1131) and `node_gyp` (#737). - #1319 replaced Pin's `bin` with `manifest`; the url-pin restore now passes a manifest holding only the version document's bin (and a declared node-gyp so render_pinned_entry keeps the entry's dependencies), and runs before the implicit node-gyp re-add so that re-add is not undone. - CLI_CONTRACT.md npm-family paragraph merged word by word: keeps the berry bin restore note and the Bun user-config registry rules. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted Bun rollback/remove ignores a private scope set in ~/.npmrc or ~/.bunfig.toml: it looks the package up on the public registry, then fails or writes a "" slot with the public package's integrity (#992 fix reads only the project's files)
There was an error while loading. Please reload this page.