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
Merged 40h 19m ago, live in production
scout/forge:scout/17344-an-open-edge-kept-finding-is-assigned-to → main 0 commits fork
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 filesrc/crew/held.ts +6
| @@ -13,6 +13,9 @@ | ||
| 13 | 13 | * builder opened in the last 10 minutes (`fresh_pull.ts`). |
| 14 | 14 | * - `planner`: the planner or a reviewer holds it, not a builder. The tick |
| 15 | 15 | * 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. | |
| 16 | 19 | * - `with_planner`: its limb was handed to the planner by a person and the |
| 17 | 20 | * planner has not answered (`core/limb_replan.ts`). |
| 18 | 21 | * - `done_on_main`: the crew found it done on the base branch and waits for |
| @@ -88,6 +91,7 @@ export const HOLDS = [ | ||
| 88 | 91 | "red_thrice", |
| 89 | 92 | "open_pull", |
| 90 | 93 | "planner", |
| 94 | "person", | |
| 91 | 95 | "with_planner", |
| 92 | 96 | "done_on_main", |
| 93 | 97 | "landed", |
| @@ -296,6 +300,7 @@ export function heldBy( | ||
| 296 | 300 | if (reds.has(issue.number)) return "red_thrice"; |
| 297 | 301 | if (proposed.has(issue.number)) return "open_pull"; |
| 298 | 302 | if (issue.assigneeId !== null && planners.has(issue.assigneeId)) return "planner"; |
| 303 | if (issue.assigneeId !== null && !issue.assigneeIsAgent) return "person"; | |
| 299 | 304 | if (hasDesigner && isWaveTitle(issue.title)) return "planner"; |
| 300 | 305 | if (handed.has(issue.id)) return "with_planner"; |
| 301 | 306 | // 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>> = { | ||
| 406 | 411 | red_thrice: "its pull failed its check three times; the planner splits or rewrites it", |
| 407 | 412 | open_pull: "an open pull already proposes it", |
| 408 | 413 | planner: "the planner or a reviewer holds it", |
| 414 | person: "a person is its assignee; it starts when they hand it to a builder", | |
| 409 | 415 | with_planner: "its limb waits on the planner", |
| 410 | 416 | done_on_main: "found done on the base branch; waits for a person to close it", |
| 411 | 417 | 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 | ||
| 53 | 53 | const [owner = "", name = ""] = ownRepoPath().split("/"); |
| 54 | 54 | const repo = getRepo(db, owner, name); |
| 55 | 55 | // 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. | |
| 57 | 58 | if (repo !== undefined) |
| 58 | 59 | for (const path of PATHS) { |
| 59 | 60 | 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) | |
| 61 | 63 | actions.push(`assigned #${String(issue.number)} to the owner, whose fix it is`); |
| 62 | 64 | } |
| 63 | 65 | 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", () => { | ||
| 306 | 306 | expect(getIssueById(app.db, finding.id)!.assigneeId).toBe(mason.id); |
| 307 | 307 | }); |
| 308 | 308 | |
| 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 | ||
| 309 | 324 | test("a planner or a reviewer with a run in flight keeps its issue", async () => { |
| 310 | 325 | const { repo, atlas } = await crewed(app, alice, "in-flight"); |
| 311 | 326 | 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"; | ||
| 14 | 14 | import { Session } from "../src/tui/session.ts"; |
| 15 | 15 | import { dutyLines } from "../src/tui/screens/dutyswitch.ts"; |
| 16 | 16 | import { createRepo } from "../src/actions/repos.ts"; |
| 17 | import { createAgent } from "../src/actions/crew.ts"; | |
| 17 | 18 | import { getIssue } from "../src/core/issues.ts"; |
| 18 | 19 | import { getRepo } from "../src/core/repos.ts"; |
| 19 | 20 | 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 | ||
| 148 | 149 | expect(repo.ownerId).not.toBe(other.value.id); |
| 149 | 150 | }); |
| 150 | 151 | |
| 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 | ||
| 151 | 172 | test("no edge header, an unshared page, a refused host or no URL say nothing", async () => { |
| 152 | 173 | expect((await (await run(shareable({}))).once()).findings).toEqual([]); |
| 153 | 174 | expect((await (await run(async () => h({ "cache-control": "no-cache", "cf-cache-status": "DYNAMIC" }))).once()).findings).toEqual([]); |
new above
offline