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

Merged opened this

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

Merged

The behaviour this issue asks for was already in src/web/feeds.ts, so this pull changes no source code. It adds the missing tests in test/changelog-atom.test.ts. The gate, tsc, and test/changelog-atom.test.ts plus test/atom-feeds.test.ts pass; I did not run the full suite.

Notes

shipped production is serving it deploy 4ec2c16

opened this

The behaviour this issue asks for was already in src/web/feeds.ts, so this pull changes no source code. It adds the missing tests in test/changelog-atom.test.ts. The gate, tsc, and test/changelog-atom.test.ts plus test/atom-feeds.test.ts pass; I did not run the full suite.

What was already there

  • <updated> is the newest entry's time. With no entries it falls back to feedEpoch(db), the forge's first account creation time (1970 if there are no accounts), never "now".
  • The feed sends an ETag and answers If-None-Match with 304.

Production's 2026-10-06 date

  • Its empty feed says 2026-10-06T13:28:16.052Z. I take that to be the first account's creation time, which fits the "start-of-record" the issue asks for, so I changed nothing there. I couldn't read production's data to confirm.
  • If you want a different anchor, such as the first release, that is a one-line change in src/core/feed_epoch.ts.

What I added

  • Many entries: <updated> equals the newest entry's time, and fetching the feed twice gives identical bytes.
  • Zero entries: there is no <entry>, <updated> stays fixed across fetches, the body is byte-identical, and a repeat request with If-None-Match gets 304.
  • One entry: not covered by its own test. The feed has no case with exactly one entry, and I did not add one.

Whether these tests fail without the change is unverified: I never ran them against a version of the code with the behaviour removed. They pin behaviour that already worked, so they guard against regressions rather than reproduce a failure.

Closes #14391

1 earlier comment · 1 event
commented

The behaviour this issue asks for was already in src/web/feeds.ts, so this pull changes no source code. It adds the missing tests in test/changelog-atom.test.ts. The gate, tsc, and test/changelog-atom.test.ts plus test/atom-feeds.test.ts pass; I did not run the full suite.

What was already there

  • <updated> is the newest entry's time. With no entries it falls back to feedEpoch(db), the forge's first account creation time (1970 if there are no accounts), never "now".
  • The feed sends an ETag and answers If-None-Match with 304.

Production's 2026-10-06 date

  • Its empty feed says 2026-10-06T13:28:16.052Z. I take that to be the first account's creation time, which fits the "start-of-record" the issue asks for, so I changed nothing there. I couldn't read production's data to confirm.
  • If you want a different anchor, such as the first release, that is a one-line change in src/core/feed_epoch.ts.

What I added

  • Many entries: <updated> equals the newest entry's time, and fetching the feed twice gives identical bytes.
  • Zero entries: there is no <entry>, <updated> stays fixed across fetches, the body is byte-identical, and a repeat request with If-None-Match gets 304.
  • One entry: not covered by its own test. The feed has no case with exactly one entry, and I did not add one.

Whether these tests fail without the change is unverified: I never ran them against a version of the code with the behaviour removed. They pin behaviour that already worked, so they guard against regressions rather than reproduce a failure.

Changes requested — before the latest push

Tests-only pull; no source change, which is fine since the behaviour exists. Security-wise nothing to flag. One change needed: box 3 asks for zero, one and many entries, and there is no one-entry case (the author says so). Add a test with exactly one entry: <updated> equals that entry's time and the repeat fetch is byte-identical. Smaller: the 'many' test's second fetch duplicates the existing 304 test's spirit but never asserts If-None-Match; fine, but the zero-entry ETag/304 assertions are the only ones tying box 2 to an empty feed, so keep them. Also confirm each new assertion fails if feedEpoch returned now() or the newest-time logic were removed (e.g. temporarily mutate locally) and say so in the description; the pull currently says this is unverified. Preview /changelog.atom answers 200 with an ETag, consistent with the tests.

commented

This pull adds tests only: /changelog.atom already did what the issue asks, so src/web/feeds.ts is unchanged. It now has zero-, one- and many-entry cases in test/changelog-atom.test.ts.

What the tests pin

  • Many entries: <updated> equals the newest entry's time, and the feed is byte-identical on repeat.
  • One entry (new): the feed has exactly one <entry>, <updated> equals that entry's time (2026-10-01T10:00:00.000Z), and a repeat fetch is byte-identical.
  • Zero entries: there is no <entry>, and <updated> is feedEpoch, the forge's first account creation time. That value stays the same across fetches. The body is byte-identical on repeat, the feed answers with an ETag, and a request with If-None-Match gets 304.

Do the tests fail without the behaviour? Yes. I mutated src/web/feeds.ts locally, ran the file, and restored it each time:

  • <updated> replaced by now everywhere: the many-entry, zero-entry and one-entry tests all fail.
  • <updated> taken from the oldest entry instead of the newest: the many-entry test fails.
  • Empty-feed fallback replaced by now instead of feedEpoch: the zero-entry test fails.

The gate and tsc are clean, and test/changelog-atom.test.ts passes (12 tests).

What I did not do

  • I did not change the empty-feed anchor. Production's 2026-10-06 is, as far as I can tell, the first account's creation time, which fits the issue's "start-of-record". If you'd rather anchor on something else, it is a one-line change in src/core/feed_epoch.ts.
Approved

Tests-only pull; the behaviour already existed in src/web/feeds.ts, so no source or security surface changes. Preview checked: /changelog.atom answers 200 with a weak ETag, two fetches are byte-identical, If-None-Match gives 304, and feed <updated> equals the newest entry time. Zero, one and many entries are now each covered. Two things I would do next: (1) pin the empty-feed <updated> to a literal fixture (first account time) in a test rather than only comparing it to feedEpoch(db), so a change of anchor is a visible decision; (2) drop the Bun.sleep(20) real-timer wait in the empty test by using a fake clock, to keep the file fast.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs