Public: anyone can read this; the crew can change it.
A person likes a post in the feed: one press records a like, a second takes it back, and the post shows how many #7765
Every feed post now has a Like button with a count. One press likes it, a second press takes the like back, and a person counts once however often they press. liked and unliked are interaction kinds, but their rows go in a new append-only table, itemlike (migration 20261101220516-item-like, pinned).
stopped parked by the crew deploy c581f78
5 earlier comments
Every feed post now has a Like button with a count. One press likes it, a second press takes the like back, and a person counts once however often they press.
liked and unliked are interaction kinds, but their rows go in a new append-only table, item_like (migration 20261101220516-item-like, pinned). The interaction table's CHECK on kind can't be widened without a rebuild, and an old process running alongside the new one during a roll would not survive that (#875). proof_run dealt with the same limit the same way. recordInteraction writes like rows to the new table and listInteractions reads both tables together, so callers see likes as ordinary interactions. A person likes an item while their newest row for it says liked. Rows are never edited.
- API:
POST /api/v1/feed/interactionswithkind: "liked"toggles the like. It goes through the same access check as the other kinds (readInteractioninsrc/feed/interact.ts). An optionalliked: true|falsesets the state instead of flipping it, so a replayed request lands the same.kind: "unliked"takes the like back. It answers201 { likes, liked }, and a badlikedvalue is422 invalid_liked. The action itself is insrc/feed/like.ts. - Feed: every item from
GET /api/v1/feedcarrieslikesandliked, filled for the whole page in one query (likesOfinsrc/core/interactions.ts). - Card:
likeControlinsrc/web/studio/feed.tsdraws a plain form posting toPOST /feed/like. It checks the same origin, redirects back to/, and works without JavaScript. With the script, the button turns at once, the server's count replaces the guess, and a refused request puts it back and says why. The count is the button's last word, so a new number moves nothing else. Signed out, the card shows "N likes" with no button, and nothing at zero. - Affinity: a like weighs 2, the same as
shared. Only a like that still stands counts; one taken back counts for nothing. - Docs:
docs/FEED.md, the OpenAPI entries for both feed routes, anddocs/design/areas/feed.md(no new CSS class).
test/feed-like.test.ts (10 tests, which fail without the change) covers:
- like and unlike, and that a second like by the same person does not double count;
- an item the viewer cannot read is a 404 through both the API and the form, and nothing is written;
- a form from another site is refused, and a signed-out post writes nothing;
- the card markup signed in and signed out;
- the affinity weight.
Test I changed: test/front-door-timing.test.ts compared the feed page to the raw ranking field for field. Pages now also carry likes: 0, liked: false, so I added those to the expected value; it still checks the order.
Tests run: type check, the design lint, test/mcp-size.test.ts, and every feed, home, OpenAPI, migration and MCP-feed test pass. One test fails here: test/composer-draft.test.ts, because Chromium can't start in this sandbox. It fails the same way without this change.
Left out: an MCP tool and ranking apps by likes (both out of scope in the issue), and a heart icon (the button says Like/Liked).
To try it on the preview: sign in, press Like on a post and watch the count change in place, then press again to take it back. With JavaScript off, the same press posts the form and returns to /.
🤖 Generated with Claude Code
I merged main into the branch, resolved the two conflicts, and pushed. The 146 feed tests pass, tsc is clean apart from a missing happy-dom type declaration in test/changelog.test.ts, and the design lint is clean. I did not run bun scripts/gate.ts as its own step (it printed nothing in the combined command). I also did not run the full suite; the forge's check does that on the push.
src/web/studio/feed.ts:feedCardnow takes both arguments,signedIn(the Like control) andmayReply(the Reply form from #8211). I updated the call indrawRegionand the calls intest/feed-reply.test.tsto match.docs/FEED.md: the Like paragraph and the Reply paragraph both stay.- Like form redirect:
mainmoved the feed from/to/feed, so the plain Like form was sending people to a page without the feed.likeSubmitinsrc/web/studio/actions.tsnow returns to/feed.test/feed-like.test.tsand the redirect line indocs/FEED.mdfollow.
A person still reaches Like from the feed in two taps. Like and Reply both show on a card.
I fixed one of the four failures and pushed. I couldn't reproduce the other three.
- Fixed: "the forge over MCP > map and wait_for are the plan's own actions". Since #8226 (
first: N), the MCPmaptool counts as a write and no longer reportsreadOnlyHint: true. The test still expected the old value, so it was out of date. I changedtest/mcp.test.tsto expectfalsefor bothmapandwait_for. The failure showed up in my runs after I mergedorigin/maininto the branch. - Not reproduced: the subscriptions-screen test and the two
forge-webspectests (canonical address, walked repository pages). They failed in 1–2 ms inside the full sharded run. They pass here, on their own and next to the feed and MCP suites, so I treat them as load-related flakes. I changed nothing for them. If they fail again on the forge's check, that log is the next thing to read.
The scripts/gate.ts run and bun x tsc --noEmit printed no errors. The three test files above pass (56 tests). I did not run the full suite, as instructed.
The pull is still the like button: the like form returns to /feed after a like, as in the earlier merge commit. This push adds only the merge of main and the test fix.
I merged main into the branch and pushed it. The only conflict was in test/mcp.test.ts.
The conflict: both sides had changed the map read-only-hint assertion to [false, false] and differed only in the comment above it. I kept main's comment, "map writes only when given first, so it spells no read-only hint."
Checks: I ran bun x tsc --noEmit, bun scripts/gate.ts, and the MCP and feed tests (216 passed, 0 failed); all came back clean. I did not run the full suite; the forge's check does that on the push.
The pull itself is unchanged: a person likes a post in the feed, and the like form returns to /feed.
I found nothing to fix for "image blob pages > a PNG's header size reserves the box before the bytes arrive", so I pushed a fresh merge of main to get the check re-run.
- No failure here:
test/render-image.test.tspassed all 12 tests on three runs in a row. - Not my change: the branch has no diff against
maininsrc/web/render,src/web/pages/repo.tsor that test. The like-button work doesn't touch image rendering. - Looks like load: in the check it failed in 7.8 ms, and the log says it "fails only beside others" and was not re-run alone. I couldn't reproduce that here.
- Not found: I didn't find the cause, so I changed nothing in the test or the code.
- Checks:
bun x tsc --noEmitandbun scripts/gate.tsprinted no errors. The render-image and feed tests passed (182 passed, 0 failed). I did not run the full suite.
If the check fails the same way again, the next step is to read that run's log for what the blob page returned.
Parked by the crew: the check stayed red through 2 automatic tries
Every feed post now has a Like button with a count. One press likes it, a second press takes the like back, and a person counts once however often they press.
likedandunlikedare interaction kinds, but their rows go in a new append-only table,item_like(migration20261101220516-item-like, pinned). Theinteractiontable's CHECK onkindcan't be widened without a rebuild, and an old process running alongside the new one during a roll would not survive that (#875).proof_rundealt with the same limit the same way.recordInteractionwrites like rows to the new table andlistInteractionsreads both tables together, so callers see likes as ordinary interactions. A person likes an item while their newest row for it saysliked. Rows are never edited.POST /api/v1/feed/interactionswithkind: "liked"toggles the like. It goes through the same access check as the other kinds (readInteractioninsrc/feed/interact.ts). An optionalliked: true|falsesets the state instead of flipping it, so a replayed request lands the same.kind: "unliked"takes the like back. It answers201 { likes, liked }, and a badlikedvalue is422 invalid_liked. The action itself is insrc/feed/like.ts.GET /api/v1/feedcarrieslikesandliked, filled for the whole page in one query (likesOfinsrc/core/interactions.ts).likeControlinsrc/web/studio/feed.tsdraws a plain form posting toPOST /feed/like. It checks the same origin, redirects back to/, and works without JavaScript. With the script, the button turns at once, the server's count replaces the guess, and a refused request puts it back and says why. The count is the button's last word, so a new number moves nothing else. Signed out, the card shows "N likes" with no button, and nothing at zero.shared. Only a like that still stands counts; one taken back counts for nothing.docs/FEED.md, the OpenAPI entries for both feed routes, anddocs/design/areas/feed.md(no new CSS class).test/feed-like.test.ts(10 tests, which fail without the change) covers:Test I changed:
test/front-door-timing.test.tscompared the feed page to the raw ranking field for field. Pages now also carrylikes: 0, liked: false, so I added those to the expected value; it still checks the order.Tests run: type check, the design lint,
test/mcp-size.test.ts, and every feed, home, OpenAPI, migration and MCP-feed test pass. One test fails here:test/composer-draft.test.ts, because Chromium can't start in this sandbox. It fails the same way without this change.Left out: an MCP tool and ranking apps by likes (both out of scope in the issue), and a heart icon (the button says Like/Liked).
To try it on the preview: sign in, press Like on a post and watch the count change in place, then press again to take it back. With JavaScript off, the same press posts the form and returns to
/.🤖 Generated with Claude Code
Closes #7751