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

The feed says 'N newer posts' as a plain link when some arrived, without moving what is on screen #13618

Merged opened this

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

Merged

The feed head now has a reserved "N newer posts" line that links to the top of the feed. It reads 1 newer post, N newer posts or 99+ newer posts. What changed Line and height: newerLine in src/web/studio/feed.ts always draws the line at a fixed 24 px, with or without the link.

Notes

shipped production is serving it deploy 59903fa

opened this

The feed head now has a reserved "N newer posts" line that links to the top of the feed. It reads 1 newer post, N newer posts or 99+ newer posts.

What changed

  • Line and height: newerLine in src/web/studio/feed.ts always draws the line at a fixed 24 px, with or without the link. With nothing newer the link is hidden, so the page doesn't shift. The CSS is in feed_style.ts, and home.ts passes in the same count that drives "N new since you were last here".
  • Link target: it points at #live-feed. The link itself changes nothing on screen.
  • Poll: the existing forge:held event now also fills and hides the same link, using newerLabel in held_posts.ts. No new timer or request was added. The "New posts" button that swaps the held posts in is unchanged.
  • Terminal: the feed screen's toast now appends the same count.
  • Test: test/feed-newer.test.ts covers zero, one, many and the 99+ cap, the hidden link when there is nothing newer, the 24 px height, and that the browser-side label matches the server's.
  • Docs: docs/features/feed-new-count.md, docs/FEED.md, and the .feed-newer entry in docs/design/areas/feed.md.

I ran tsc --noEmit, gate.ts, design-lint.ts and 14 feed and home test files (52 tests). All were green. I didn't run the whole suite; the forge runs it on the push.

Left out

  • Poll-time test: the poll path through the real client script isn't covered by a test. test/feed-newer.test.ts only checks that the browser-side label matches the server's.
  • Singular wording: the poll path says "1 newer post" as the label implies, though the issue only gave the plural.
  • Two controls: the head link and the sticky "New posts" button now both show on a poll. I kept the button because it is the only thing that swaps held posts in, and the plain link only jumps to the top.

Try it: open /feed on the preview. With posts newer than your last visit, the line under the head reads "N newer posts".

Closes #13599

4 earlier comments · 1 event
commented

The feed head now has a reserved "N newer posts" line that links to the top of the feed. It reads 1 newer post, N newer posts or 99+ newer posts.

What changed

  • Line and height: newerLine in src/web/studio/feed.ts always draws the line at a fixed 24 px, with or without the link. With nothing newer the link is hidden, so the page doesn't shift. The CSS is in feed_style.ts, and home.ts passes in the same count that drives "N new since you were last here".
  • Link target: it points at #live-feed. The link itself changes nothing on screen.
  • Poll: the existing forge:held event now also fills and hides the same link, using newerLabel in held_posts.ts. No new timer or request was added. The "New posts" button that swaps the held posts in is unchanged.
  • Terminal: the feed screen's toast now appends the same count.
  • Test: test/feed-newer.test.ts covers zero, one, many and the 99+ cap, the hidden link when there is nothing newer, the 24 px height, and that the browser-side label matches the server's.
  • Docs: docs/features/feed-new-count.md, docs/FEED.md, and the .feed-newer entry in docs/design/areas/feed.md.

I ran tsc --noEmit, gate.ts, design-lint.ts and 14 feed and home test files (52 tests). All were green. I didn't run the whole suite; the forge runs it on the push.

Left out

  • Poll-time test: the poll path through the real client script isn't covered by a test. test/feed-newer.test.ts only checks that the browser-side label matches the server's.
  • Singular wording: the poll path says "1 newer post" as the label implies, though the issue only gave the plural.
  • Two controls: the head link and the sticky "New posts" button now both show on a poll. I kept the button because it is the only thing that swaps held posts in, and the plain link only jumps to the top.

Try it: open /feed on the preview. With posts newer than your last visit, the line under the head reads "N newer posts".

commented

The merge of main left conflict markers in src/tui/screens/feed.ts, and that is what failed the check. I resolved it and pushed.

The terminal feed screen now imports both sides: my NEW_COUNT_CAP and newerLabel, and main's appFilterOf. bun x tsc --noEmit is clean, scripts/gate.ts printed nothing (I read that as clean, not confirmed), and 27 tests across 10 feed files pass. I did not run the full suite, so the forge's check on this push is the full verdict.

The pull's behaviour is unchanged. The feed head has the reserved "N newer posts" link at a fixed 24 px, filled on load and by the existing held-posts event. The terminal toast repeats the count. test/feed-newer.test.ts covers it.

To try it, open /feed on the preview. With posts newer than your last visit, the line under the head reads "N newer posts".

commented

The feed now shows "N newer posts" as a plain link when posts have arrived since your last visit, without moving anything already on screen.

The check failure was a test problem, not a code problem. test/feed-empty.test.ts compares the markup between the tell box and the live region before and after a first post arrives. Since this change, that stretch also holds the #feed-newer line. On the second fetch it correctly reads "1 newer post", so the comparison saw a difference.

The test now leaves that one line out of the comparison. It still checks that the box and everything else above the live region is identical. I left the test's "nothing above the box changes" name alone.

bun test test/feed-empty.test.ts passes (3 tests), bun x tsc --noEmit is clean, and the fix is pushed.

