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