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

A post in the feed says how long ago its run finished in plain words, and the words never change width on refresh #14713

Merged opened this

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

Merged

Run posts in the feed now say how long ago the run finished, in plain words, in the first paint. The tests for the feed card pass (137 across 21 files), and tsc, scripts/gate.ts --fix and design-lint are clean. I didn't take before/after screenshots or run the app.

Notes

shipped production is serving it deploy 5b5da4d

opened this

Run posts in the feed now say how long ago the run finished, in plain words, in the first paint. The tests for the feed card pass (137 across 21 files), and tsc, scripts/gate.ts --fix and design-lint are clean. I didn't take before/after screenshots or run the app.

What changed

  • A new src/feed/finished_label.ts builds the label from the run's end time and the request clock. It reads "finished 30 s ago", "finished 4 min ago", "finished 3 h ago", "finished yesterday", "finished 2 d ago" and "finished 40 d ago". An unreadable time gives no label.
  • feedCard in src/web/studio/feed.ts uses it for run posts that link to a run page. It reuses the existing <time> element, so the exact UTC time stays in title and datetime.
  • test/feed-run-time.test.ts builds runs ending 30 s, 4 min, 3 h, 1 d, 2 d and 40 d ago and asserts each label and its title. It also checks that headline and actor text are escaped, and that a non-run post keeps "3h ago".
  • I changed test/feed-age.test.ts: it used a run post to test the short "3h ago" age, which run posts no longer show. It now uses a tell post.

Not done

  • The label sits inside the existing <time> element, which only reserves 7 characters. The words are longer than that, so the line can still shift slightly when a post moves from seconds to minutes, minutes to hours, or hours to days. I left src/web/style/base.ts alone because the issue limits the change to the feed card.
  • Failed runs also read "finished …", and sync failures keep the short age.
  • I didn't reuse the existing labeller: ago in rank.ts, agoWords in follow_words.ts and timeAgo in ui.ts use different wording, so a small run-specific module was simpler.

Try it Open / signed in and read a run post's time. Hover it to see the full UTC time.

[{"go":"/","look":"a crew run post's time in its byline","expect":"reads \"finished 4 min ago\" (or h/d/yesterday) in the first paint, full UTC time on hover; non-run posts keep \"3h ago\""}]

🤖 Generated with Claude Code

Closes #14704

Show 16 earlier items

7 earlier comments
commented

The run age in the feed now keeps a fixed width, so it no longer changes size as it grows older. tsc, the design lint and the feed tests pass, and the forge runs the full check on this push.

  • Width: the age sits in a new time[datetime].age slot with min-width: 10ch, sized to the longest label, 59 min ago. .age is documented in docs/design/areas/feed.md, and AGE_SLOT_CH ties the CSS to the label module so a test can check them together.
  • "finished" dropped (1): the label is now elapsed time only (4 min ago). The headline already says whether the run finished or failed.
  • "yesterday" replaced (2): it is now 1 d ago, 2 d ago and so on, counted from elapsed hours.
  • Screen readers (3): the permalink's aria-label is now Open post, 4 min ago, so the age is announced. I kept the link wrapper rather than moving the age out of it.
  • Tests (4, 5): the new tests cover the slot class, the aria-label, the label length at 59 min and 999 d, and the 23 h 50 min, 47 h and 49 h edges. I also loosened the regex in test/feed-time-title.test.ts so it accepts the new class on <time>.
  • 360px not checked: I did not look at the byline in a real 360px browser here. The slot is nowrap and 10ch wide, and the byline already allows wrapping, but please check it on the preview. A short review block for that check follows.
[
  {"go": "/feed", "look": "A run post byline at 360px width", "expect": "App name, age (e.g. '4 min ago') and badge wrap without horizontal overflow; the age does not shift width on refresh"}
]
commented

I merged main into the branch and pushed. The only conflict was the import block in src/web/studio/feed.ts, and I kept both sides: ONLY_LEAD from main and finishedLabel from this pull.

  • Tests: I ran the three age tests this pull adds (feed-age, feed-run-time, feed-time-title) plus seven other feed test files. All 53 tests pass. I did not run the full suite, because scripts/fast.ts found the change too broad to name tests for. The forge runs the full check on the push.
  • Type check and design lint: bun x tsc --noEmit and bun scripts/design-lint.ts are both clean.
  • Gate: bun scripts/gate.ts --fix raised one similarity note and changed nothing. It says finishedLabel in src/feed/finished_label.ts scores 0.61 against queuedPhrase in src/web/ui.ts and asks "one implementation?". I left both as they are, since merging them is outside this conflict resolution.

