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

Full suite red: test/flow-alarm-drift.test.ts #12894

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/12883-full-suite-red-test-flow-alarm-drift-tes → main 2 commits fork

  • Merged. scout/12883-full-suite-red-test-flow-alarm-drift-tes was merged into main as 37f77c9.

Review

Sign in to review this change.
1 file changed +20 −7
test/flow-alarm-drift.test.ts +20 −7
@@ -114,12 +114,24 @@ test("read from git: landings past a pull's base, open pulls only", async () =>
114114 setIssueState(app.db, open.id, "closed");
115115 });
116116
117 test("a rebased head stops counting; a merged pull never counts", async () => {
117 /**
118 * A repository `name` of user `username` with one open pull from `work`, as the drift tests below
119 * start.
120 */
121 async function pullFixture(username: string, name: string) {
118122 const ada = ok(
119 await createUser(app.db, { origin: "seed", trusted: true, username: "bo", email: "bo@forge.local", password: "a-good-passphrase" }),
123 await createUser(app.db, { origin: "seed", trusted: true, username, email: `${username}@forge.local`, password: "a-good-passphrase" }),
120124 );
121 const repo = ok(await createRepo(app.db, app.reposRoot, { ownerId: ada.id, name: "rb", visibility: "public" }));
125 const repo = ok(await createRepo(app.db, app.reposRoot, { ownerId: ada.id, name, visibility: "public" }));
122126 const dir = repoDir(app.reposRoot, ada.username, repo.name);
127 ok(await commitToBranch(app, ada, repo, { message: "seed", files: [{ path: "a.txt", content: "a\n" }] }));
128 ok(await commitToBranch(app, ada, repo, { message: "w", branch: "work", files: [{ path: "w.txt", content: "w\n" }] } as any));
129 const pull = ok(await createPull(app.db, dir, { repoId: repo.id, authorId: ada.id, title: "w", baseBranch: "main", headBranch: "work" }));
130 return { dir, pull };
131 }
132
133 test("a rebased head stops counting", async () => {
134 const { dir, pull } = await pullFixture("bo", "rb");
123135 const git = async (...args: string[]) => {
124136 const p = Bun.spawn(["git", ...args], {
125137 cwd: dir,
@@ -129,9 +141,6 @@ test("a rebased head stops counting; a merged pull never counts", async () => {
129141 });
130142 return (await new Response(p.stdout).text()).trim();
131143 };
132 ok(await commitToBranch(app, ada, repo, { message: "seed", files: [{ path: "a.txt", content: "a\n" }] }));
133 ok(await commitToBranch(app, ada, repo, { message: "w", branch: "work", files: [{ path: "w.txt", content: "w\n" }] } as any));
134 const pull = ok(await createPull(app.db, dir, { repoId: repo.id, authorId: ada.id, title: "w", baseBranch: "main", headBranch: "work" }));
135144 await landMany(dir, 26, "g");
136145 expect((await alarmDrift(app, new Date())).fired).toBe(true);
137146 // Merge main into the head and tell the pull, as a push does.
@@ -140,7 +149,11 @@ test("a rebased head stops counting; a merged pull never counts", async () => {
140149 await git("update-ref", "refs/heads/work", merged);
141150 app.db.query("UPDATE pull SET head_oid = ?1 WHERE issue_id = ?2").run(merged, pull.id);
142151 expect((await alarmDrift(app, new Date())).fired).toBe(false);
143 // Behind again, but merged: never counts.
152 setIssueState(app.db, pull.id, "closed");
153 });
154
155 test("a merged pull never counts", async () => {
156 const { dir, pull } = await pullFixture("bp", "mg");
144157 await landMany(dir, 26, "h");
145158 expect((await alarmDrift(app, new Date())).fired).toBe(true);
146159 app.db.query("UPDATE pull SET merged_at = ?1 WHERE issue_id = ?2").run(new Date().toISOString(), pull.id);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs