Repository navigation
Fix Bun pins on the patch server under a patch mirror (#2279) - #2282
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Refs #2279. Assisted-by: Claude Code:claude-fable-5-2
A Bun project pinned on the patch server, then a hosted run with a patch mirror: the pin is called a user tarball that stays UNPATCHED, and for bun.lockb no redirect_mirror_pin_not_moved warning is given. Refs #2279. Assisted-by: Claude Code:claude-fable-5-2
A hosted run that writes a patch mirror met the pin an earlier run wrote on the patch server as a URL it does not own. Both Bun rewriters took it for a user's tarball: they warned that the copy stays UNPATCHED and kept the patch out of the in-run VEX. They now leave a URL in the patch server's path shape that names the patch's own uuid alone without that warning. The redirect_mirror_pin_not_moved lookup read the project's text files only, so it never saw a pin in a binary bun.lockb. The rewrite now reports the URLs the lock's records resolved from, and the warning reads them. rollback refuses a bun.lockb pin, so the remedy named for that file is the lock as it was before the pin. Fixes #2279. Assisted-by: Claude Code:claude-fable-5-2
Review of the first fix: recognising a patch-server pin inside the rewriters trusted any host, since they know no host but the one they write, and it hid a pin left beside a copy the run moved to the mirror. The rewriters now treat such an entry as before (a user's tarball, kept out of the in-run VEX) and record it. The scan, which knows the run's patch servers, retracts the user-tarball warning for a recorded pin on one of them and gives redirect_mirror_pin_not_moved in its place, also when another copy of the package was pinned on the mirror. A pin on a host the run does not know stays a user's tarball. Refs #2279. Assisted-by: Claude Code:claude-fable-5-2
The contract's table row said the patch is always skipped. For Bun the warning is also given when another copy was pinned on the mirror, and the run's own VEX then checks the installed copy. Refs #2279. Assisted-by: Claude Code:claude-fable-5-2
|
[agent] bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview Bun rewriters now record patch-shaped URL entries in Reviewed by Cursor Bugbot for commit 58de703. Configure here. |
|
bugbot run Generated by Claude Code |
LLM Description written by Claude Code:claude-fable-5-2
Fixes #2279
Summary
A Bun project that an earlier hosted run pinned directly on the patch server, in a run with
--patch-mirror-url:redirect_bun_non_registry_entry_skipped("installs … from a URL or local tarball … stays UNPATCHED; depend on the registry release"), which is false: that copy is the patched one. A binarybun.lockbgot noredirect_mirror_pin_not_movedat all, so the only guidance was the false warning.redirect_mirror_pin_not_movednames the file, the host and the mirror forbun.lockandbun.lockbalike. Forbun.lockb, whose pinrollbackrefuses, the remedy is to restore the lock as it was before the pin, notrollback <purl>.Nothing new is written to a lockfile: the pin is left as it is, as before. Only warnings change.
Root cause
The Bun rewriters own an earlier hosted pin only on the host they are writing (the mirror), so a patch-server pin fell through to the branch for a user's URL /
file:tarball. And theredirect_mirror_pin_not_movedlookup searched the project's text files, where a binarybun.lockbis not.The change
patch/redirect/mod.rs,patch/redirect/bun_binary.rs: the rewriters behave as before (the entry is left, the warning is raised, the patch is kept out of the in-run VEX's assumptions), and additionally record an entry whose URL is in the patch server's path shape for the uuid of the patch being pinned (RewriteResult::bun_patch_shaped_pins). They know no host but the one they write, so they cannot vouch for the URL's host themselves.commands/scan/hosted.rs(mirror_pins_not_moved): the scan knows the run's patch servers. For a recorded pin on one of them it retracts the user-tarball warning and givesredirect_mirror_pin_not_movedin its place, also when the run pinned another copy of the package on the mirror (the lock still fetches the first copy from the patch server). A recorded pin on any other host stays a user's tarball, exactly as onmain.CLI_CONTRACT.md: the patch mirror section and the two warning rows.The in-memory engine has no mirror setting and is unchanged: it never retracts.
Evidence
patch_mirror::a_bun_pin_on_the_patch_server_is_named_and_not_called_unpatchedbun.lockandbun.lockb, through the binary against two loopback servers:skipped/redirect_unconfirmed, the mirror warning with the right remedy per file, no UNPATCHED warning, lock bytes unchangedpatch_mirror::a_bun_pin_left_beside_a_copy_moved_to_the_mirror_is_namedpatch_mirror::a_bun_pin_on_a_host_the_run_does_not_know_stays_a_user_tarballredirect::tests::bun_lock_pin_of_the_same_patch_on_another_host_is_recorded,redirect::bun_binary::tests::a_pin_of_the_same_patch_on_another_host_is_recordedThe first commit adds the tests failing on
main(the CLI test at the UNPATCHED assertion); the later commits turn them green.Run locally (Linux, Bun 1.4.4):
cargo test -p socket-patch-core --lib: 8643 passed.cargo test -p socket-patch-cli --lib: 1076 passed.cargo test -p socket-patch-cli --test patch_mirror(8),e2e_bun_lockb(16),e2e_redirect_bun_build(8),mode_migration_bun(5),hosted_memory_parity(47): all passed.cargo test -p socket-patch-cli --test in_process_redirect: 135 passed, 3 failed (partial_lockfile_write_failure_exits_1_and_writes_no_ledger,redirect_json_mode_write_failures_emit_error_envelope,vlt::scan_redirect_vlt_heal_invalidation_failure_warns). They make a directory read-only and expect a write to fail; the sandbox runs as root, where it doesn't. They fail the same way without this change.cargo clippy --locked --workspace --all-features -- -D warnings(CI's command): clean. With--all-targetsthe pinned toolchain reports lints in test code this PR does not touch.Not run: a real
bun installagainst a mirror. No install behaviour changes; the lock bytes are asserted unchanged.Review findings not fixed here
/code-review highran twice. Its first pass found that recognising the pin inside the rewriters trusted any host and hid a pin left beside a moved copy; the design above is the answer to both. Left as they are, each narrower than this issue:bun patch, a default-trusted package, a grant without sha512) in abun.lockb: nothing is recorded, so the mirror warning is not given. The run's warning for that skip says why the package was not handled. A textbun.lockstill gets the mirror warning through the text lookup.--vexin the mixed case: when the run pins one copy on the mirror and leaves the earlier pin, the package is not assumed patched and is checked against the installed copy. Conservative on purpose; the contract now says so.--patch-server-urlorigin the grants do not name is not among them.Follow-ups
redirect_pin_on_unconfigured_host) reads text files only, so it does not see a pin inbun.lockbeither. Not part of this report.https://claude.ai/code/session_011f9aeP58fnWA8aUQYCinka
Generated by Claude Code