Public: anyone can read this; the crew can change it.
"pillars > merged pulls of the last 7 days count by the pillar of the issue each closes, on the board and in the map's data" passes every time on a loaded check machine #5452
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5410-pillars-merged-pulls-of-the-last-7-days → main 1 commit fork
1 file
changed +12
−5
test/pillars.test.ts +12 −5
| @@ -424,18 +424,25 @@ describe("pillars", () => { | ||
| 424 | 424 | await land("composer", composer); |
| 425 | 425 | await land("readme", loose); |
| 426 | 426 | await land("nothing", null); |
| 427 | // Merged, but ten days ago: outside the week. | |
| 428 | 427 | const old = await land("verdict", parts[1]!); |
| 429 | app.db | |
| 430 | .query("UPDATE pull SET merged_at = ?1 WHERE issue_id = ?2") | |
| 431 | .run(new Date(Date.now() - 10 * 86_400_000).toISOString(), old); | |
| 428 | // One instant for the whole case: the merges happened a minute before it | |
| 429 | // however long they took, and the odd one out ten days before, outside | |
| 430 | // the week. The view is read at that instant, not at whatever the clock | |
| 431 | // says by the time the assertions run. | |
| 432 | const T = Date.now(); | |
| 433 | const pin = (ago: number, where: string, ...args: string[]) => | |
| 434 | app.db | |
| 435 | .query(`UPDATE pull SET merged_at = ?1 WHERE ${where}`) | |
| 436 | .run(new Date(T - ago).toISOString(), ...args); | |
| 437 | pin(60_000, "merged_at IS NOT NULL AND issue_id != ?2", old); | |
| 438 | pin(10 * 86_400_000, "issue_id = ?2", old); | |
| 432 | 439 | const want = [ |
| 433 | 440 | { pillar: "P0 Trust", merged: 2 }, |
| 434 | 441 | { pillar: "P1 Feed", merged: 1 }, |
| 435 | 442 | { pillar: "Later", merged: 0 }, |
| 436 | 443 | { pillar: null, merged: 2 }, |
| 437 | 444 | ]; |
| 438 | expect(pillarView(app.db, fresh())!.merged).toEqual(want); | |
| 445 | expect(pillarView(app.db, fresh(), new Date(T))!.merged).toEqual(want); | |
| 439 | 446 | const data = await api("/api/v1/repos/alice/engine/map"); |
| 440 | 447 | // Nothing has gone live yet, so each pillar's ask-to-live is null: a dash. |
| 441 | 448 | expect(data.mergedByPillar).toEqual({ |
new above
offline