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 installs getting npm self-update hints (#1621) by mikolalysenko · Pull Request #1622 · SocketDev/socket-patch Conversation
|
| Install shape | Detected by | Hint |
|---|---|---|
bun add -g |
…/install/global/node_modules/… ($BUN_INSTALL, default ~/.bun) |
bun add -g @socketsecurity/socket-patch@latest (bun update -g keeps the exact pinned version) |
bun add in a project |
node_modules/.bun/ isolated store in the path, or bun.lock / bun.lockb beside the outermost node_modules |
bun add @socketsecurity/socket-patch@latest |
bunx |
the holder (or, for a scoped spec, its parent) is named bunx-<numeric uid>-… |
bunx @socketsecurity/socket-patch@latest … |
update/channel.rs's node_manager knew only npm, pnpm and vlt ("Anything else is npm, which also covers yarn and Bun (no dedicated hint yet)"). The fix adds Bun / Bunx managers at that boundary. commands/update.rs (the refusal) and update_notifier.rs (the passive notice) both go through upgrade_hint_for / channel_label_for, so they're both fixed. A path's own store component (.pnpm, .bun) now outranks a lockfile left beside the project, and pnpm's lockfile still outranks Bun's when no store names the manager. CLI_CONTRACT.md's managed-install row is updated to match. The npm/PyPI/gem wrappers have no update hints of their own, so they need no change.
crates/socket-patch-core/src/update/channel.rs): bun_global_installs_get_bun_add_g, bun_project_installs_get_bun_add, bunx_cache_gets_bunx_latest. All 3 failed on main 657fce2 (cargo test -p socket-patch-core --lib update::channel: 18 passed, 3 failed) and pass with the fix (21 passed).crates/socket-patch-cli/tests/update/self_update_channels_e2e.rs): bun_project_refuses_with_bun_hint and bun_global_refuses_with_bun_hint spawn the real binary from a staged Bun layout and check the managed by bun refusal and its hint. cargo test -p socket-patch-cli --all-features --test update: 65 passed.cargo fmt --all -- --check and cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --all-features --lib: 6537 passed. 4 failed, all permission-injection tests (copy_tree, vlt_heal, pypi_poetry, pypi_requirements) that chmod a dir to 0o555 and expect a write to fail. The agent container runs as root, which ignores that. They're unrelated to this diff, and CI runs as non-root.cargo test --workspace run didn't fit this container's disk allowance (the target dir passed 20 GB). CI covers it.Per-issue checklist:
socket-patch --update on a Bun-installed copy says "managed by npm" and gives an npm command: npm update -g leaves a bun add -g install stale, and npm install …@latest in a Bun project breaks bun install --frozen-lockfile #1621 global (bun add -g): bun_global_installs_get_bun_add_g, bun_global_refuses_with_bun_hintsocket-patch --update on a Bun-installed copy says "managed by npm" and gives an npm command: npm update -g leaves a bun add -g install stale, and npm install …@latest in a Bun project breaks bun install --frozen-lockfile #1621 project (text/binary lock, isolated linker): bun_project_installs_get_bun_add, bun_project_refuses_with_bun_hintsocket-patch --update on a Bun-installed copy says "managed by npm" and gives an npm command: npm update -g leaves a bun add -g install stale, and npm install …@latest in a Bun project breaks bun install --frozen-lockfile #1621 bunx cache (scoped and unscoped spec, cache dir missing package.json): bunx_cache_gets_bunx_latestI fixed two findings in 26461c3. (1) A bunx cache dir without a package.json was read as a global prefix. (2) A leftover pnpm-lock.yaml beat Bun's own .bun store. I tightened the bunx name match to a numeric uid in the same commit. Not fixed, as follow-ups outside this PR's scope:
node_modules copy: the lockfile is only looked for beside the outermost node_modules. pnpm and vlt have the same limit today.pnpm update --recursive --latest. I couldn't verify Bun's equivalent here, so Bun keeps bun add …@latest.BUN_INSTALL_GLOBAL_DIR / bunfig install.globalDir isn't recognized as global.--backend=symlink installs that canonicalize into ~/.bun/install/cache have no node_modules component and read as Standalone. This predates the PR and applies to every channel heuristic.https://claude.ai/code/session_016akFSbKa8ztJC4jji31cAn
Note
Low Risk
Heuristic-only changes to refusal messaging and upgrade hints for managed installs; no self-update download or binary replacement behavior changes beyond correct manager detection.
Overview
Self-update managed-install detection now recognizes Bun installs (global store, project with bun.lock/bun.lockb or node_modules/.bun, and bunx cache dirs) instead of labeling them npm and suggesting npm commands that don't work or corrupt lockfiles.
node_manager in update/channel.rs gains Bun / Bunx with path heuristics (store components beat stale lockfiles; pnpm lock still wins when no store names the manager). Refusal messages use managed by bun and hints like bun add -g …, bun add …, or bunx …@latest. CLI_CONTRACT.md documents the Bun row; unit and e2e tests cover global, project, and bunx cases.
Reviewed by Cursor Bugbot for commit 26461c3. 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
`socket-patch --update` on a copy installed with Bun said it was "managed by npm" and suggested an npm command. For a `bun add -g` install that command is a no-op, and in a Bun project `npm install` writes a stray package-lock.json and breaks the next `bun install --frozen-lockfile`. The passive update notice showed the same wrong hint. Bun installs are now labelled "bun" and told to run: - `bun add -g @socketsecurity/socket-patch@latest` for Bun's global store (`$BUN_INSTALL/install/global`), - `bun add @socketsecurity/socket-patch@latest` in a project with bun.lock / bun.lockb or Bun's isolated `node_modules/.bun` store, - `bunx @socketsecurity/socket-patch@latest …` for bunx's cache dir. Fixes #1621 Assisted-by: Claude Code:claude-opus-5-5
A bunx cache dir is now recognized by its name even when it holds no package.json (which would otherwise read as a global prefix and get `bun add -g`). A project-only `bunx-...` name no longer matches: the uid part must be numeric, as bunx writes it. A `.bun` or `.pnpm` store in the binary's path now outranks a lockfile left beside the project, so a project that moved from pnpm to Bun and still has pnpm-lock.yaml is told to use Bun. Refs #1621 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 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 26461c3. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review (burn-down agent).
Slack announcement could not be sent this run (no Slack send tool available); the next run will retry. 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.
The merge queue dropped this PR because
`pipenv::pipenv_pylock_projects_wire_what_pipenv_installs` failed in the
e2e_vex_build pipenv leg. uv 0.13.2+ refuses the `environments = []`
pylock that Pipenv 2026.8.0 writes ("The target environment is not
supported by the lockfile"), and setup-uv without `version:` installs
the newest uv. main's nightly is red for the same reason.
This is the same pin #1639 adds to ci.yml and pipenv-compatibility.yml.
It changes nothing once #1639 lands.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016akFSbKa8ztJC4jji31cAn
|
The merge queue dropped this PR (CI_FAILURE) because a check failed that has nothing to do with this PR's code.
The PR needs to be added back to the merge queue once CI is green on Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Wenxin Jiang (@Wenxin-Jiang) this changed after your approval (on Besides merges from main, the only new commit is 251cd21: the CI-only uv pin from #1639 ( If that's fine with you, re-approving 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 an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
socket-patch --update on a Bun-installed copy says "managed by npm" and gives an npm command: npm update -g leaves a bun add -g install stale, and npm install …@latest in a Bun project breaks bun install --frozen-lockfile
There was an error while loading. Please reload this page.