The sandbox blocked one network request (alpha--localhost:80) during a stray test run that I stopped. It doesn't affect the result.

commented

<!-- look-pages af91cc51b30a --> Look pages for af91cc5, from the gate:

  • look pages (inferred): this pull changes src/web/studio/feed.ts, src/web/style/base.ts; the forge pictures / (src/web/studio/feed.ts), /docs (src/web/studio/feed.ts), /explore (src/web/studio/feed.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A run post's age now keeps a fixed-width slot, is worded by elapsed time, and is read aloud. The fixed slot is sized to the longest label, 59 min ago. I merged current main into the branch and fixed the one failure that was this pull's own.

  • Cause: the dead-code test (test/unused-exports.test.ts) flagged AGE_SLOT_CH in src/feed/finished_label.ts, because only a test used it.
  • Fix: src/web/style/base.ts now writes the slot width from that constant, so the export has a caller. The feed-run-time test now reads the rendered stylesheet rather than the source file, and it passes. tsc and the design lint are clean.
  • Main-branch failures: the check log says the other five failures (the fetch-timeout, relative-time, page-budget, SQL-budget and /llms.txt tests) are also red on main. I did not touch them. test/time-element.test.ts still fails in my local run too, on a <time> written by hand in src/web/pages/passkeys.ts.
  • client-list: it failed in the earlier check but isn't in this one. My run for it timed out, so I never reproduced it.
  • Left as is: the gate still asks whether finishedLabel and queuedPhrase in src/web/ui.ts should be one implementation (0.61 similar). I kept them separate, since they're worded differently.

Look at src/web/style/base.ts and test/feed-run-time.test.ts.

commented

<!-- look-pages 69a7a3f6f644 --> Look pages for 69a7a3f, from the gate:

  • look pages (inferred): this pull changes src/web/studio/feed.ts, src/web/style/base.ts; the forge pictures / (src/web/studio/feed.ts), /docs (src/web/studio/feed.ts), /explore (src/web/studio/feed.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The only feedback was the gate's automated list of look pages, with no change requested. It inferred 28 pages, because every route that imports src/web/studio/feed.ts counts. The age label only renders on feed cards, so I pushed an empty commit with a Looks: / line to narrow the pictures to the home feed. I haven't seen the gate re-run on it, so whether it takes that line is untested.

No code changed in this push. The earlier fix still stands: the stylesheet reads the age slot's width from AGE_SLOT_CH.

Still red, as before:

  • test/time-element.test.ts is red on main too, on the hand-written <time> in src/web/pages/passkeys.ts. I left it alone.
commented

<!-- look-pages 4d582387f3f2 --> Look pages for 4d58238, from the gate:

  • look pages (named): this pull changes src/web/studio/feed.ts, src/web/style/base.ts; a commit names /
commented

The gate's note on 4d58238 only says which page it will look at: /, because the pull touches src/web/studio/feed.ts and src/web/style/base.ts and the commit names it. It asks for no change, so I made none and pushed nothing. bun scripts/design-lint.ts passes on the branch.

What changed: a feed post now says how long ago its run finished in plain words. The age label sits in a fixed-width slot, and the stylesheet reads that width from AGE_SLOT_CH. A refresh that changes the words, for example "2 minutes ago" to "3 minutes ago", therefore doesn't shift the layout.

Not done: the other pages that import the age module show no age label, so I added no look for them. Only feed cards, which / renders, show it.

Try it: open / and look at the age label on each feed card. Refresh it and check that nothing around the label moves.

[{"go":"/","look":"the age text on a feed card","expect":"plain words such as '3 minutes ago', and the card layout does not shift when it changes on refresh"}]
Approved

Earlier asks are met: the age keeps a 10ch slot (.age, documented in docs/design/areas/feed.md), the label is elapsed time only, "yesterday" is now "Nd ago", the permalink aria-label carries the age, and the edge cases (23h50m, 47h, 49h, 59 min, 999 d) are tested. It is server-rendered with the full UTC time in title, so it works with JavaScript off. Next, I would do two things (non-blocking): 1) check the byline at 360px in the preview, since the slot is nowrap; 2) fold finishedLabel and queuedPhrase into one implementation if the wording can be shared.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs