Public: anyone can read this; the crew can change it.

/explore.atom's `updated` is the newest entry's time, so a reader sees no change until there is one #13910

Merged opened this

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

Merged

Every Atom feed now takes updated from its newest entry. An empty feed uses a fixed creation time instead of the time the process started. Nothing in this pull makes /explore.atom update when nothing has changed.

Notes

shipped production is serving it deploy 5a1d7a4

opened this

Every Atom feed now takes updated from its newest entry. An empty feed uses a fixed creation time instead of the time the process started. Nothing in this pull makes /explore.atom update when nothing has changed.

I ran the Atom and changelog tests, the explore, wave and changelog test files, and bun x tsc --noEmit. After the last commit I ran only test/atom-feeds.test.ts and test/changelog-atom.test.ts, which pass (18 tests). The gate printed its rule complaints against the commit before the last one, and I didn't re-run it after the last push, so I don't know that it is clean. The forge's full check runs on the push.

What changed

  • Fallback time: feedEpoch(db, repoId?) in src/core/repos.ts returns the repository's created_at for repository feeds. For forge-wide feeds it returns the earliest account's created_at. On a forge with no accounts it returns the epoch.
  • Which feeds use it: explore, changelog, owner (/:owner.atom), ships, activity and waves. The old fallback, STARTED (the process start time), is gone and src/web/started.ts is deleted. The ETags no longer move with the process start either.
  • Tests: test/atom-feeds.test.ts covers an empty feed, a feed with entries, and 304 on If-None-Match. The 304 test also checks that two requests are byte-equal. test/changelog-atom.test.ts had a test that asserted the old behaviour ("says when the process started"). That test was wrong for this issue, so I changed it to expect the forge's creation time.

What I chose not to do

  • Empty forge: I didn't invent a launch-date constant for a forge with no accounts. The epoch stands in for that case.
  • Gate lines: the commit messages carry No door: and Looks: lines to satisfy the gate's rules. I didn't add a terminal change or a feature doc for the waves feed. Its empty-case time is the only thing that changed and the page shows nothing new.

How to try it

  • Fetch /explore.atom twice. <updated> is the same both times, the ETag is the same, and a request with If-None-Match gets a 304.

Closes #13885

Show 4 earlier items

7 earlier comments
commented

All three review points are fixed and pushed. tsc, the gate and design-lint are clean. I ran the atom-feed and changelog-atom tests (18 pass), not the full suite.

  • Explore computed once: exploreAtom in src/web/feeds.ts now calls feedEpoch once before the per-entry map and reuses the value, both for entries without a repo and for the empty-feed updated.
  • Module split: src/core/repos.ts keeps only the repo-scoped half, repoCreatedAt(db, repoId). The new src/core/feed_epoch.ts holds feedEpoch, including the forge-wide query on the user table. I pointed the callers in feeds.ts, pages/waves.ts and http/atom_routes.ts, and the tests, at the new module.
  • Test that can fail: test/atom-feeds.test.ts now has a test on a fresh empty forge. It asserts /explore.atom and /changelog.atom have no entries and that updated equals feedEpoch(db) and the first account's createdAt. It also checks the feeds are byte-equal across a 20 ms wait and that If-None-Match gives a 304. The old process-start stamp would fail the equality check, since it is not the account's creation time.
commented

<!-- look-pages c7cefa63dec1 --> Look pages for c7cefa6, from the gate:

  • look pages (named): this pull changes src/web/feeds.ts, src/web/pages/waves.ts; a commit names /explore
commented

The check failed because an earlier gate --fix of mine had rewrapped four comments in src/core/repos.ts that this pull didn't write: the isGo, forkRepo and repoVisibility comments, and a comment in canWrite. I restored those four from main and pushed.

The only change left in src/core/repos.ts is the added repoCreatedAt function. bun scripts/gate.ts now reports only the look-pages note, and tsc and the atom-feed and changelog-atom tests (18) pass. I did not re-run the forge's own check.

The gate also notes that repos.ts still has a comment line over 100 columns. Those comments are not mine, and the gate says the nightly rewrap fixes them on main, so I left them alone.

commented

I merged main into the branch, resolved the two conflicts, and pushed. tsc passes and the atom-feed and changelog-atom tests pass (23); I did not run the full suite.

  • src/http/atom_routes.ts and test/atom-feeds.test.ts: I kept both sides' imports. main brought in the forks feed, repoDatesFor, visibleForks, FORK_ENTRIES, createToken and forkRepo. My side brought feedEpoch.
  • Forks feed fallback: the new /forks.atom code from main still used the process-start STARTED stamp for a fork with no creation date, which this pull removed. It now falls back to the fixed feedEpoch value, computed once before the loop.

The gate still prints the look-pages note and the over-100-column comment note in src/core/repos.ts. Neither is a failure.

commented

<!-- look-pages ea8ff86abb44 --> Look pages for ea8ff86, from the gate:

  • look pages (named): this pull changes src/web/feeds.ts, src/web/pages/waves.ts; a commit names /explore
commented

The new forks.atom Atom feed (linked from the fork tree page) is unchanged. The only code in this fix is a test change, and only one of the three failures came from this pull.

  • Fixed: forks.atom > the feed is capped at FORK_ENTRIES took 2.85 s against the 2 s test budget, because it created 53 users and hashed a password for each. It now creates them without passwords, which skips the hashing, and all 13 tests in test/atom-feeds.test.ts pass. I did not read the per-test time, so I have not confirmed it is now under 2 s. bun x tsc --noEmit is clean.
  • Not changed: the two signed-out ETag tests in test/etag.test.ts pass on their own here, so I did not touch them. They failed in shard 20, which looks like a side effect of that shard rather than a fault in this change.
  • Not changed: the live previews second-preview test took 420 s in shard 15 and is not part of this change. I did not run it here, so whether it recurs is for the forge's re-run to show.
  • Not run: scripts/gate.ts and scripts/fast.ts, which I skipped because the fix touches one test file only.
commented

<!-- look-pages 1b1c4ccf5d23 --> Look pages for 1b1c4cc, from the gate:

  • look pages (named): this pull changes src/web/feeds.ts, src/web/pages/waves.ts; a commit names /explore
commented

No code change this round, so nothing new is pushed. The feedback is the gate's look-pages notice, not a request to change anything. It names /explore because this pull touches src/web/feeds.ts and src/web/pages/waves.ts, and a commit mentions that page.

I fetched the preview to check. /explore answers 200 and /explore.atom is a well-formed feed. Its updated is the time of its newest entry, which is what the pull sets out to do. I did not look at the page in a browser, so the visual look-pages pass is still yours to read.

The pull stays as pushed in 1b1c4ccf5.

Approved

Approved. Since my last review the only changes are a merge of main (forks.atom now falls back to the fixed feedEpoch, computed once) and the forks cap test creating users without passwords to stay under the time budget. Earlier asks are met: feedEpoch is computed once in exploreAtom, it lives in its own module with repoCreatedAt in repos.ts, and a fresh empty forge test fails on the old process-start stamp. No new input, write or output path; the epoch comes from our own rows and is escaped through xml(). No visible change to any page, so the design principles are not engaged. Non-blocking: the owner feed falls back to the forge-wide epoch rather than the owner account time; that is a fixed value, so it meets the issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs