Skip to content

Commit 2036943

Browse files
Yuruzuuclaude
andcommitted
test(server): share the in-flight git read test across invalidations
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 69c7f0b commit 2036943

1 file changed

Lines changed: 5 additions & 53 deletions

File tree

‎apps/server/src/git/GitManager.test.ts‎

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -969,58 +969,10 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
969969
}),
970970
);
971971

972-
it.effect("a git read in flight during a T3 git action does not outlive it", () =>
973-
Effect.gen(function* () {
974-
const repoDir = yield* makeTempDir("t3code-git-manager-");
975-
yield* initRepo(repoDir);
976-
const remoteDir = yield* createBareRemote();
977-
yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]);
978-
yield* runGit(repoDir, ["checkout", "-b", "feature/racing-upstream"]);
979-
yield* runGit(repoDir, ["push", "-u", "origin", "feature/racing-upstream"]);
980-
yield* runGit(repoDir, ["push", "origin", "HEAD:refs/heads/feature/raced-head"]);
981-
const pullRequest = (number: number, headRefName: string): FakeChangeRequest[] => [
982-
{
983-
number,
984-
title: headRefName,
985-
url: `https://github.com/pingdotgg/codething-mvp/pull/${number}`,
986-
baseRefName: "main",
987-
headRefName,
988-
state: "open",
989-
updatedAt: "2026-04-07T15:00:00Z",
990-
},
991-
];
992-
const gate = {
993-
matches: (args: ReadonlyArray<string>) =>
994-
args[0] === "for-each-ref" && args.at(-1) === "refs/heads/feature/racing-upstream",
995-
reached: yield* Deferred.make<void>(),
996-
release: yield* Deferred.make<void>(),
997-
};
998-
const { manager } = yield* makeManager({
999-
gitSpawnGate: gate,
1000-
providerScenario: {
1001-
prListByHeadSelector: {
1002-
"feature/racing-upstream": pullRequest(237, "feature/racing-upstream"),
1003-
"feature/raced-head": pullRequest(238, "feature/raced-head"),
1004-
},
1005-
},
1006-
});
1007-
const lookup = manager.branchPullRequest({
1008-
cwd: repoDir,
1009-
branch: "feature/racing-upstream",
1010-
});
1011-
1012-
const inFlight = yield* Effect.forkChild(lookup);
1013-
yield* Deferred.await(gate.reached);
1014-
yield* runGit(repoDir, ["branch", "--set-upstream-to=origin/feature/raced-head"]);
1015-
yield* manager.invalidateStatus(repoDir);
1016-
yield* Deferred.succeed(gate.release, undefined);
1017-
yield* Fiber.join(inFlight);
1018-
1019-
expect((yield* lookup)?.number).toBe(238);
1020-
}),
1021-
);
1022-
1023-
it.effect("a git read in flight during a checkout does not outlive it", () =>
972+
it.effect.each([
973+
{ action: "a T3 git action", options: undefined },
974+
{ action: "a checkout", options: { keepPullRequestLookups: true } },
975+
])("a git read in flight during $action does not outlive it", ({ options }) =>
1024976
Effect.gen(function* () {
1025977
const repoDir = yield* makeTempDir("t3code-git-manager-");
1026978
yield* initRepo(repoDir);
@@ -1063,7 +1015,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
10631015
const inFlight = yield* Effect.forkChild(lookup);
10641016
yield* Deferred.await(gate.reached);
10651017
yield* runGit(repoDir, ["branch", "--set-upstream-to=origin/feature/raced-head"]);
1066-
yield* manager.invalidateStatus(repoDir, { keepPullRequestLookups: true });
1018+
yield* manager.invalidateStatus(repoDir, options);
10671019
yield* Deferred.succeed(gate.release, undefined);
10681020
yield* Fiber.join(inFlight);
10691021

0 commit comments

Comments
 (0)