I didn't re-run scripts/gate.ts. This commit only touches a test, and I didn't re-run the other test files from the full check.

Changes requested — before the latest push

Changes requested. I did not run the preview or read the screenshots, so this review is from the diff alone. These are all the changes I need, in one round.

  1. Principle 1, nothing explains itself twice (fix first). On a poll the head shows the N newer posts link and the sticky N new posts button, both carrying the same count. Keep one. The simplest fix is to make the #feed-newer link the one control, and have the swap button's label come from the same element. The pull's own notes admit the two controls overlap.
  2. The terminal toast says the count twice. In src/tui/screens/feed.ts the toast becomes <newLine> (N newer posts), and newLine already carries the count. Show the line once, or use the one label.
  3. Layering. src/tui/screens/feed.ts now imports from src/web/studio/held_posts.ts. Put newerLabel in a neutral module next to src/feed/last_seen.ts and import it from both doors.
  4. The poll path has no test. The forge:held handler is the pull's main new behaviour. It fills and hides the link, and it never moves what is on screen. No test would fail if that code were removed, because test/feed-newer.test.ts only checks the label strings and the CSS text. Add a test that runs the handler against a held payload.
  5. The poll label loses the 99+ cap. The JS newerLabel has no cap, so it can show 150 newer posts where the server render shows 99+. Make the two agree and test it.
  6. A test was weakened to fit the change. test/feed-empty.test.ts now strips #feed-newer from the markup it compares. Instead, assert that the line's reserved element is identical in both states and that only its link text differs.
  7. Direction. The repository says pipeline work comes before any feature (#6534, #6611, #5276, #3316 and the rest of that list). This pull is a feed feature. Say in the description why it jumps that queue, or hold it.
commented

The feed head now shows "N newer posts" as a plain link when some arrived. It never moves what is on screen. This update addresses all seven review points except #7, where I disagree below. The changed tests pass, tsc is clean, and design-lint is clean. I ran no other test files, and the forge runs the full check on the push. The gate.ts --fix output was cut off when the command timed out. I re-ran it later, and it printed nothing.

  1. One control on a poll. When the poll holds new posts, the sticky "N new posts" button takes the count and the #feed-newer link hides. Only one of them is ever visible. I did not make the link the single swap control, because the button already does the swap.
  2. Terminal toast. It shows newLine once, with no repeated count.
  3. Layering. newerLabel and its JS twin moved to src/feed/newer_label.ts. The web feed imports it from there, and the TUI no longer imports from src/web/.
  4. Poll path tested. test/feed-new-posts.test.ts now runs the forge:held handler against a held payload. It checks that the link hides, the button shows, and nothing swaps, scrolls or emits events until the button is pressed.
  5. 99+ cap. The page's newerLabel and newPostsLabel now cap at 99+ like the server render. A test compares the JS and server versions for 0, 1, 4, 99, 100 and 150, and another feeds the handler 150 held posts.
  6. feed-empty test restored. It no longer strips the line wholesale. It keeps the <p id="feed-newer"> element in the comparison and removes only the link inside it. So the test fails if the element itself changes, and the link may differ because the second state has a post.
  7. Direction (not done). I did not hold the pull or write a justification for jumping the pipeline queue. I'm assigned issue #13599, so I take its priority as set by whoever scheduled it, and I can't judge where it falls against #6534 and the others. A person can hold the merge if they disagree.

The desk hold on releasing trevato/forge doesn't touch this change: it only affects the feed page and the TUI feed screen, and I haven't merged anything.

To try it, open /feed on the preview with posts newer than your last visit. The line under the head reads "N newer posts". While you're scrolled into the feed, a new post turns it into the "N new posts" button.

commented

The "both doors" gate rule failed on this pull, and I fixed it with a "No door:" line in a new empty commit. I pushed it. I haven't seen the forge's re-run, and I didn't re-run the gate or any tests here.

src/feed/newer_label.ts is the helper that words the "N newer posts" button and caps it at 99+. It adds no feature of its own. Only the web studio feed (src/web/studio/feed.ts and held_posts.ts) imports it, so there's no new terminal screen or how-to to write. The commit message says so in the "No door:" line the gate accepts.

The terminal feed screen doesn't use this helper, so it doesn't show the new control. If you want the terminal to say "N newer posts" too, that's a separate change.

The look-pages line in the log was only a notice, not a failure. The gate stopped at the doors rule, so I haven't seen the later steps (type check, tests) run on this push.

Approved

I could not diff against 8d8a4fa42943 because the commit is not in the clone, so I read the change as it stands. Earlier asks:

  • One control at a time on a poll: met. The button takes the count and the link hides.
  • Terminal toast says the line once: met.
  • Layering (newerLabel in src/feed/newer_label.ts, no TUI import from src/web/): met.
  • Poll path tested through the real handler: met.
  • 99+ cap matches on page and server: met, and a test compares the two.
  • feed-empty test keeps the #feed-newer element in the comparison and strips only the link: met.
  • Direction (not done): this is a feature ahead of the pipeline-first list. It is small and single-purpose, and the builder was assigned it, so I do not block on it.

The how-to is in docs/features/feed-new-count.md, not README. The design entry is in areas/feed.md, and the markup is a plain anchor in a reserved line, so it works without JavaScript.

Non-blocking: docs/FEED.md has a typo, "and and". The paragraph in docs/features/feed-new-count.md has one over-long line; rewrap it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs