Skip to content

Commit bc9c9be

Browse files
committed
Restore per-caller bun.lockb rollback status
The shared bun.lockb rollback helper expected status "error" for every caller, so the hosted -> vendored -> hosted takeover leg went red: there a manifest record makes the agent leg report the copy already original, and the run is correctly a partial_failure. A branch rewrite had dropped the earlier fix for this. Each caller now states which outcome it expects, so the takeover leg checks partial_failure and the hosted-only alias/transitive shapes keep checking rollback_failed. Assisted-by: Claude Code:claude-opus-5-5
1 parent 1e69b30 commit bc9c9be

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

‎crates/socket-patch-cli/tests/e2e_bun_lockb.rs‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,30 @@ fn cli_code(project: &Path, args: &[&str]) -> (i32, Value) {
122122
/// `rollback` REFUSES the pin, naming the checkout remedy, and leaves the
123123
/// lock exactly as found; the test then applies that remedy (`git checkout --
124124
/// bun.lockb`, here: the original bytes written back).
125-
fn rollback_refuses_binary_hosted_pin_then_checkout(fixture: &Fixture, server: &MockServer) {
125+
fn rollback_refuses_binary_hosted_pin_then_checkout(
126+
fixture: &Fixture,
127+
server: &MockServer,
128+
copy_already_original: bool,
129+
) {
126130
let hosted_lock = fixture.lock();
127131
let uri = server.uri();
128132
let (code, env) = cli_code(
129133
&fixture.project,
130134
&["rollback", "--yes", "--patch-server-url", &uri],
131135
);
132136
assert_eq!(code, 1, "a binary hosted pin cannot be restored: {env}");
133-
// The refused pin is the run's only outcome: a total failure (#1066).
134-
assert_eq!(env["status"], "error", "{env}");
135-
assert_eq!(env["error"]["code"], "rollback_failed", "{env}");
137+
// The refused pin counts as a failure (#1066). After a takeover a
138+
// manifest record makes the agent leg find the installed copy already
139+
// original, so the run is a partial failure; a hosted-only project has
140+
// no other outcome, so the run failed as a whole (`rollback_failed`).
141+
if copy_already_original {
142+
assert_eq!(env["status"], "partial_failure", "{env}");
143+
assert_eq!(env["alreadyOriginal"], 1, "{env}");
144+
} else {
145+
assert_eq!(env["status"], "error", "{env}");
146+
assert_eq!(env["error"]["code"], "rollback_failed", "{env}");
147+
assert_eq!(env["alreadyOriginal"], 0, "{env}");
148+
}
136149
assert_eq!(env["failed"], 1, "{env}");
137150
let failed = env["hosted"]["failed"]
138151
.as_array()
@@ -1077,7 +1090,7 @@ async fn native_binary_hosted_vendored_takeover_roundtrip() {
10771090
);
10781091
fixture.frozen("hosted-again", &fixture.patched, "minimist");
10791092
fixture.manifestless_vex("hosted-again", bun_vex::BunMode::Hosted, &server.uri());
1080-
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server);
1093+
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server, true);
10811094
fixture.pristine();
10821095
fixture.frozen("rolled-back", &fixture.original, "minimist");
10831096
}
@@ -1187,7 +1200,7 @@ async fn binary_shared_bundled_record_hosted_pin_is_managed() {
11871200
hosted["redirect"]["redirected"], 1,
11881201
"hosted again: {hosted}"
11891202
);
1190-
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server);
1203+
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server, true);
11911204
assert_eq!(fixture.lock(), fixture.original_lock);
11921205
}
11931206

@@ -1294,7 +1307,7 @@ async fn native_binary_alias_and_transitive() {
12941307
bun_vex::BunMode::Hosted,
12951308
&server.uri(),
12961309
);
1297-
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server);
1310+
rollback_refuses_binary_hosted_pin_then_checkout(&fixture, &server, false);
12981311
fixture.pristine();
12991312
fixture.stage();
13001313
let result = cli(&fixture.project, &["vendor", "--offline"]);

0 commit comments

Comments
 (0)