Public: anyone can read this; the crew can change it.
The like ledger pages past twenty names: a cursor on the API and a "more" row in the feed screen #15276
Check · Review · Land · Live done — Landed and live in production.
The like ledger now takes a cursor and limit and answers nextcursor. The post's "and N more" links to it, and in the terminal h loads the next page. The pushed code type-checks, and about 680 tests covering the feed, the terminal feed and the API contract pass.
shipped production is serving it deploy b03b44b
12 earlier comments · 2 events
The like ledger now takes a cursor and limit and answers next_cursor. The post's "and N more" links to it, and in the terminal h loads the next page. The pushed code type-checks, and about 680 tests covering the feed, the terminal feed and the API contract pass. I did not run the full suite, because scripts/fast.ts named 3,300 test files and the forge runs the full check on push. The two new feed tests and the terminal paging test fail without the change.
What changed
- API:
GET /api/v1/feed/likestakescursor(a ledger seq;beforestill works as an alias) andlimit(1 to 200, default 50). It answersnext_cursor, which is null on the last page, and keepsmore. A badcursororlimitgets a 422. The parsing isparseLedgerLimitinsrc/feed/likes.ts, and the contract entry and docs are updated. - Post: for administrators, "and 3 more" is a link to
/api/v1/feed/likes?item=…&app=…&limit=200, built insrc/web/studio/feed.ts. - Terminal: in the like ledger,
hagain loads the next page. The oldmstill works, and the footer now reads "h older". - Tests:
test/feed-like.test.tscovers cursor and limit paging, the bad values, a 404 for an unreadable item, and the link.test/tui-feed-reply.test.tscovershpaging.
What I left out
- The ledger "page" is the JSON endpoint, not a styled page. I noted this in
docs/features/likers.md. - I did not add an admin check to the ledger route. By design, documented in
docs/features/feed-like-ledger.md, any reader of an item may see its likers there, and existing tests assert it. Names on the post line are still shown only to administrators of the app. Say if you want the route restricted too. - No before/after screenshots or look were captured.
Review
[{"go":"/feed as an admin of an app whose post has more than 20 likes","look":"the muted line under the post","expect":"Liked by …20 names and a link reading 'and N more'"},
{"go":"click 'and N more'","look":"the JSON","expect":"ledger rows, limit 200, next_cursor null or a seq"},
{"go":"terminal Feed screen, h on that post, then h again","look":"the ledger list","expect":"older rows are appended; the footer drops 'h older' on the last page"}]
The first push was refused by the pre-push hook because the commits carried no "Try:" line. I added an empty Try: commit and it went through.
<!-- look-pages 0c7b9eccf5b9 --> Look pages for 0c7b9ec, from the gate:
look pages (inferred): this pull changes src/web/studio/feed.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
I fixed the gate failure and pushed. The gate no longer reports the as never rule, bun x tsc --noEmit passes, and bun test test/feed-like.test.ts passes (25 tests). I haven't seen the forge's check run on the new push yet.
The cast was in my own new test in test/feed-like.test.ts, the one for the "and N more" link. It now builds its card from a real item read with readFeed and adds likedBy and likedByMore to it.
The gate also notes that src/http/feed.ts has a comment line over 100 columns. It says no action is needed and the nightly rewrap handles it on main.
Pull description (unchanged except for the test fix):
The like ledger now pages. GET /api/v1/feed/likes takes cursor (a ledger seq; before still works) and limit (1 to 200, default 50), and answers next_cursor (null on the last page) alongside more. A bad value gets a 422. For administrators, the post's "and N more" links to the ledger. In the terminal's like ledger, h again loads the next page, and m still works.
Not done: the ledger "page" is the JSON endpoint, not a styled page. I did not add an admin check to the ledger route: by documented design any reader of an item may see its likers there, and existing tests assert it. Names on the post line are still shown only to administrators of the app.
Try: open /feed as an admin of an app with a post liked more than twenty times, click "and N more", and in the terminal's Feed screen press h twice on that post.
[{"go":"/feed as an admin of an app whose post has more than 20 likes","look":"the muted line under the post","expect":"Liked by …20 names and a link reading 'and N more'"},
{"go":"click 'and N more'","look":"the JSON","expect":"ledger rows, limit 200, next_cursor null or a seq"},
{"go":"terminal Feed screen, h on that post, then h again","look":"the ledger list","expect":"older rows are appended; the footer drops 'h older' on the last page"}]<!-- look-pages 10e12701d1e5 --> Look pages for 10e1270, from the gate:
look pages (inferred): this pull changes src/web/studio/feed.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
What changed: GET /api/v1/feed/likes now checks limit and cursor before it looks up the item. A bad value gets the shared 422 shapes, limitRefusal and cursorRefusal from contract/page_query.ts, with field set and the standard message. Before, a bad limit with no item got invalid_item. A bad value with an item got invalid_limit or invalid_cursor, but without field. That broke test/list-limit-shape.test.ts, the two tests in the check's red.
Not confirmed: I did not reproduce the three lane/disk tests from shard 60, and I did not look into why they failed. test/vitals.test.ts, the file with the lane test, passes here, so they may have been flaky or unrelated.
Checked: bun x tsc --noEmit is clean. list-limit-shape, feed-likes* and vitals pass. So do 1199 tests across the 140 files whose names match like, ledger, feed, openapi or contract. scripts/fast.ts found the diff too broad to name tests, so I did not run the full suite.
Left out: the MCP feed_like tool still answers invalid_before with its own wording. It is not a list route, so I left it alone.
Try it: GET /api/v1/feed/likes?limit=0 answers 422 invalid_limit with field: "limit".
<!-- look-pages 59d85e9561e4 --> Look pages for 59d85e9, from the gate:
look pages (inferred): this pull changes src/web/studio/feed.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
Cursor/limit paging is sound: validated at the boundary, 422 shapes shared, tests fail without the change, TUI h pages. Two things to fix. First: the "ledger page" an admin lands on is raw JSON, which is not a page; render a real ledger page (rows, with a "more" link carrying the cursor) or the link strands admins with over 200 likes. Second: no before/after looks were captured, which the issue's last box requires. Smaller: the link is muted, so nothing marks it as interactive; and the long json(...) line should be wrapped.
"and N more" on a post now opens a rendered ledger page, so an admin can page through any number of likes. Typecheck and the 170 feed/route/page test files pass, including a new test for the page. I captured no before/after pictures.
- Ledger page:
GET /feed/likes?item=…&app=…[&cursor=seq]is a normal signed-in page showing who, when, and Liked or Unliked, 50 rows a page, newest first. An "Older likes" button carries the cursor and disappears on the last page. It uses the same access check and the same rows as the API, so a reader sees only what the API would show them. A bad cursor, an unknown item or a private item gives the 404 page. The code is insrc/web/studio/ledger_page.ts, registered insrc/http/server.ts. The oldlimit=200baked into the link is gone. - Link style:
class="muted"is removed from the "and N more" link, so it now has the normal link look. next_cursor: it comes from a smallnextCursor(page)helper insrc/feed/likes.ts, and the longjson(...)line is wrapped.- Test:
test/feed-like.test.tshas a new test that walks the 60-row ledger: first page, Older link, last page, bad cursor, secret item. The old link assertion now expects/feed/likes?…. - Looks: I put
Looks: /feedin the commit message so the forge pictures the page the link lives on. I did not capture before/after pictures myself, since this sandbox can't reach the forge's look tooling. The new/feed/likespage is not in that line.
Left out: the ledger page has no limit control. The API still takes limit up to 200.
Try it: as an admin of an app whose post has more than 20 likes, open /feed and click "and N more".
<!-- look-pages 2834a3c2173b --> Look pages for 2834a3c, from the gate:
look pages (inferred): "Looks: /feed" is not a page of app.looks in forge.json; this pull changes src/web/studio/feed.ts, src/web/studio/ledger_page.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
I pushed one empty commit whose message carries the three lines the gate asked for. No code changed, and I did not re-run the check after pushing. A local bun scripts/gate.ts --fix printed no rule failure, only the over-100-column comment note.
No look:/feedis not a page inapp.looks, so my earlierLooks: /feedline was wrong. The ledger page needs a signed-in viewer and a post with likes, which no looks page has. A test intest/feed-like.test.tswalks it instead.No door:the terminal already pages the ledger on this pull. The Feed screen'shkey lists it andmreads older rows.Direction:names #15260, the issue this branch is for. The commit says the ledger paging is that issue's own ask and the rendered page was asked for in review. I used #15260 because the branch name carries it. The pull is #15276, so if the gate wants a different issue number, tell me.
The like ledger is now a page at /feed/likes: it lists likes and unlikes, newest first, with an "Older likes" link carrying the cursor. "and N more" in the feed opens it as a link. This push fixes two of the four failing checks. The other two are untouched; I think they are shard-only flakes, but I did not confirm that.
- Audit test:
/feed/likeshad no entry indocs/design/audit.md. I added one. - Server-Timing sweep: the page did not name
sessionandrenderphases.src/web/studio/ledger_page.tsnow namessessionfirst. It namesrenderon every path, including the not-found ones, because the sweep requests the bare route. - Not touched: "the guides are read once however many requests come" and "a refresh that throws synchronously raises nothing uncaught" failed in shard 71 and have nothing to do with this change.
test/sitemap-guides.test.tspasses here. I did not look for a reason they failed on the forge. - Local run:
tsc,design-lint, the sweep, the audit andtest/feed-like.test.tsall pass.bun scripts/gate.ts --fixreported nothing to fix. - Not left out: the page has no JavaScript and adds no dependencies.
To try it: open /feed as an admin of an app whose post has more than twenty likes, and click "and N more".
[
{"go": "/feed", "look": "a post with more than twenty likes shows 'and N more' as a link", "expect": "clicking it opens /feed/likes with rows of Liked/Unliked badges"},
{"go": "/feed/likes?item=x", "look": "an unknown item", "expect": "a not-found page, not an error"}
]Preview opened: / answers 200 and /feed/likes?item=x answers 303 to sign-in for an anonymous caller. The look files listed for this head do not exist in my sandbox (the directory is absent), so the page is judged from its code and tests, not from a picture.
The rendered /feed/likes page answers my earlier ask well. It uses the same readInteraction door and likeLedger rows as the API, 404s on a bad cursor or an unreadable item, and keeps Server-Timing phases. The audit entry is added.
One thing to fix first: docs/features/likers.md now contradicts the head. It says "and 3 more" links to GET /api/v1/feed/likes?...&limit=200, and it ends with "Not done: the ledger page is JSON, not a styled page". The link opens the HTML page /feed/likes?item=…&app=…[&cursor=seq] (50 rows a page, "Older likes" link), so rewrite that bullet and drop the "Not done" clause. Add one line about the page to docs/features/feed-like-ledger.md too.
Non-blocking: the page reads only cursor, while the API also accepts before; say so in the doc.
Non-blocking: check listCard is the named rows component under principle 7 and not a box around the rows.
Box 4 stays open: no before/after looks of the new page, and likers.md is stale.
Box 3: names on the post line stay admin-only. The ledger route stays open to any reader of the item, by documented existing design, unchanged here.
The like ledger now pages past twenty names in all three places. The API takes a cursor, the terminal feed screen loads older rows, and "and N more" on /feed is a link to a ledger page at /feed/likes?item=…&app=…[&cursor=seq].
API. GET /api/v1/feed/likes takes cursor (alias before, a seq) and limit (1 to 200, default 50), and answers next_cursor, which is null on the last page. A bad cursor or limit is refused before the item is looked up.
Page. It has one row per like or unlike, newest first, 50 a page, and an "Older likes" link that carries the next cursor. It uses the same readInteraction check and likeLedger rows as the API. An unreadable item or a bad cursor is a 404. It names session and render in Server-Timing, and it has an entry in docs/design/audit.md.
Terminal. In the feed screen, h opens a post's ledger, and h again (or m) loads the next page.
Docs.
docs/features/likers.mdnow says "and 3 more" opens the ledger page, not the JSON endpoint. It also says the page reads onlycursor, while the API also takesbefore. The "ledger page is JSON" clause is gone from "Not done".docs/features/feed-like-ledger.mdgains one line on the ledger page.
Kept as is. The page uses listCard, which is one card around a single ul.list of rows. That is the shape every listing in the app takes, and it does not put a box around each row, so it fits principle 7 ("rows over boxes").
Not done.
- No before/after screenshots of the new page.
- Names on the post line stay admin-only. The ledger stays readable by anyone who can read the item, as documented before this change.
Tests. The type check passes. These pass: test/feed-like.test.ts, test/tui-feed-reply.test.ts (run only before the docs edit), test/server-timing-sweep.test.ts, test/design-audit.test.ts, and the test/feature- and test/docs- suites. bun scripts/design-lint.ts is clean. scripts/fast.ts named most of the suite for the docs edit, so I ran the files above instead. Two tests that failed in shard 71 on the forge's first check ("the guides are read once however many requests come" and "a refresh that throws synchronously raises nothing uncaught") are outside this change, and I did not look into why they failed.
To try it. As an admin of an app whose post has more than twenty likes, open /feed and click "and N more".
[
{"go": "/feed", "look": "a post with more than twenty likes, as an admin of its app", "expect": "'and N more' is a link to /feed/likes"},
{"go": "/feed/likes?item=…&app=…", "look": "the ledger page", "expect": "rows with Liked/Unliked badges and times, and an 'Older likes' link when more remain"},
{"go": "/feed/likes?item=x", "look": "an unknown item, signed in", "expect": "a not-found page"}
]
🤖 Generated with Claude Code
The like ledger now pages past twenty names, in the API, on the web and in the terminal:
- API:
GET /api/v1/feed/likestakescursor(aliasbefore, aseq) andlimit(1 to 200, default 50), and answersnext_cursor, which is null on the last page. A bad limit or cursor is refused before the item is looked up. - Page:
/feed/likes?item=…&app=…[&cursor=seq](src/web/studio/ledger_page.ts) lists likes and unlikes newest first, 50 a page, with an "Older likes" link carrying the next cursor. It readscursoronly, notbefore. It uses the samereadInteractionaccess check as the API, and an unreadable item or a bad cursor is a 404. It namessessionandrenderin Server-Timing, and has an entry indocs/design/audit.md. - Feed: for an app's administrators, "and N more" under a post links to that page.
- Terminal: in the feed screen
hopens the ledger, andhagain (orm) loads the next page. - Docs:
docs/features/likers.mdanddocs/features/feed-like-ledger.mddescribe the page and the cursor.
The three failures in the last check are not caused by this change. One is the ?page test on the commits page (test/hardening.test.ts), and two are scheduling tests in test/timers-sync.test.ts that ran for over 10 seconds. All three were in shard 66, and shard 51 was killed on time in the same run, which points to a loaded machine. This branch touches neither the commits page nor timers, and main has no fix for them since. test/hardening.test.ts passes locally; test/timers-sync.test.ts is skipped here because it needs unix sockets, so the forge's check is the only run of it. main is merged in so the branch is current.
Left out: showing liker names to people who do not administer the app, and before/after screenshots of the new page.
Checked locally: bun x tsc --noEmit, bun scripts/design-lint.ts, and test/feed-like.test.ts, test/tui-feed-reply.test.ts, test/server-timing-sweep.test.ts, test/design-audit.test.ts, test/hardening.test.ts, plus the test/feature- and test/docs- suites, all pass.
[
{"go": "/feed", "look": "a post with more than twenty likes, as an admin of its app", "expect": "'and N more' is a link to /feed/likes"},
{"go": "/feed/likes?item=…&app=…", "look": "the ledger page", "expect": "rows with Liked/Unliked badges and times, and an 'Older likes' link when more remain"},
{"go": "/feed/likes?item=x", "look": "an unknown item, signed in", "expect": "a not-found page"}
]
🤖 Generated with Claude Code
The like ledger is now a page. The feed's "and N more" opens /feed/likes, which shows one post's likers 20 at a time and pages through the rest with a cursor.
- Page:
src/web/studio/ledger_page.tsrenders the page on the server, newest like first, with an "older" link while more rows remain. It reports session and render time inServer-Timing./feed/likesis listed indocs/design/audit.md. - API:
GET /api/v1/feed/likesnow also acceptscursor(the same thing asbefore), takes a boundedlimitand returnsnext_cursor. A badcursororlimitgets a 422 that says why, and the check happens before anything is read. The OpenAPI route andsrc/feed/likes.ts(parseLedgerLimit,nextCursor) match. - Terminal: the feed screen pages the ledger the same way.
- Docs:
docs/features/likers.mdanddocs/features/feed-like-ledger.mddescribe the page and say it reads onlycursor.
What to look at: the cursor and limit checks at the top of the handler in src/http/feed.ts, and test/feed-like.test.ts and test/tui-feed-reply.test.ts, which cover paging past 20, a hostile cursor, an out-of-range limit, and the terminal walking the pages.
The previous check run: 18 tests failed, and none of them touch the ledger. I ran every failing file that this sandbox can run and all pass: hardening, feed-like, templates-tui, apps-identity, apps-data-move-restart, relay-stall-name, fork-pull-approval, private_app_grant, apps-require-checks-green and pages-memory. The "hello did not deploy" failures come from the new-app scaffold's own tests; unpacked from templates/app-template.json, which this branch does not change, those also pass. The run showed many 10–90 s timeouts, so the machine looks to have been overloaded. I pushed an empty commit to re-run the check and changed no code.
checks.test.ts and looks.test.ts did not run here: they need *--localhost hosts, which the sandbox refuses. The gate and bun x tsc --noEmit both pass.
[
{"go": "/feed", "look": "a post with more than 20 likes", "expect": "the likers line ends in \"and N more\", which links to /feed/likes"},
{"go": "/feed/likes?item=<that post>", "look": "the list and the link at the bottom", "expect": "20 names, newest first, and an \"older\" link while more remain; following it shows the next 20 with no name repeated"},
{"go": "/api/v1/feed/likes?item=<that post>&cursor=abc", "look": "the answer", "expect": "422 with a sentence saying what cursor must be"}
]
🤖 Generated with Claude Code
Approved. The API takes cursor (alias before) and limit 1 to 200, validates both before the item lookup, and answers next_cursor. The post's "and N more" links to a server-rendered /feed/likes page that uses listCard rows, needs no JavaScript and reads only cursor. In the terminal, h again loads older rows. Tests cover cursor and limit paging, bad values, the hidden item, the page and its Older link, and the terminal paging. The feature docs are in docs/features, not README. Non-blocking: the ledger route is readable by any reader of the item, as the API already was by documented design. Names on the post line stay admin-only.
The like ledger now takes a cursor and limit and answers
next_cursor. The post's "and N more" links to it, and in the terminalhloads the next page. The pushed code type-checks, and about 680 tests covering the feed, the terminal feed and the API contract pass. I did not run the full suite, becausescripts/fast.tsnamed 3,300 test files and the forge runs the full check on push. The two new feed tests and the terminal paging test fail without the change.What changed
GET /api/v1/feed/likestakescursor(a ledger seq;beforestill works as an alias) andlimit(1 to 200, default 50). It answersnext_cursor, which is null on the last page, and keepsmore. A badcursororlimitgets a 422. The parsing isparseLedgerLimitinsrc/feed/likes.ts, and the contract entry and docs are updated./api/v1/feed/likes?item=…&app=…&limit=200, built insrc/web/studio/feed.ts.hagain loads the next page. The oldmstill works, and the footer now reads "h older".test/feed-like.test.tscovers cursor and limit paging, the bad values, a 404 for an unreadable item, and the link.test/tui-feed-reply.test.tscovershpaging.What I left out
docs/features/likers.md.docs/features/feed-like-ledger.md, any reader of an item may see its likers there, and existing tests assert it. Names on the post line are still shown only to administrators of the app. Say if you want the route restricted too.Review
The first push was refused by the pre-push hook because the commits carried no "Try:" line. I added an empty
Try:commit and it went through.Closes #15260