Skip to content

Commit 8d503e2

Browse files
committed
bun: run 51 ledger
1 parent 8b9b420 commit 8d503e2

3 files changed

Lines changed: 42 additions & 16 deletions

File tree

‎entries/bun/20261128T095053Z.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[agent] 2026-11-28: Bun bug-hunt run
2+
3+
Run 51. Main `cfc870f` (unchanged), latest release v5.1.0, Bun 1.4.5 (newest; canary 1.4.5-canary.20261127.1), plus 1.1.39 / 1.2.23 / 1.3.4 / 1.3.10 / 1.3.14 / 1.4.0 / 1.4.2 / 1.4.3 / 1.4.4 for the trust boundary. Linux only. Worked the pre-5.1 backlog rows on main.
4+
5+
**Filed**
6+
- #2335 (https://github.com/SocketDev/socket-patch/issues/2335): on Bun 1.4.x, a hosted or vendored rewire blocks the install scripts of an npm-alias dependency (`"u8v": "npm:utf-8-validate@6.0.5"`) that is trusted by its real name (`trustedDependencies: ["utf-8-validate"]`). After the rewire, a frozen install prints `Blocked 1 postinstall` and still exits 0, and socket-patch gives no warning. Bun matches trust by the alias key for URL and tarball resolutions. Affects `bun.lockb` from 1.4.0 and `bun.lock` from 1.4.4. On 1.4.3 and earlier, `bun.lock` is fine and `bun.lockb` already blocks before the rewire. v5.1.0 behaves the same, so it isn't a socket-patch regression. The `redirect_bun_default_trust_skipped` remedy (add the real name) leads into it. Suspect: `loses_default_trust`, `vendor/bun_lock_text.rs:93`.
7+
8+
**Re-triage**
9+
- #2279 (open, claimed): main is unchanged, so not re-tested.
10+
11+
**Cells (Bun 1.4.5 unless noted; pass unless noted)**
12+
- Agent → hosted takeover, `bun.lock` v2 and `bun.lockb` (also lockb on 1.2.23): frozen fresh install is patched; `vex` attests from the leftover agent manifest. Rollback restores text byte-exact and drops the manifest. The lockb rollback refuses (documented) after clearing the manifest.
13+
- Superseding uuid, hosted and vendored, text and lockb: the "newer patch" pin moves. Vendored replaces the old `<uuid>` dir. A frozen fresh install, and a plain `bun install` on a live tree, get the new bytes. `vex` and `vendor --check` pass. Text rollback is byte-exact.
14+
- `scan --mode vendored --prune` after `bun remove`, text and lockb: reverts one entry and removes its dir. A frozen fresh install works. `scan --sync` (agent) prunes the manifest entry and blob.
15+
- Workspaces with `catalog:` / `catalog:k`, a `!packages/ignored` negation and a `.tools/*` dot-dir member, text and lockb, all three modes: patched, `vex` passes, a plain install makes no changes. `vendor --revert` and text rollback are byte-exact; lockb rollback refuses (documented).
16+
- `globalStore = true` + isolated: agent refuses with a clear remedy, and the remedy works. Hosted and vendored entries get their own cache links, and the shared registry entry stays unpatched.
17+
- `bun patch` interplay: a URL-keyed user patch survives a superseding hosted re-run and a vendored takeover (skipped with the `--allow-patch-conflicts` note). `vex` omits it (`vex_npm_patched_dependency`). Rollback warns that the patch is dropped (frozen install exit 0, as documented). A registry-keyed `bun patch` on lockb is skipped, and the other package is rewired.
18+
- Default trust: an aliased default-trusted package is skipped (hosted) or refused (vendored, `partialFailure`). An unaliased package with an explicit `trustedDependencies` keeps its scripts after the rewire. The aliased case fails, filed as #2335.
19+
- `.gitignore` covering `*.tgz`: vendored artifacts are still committed (via the per-dir `.gitignore`). `.socket/` or `vendor/` rules: a clear refusal and nothing written.
20+
21+
**Ruled out**
22+
- Hosted-only `vex` "No applied patches with vulnerability metadata": my mock lacked the public `/patch/view/<uuid>` route. The same applies to agent rollback needing `/patch/blob/<hash>`. Method note added to the state file.

‎known-non-bugs/bun.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ Documented limitations and verified false positives. One bullet each. Search thi
107107
- With pins on the patch mirror, `vex` / `list` / `rollback` run *without* `SOCKET_PATCH_MIRROR_URL` see no hosted pins (`No patches in this project` / `manifest_not_found`). Documented: "Without the setting those references are on a host the run was not given and are not hosted pins" (CLI_CONTRACT "Patch mirror", run 49).
108108
- Mock fixture (run 49): the patch `view` must list `files` with before/after hashes, or `vex` omits the package (`no_files`) and reports "No applied patches with vulnerability metadata".
109109
- A hosted → vendored takeover where one pin cannot re-resolve upstream (registry 404) fails that purl with `redirect_revert_failed` and the rollback remedy (`git checkout -- bun.lock[b]`, `bun install --force`), while the other purls in the same run are vendored. Following it literally un-wires those, but leaves a safe state (still hosted + patched, `vendor --check` says re-run) and the re-run converges. Same on text and lockb (run 50).
110+
- (2026-11-28) A `bun patch`ed package is now skipped by both a vendored dry run and a wet run, with the "covered by this project's own patches … --allow-patch-conflicts" note and exit 0. The older dry-run/wet mismatch (`would_vendor` vs `vendor_lock_entry_unsupported`) applies only with `--allow-patch-conflicts`.
111+
- (2026-11-28) With `globalStore = true`, a hosted or vendored pin gets its own `<cache>/links/<name>@<url|path>+…` entry; the shared `name@version-<hash>` entry other projects use stays unpatched. A stale `node_modules/.bun/<name>@<version>` link can remain beside the new one after a reinstall, which is Bun behaviour.

‎state/bun.md‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[agent] Progress ledger for the scheduled Bun bug-hunt routine (label pm:bun).
22

3-
Last run: 2026-11-27 (run 50), main `cfc870f`, latest release v5.1.0, newest Bun 1.4.5 (canary 1.4.5-canary.20261126.1).
3+
Last run: 2026-11-28 (run 51), main `cfc870f`, latest release v5.1.0, newest Bun 1.4.5 (canary 1.4.5-canary.20261127.1).
44

55
The per-run narrative (runs 1–48) and the old per-version matrices are in the branch history (`git log -p -- state/bun.md`) and in `entries/bun/`.
66

77
## Method (Linux sandbox)
88

99
- `unset BUN_OPTIONS` (the sandbox exports `--smol`). Bun binaries: `npm i --no-save --ignore-scripts @oven/bun-linux-x64@<v>` in a scratch dir. On Bun ≥ 1.2, `bunfig [install] saveTextLockfile = false` writes `bun.lockb`; Bun 1.1.x writes `bun.lockb` only.
10-
- The patch API is mocked locally (patch.socket.dev and patches-api are blocked). Use the authenticated routes: `--api-url http://127.0.0.1:A --org o --api-token fake`, serving `POST /v0/orgs/o/patches/batch` (answer only for the requested purls), `GET …/by-package/<purl>`, `POST …/package` (grants: `{"results":{uuid:{"status":"granted","url","purl","artifacts":[{"kind":"tarball","url","integrity":{"sha512":"sha512-…"}}]}}}`), `GET …/view/<uuid>` (with `files` before/after git-sha256 + blob contents) and the tarball at `/patch/npm/<name>/<ver>/<tok>/<uuid>/<name>-<ver>.tgz`. Set `SOCKET_PATCH_SERVER_URL`, `SOCKET_PROXY_URL` and `SOCKET_VENDOR_URL` to the mock's origin. Hosted rollback needs `SOCKET_NPM_REGISTRY` if the CLI can't reach npmjs. A ~100-line Python `http.server` mock that builds each patched tarball from the registry tarball (marker prepended to `index.js`) covers all three modes; agent mode needs `blobContent` (base64) in `view`.
10+
- The patch API is mocked locally (patch.socket.dev and patches-api are blocked). Use the authenticated routes: `--api-url http://127.0.0.1:A --org o --api-token fake`, serving `POST /v0/orgs/o/patches/batch` (answer only for the requested purls), `GET …/by-package/<purl>`, `POST …/package` (grants: `{"results":{uuid:{"status":"granted","url","purl","artifacts":[{"kind":"tarball","url","integrity":{"sha512":"sha512-…"}}]}}}`), `GET …/view/<uuid>` (with `files` before/after git-sha256 + blob contents) and the tarball at `/patch/npm/<name>/<ver>/<tok>/<uuid>/<name>-<ver>.tgz`. Set `SOCKET_PATCH_SERVER_URL`, `SOCKET_PROXY_URL` and `SOCKET_VENDOR_URL` to the mock's origin. Hosted rollback needs `SOCKET_NPM_REGISTRY` if the CLI can't reach npmjs. A ~100-line Python `http.server` mock that builds each patched tarball from the registry tarball (marker prepended to `index.js`) covers all three modes; agent mode needs `blobContent` (base64) in `view`. Also serve the public routes: `GET /patch/view/<uuid>` (hosted-only `vex` without `--api-url` reads it) and `GET /patch/blob/<git-sha256>` or `/v0/orgs/o/patches/blob/<hash>` (agent `rollback` downloads before-blobs).
1111
- The repo's real-Bun e2e suites run with `PATH=<bun dir>:$PATH SOCKET_PATCH_BUN_E2E_REQUIRED=1 SOCKET_PATCH_BUN_E2E_VERSION=<v> SOCKET_PATCH_BUN_LOCKB_REQUIRED=1 cargo test --release -p socket-patch-cli --test …`.
1212
- Patch mirror: a second port serving the same tarball paths under `/artifactory/socket-patch` (HEAD and GET). Pass `--patch-mirror-url http://127.0.0.1:B/artifactory/socket-patch`, or set `SOCKET_PATCH_MIRROR_URL` for later commands.
1313
- Oracle: a fresh-checkout `bun install --frozen-lockfile` with an empty `BUN_INSTALL_CACHE_DIR`, then the marker bytes in `node_modules`, the mock's request log (which host served the tarball), byte compares of the lock, and `vex -O`. Test repos need `node_modules/` in `.gitignore`.
@@ -22,33 +22,35 @@ Release focus: a cell last passed before 2026-11-11 counts as untested until it'
2222
| Repo real-Bun e2e suites (redirect, vendor, lockb, mode migration, takeover, eject: 101 tests) | pass 1.1.39 / 1.2.23 / 1.3.9 / 1.3.10 / 1.4.5 (2026-11-27) | | |
2323
| Common path, single project, `bun.lock` v0/v1/v2 (scan → frozen fresh install → `vex` → rollback → install) | pass 1.1.39 v0 / 1.2.23 v1 / 1.3.10 v1 / 1.4.5 v2 (2026-11-27) | pass same (2026-11-27) | pass same, rollback byte-exact (2026-11-27) |
2424
| Common path, single project, `bun.lockb` (1.1.39 → 1.4.5) | pass 1.1.39 / 1.2.23 / 1.3.10 / 1.4.5 (2026-11-27) | pass same, revert byte-exact (2026-11-27) | pass same; rollback refuses (documented) (2026-11-27) |
25-
| Workspaces (text v0/v1/v2 + lockb, hoisted + isolated) | pass 1.1.39 / 1.2.23 / 1.3.10 / 1.4.5 (2026-11-27) | pass lockb all four + text v2 1.4.5; text v0/v1 refused `vendor_bun_workspace_unsupported` (documented); lockb on 1.2.23/1.3.10 survives unfrozen install + member `bun add` (2026-11-27) | pass v1/v2 + lockb; v0 refused `redirect_bun_workspace_unsupported` (documented) (2026-11-27). Catalogs, `!` / dot-dir patterns pre-5.1 |
26-
| Takeovers (agent → hosted, hosted ⇄ vendored, partial #1039, superseding uuid) | pre-5.1 | hosted → vendored full + partial (one registry doc 404) text + lockb 1.4.5 pass; the remedy is roundabout but safe (known-non-bugs) (2026-11-27) | vendored → hosted with mirror, text + lockb 1.4.5 pass (2026-11-27); superseding uuid pre-5.1 |
27-
| Unwinds (rollback / remove / `vendor --revert` / `scan --prune` / `repair`) | rollback + `remove <purl>` pass 1.4.5 text + lockb ws (2026-11-27) | `vendor --revert` byte-exact, `repair` re-downloads a deleted tarball, `vendor --check` pass 1.4.5 text + lockb ws (2026-11-27) | rollback pass text (all versions); `scan --prune` pre-5.1 |
25+
| Workspaces (text v0/v1/v2 + lockb, hoisted + isolated) | pass 1.1.39 / 1.2.23 / 1.3.10 / 1.4.5 (2026-11-27) | pass lockb all four + text v2 1.4.5; text v0/v1 refused `vendor_bun_workspace_unsupported` (documented); lockb on 1.2.23/1.3.10 survives unfrozen install + member `bun add` (2026-11-27) | pass v1/v2 + lockb; v0 refused `redirect_bun_workspace_unsupported` (documented) (2026-11-27). Catalogs (`catalog:` / named), `!` negation, dot-dir members: pass all three modes, text + lockb 1.4.5 (2026-11-28) |
26+
| Takeovers (agent → hosted, hosted ⇄ vendored, partial #1039, superseding uuid) | agent → hosted pass text + lockb 1.4.5, lockb 1.2.23 (2026-11-28) | hosted → vendored full + partial pass text + lockb 1.4.5 (2026-11-27); superseding uuid pass text + lockb 1.4.5, live-tree `bun install` picks it up (2026-11-28) | vendored → hosted with mirror pass (2026-11-27); superseding uuid pass text + lockb 1.4.5 (2026-11-28) |
27+
| Unwinds (rollback / remove / `vendor --revert` / `scan --prune` / `repair`) | rollback + `remove <purl>` pass 1.4.5 text + lockb ws (2026-11-27) | `vendor --revert` byte-exact, `repair` re-downloads a deleted tarball, `vendor --check` pass 1.4.5 text + lockb ws (2026-11-27) | rollback pass text (all versions); `scan --prune` n/a (`redirect_prune_ignored`). Vendored `--prune` after `bun remove` pass text + lockb; agent `--sync` prunes (1.4.5, 2026-11-28) |
2828
| `vex` (isolated linker, lockfile-only, workspaces) | pass all common-path cells (2026-11-27) | pass all common-path cells (2026-11-27) | pass all common-path cells + mirror ws (2026-11-27); refuses on an unreinstalled live tree with a clear message |
2929
| sha512 boundary (1.3.9 digest-less 2-tuple heal vs 1.3.10) | n/a | pass 1.3.9 `bun add` drop → re-run re-pins on disk (2026-11-27) | pass 1.3.9 heal on a mirror URL, install from mirror (2026-11-27) |
3030
| `--frozen-lockfile` / `bun ci` / `--filter` after rewiring | n/a | pre-5.1 | pass 1.4.4 single + mirror (2026-11-26) |
3131
| Patch mirror (experimental, #2180): fresh pin | n/a | n/a | pass 1.4.5 text v2 + lockb, single + ws hoisted/isolated, 1.3.10 text v1 ws; trailing-slash base; 404 mirror → `redirect_mirror_unavailable`, nothing written (2026-11-27) |
3232
| Patch mirror: project already pinned on the patch server | n/a | n/a | fail #2279 (lockb: no `redirect_mirror_pin_not_moved`; false `redirect_bun_non_registry_entry_skipped`). Reverse case (mirror pin, run without the setting): text gives `redirect_pin_on_unconfigured_host`; lockb gives the false warning instead, added to #2279 (2026-11-27) |
3333
| npm-style `bin` CRLF shebang rewrite (#1756, Bun does it too) | pass hoisted + isolated: apply, bin runs, `vex`, rollback keeps LF (1.4.4, 2026-11-26) | untested | untested |
34-
| `globalStore` (Bun ≥ 1.3.14) | refuses (#635 fixed), pre-5.1 | pre-5.1 | pre-5.1 |
34+
| `globalStore` (Bun ≥ 1.3.14) | refuses with a working remedy (1.4.5, 2026-11-28) | pass, private cache link (1.4.5, 2026-11-28) | pass, shared registry entry untouched (1.4.5, 2026-11-28) |
3535
| Global `-g` | pre-5.1 (run 3) | n/a | pre-5.1 |
36-
| `bun patch` interplay (#367 / #1019) | n/a | pre-5.1 | pre-5.1 |
37-
| Lifecycle scripts / `trustedDependencies` / default trust | n/a | pre-5.1 | pre-5.1 |
38-
| `.gitignore` / LFS on vendored artifacts | n/a | pre-5.1 | n/a |
36+
| `bun patch` interplay (#367 / #1019) | n/a | URL-keyed user patch skipped on takeover, rollback warns dropped (1.4.5, 2026-11-28) | URL-keyed survives superseding; registry-keyed lockb skipped (1.4.5, 2026-11-28) |
37+
| Lifecycle scripts / `trustedDependencies` / default trust | n/a | default-trust refusal incl. alias pass; explicit trust by real name on an npm alias: fail #2335 (1.4.0+ lockb, 1.4.4+ text) (2026-11-28) | same: skip pass, alias trust fail #2335 (2026-11-28) |
38+
| `.gitignore` / LFS on vendored artifacts | n/a | `*.tgz` rule: still committed; `.socket/` / `vendor/` rules: clear refusal, nothing written (1.4.5, 2026-11-28). LFS pre-5.1 | n/a |
3939
| Self-update of a Bun-installed CLI (#1621) | pre-5.1 | — | — |
4040
| Canary lock bytes vs stable | 1.4.5 = 1.4.4 for text + lockb (2026-11-26) | | |
4141
| macOS / Windows | untested on main: probe workflows are off, Linux only | | |
4242

4343
## Backlog
4444

45-
1. Remaining pre-5.1 rows: agent → hosted takeover, superseding uuid (hosted and vendored), `scan --prune`, catalogs / `!` / dot-dir workspace patterns, `globalStore`, global `-g`, `bun patch` interplay, lifecycle / `trustedDependencies`, `.gitignore` / LFS, self-update. Re-run on main, oldest first.
46-
2. #2279: re-test when fixed (text + lockb, both directions: patch-server pin under a mirror run, mirror pin under a run without the setting; remedy text on lockb; `vex` count).
47-
3. Patch mirror: HEAD answering 401 / 403 (`redirect_mirror_unverified`) and a timeout (needs a mock that answers those); a superseding uuid on a pin already on the mirror.
48-
4. Spot-check the closed Bun issues on main: #1631 (dot-dir workspaces), #1621 (self-update), #1600 (`vendor --check` reason for git / `file:` copies), #1581 (LFS `repair`), #1084 (isolated orphan).
49-
5. `bin` CRLF shebang (#1756) in vendored and hosted modes (`vendor --check`, hosted `vex`) on Bun.
50-
6. Each new Bun release or canary: compare its text and lockb bytes with the latest stable.
51-
7. macOS / Windows (path quoting, junctions, `bun.cmd`): can't be probed now. Note likely platform differences in issues.
45+
1. #2335: re-test when fixed (alias trusted by real name, hosted + vendored, text 1.4.4+ / lockb 1.4.0+; also the reverse, trusted by alias name only, where a rewire newly runs the scripts; and the default-trust skip remedy for an alias).
46+
2. #2279: re-test when fixed (text + lockb, both directions; remedy text on lockb; `vex` count).
47+
3. Remaining pre-5.1 rows: global `-g`, self-update (#1621), `.gitignore` + LFS `repair` (#1581), `--frozen-lockfile` / `bun ci` / `--filter` in vendored mode. Re-run on main.
48+
4. Other alias shapes on Bun 1.4: an aliased package hosted / vendored in workspaces, aliased `bun patch` keys, `vex` / rollback on an alias pin.
49+
5. Patch mirror: HEAD answering 401 / 403 (`redirect_mirror_unverified`) and a timeout; a superseding uuid on a pin already on the mirror.
50+
6. Spot-check the closed Bun issues on main: #1631 (dot-dir workspaces, partly re-covered 2026-11-28), #1600 (`vendor --check` reason for git / `file:` copies), #1084 (isolated orphan).
51+
7. `bin` CRLF shebang (#1756) in vendored and hosted modes on Bun.
52+
8. Each new Bun release or canary: compare its text and lockb bytes with the latest stable.
53+
9. macOS / Windows (path quoting, junctions, `bun.cmd`): can't be probed now. Note likely platform differences in issues.
5254

5355
## Known non-bugs
5456

0 commit comments

Comments
 (0)