Public: anyone can read this; the crew can change it.

pull-check-again: a writer's ask waits for the pull's own check, so the run it gets is the asked one #17231

opened this

Merged 42h 57m ago, live in production

fix/pull-check-again-race → main 0 commits

  • Merged. fix/pull-check-again-race was merged into main as ca01e9e.

Review

Sign in to review this change.
1 file changed +6 −0
test/pull-check-again.test.ts +6
@@ -11,11 +11,13 @@ import { createApp, type App } from "../src/app.ts";
1111 import { openPull } from "../src/actions/pulls.ts";
1212 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
1313 import { startChecks, type ChecksHandle } from "../src/checks/service.ts";
14 import { listActive } from "../src/core/runs.ts";
1415 import { createToken } from "../src/core/tokens.ts";
1516 import { createSession } from "../src/core/sessions.ts";
1617 import { createUser, type User } from "../src/core/users.ts";
1718 import { serve, type Servers } from "../src/http/server.ts";
1819 import { quietLogs } from "./helpers/globals.ts";
20 import { waitFor } from "./helpers/poll.ts";
1921
2022 quietLogs();
2123
@@ -114,6 +116,10 @@ describe("asking again over HTTP", () => {
114116 });
115117
116118 test("a writer queues a check and gets the run", async () => {
119 // Opening the pull queued its own check of this head, and a check running on a head is that
120 // head's check: asked meanwhile, the answer is the running one, reason "pull"
121 // (`checks/request.ts`). That one finishing first was a race (1 in 8 alone); it is waited for.
122 expect(await waitFor(() => listActive(app.db, "check").length === 0)).toBe(true);
117123 const res = await post(openNumber, writerToken);
118124 expect(res.status).toBe(202);
119125 const body = (await res.json()) as { run: { reason: string } };

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs