Public: anyone can read this; the crew can change it.
A pull serves flow when its issue carries the `flow` label, not only when it is on a hard-coded list #6505
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/6498-a-pull-serves-flow-when-its-issue-carrie → main 1 commit fork 1 thread · 1 unresolved
2 files
changed +17
−2
src/flow/openers.ts +5 −2
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * Who opened the last hour's pulls (#6443): per author, how many pulls opened |
| 3 | 3 | * in the hour before `now`, and how many of those serve a flow issue. A pull |
| 4 | 4 | * serves flow when the issue its description closes (`Closes #N`) is one of |
| 5 | * the flow issues, or waits on one in the dependency graph, however far. | |
| 5 | * the flow issues or carries the `flow` label (any case), or waits on one in the dependency graph, however far. | |
| 6 | 6 | * Most first, ties by name. Same `publicOnly` rule as `readVitals`; two reads. |
| 7 | 7 | */ |
| 8 | 8 | |
| @@ -34,7 +34,10 @@ export function readOpeners(db: Database, now = new Date(), publicOnly = false): | ||
| 34 | 34 | .query<{ key: string }, [number, number, number, number]>( |
| 35 | 35 | `WITH RECURSIVE flow(id) AS ( |
| 36 | 36 | SELECT i.id FROM issue i JOIN repo r ON r.id = i.repo_id |
| 37 | WHERE i.number IN (?1, ?2, ?3) AND (?4 = 0 OR r.visibility = 'public') | |
| 37 | WHERE (i.number IN (?1, ?2, ?3) | |
| 38 | OR EXISTS (SELECT 1 FROM issue_label il JOIN label l ON l.id = il.label_id | |
| 39 | WHERE il.issue_id = i.id AND l.name = 'flow' COLLATE NOCASE)) | |
| 40 | AND (?4 = 0 OR r.visibility = 'public') | |
| 38 | 41 | UNION |
| 39 | 42 | SELECT d.issue_id FROM issue_dependency d JOIN flow f ON f.id = d.blocked_by_id |
| 40 | 43 | ) |
test/flow-openers.test.ts +12
| @@ -79,6 +79,18 @@ describe("readOpeners", () => { | ||
| 79 | 79 | expect(readOpeners(app.db, NOW)).toEqual([{ author: "bob", opened: 2, flow: 1 }]); |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | test("a pull closing a flow-labelled issue in another repository is flow; an unlabelled one is not", () => { | |
| 83 | const other = repo("other", "public", users.alice!); | |
| 84 | const tagged = issue(other, 7, users.alice!); | |
| 85 | issue(other, 8, users.alice!); | |
| 86 | const lid = id(); | |
| 87 | app.db.query(`INSERT INTO label (id, repo_id, name) VALUES (?1, ?2, 'Flow')`).run(lid, other); | |
| 88 | app.db.query(`INSERT INTO issue_label (issue_id, label_id) VALUES (?1, ?2)`).run(tagged, lid); | |
| 89 | pull(other, users.bob!, "Closes #7", 3); | |
| 90 | pull(other, users.bob!, "Closes #8", 4); | |
| 91 | expect(readOpeners(app.db, NOW)).toEqual([{ author: "bob", opened: 2, flow: 1 }]); | |
| 92 | }); | |
| 93 | ||
| 82 | 94 | test("a pull opened 61 minutes ago is left out, 59 is in", () => { |
| 83 | 95 | pull(pub, users.bob!, "", 61); |
| 84 | 96 | pull(pub, users.alice!, "", 59); |
new above
offline
Rewrap: this line is well past the file's wrapping width.