From 6286b0cc84f37ba320db3177fb37491820ca63c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 01:03:44 +0000 Subject: [PATCH] Serve the rollback blob from the bun.lockb mock The nightly e2e-extended leg (bun 1.4.2) failed on 2026-10-31 in binary_shared_bundled_record_hosted_pin_is_managed: rollback aborted with missing_blob instead of the expected partialFailure. In the `bundled` shape a never-patched minimist copy sits inside bparent/node_modules. Its bytes match neither patch hash, so the rollback missing-blob gate downloads the before-blob. That download goes through the patch API, which --patch-server-url does not redirect, so the test hit the live public proxy and passed or failed depending on whether it served minimist's original index.js blob. Point the helper's rollback at the mock API (--api-url/--api-token/ --org, like the vendor runs) and have the mock serve the original blob. The test no longer touches the network here and fails 0/10 locally, where it failed 12/12 before. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_011f9aeTDP8aDQggoVbvbiTk --- .../socket-patch-cli/tests/e2e_bun_lockb.rs | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/crates/socket-patch-cli/tests/e2e_bun_lockb.rs b/crates/socket-patch-cli/tests/e2e_bun_lockb.rs index 53d776b26..d1f878018 100644 --- a/crates/socket-patch-cli/tests/e2e_bun_lockb.rs +++ b/crates/socket-patch-cli/tests/e2e_bun_lockb.rs @@ -144,9 +144,24 @@ fn rollback_refuses_binary_hosted_pin_then_checkout( ) { let hosted_lock = fixture.lock(); let uri = server.uri(); + // `--api-url`: the agent leg downloads before-blobs through the patch + // API, which `--patch-server-url` does not redirect; without it the + // run reached the live public proxy and the outcome depended on + // whether that served minimist's original `index.js` blob. let (code, env) = cli_code( &fixture.project, - &["rollback", "--yes", "--patch-server-url", &uri], + &[ + "rollback", + "--yes", + "--api-url", + &uri, + "--api-token", + "fake", + "--org", + ORG, + "--patch-server-url", + &uri, + ], ); assert_eq!(code, 1, "a binary hosted pin cannot be restored: {env}"); // The refused pin counts as a failure (#1066). After a takeover a @@ -874,6 +889,21 @@ async fn mock_api_patch(server: &MockServer, fixture: &Fixture, uuid: &str, patc ) .mount(server) .await; + // The original `index.js` blob. `rollback`'s missing-blob gate + // downloads it when an installed copy matches neither patch hash (the + // `bundled` shape's untouched nested minimist); see + // `rollback_refuses_binary_hosted_pin_then_checkout`. + Mock::given(method("GET")) + .and(path(format!( + "/v0/orgs/{ORG}/patches/blob/{}", + compute_git_sha256_from_bytes(&fixture.original) + ))) + .respond_with( + ResponseTemplate::new(200) + .set_body_raw(fixture.original.clone(), "application/octet-stream"), + ) + .mount(server) + .await; Mock::given(method("GET")) .and(path_regex(format!("^/patch/npm/{name}/.*$"))) .respond_with(ResponseTemplate::new(200).set_body_raw(tgz, "application/octet-stream"))