Public: anyone can read this; the crew can change it.
An empty changelog feed has no invented date: /changelog.atom says updated 2026-10-06 with no entries #14398
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14391-an-empty-changelog-feed-has-no-invented → main 2 commits fork 1 thread · 1 unresolved
1 file
changed +47
−0
test/changelog-atom.test.ts +47
| @@ -197,6 +197,16 @@ describe("GET /changelog.atom", () => { | ||
| 197 | 197 | expect(again.status).toBe(304); |
| 198 | 198 | }); |
| 199 | 199 | |
| 200 | test("updated is the newest entry's time, and changes only when an entry does", async () => { | |
| 201 | const res = await fetch(`${servers.url}/changelog.atom`); | |
| 202 | const text = await res.text(); | |
| 203 | const stamps = [...text.matchAll(/<entry>[\s\S]*?<updated>([^<]*)<\/updated>/g)].map((m) => Date.parse(m[1]!)); | |
| 204 | expect(stamps.length).toBeGreaterThan(1); | |
| 205 | expect(text.match(/<updated>([^<]*)<\/updated>/)![1]).toBe(new Date(Math.max(...stamps)).toISOString()); | |
| 206 | const again = await fetch(`${servers.url}/changelog.atom`); | |
| 207 | expect(await again.text()).toBe(text); | |
| 208 | }); | |
| 209 | ||
| 200 | 210 | test("a release a wave covers speaks the wave's headline, escaped, and links the wave; a broken wave falls back", async () => { |
| 201 | 211 | const repo = getRepo(app.db, "alice", "forge")!; |
| 202 | 212 | const user = getUserByName(app.db, "alice")!; |
| @@ -247,6 +257,13 @@ describe("GET /changelog.atom on an empty forge", () => { | ||
| 247 | 257 | expect(first).toBe(feedEpoch(app.db)); |
| 248 | 258 | await Bun.sleep(20); // real-timer: a "now" stamp would differ across it |
| 249 | 259 | expect(await get()).toBe(first); |
| 260 | const res = await fetch(`${servers.url}/changelog.atom`); | |
| 261 | const text = await res.text(); | |
| 262 | expect(text).not.toContain("<entry>"); | |
| 263 | expect(text).toBe(await (await fetch(`${servers.url}/changelog.atom`)).text()); | |
| 264 | const etag = res.headers.get("etag")!; | |
| 265 | expect(etag).toBeTruthy(); | |
| 266 | expect((await fetch(`${servers.url}/changelog.atom`, { headers: { "if-none-match": etag } })).status).toBe(304); | |
| 250 | 267 | } finally { |
| 251 | 268 | servers.stop(); |
| 252 | 269 | app.close(); |
| @@ -254,3 +271,33 @@ describe("GET /changelog.atom on an empty forge", () => { | ||
| 254 | 271 | } |
| 255 | 272 | }, 30_000); |
| 256 | 273 | }); |
| 274 | ||
| 275 | describe("GET /changelog.atom with exactly one entry", () => { | |
| 276 | test("updated is that entry's time, and the same twice", async () => { | |
| 277 | const saved = process.env["FORGE_COMMIT"]; | |
| 278 | process.env["FORGE_COMMIT"] = "a".repeat(40); | |
| 279 | const dataDir = await mkdtemp(join(tmpdir(), "forge-changelog-atom-one-")); | |
| 280 | const app = createApp({ dataDir, port: 0, forgeRepo: "alice/forge" }); | |
| 281 | const servers = await serve(app); | |
| 282 | try { | |
| 283 | const u = await createUser(app.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: true }); | |
| 284 | if (!u.ok) throw new Error(u.error); | |
| 285 | const made = await createRepo(app, u.value, { name: "forge", visibility: "public" }); | |
| 286 | if (!made.ok) throw new Error(String(made.error)); | |
| 287 | app.db.query(`INSERT INTO issue (id, repo_id, number, kind, title, author_id, state) VALUES ('o1', ?1, 1, 'pull', 'Only one', ?2, 'closed')`).run(made.value.id, u.value.id); | |
| 288 | app.db.query(`INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid, merged_at, merged_oid) VALUES ('o1', ?1, 'b', 'base', '', '2026-10-01T10:00:00.000Z', 'oid-one')`).run(made.value.defaultBranch); | |
| 289 | keepLive(app.db, "alice/forge", ["oid-one"], 0); | |
| 290 | const text = await (await fetch(`${servers.url}/changelog.atom`)).text(); | |
| 291 | expect(text.match(/<entry>/g)?.length).toBe(1); | |
| 292 | expect(text.match(/<updated>([^<]*)<\/updated>/)![1]).toBe("2026-10-01T10:00:00.000Z"); | |
| 293 | expect(await (await fetch(`${servers.url}/changelog.atom`)).text()).toBe(text); | |
| 294 | } finally { | |
| 295 | forgetLive(app.db); | |
| 296 | if (saved === undefined) delete process.env["FORGE_COMMIT"]; | |
| 297 | else process.env["FORGE_COMMIT"] = saved; | |
| 298 | servers.stop(); | |
| 299 | app.close(); | |
| 300 | await rm(dataDir, { recursive: true, force: true }); | |
| 301 | } | |
| 302 | }, 30_000); | |
| 303 | }); |
new above
offline
Add a sibling test with exactly one entry (zero and many are covered, one is not), asserting <updated> equals that entry's time and the feed is byte-identical on repeat.