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

Merged opened this

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

Merged

scout/forge:scout/6498-a-pull-serves-flow-when-its-issue-carrie → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/6498-a-pull-serves-flow-when-its-issue-carrie was merged into main as 8703d33.

Review

Sign in to review this change.
2 files changed +17 −2
src/flow/openers.ts +5 −2
@@ -2,7 +2,7 @@
22 * Who opened the last hour's pulls (#6443): per author, how many pulls opened
33 * in the hour before `now`, and how many of those serve a flow issue. A pull
44 * 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.

Rewrap: this line is well past the file's wrapping width.

66 * Most first, ties by name. Same `publicOnly` rule as `readVitals`; two reads.
77 */
88
@@ -34,7 +34,10 @@ export function readOpeners(db: Database, now = new Date(), publicOnly = false):
3434 .query<{ key: string }, [number, number, number, number]>(
3535 `WITH RECURSIVE flow(id) AS (
3636 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')
3841 UNION
3942 SELECT d.issue_id FROM issue_dependency d JOIN flow f ON f.id = d.blocked_by_id
4043 )
test/flow-openers.test.ts +12
@@ -79,6 +79,18 @@ describe("readOpeners", () => {
7979 expect(readOpeners(app.db, NOW)).toEqual([{ author: "bob", opened: 2, flow: 1 }]);
8080 });
8181
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
8294 test("a pull opened 61 minutes ago is left out, 59 is in", () => {
8395 pull(pub, users.bob!, "", 61);
8496 pull(pub, users.alice!, "", 59);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs