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

An open edge-kept finding is assigned to the owner on production, so no builder is handed it #17349

opened this

Merged 40h 19m ago, live in production

scout/forge:scout/17344-an-open-edge-kept-finding-is-assigned-to → main 0 commits fork

  • Merged. scout/17344-an-open-edge-kept-finding-is-assigned-to was merged into main as a244ed0.

Review

Sign in to review this change.
5 files changed +47 −3
docs/features/maintenance-duties.md +1 −1

Diff not shown — a line 2,166 characters wide (limit 2,000). +1 −1

View file
src/crew/held.ts +6
@@ -13,6 +13,9 @@
1313 * builder opened in the last 10 minutes (`fresh_pull.ts`).
1414 * - `planner`: the planner or a reviewer holds it, not a builder. The tick
1515 * frees these (`freeParked` in `unstick.ts`): neither ever builds it.
16 * - `person`: a person who is not an agent is its assignee (#17344): it is theirs, and a
17 * builder's pick would take it from them. It starts when they unassign it or hand it to a
18 * builder.
1619 * - `with_planner`: its limb was handed to the planner by a person and the
1720 * planner has not answered (`core/limb_replan.ts`).
1821 * - `done_on_main`: the crew found it done on the base branch and waits for
@@ -88,6 +91,7 @@ export const HOLDS = [
8891 "red_thrice",
8992 "open_pull",
9093 "planner",
94 "person",
9195 "with_planner",
9296 "done_on_main",
9397 "landed",
@@ -296,6 +300,7 @@ export function heldBy(
296300 if (reds.has(issue.number)) return "red_thrice";
297301 if (proposed.has(issue.number)) return "open_pull";
298302 if (issue.assigneeId !== null && planners.has(issue.assigneeId)) return "planner";
303 if (issue.assigneeId !== null && !issue.assigneeIsAgent) return "person";
299304 if (hasDesigner && isWaveTitle(issue.title)) return "planner";
300305 if (handed.has(issue.id)) return "with_planner";
301306 // A landing that left boxes names what remains (#15289); its own done note waits behind it.
@@ -406,6 +411,7 @@ const HOLD_WORDS: Readonly<Record<HoldName, string>> = {
406411 red_thrice: "its pull failed its check three times; the planner splits or rewrites it",
407412 open_pull: "an open pull already proposes it",
408413 planner: "the planner or a reviewer holds it",
414 person: "a person is its assignee; it starts when they hand it to a builder",
409415 with_planner: "its limb waits on the planner",
410416 done_on_main: "found done on the base branch; waits for a person to close it",
411417 landed: "a merged pull closes it with boxes unticked; waits for a person",
src/maintain/duties/edge_kept.ts +4 −2
@@ -53,11 +53,13 @@ export function edgeKept(read: Get = get, inCell: () => boolean = inACell): Duty
5353 const [owner = "", name = ""] = ownRepoPath().split("/");
5454 const repo = getRepo(db, owner, name);
5555 // A finding is the owner's from the moment it exists, whether or not this run reads the edge.
56 // A finding a person assigned to someone else is left alone.
56 // One the crew handed a builder is taken back: a builder has nothing to change (#17344). A
57 // finding a person assigned to another person is left alone.
5758 if (repo !== undefined)
5859 for (const path of PATHS) {
5960 const issue = findingFor(db, repo, path);
60 if (issue !== undefined && issue.assigneeId === null && setAssignee(db, issue.id, repo.ownerId) !== undefined)
61 const unowned = issue !== undefined && (issue.assigneeId === null || issue.assigneeIsAgent);
62 if (unowned && setAssignee(db, issue.id, repo.ownerId) !== undefined)
6163 actions.push(`assigned #${String(issue.number)} to the owner, whose fix it is`);
6264 }
6365 const url = app?.config.url;
test/crew-held.test.ts +15
@@ -306,6 +306,21 @@ describe("the tick says why each ready issue cannot start", () => {
306306 expect(getIssueById(app.db, finding.id)!.assigneeId).toBe(mason.id);
307307 });
308308
309 test("an issue a person is assigned is held as person: the picker starts no run on it and keeps their name (#17344)", async () => {
310 const { repo, mason } = await crewed(app, alice, "persons");
311 const fresh = () => getRepoById(app.db, repo.id)!;
312 const owners = issue(fresh(), "The owner's to do");
313 expect(assignIssue(app, alice, fresh(), owners, alice).ok).toBe(true);
314 const held = heldNow(app, fresh());
315 expect(held.by.person.map((i) => i.number)).toEqual([owners.number]);
316 expect(held.startable.map((r) => r.issue.number)).not.toContain(owners.number);
317 expect(await driveRepo(app, fresh())).not.toBe("picked");
318 expect(getIssueById(app.db, owners.id)!.assigneeId).toBe(alice.id);
319 // Handed to a builder, it is the builder's to start: an agent's name holds nothing.
320 expect(assignIssue(app, alice, fresh(), getIssueById(app.db, owners.id)!, mason).ok).toBe(true);
321 expect(heldNow(app, fresh()).by.person).toHaveLength(0);
322 });
323
309324 test("a planner or a reviewer with a run in flight keeps its issue", async () => {
310325 const { repo, atlas } = await crewed(app, alice, "in-flight");
311326 const fresh = () => getRepoById(app.db, repo.id)!;
test/maintain-edge-kept.test.ts +21
@@ -14,6 +14,7 @@ import { serve } from "../src/http/server.ts";
1414 import { Session } from "../src/tui/session.ts";
1515 import { dutyLines } from "../src/tui/screens/dutyswitch.ts";
1616 import { createRepo } from "../src/actions/repos.ts";
17 import { createAgent } from "../src/actions/crew.ts";
1718 import { getIssue } from "../src/core/issues.ts";
1819 import { getRepo } from "../src/core/repos.ts";
1920 import { agentFor } from "../src/crew/dispatch.ts";
@@ -148,6 +149,26 @@ test("an unassigned finding is the owner's even when the run skips (no FORGE_URL
148149 expect(repo.ownerId).not.toBe(other.value.id);
149150 });
150151
152 test("a finding the crew's picker handed a builder is the owner's again on the next run, even a skipped one (#17344)", async () => {
153 const [owner = "", name = ""] = ownRepoPath().split("/");
154 const { app, once } = await run(shareable({ "cf-cache-status": "DYNAMIC" }));
155 await once();
156 const repo = getRepo(app.db, owner, name)!;
157 const root = getUserById(app.db, repo.ownerId)!;
158 const made = await createAgent(app, root, { username: "builder" });
159 if (!made.ok) throw new Error(String(made.error));
160 const num = (app.db.query("SELECT number FROM issue WHERE title = ?1").get(title("/")) as { number: number }).number;
161 // What production showed: the picker put a builder's name on it over the owner's.
162 app.db.query("UPDATE issue SET assignee_id = ?1 WHERE repo_id = ?2").run(made.value.user.id, repo.id);
163 const skipped = edgeDuty(async () => undefined, () => true);
164 const r = await skipped.run({ db: app.db, bus: app.bus, now: new Date(), app });
165 expect(r.actions[0]).toBe(`assigned #${String(num)} to the owner, whose fix it is`);
166 expect(r.actions.some((a) => a.startsWith("skipped"))).toBe(true);
167 const issue = getIssue(app.db, repo.id, num)!;
168 expect(issue.assigneeId).toBe(repo.ownerId);
169 expect(agentFor(app, issue)).toBeUndefined();
170 });
171
151172 test("no edge header, an unshared page, a refused host or no URL say nothing", async () => {
152173 expect((await (await run(shareable({}))).once()).findings).toEqual([]);
153174 expect((await (await run(async () => h({ "cache-control": "no-cache", "cf-cache-status": "DYNAMIC" }))).once()).findings).toEqual([]);

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

Keyboard shortcuts

Docs