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 rewiring dropping the project's bun patch (#367) by mikolalysenko · Pull Request #873 · SocketDev/socket-patch Conversation
|
| Issue / path | Regression test | Without fix | With fix |
|---|---|---|---|
#367 hosted bun.lock (manifest key, lock mirror, both; other-version key does not gate) |
patch::redirect::tests::bun_lock_user_patched_dependency_is_left_alone_loudly |
FAILED | ok |
#367 hosted bun.lockb (engine reads manifest, skips + warns + no VEX assume) |
hosted::engine::tests::issue_367_bun_lockb_keeps_a_user_patched_package_on_the_registry |
FAILED | ok |
#367 vendored bun.lock (loop + download preflight agree, nothing written) |
vendor::bun_lock::tests::user_bun_patch_refuses_before_any_write |
FAILED | ok |
#367 vendored bun.lockb |
vendor::bun_lock::tests::binary_user_bun_patch_refuses_before_any_write |
FAILED | ok |
| key reader | vendor::bun_lock_text::tests::patched_dependency_keys_read_manifest_and_lock |
n/a | ok |
For the red runs I made patched_dependency_key always return None: all 4 regression tests failed, and they pass with the real matcher.
Real Bun 1.3.14 check: bun patch --commit writes exactly the keys and mirror the reader parses, scoped included ("@types/[email protected]": "patches/@types%[email protected]" under "patchedDependencies": { in bun.lock).
Commands run locally:
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --all-features --lib: 5055 passed, 4 failed. The 4 failures (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_rolls_back_…) are chmod-based tests that can't fail as uid 0 in this sandbox. They are in untouched modules and run as non-root in CI.SOCKET_PATCH_BUN_E2E_REQUIRED=1 cargo test -p socket-patch-cli --all-features --test e2e_redirect_bun_build --test e2e_vendor_bun_build --test mode_migration_bun -- --include-ignored with real Bun 1.3.14: 16 + 14 + 14 passed.cargo test -p socket-patch-cli --all-features --test e2e_bun_lockb --test in_process_vendor_bun_takeover --test vendor_eject_bun_lockb -- --include-ignored: 13 + 22 + 5 passed.cargo fmt: the new hunks are rustfmt-clean. The repo isn't fmt-clean on main (130 files) and CI has no fmt step, so I didn't reformat untouched code.package.json beside either Bun lock. Before, a text bun.lock reached the manifest only through a parseable workspaces section.RewriteResult::refused_bun_uuids and is never confirmed, even when a sibling package-lock.json takes the hosted URL.hosted::engine::tests::issue_367_bun_lock_user_patched_package_is_never_confirmed: fails at the manifest-read assertion without the first fix, and at confirmed.is_empty() without the second. Passes with both. 129 Bun-area core tests pass, and clippy -D warnings is clean.The new refused_bun_uuids set is skipped during serialization when empty, like the other per-ecosystem uuid sets, so the hashed rewrite goldens don't change.
main to clear a conflict that was only in two re-blessed goldens. Main's versions pass with this branch: 48/48 equivalence tests.main is red on coverage (utils::digest::tests::production_digests_go_through_the_helpers flags three Gradle files). I ported Route Gradle digests through utils::digest #878's fix (659ac2c → e5dfad6); it becomes a no-op once Route Gradle digests through utils::digest #878 lands.coverage, clippy and test (macOS, Windows) were green. Six Ubuntu Bun-compat cells failed with HTTP Error 503 from the patch service, all inside one 40 s window (18:55:41–18:56:20). Every cell that started after it passed, including 1.1.43 and 1.1.45 on the same lock formats. The CodeQL Analyze (rust) runner received a shutdown signal. The next push re-runs both.patchedDependencies reader now accepts a JSONC package.json (comments, trailing commas), as Bun does. Before, it found no keys there, which mattered most for bun.lockb projects that have no lock mirror. The JSONC case in patched_dependency_keys_read_manifest_and_lock fails with the fallback disabled and passes with it.utils::serde::strip_bom. The BOM case in the same test fails without the strip.Wrappers under npm/, pypi/ and gem/ only dispatch to the binary, so they need no change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UMfrUU5yGZgTxSnrSsKLoL
Note
Medium Risk
Changes Bun lock rewrite and vendored preflight semantics plus VEX confirmation rules; behavior is fail-closed (skip/refuse with warnings) but affects which deps are considered patched.
Overview
Fixes #367: dependencies the project patches via bun patch (patchedDependencies in root package.json and/or mirrored in bun.lock) are no longer silently rewired to hosted URLs or vendored tarballs, which made Bun stop applying the user's patch on every install.
Hosted mode detects those keys (including JSONC manifests and bare-name keys), leaves the lock entry on its registry tuple, emits redirect_bun_patched_dependency_skipped, and tracks uuids in refused_bun_uuids so in-run VEX and sibling-lock confirmation never treat them as patched. bun.lockb-only projects now read root package.json for this gate; text bun.lock uses the same skip path via skip_bun_user_patched.
Vendored mode refuses the package at preflight with vendor_lock_entry_unsupported before any write or download (text and binary locks).
Docs add the warning code to CLI_CONTRACT.md and a compatibility row in docs/testing/bun-compatibility.md. A small refactor routes Gradle/JVM SHA-1/SHA-256 hashing through utils::digest helpers (aligned with coverage expectations on main).
Reviewed by Cursor Bugbot for commit 21da460. 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
Bun applies a patch from `bun patch` (package.json patchedDependencies, mirrored in bun.lock) only while the lock resolves the package to its registry name@version. Hosted and vendored mode moved that entry to a hosted URL or a vendored tarball, so every later install silently dropped the user's own patch while socket-patch reported success. Hosted mode now leaves such a package on its registry entry in both bun.lock and bun.lockb, warns redirect_bun_patched_dependency_skipped naming the key, and keeps the in-run VEX from assuming the Socket patch applied. Vendored mode refuses it with vendor_lock_entry_unsupported before any write or download. Other packages in the lock are still rewired. Fixes #367 Assisted-by: Claude Code:claude-opus-5-5
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.
There was an error while loading. Please reload this page.
Bugbot review of #873 found two gaps in the bun patch guard. A text bun.lock only reached the root package.json through its workspaces section, so a lock without one never saw the patchedDependencies keys and rewired the package anyway. The manifest is now read beside either Bun lock. A package left on the registry could still be counted as switched when a sibling package-lock.json took the hosted URL, although Bun keeps installing the registry bytes. Such uuids are now recorded as refused and never confirmed. Refs #367 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.
The refused-Bun uuid set added to RewriteResult changed the serialized and Debug output that the redirect equivalence goldens hash. The set is now left out of serialization when empty, like the other per-ecosystem uuid sets, and the two goldens that hash the Debug output (poetry, pdm) are re-blessed. Only their output digests change; every case and input digest is identical. Refs #367 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.
…-dependencies-gate # Conflicts: # crates/socket-patch-core/tests/equivalence/pdm_rewrite_shared_parse.golden # crates/socket-patch-core/tests/equivalence/poetry_rewrite.golden
main has failed socket-patch-core's lib tests since Gradle support (#646) and the digest helpers (#865) both landed. The guard test production_digests_go_through_the_helpers flags three files #646 added that still hash inline: crawlers/gradle_cache.rs, patch/jvm_jar.rs and patch/sidecars/maven.rs. That breaks test, test-release and coverage on every open PR. Each inline sha1/sha256 call now goes through sha1_hex_of or sha256_hex_of, which compute the same lowercase hex. Behaviour is unchanged. Assisted-by: Claude Code:claude-opus-5-5 (cherry picked from commit 659ac2c)
|
[agent] Merged
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 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.
Bun accepts comments and trailing commas in package.json. The patchedDependencies reader parsed it as strict JSON, so such a manifest yielded no keys. A bun.lockb project has no text mirror to fall back on, so the project's own bun patch could still be rewired away. The reader now strips JSONC comments and trailing commas before parsing, leaving string contents untouched. Refs #367 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 Windows-saved package.json can start with a UTF-8 byte order mark, which Bun ignores but serde_json rejects. The reader found no patchedDependencies keys in such a manifest, so a bun.lockb project could still lose its own bun patch. The mark is now stripped first, as the crate's other manifest readers do. Refs #367 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 21da460. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] CI on 21da460 lost runners across the board: about 60 jobs were cancelled at once (install-proof, build, composer, go, CodeQL and others), and none of them reported a test failure. I re-ran the failed jobs on the four runs that have finished (Audit GHA Workflows, npm hosted/vendored, Benchmarks, pnpm hosted). I'll re-run the rest, including Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] Status on 21da460: every non-green job is a cancellation, and none of them reported a test failure. The jobs waited about 16 minutes without being assigned a runner, then were cancelled with no steps run. The one exception is
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review at
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.
Hosted and vendored Bun rewiring silently discards the project's ownbun patch (patchedDependencies): fresh frozen installs drop the user's patch with exit 0
There was an error while loading. Please reload this page.