Skip to content

Commit 7a5cee3

Browse files
test(server): slow pull and pull request refresh checkouts outlast 30 seconds
Failing tests for #34985: pullCurrentBranch and refreshCheckedOutBranch kill git at the 30-second default mid-checkout, leaving a half-updated working tree. AI-assisted; verified with the tests and tools listed above.
1 parent b68aedf commit 7a5cee3

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,48 @@ describe("pullCurrentBranch", () => {
11671167
),
11681168
),
11691169
);
1170+
1171+
// A slow smudge filter (LFS) can hold the checkout past 30 seconds; killing it there leaves a
1172+
// half-updated working tree. The automatic pulls and pull request refresh use these defaults.
1173+
it.effect.each(["pull", "merge"] as const)(
1174+
"lets a slow %s checkout finish instead of killing it at 30 seconds",
1175+
(subcommand) =>
1176+
Effect.gen(function* () {
1177+
const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
1178+
const { cwd, remoteHead } = yield* cloneBehindRemote;
1179+
yield* git(cwd, ["fetch", "origin"]);
1180+
const checkoutStarted = yield* Deferred.make<void>();
1181+
const releaseCheckout = yield* Deferred.make<void>();
1182+
const spawner = ChildProcessSpawner.make((command) =>
1183+
Effect.gen(function* () {
1184+
const handle = yield* delegate.spawn(command);
1185+
if (!ChildProcess.isStandardCommand(command) || command.args[0] !== subcommand) {
1186+
return handle;
1187+
}
1188+
yield* Deferred.succeed(checkoutStarted, undefined);
1189+
return ChildProcessSpawner.makeHandle({
1190+
...handle,
1191+
exitCode: Deferred.await(releaseCheckout).pipe(Effect.andThen(handle.exitCode)),
1192+
});
1193+
}),
1194+
);
1195+
const driver = yield* makeGitVcsDriverCore().pipe(
1196+
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
1197+
);
1198+
1199+
const moving = yield* (
1200+
subcommand === "pull"
1201+
? driver.pullCurrentBranch(cwd)
1202+
: driver.refreshCheckedOutBranch({ cwd, targetCommit: remoteHead })
1203+
).pipe(Effect.forkChild({ startImmediately: true }));
1204+
yield* Deferred.await(checkoutStarted);
1205+
yield* TestClock.adjust("60 seconds");
1206+
yield* Deferred.succeed(releaseCheckout, undefined);
1207+
1208+
yield* Fiber.join(moving);
1209+
assert.equal(yield* git(cwd, ["rev-parse", "HEAD"]), remoteHead);
1210+
}).pipe(Effect.provide(layerTest)),
1211+
);
11701212
});
11711213

11721214
it.effect("retries an in-flight ref snapshot invalidated by a mutation", () =>

0 commit comments

Comments
 (0)