Public: anyone can read this; the crew can change it.
The digest sends nothing, not an empty email, when nothing happened since the last one #15184
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15163-the-digest-sends-nothing-not-an-empty-em → main 1 commit fork 1 thread · 1 unresolved
1 file
changed +26
−0
test/feed-digest-empty.test.ts added +26
| @@ -0,0 +1,26 @@ | ||
| 1 | /** #15163: a window with nothing in it makes no digest: no lines, no heading, no card. */ | |
| 2 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 3 | import { digest, DIGEST_WINDOW_MS } from "../src/feed/digest.ts"; | |
| 4 | import { feedDigest, sinceDigest, sinceYouWere } from "../src/web/studio/since.ts"; | |
| 5 | import { snappyFixture, type SnappyFixture } from "../bench/snappy.ts"; | |
| 6 | ||
| 7 | let f: SnappyFixture; | |
| 8 | beforeAll(async () => { | |
| 9 | f = await snappyFixture(); | |
| 10 | }, 120_000); | |
| 11 | afterAll(async () => { | |
| 12 | await f.close(); | |
| 13 | }); | |
| 14 | ||
| 15 | test("no events, or only old ones, give no lines", () => { | |
| 16 | const now = Date.now(); | |
| 17 | expect(digest([], now)).toEqual([]); | |
| 18 | expect(digest([{ repo: "a/b", kind: "landed", at: now - 2 * DIGEST_WINDOW_MS, href: "/a/b", weight: 1 }], now)).toEqual([]); | |
| 19 | }); | |
| 20 | ||
| 21 | test("an empty window builds no digest and no card, for the page, the API and MCP", () => { | |
| 22 | const later = Date.now() + 30 * 24 * 3600 * 1000; // everything seeded is older than any window | |
| 23 | expect(sinceDigest(f.app.db, f.owner, undefined, later)).toBeUndefined(); | |
| 24 | expect(feedDigest(f.app.db, f.owner, later)).toBeNull(); | |
| 25 | expect(sinceYouWere(f.app.db, f.owner, undefined, later)).toBeNull(); | |
| 26 | }); | |
new above
offline
Passes on base, so it guards the behaviour but would not fail without a change. Fine as a regression pin; say so in the issue when closing.