History

Drop tight per-test timeout overrides in GitManager tests

Six cross-repo PR tests carried 12s/20s per-test timeouts from when the suite default was Vitest's 5s. The server suite now sets a 120s budget precisely because these git-subprocess-heavy tests can crawl on loaded CI hosts, so the leftover overrides only shrank the budget and made the tests time out spuriously. Remove them so the tests inherit the configured default.

Cursor Agent committed 4 months ago

Commit 13ed3db1 parent 0ebee5e1 file · +232 −246Browse files

Unified · Split

apps/server/src/git/GitManager.test.ts+232−246
@@ -1008,73 +1008,70 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 1007 unmodified lines
10081008 }),
10091009 );
10101010
1011− it.effect(
1012− "status detects cross-repo PRs from the upstream remote URL owner",
1013− () =>
1014− Effect.gen(function* () {
1015− const repoDir = yield* makeTempDir("t3code-git-manager-");
1016− yield* initRepo(repoDir);
1017− const forkDir = yield* createBareRemote();
1018− yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
1019− yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
1020− NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
1021− yield* runGit(repoDir, ["add", "fork-pr.txt"]);
1022− yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
1023− yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1024− yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
1025− yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
1026− yield* configureVisibleRemoteUrlWithLocalRewrite(
1027− repoDir,
1028− "fork-seed",
1029− "git@github.com:jasonLaster/codething-mvp.git",
1030− forkDir,
1031− );
1011+ it.effect("status detects cross-repo PRs from the upstream remote URL owner", () =>
1012+ Effect.gen(function* () {
1013+ const repoDir = yield* makeTempDir("t3code-git-manager-");
1014+ yield* initRepo(repoDir);
1015+ const forkDir = yield* createBareRemote();
1016+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
1017+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
1018+ NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
1019+ yield* runGit(repoDir, ["add", "fork-pr.txt"]);
1020+ yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
1021+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1022+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
1023+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
1024+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1025+ repoDir,
1026+ "fork-seed",
1027+ "git@github.com:jasonLaster/codething-mvp.git",
1028+ forkDir,
1029+ );
10321030
1033− const { manager, ghCalls } = yield* makeManager({
1034− ghScenario: {
1035− prListSequence: [
1036− // @effect-diagnostics-next-line preferSchemaOverJson:off
1037− JSON.stringify([]),
1038− // @effect-diagnostics-next-line preferSchemaOverJson:off
1039− JSON.stringify([]),
1040− // @effect-diagnostics-next-line preferSchemaOverJson:off
1041− JSON.stringify([
1042− {
1043− number: 488,
1044− title: "Rebase this PR on latest main",
1045− url: "https://github.com/pingdotgg/codething-mvp/pull/488",
1046− baseRefName: "main",
1047− headRefName: "statemachine",
1048− state: "OPEN",
1049− updatedAt: "2026-03-10T07:00:00Z",
1050− isCrossRepository: true,
1051− headRepository: {
1052− nameWithOwner: "jasonLaster/codething-mvp",
1053− },
1054− headRepositoryOwner: {
1055− login: "jasonLaster",
1056− },
1031+ const { manager, ghCalls } = yield* makeManager({
1032+ ghScenario: {
1033+ prListSequence: [
1034+ // @effect-diagnostics-next-line preferSchemaOverJson:off
1035+ JSON.stringify([]),
1036+ // @effect-diagnostics-next-line preferSchemaOverJson:off
1037+ JSON.stringify([]),
1038+ // @effect-diagnostics-next-line preferSchemaOverJson:off
1039+ JSON.stringify([
1040+ {
1041+ number: 488,
1042+ title: "Rebase this PR on latest main",
1043+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
1044+ baseRefName: "main",
1045+ headRefName: "statemachine",
1046+ state: "OPEN",
1047+ updatedAt: "2026-03-10T07:00:00Z",
1048+ isCrossRepository: true,
1049+ headRepository: {
1050+ nameWithOwner: "jasonLaster/codething-mvp",
10571051 },
1058− ]),
1059− ],
1060− },
1061− });
1052+ headRepositoryOwner: {
1053+ login: "jasonLaster",
1054+ },
1055+ },
1056+ ]),
1057+ ],
1058+ },
1059+ });
10621060
1063− const status = yield* manager.status({ cwd: repoDir });
1064− expect(status.refName).toBe("t3code/pr-488/statemachine");
1065− expect(status.pr).toEqual({
1066− number: 488,
1067− title: "Rebase this PR on latest main",
1068− url: "https://github.com/pingdotgg/codething-mvp/pull/488",
1069− baseRef: "main",
1070− headRef: "statemachine",
1071− state: "open",
1072− });
1073− expect(ghCalls).toContain(
1074− "pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1075− );
1076− }),
1077− 20_000,
1061+ const status = yield* manager.status({ cwd: repoDir });
1062+ expect(status.refName).toBe("t3code/pr-488/statemachine");
1063+ expect(status.pr).toEqual({
1064+ number: 488,
1065+ title: "Rebase this PR on latest main",
1066+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
1067+ baseRef: "main",
1068+ headRef: "statemachine",
1069+ state: "open",
1070+ });
1071+ expect(ghCalls).toContain(
1072+ "pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1073+ );
1074+ }),
10781075 );
10791076
10801077 it.effect(
@@ -1190,7 +1187,6 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 109 unmodified lines
11901187 ),
11911188 ).toBe(false);
11921189 }),
1193− 20_000,
11941190 );
11951191
11961192 it.effect("status returns merged PR state when latest PR was merged", () =>
@@ -1884,65 +1880,62 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 687 unmodified lines
18841880 }),
18851881 );
18861882
1887− it.effect(
1888− "returns existing cross-repo PR metadata using the fork owner selector",
1889− () =>
1890− Effect.gen(function* () {
1891− const repoDir = yield* makeTempDir("t3code-git-manager-");
1892− yield* initRepo(repoDir);
1893− yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
1894− const forkDir = yield* createBareRemote();
1895− yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
1896− yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1897− yield* configureVisibleRemoteUrlWithLocalRewrite(
1898− repoDir,
1899− "fork-seed",
1900− "git@github.com:octocat/codething-mvp.git",
1901− forkDir,
1902− );
1883+ it.effect("returns existing cross-repo PR metadata using the fork owner selector", () =>
1884+ Effect.gen(function* () {
1885+ const repoDir = yield* makeTempDir("t3code-git-manager-");
1886+ yield* initRepo(repoDir);
1887+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
1888+ const forkDir = yield* createBareRemote();
1889+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
1890+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1891+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1892+ repoDir,
1893+ "fork-seed",
1894+ "git@github.com:octocat/codething-mvp.git",
1895+ forkDir,
1896+ );
19031897
1904− const { manager, ghCalls } = yield* makeManager({
1905− ghScenario: {
1906− prListSequence: [
1907− // @effect-diagnostics-next-line preferSchemaOverJson:off
1908− JSON.stringify([]),
1909− // @effect-diagnostics-next-line preferSchemaOverJson:off
1910− JSON.stringify([
1911− {
1912− number: 142,
1913− title: "Existing fork PR",
1914− url: "https://github.com/pingdotgg/codething-mvp/pull/142",
1915− baseRefName: "main",
1916− headRefName: "statemachine",
1917− state: "OPEN",
1918− isCrossRepository: true,
1919− headRepository: {
1920− nameWithOwner: "octocat/codething-mvp",
1921− },
1922− headRepositoryOwner: {
1923− login: "octocat",
1924− },
1898+ const { manager, ghCalls } = yield* makeManager({
1899+ ghScenario: {
1900+ prListSequence: [
1901+ // @effect-diagnostics-next-line preferSchemaOverJson:off
1902+ JSON.stringify([]),
1903+ // @effect-diagnostics-next-line preferSchemaOverJson:off
1904+ JSON.stringify([
1905+ {
1906+ number: 142,
1907+ title: "Existing fork PR",
1908+ url: "https://github.com/pingdotgg/codething-mvp/pull/142",
1909+ baseRefName: "main",
1910+ headRefName: "statemachine",
1911+ state: "OPEN",
1912+ isCrossRepository: true,
1913+ headRepository: {
1914+ nameWithOwner: "octocat/codething-mvp",
19251915 },
1926− ]),
1927− ],
1928− },
1929− });
1916+ headRepositoryOwner: {
1917+ login: "octocat",
1918+ },
1919+ },
1920+ ]),
1921+ ],
1922+ },
1923+ });
19301924
1931− const result = yield* runStackedAction(manager, {
1932− cwd: repoDir,
1933− action: "commit_push_pr",
1934− });
1925+ const result = yield* runStackedAction(manager, {
1926+ cwd: repoDir,
1927+ action: "commit_push_pr",
1928+ });
19351929
1936− expect(result.pr.status).toBe("opened_existing");
1937− expect(result.pr.number).toBe(142);
1938− expect(
1939− ghCalls.some((call) =>
1940− call.includes("pr list --head octocat:statemachine --state open --limit 1"),
1941− ),
1942− ).toBe(true);
1943− expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
1944− }),
1945− 12_000,
1930+ expect(result.pr.status).toBe("opened_existing");
1931+ expect(result.pr.number).toBe(142);
1932+ expect(
1933+ ghCalls.some((call) =>
1934+ call.includes("pr list --head octocat:statemachine --state open --limit 1"),
1935+ ),
1936+ ).toBe(true);
1937+ expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
1938+ }),
19461939 );
19471940
19481941 it.effect(
@@ -2042,149 +2035,142 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 93 unmodified lines
20422035 false,
20432036 );
20442037 }),
2045− 20_000,
20462038 );
20472039
2048− it.effect(
2049− "prefers owner-qualified selectors before bare branch names for cross-repo PRs",
2050− () =>
2051− Effect.gen(function* () {
2052− const repoDir = yield* makeTempDir("t3code-git-manager-");
2053− yield* initRepo(repoDir);
2054− yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2055− const forkDir = yield* createBareRemote();
2056− yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2057− yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2058− yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2059− yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2060− yield* configureVisibleRemoteUrlWithLocalRewrite(
2061− repoDir,
2062− "fork-seed",
2063− "git@github.com:octocat/codething-mvp.git",
2064− forkDir,
2065− );
2040+ it.effect("prefers owner-qualified selectors before bare branch names for cross-repo PRs", () =>
2041+ Effect.gen(function* () {
2042+ const repoDir = yield* makeTempDir("t3code-git-manager-");
2043+ yield* initRepo(repoDir);
2044+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2045+ const forkDir = yield* createBareRemote();
2046+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2047+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2048+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2049+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2050+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2051+ repoDir,
2052+ "fork-seed",
2053+ "git@github.com:octocat/codething-mvp.git",
2054+ forkDir,
2055+ );
20662056
2067− const { manager, ghCalls } = yield* makeManager({
2068− ghScenario: {
2069− prListByHeadSelector: {
2070− // @effect-diagnostics-next-line preferSchemaOverJson:off
2071− "t3code/pr-142/statemachine": JSON.stringify([]),
2072− // @effect-diagnostics-next-line preferSchemaOverJson:off
2073− statemachine: JSON.stringify([
2074− {
2075− number: 41,
2076− title: "Unrelated same-repo PR",
2077− url: "https://github.com/pingdotgg/codething-mvp/pull/41",
2078− baseRefName: "main",
2079− headRefName: "statemachine",
2057+ const { manager, ghCalls } = yield* makeManager({
2058+ ghScenario: {
2059+ prListByHeadSelector: {
2060+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2061+ "t3code/pr-142/statemachine": JSON.stringify([]),
2062+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2063+ statemachine: JSON.stringify([
2064+ {
2065+ number: 41,
2066+ title: "Unrelated same-repo PR",
2067+ url: "https://github.com/pingdotgg/codething-mvp/pull/41",
2068+ baseRefName: "main",
2069+ headRefName: "statemachine",
2070+ },
2071+ ]),
2072+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2073+ "octocat:statemachine": JSON.stringify([
2074+ {
2075+ number: 142,
2076+ title: "Existing fork PR",
2077+ url: "https://github.com/pingdotgg/codething-mvp/pull/142",
2078+ baseRefName: "main",
2079+ headRefName: "statemachine",
2080+ state: "OPEN",
2081+ isCrossRepository: true,
2082+ headRepository: {
2083+ nameWithOwner: "octocat/codething-mvp",
20802084 },
2081− ]),
2082− // @effect-diagnostics-next-line preferSchemaOverJson:off
2083− "octocat:statemachine": JSON.stringify([
2084− {
2085− number: 142,
2086− title: "Existing fork PR",
2087− url: "https://github.com/pingdotgg/codething-mvp/pull/142",
2088− baseRefName: "main",
2089− headRefName: "statemachine",
2090− state: "OPEN",
2091− isCrossRepository: true,
2092− headRepository: {
2093− nameWithOwner: "octocat/codething-mvp",
2094− },
2095− headRepositoryOwner: {
2096− login: "octocat",
2097− },
2085+ headRepositoryOwner: {
2086+ login: "octocat",
20982087 },
2099− ]),
2100− // @effect-diagnostics-next-line preferSchemaOverJson:off
2101− "fork-seed:statemachine": JSON.stringify([]),
2102− },
2088+ },
2089+ ]),
2090+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2091+ "fork-seed:statemachine": JSON.stringify([]),
21032092 },
2104− });
2093+ },
2094+ });
21052095
2106− const result = yield* runStackedAction(manager, {
2107− cwd: repoDir,
2108− action: "commit_push_pr",
2109− });
2096+ const result = yield* runStackedAction(manager, {
2097+ cwd: repoDir,
2098+ action: "commit_push_pr",
2099+ });
21102100
2111− expect(result.pr.status).toBe("opened_existing");
2112− expect(result.pr.number).toBe(142);
2101+ expect(result.pr.status).toBe("opened_existing");
2102+ expect(result.pr.number).toBe(142);
21132103
2114− const ownerSelectorCallIndex = ghCalls.findIndex((call) =>
2115− call.includes("pr list --head octocat:statemachine --state open --limit 1"),
2116− );
2117− expect(ownerSelectorCallIndex).toBeGreaterThanOrEqual(0);
2118− expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
2119− }),
2120− 12_000,
2104+ const ownerSelectorCallIndex = ghCalls.findIndex((call) =>
2105+ call.includes("pr list --head octocat:statemachine --state open --limit 1"),
2106+ );
2107+ expect(ownerSelectorCallIndex).toBeGreaterThanOrEqual(0);
2108+ expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
2109+ }),
21212110 );
21222111
2123− it.effect(
2124− "stops probing head selectors after finding an existing PR",
2125− () =>
2126− Effect.gen(function* () {
2127− const repoDir = yield* makeTempDir("t3code-git-manager-");
2128− yield* initRepo(repoDir);
2129− yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2130− const forkDir = yield* createBareRemote();
2131− yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2132− yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2133− yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2134− yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2135− yield* configureVisibleRemoteUrlWithLocalRewrite(
2136− repoDir,
2137− "fork-seed",
2138− "git@github.com:octocat/codething-mvp.git",
2139− forkDir,
2140− );
2112+ it.effect("stops probing head selectors after finding an existing PR", () =>
2113+ Effect.gen(function* () {
2114+ const repoDir = yield* makeTempDir("t3code-git-manager-");
2115+ yield* initRepo(repoDir);
2116+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2117+ const forkDir = yield* createBareRemote();
2118+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2119+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2120+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2121+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2122+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2123+ repoDir,
2124+ "fork-seed",
2125+ "git@github.com:octocat/codething-mvp.git",
2126+ forkDir,
2127+ );
21412128
2142− const { manager, ghCalls } = yield* makeManager({
2143− ghScenario: {
2144− prListByHeadSelector: {
2145− // @effect-diagnostics-next-line preferSchemaOverJson:off
2146− "octocat:statemachine": JSON.stringify([
2147− {
2148− number: 142,
2149− title: "Existing fork PR",
2150− url: "https://github.com/pingdotgg/codething-mvp/pull/142",
2151− baseRefName: "main",
2152− headRefName: "statemachine",
2153− state: "OPEN",
2154− isCrossRepository: true,
2155− headRepository: {
2156− nameWithOwner: "octocat/codething-mvp",
2157− },
2158− headRepositoryOwner: {
2159− login: "octocat",
2160− },
2129+ const { manager, ghCalls } = yield* makeManager({
2130+ ghScenario: {
2131+ prListByHeadSelector: {
2132+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2133+ "octocat:statemachine": JSON.stringify([
2134+ {
2135+ number: 142,
2136+ title: "Existing fork PR",
2137+ url: "https://github.com/pingdotgg/codething-mvp/pull/142",
2138+ baseRefName: "main",
2139+ headRefName: "statemachine",
2140+ state: "OPEN",
2141+ isCrossRepository: true,
2142+ headRepository: {
2143+ nameWithOwner: "octocat/codething-mvp",
21612144 },
2162− ]),
2163− // @effect-diagnostics-next-line preferSchemaOverJson:off
2164− "fork-seed:statemachine": JSON.stringify([]),
2165− // @effect-diagnostics-next-line preferSchemaOverJson:off
2166− "t3code/pr-142/statemachine": JSON.stringify([]),
2167− // @effect-diagnostics-next-line preferSchemaOverJson:off
2168− statemachine: JSON.stringify([]),
2169− },
2145+ headRepositoryOwner: {
2146+ login: "octocat",
2147+ },
2148+ },
2149+ ]),
2150+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2151+ "fork-seed:statemachine": JSON.stringify([]),
2152+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2153+ "t3code/pr-142/statemachine": JSON.stringify([]),
2154+ // @effect-diagnostics-next-line preferSchemaOverJson:off
2155+ statemachine: JSON.stringify([]),
21702156 },
2171− });
2157+ },
2158+ });
21722159
2173− const result = yield* runStackedAction(manager, {
2174− cwd: repoDir,
2175− action: "commit_push_pr",
2176− });
2160+ const result = yield* runStackedAction(manager, {
2161+ cwd: repoDir,
2162+ action: "commit_push_pr",
2163+ });
21772164
2178− expect(result.pr.status).toBe("opened_existing");
2179− expect(result.pr.number).toBe(142);
2165+ expect(result.pr.status).toBe("opened_existing");
2166+ expect(result.pr.number).toBe(142);
21802167
2181− const openLookupCalls = ghCalls.filter((call) => call.includes("--state open --limit 1"));
2182− expect(openLookupCalls).toHaveLength(1);
2183− expect(openLookupCalls[0]).toContain(
2184− "pr list --head octocat:statemachine --state open --limit 1",
2185− );
2186− }),
2187− 12_000,
2168+ const openLookupCalls = ghCalls.filter((call) => call.includes("--state open --limit 1"));
2169+ expect(openLookupCalls).toHaveLength(1);
2170+ expect(openLookupCalls[0]).toContain(
2171+ "pr list --head octocat:statemachine --state open --limit 1",
2172+ );
2173+ }),
21882174 );
21892175
21902176 it.effect("creates PR when one does not already exist", () =>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t