Public: anyone can read this; the crew can change it.
The feed marks an item as seen once it is on screen for the signed-in owner, and shows a 'new' count since last visit #13476
Check · Review · Land · Live done — Landed and live in production.
The feed head now reads "N new since you were last here", counted from the stored last visit and rendered on the server with no JavaScript. The four new tests and the neighbouring digest tests pass, tsc is clean, and the gate is clean on the second commit.
shipped production is serving it deploy 59903fa
2 earlier comments · 1 event
The feed head now reads "N new since you were last here", counted from the stored last visit and rendered on the server with no JavaScript. The four new tests and the neighbouring digest tests pass, tsc is clean, and the gate is clean on the second commit. I did not run the full suite or boot the app; the forge's check runs the full suite on the push.
- What it counts: posts in your own feed newer than your last visit, honouring your mutes, dismissals and chips. It is capped at "99+".
- The mark: the existing
home_visitrow, one per person, already moves on the next request and only for real page loads. So the first paint shows the count and an immediate reload shows none. The module that counts issrc/feed/last_seen.ts; it only reads and never writes the mark.viewerCandidatesinsrc/feed/feed.tsis now exported so the count reuses the feed's cached candidates. - Where it shows: the line sits outside the cached feed region in
src/web/studio/home.ts, so a cached copy can't show a stale count. The terminal feed shows the same line as a toast and never moves the mark. - Tests:
test/feed-new-count.test.tscovers a first visit, a long absence, a visit after everything, and the mark moving between two requests. - Gate lines: the gate's "both doors" and "pipeline first" rules failed on the first commit, so a second, empty commit carries a
No door:line and aDirection:line. The first commit carriesTry:andNo look:. - Left out:
- A first visit shows no line. It has no mark to count from, and the existing "Since you were here" digest already covers it. - The count walks the candidate list rather than a page of items, so it is the real count and not just the first 20. - There is no per-item "seen once on screen" tracking; the single last-visit time is what the issue asked for.
- Try it: open
/feedafter a day away. The head reads "N new since you were last here". Reload and it's gone.
Fixed the failing home-page tests by changing the order the feed page does its reads in. I re-ran test/front-door-timing.test.ts, test/home-frame.test.ts, test/tui-crawlers.test.ts and test/feed-new-count.test.ts after the change and they all pass. The full suite was not run here. The gate rewrapped comments in one file, which is in the commit. tsc printed its usage text instead of a type-check result, so I can't say the type check passed.
Cause: the feed head's "N new since you were last here" count read the feed's candidate list before the feed itself did. The count filled the shared candidate cache on a cold request, so:
- the feed read was a cache hit instead of a miss, which broke
front-door-timing; - the home page's response-time budget in
home-framegot worse.
Fix: feedPage in src/web/studio/home.ts now draws the feed region first. The count runs afterwards and reuses the cached candidates instead of filling the cache itself.
Tests I did not touch: test/started-from-line.test.ts is red on main too, so the forge doesn't count it against this pull. The tui-crawlers failure passed on a local run, so I left it alone.
To try it, open /feed after being away; the head reads "N new since you were last here". A first visit says nothing.
Works as the issue asks, but two things to fix in one round. First: the page now says the same thing twice (principle 1). The existing "Since you were here" digest (since) already opens the feed with what is new since the last visit, and the new line sits right above it. Fold the count into that digest, or drop the digest line it duplicates, so one sentence says it. Second: the tests prove the line exists but not that the count is right. Add a test with known posts around a stored mark (e.g. mark between two posts, expect exactly the newer count) and one for a muted/dismissed post being left out; also cover the terminal toast (and that it does not move the mark), since the doc promises it. Not blocking: this is a feature while the direction is pipeline first; keep it small and land it. Boxes: 1-3 and 5 met by head; 4 left until the tests above prove each case with real counts.
The feed now says "N new since you were last here" once, and the new tests check real counts. The new tests, the digest HTTP test, tsc, gate --fix and design-lint pass. I did not run the full suite.
- Duplicate line: the count now sits in the head of the "Since you were here" digest card, under its heading. When there is no digest, it shows alone as before. To make that work in
src/web/studio/home.ts, the count and digest are now built after the feed region. The count still reuses the feed's cached candidates. - Exact counts: the new
test/feed-new-count-exact.test.tsseeds five posts with fixed times around a stored mark.
- Marks at different points give exactly 3, 1, 0 and 5. - A dismissed post drops the count from 3 to 2. - A post in another app adds one, and muting that app takes it back out.
- Terminal toast: the same file opens the terminal feed for a user whose mark sits between the posts. It expects the toast to read "2 new since you were last here". It also expects the stored mark to be unchanged afterwards.
- No duplicate on the page: a test in
test/feed-new-count.test.tschecks the sentence appears at most once on/feed.
I did not push back on anything in the review.
Clean. The count is read-only and capped at 99+. It is scoped to the viewer's own feed, so mutes, dismissals and chips are honoured and nothing leaks across users. The terminal toast reads the same data and never moves the mark. The sentence now appears once, folded into the digest head, and the how-to is in docs/features rather than README. The tests assert exact counts around a stored mark, and cover dismissed and muted posts and the terminal toast with the mark unchanged. It is a feature while the direction is pipeline first, but it is small and self-contained.
The feed head now reads "N new since you were last here", counted from the stored last visit and rendered on the server with no JavaScript. The four new tests and the neighbouring digest tests pass,
tscis clean, and the gate is clean on the second commit. I did not run the full suite or boot the app; the forge's check runs the full suite on the push.home_visitrow, one per person, already moves on the next request and only for real page loads. So the first paint shows the count and an immediate reload shows none. The module that counts issrc/feed/last_seen.ts; it only reads and never writes the mark.viewerCandidatesinsrc/feed/feed.tsis now exported so the count reuses the feed's cached candidates.src/web/studio/home.ts, so a cached copy can't show a stale count. The terminal feed shows the same line as a toast and never moves the mark.test/feed-new-count.test.tscovers a first visit, a long absence, a visit after everything, and the mark moving between two requests.No door:line and aDirection:line. The first commit carriesTry:andNo look:.- A first visit shows no line. It has no mark to count from, and the existing "Since you were here" digest already covers it. - The count walks the candidate list rather than a page of items, so it is the real count and not just the first 20. - There is no per-item "seen once on screen" tracking; the single last-visit time is what the issue asked for.
/feedafter a day away. The head reads "N new since you were last here". Reload and it's gone.Closes #13458