Public: anyone can read this; the crew can change it.
A like can be taken back in one tap, and the decision ledger records the withdrawal #13555
Check · Review · Land · Live done — Landed and live in production.
The behaviour was already on main, so this pull adds only the missing test, test/feed-unlike.test.ts. It passes, bun x tsc --noEmit is clean, and scripts/gate.ts --fix printed nothing. I ran only this one test file, not the wider suite.
shipped production is serving it deploy 59903fa
The behaviour was already on main, so this pull adds only the missing test, test/feed-unlike.test.ts. It passes, bun x tsc --noEmit is clean, and scripts/gate.ts --fix printed nothing. I ran only this one test file, not the wider suite. The test is not one that fails without a change, because there was no change to make.
What already held on main (setLike/toggleLike in src/feed/likes.ts; the like, ledger and ranking paths were not changed):
- One tap: a second press on a liked item removes the like, and the item shows unliked on reload.
- Ledger: the withdrawal is a new
unlikerow infeed_signalbeside the originallike. History is only added to, and the current-state row infeed_likeis the only thing removed. - API: the same action exists as
POST /api/v1/feed/interactionswith kindunliked, as thefeed_likeMCP tool with actunlike, and as/feed/like. - Count: it is read from
feed_like, so it drops by one. Withdrawing when nothing is liked writes no row and cannot go below zero. - Ranking input:
rankInputsincludes thefeed_likerow count, so a withdrawal changes it and the feed re-ranks.
What the new test checks, through the API:
- Two people like an item. One withdraws.
- The count goes from 2 to 1, and the withdrawer sees it unliked on reload.
- The other person's like is unaffected.
- The ledger reads
bob:unlike,carol:like,bob:like. - The ranking input changes.
- Repeating the withdrawal, or withdrawing without having liked, writes no row and leaves the count at 0.
I did not touch src/feed/interact.ts, because it only checks that the viewer may act on the item and does not handle likes themselves. I did not add a UI test, because the live like script is already tested in test/feed-like.test.ts.
To try it, run bun test test/feed-unlike.test.ts.
🤖 Generated with Claude Code
Test-only pull: the unlike behaviour already lives on main (setLike/toggleLike, POST /api/v1/feed/interactions, feed_like MCP tool), and this adds a regression test through the API covering count drop, reload state, withdrawn ledger row beside the like, rankInputs change, and idempotent/no-op withdrawals. No security, UI or dependency surface is touched, and docs/features/feed-like-ledger.md already exists. Next two things I would do: (1) assert the terminal door also withdraws and reaches web viewers live; (2) assert a cross-origin/anonymous POST of unliked is refused.
The behaviour was already on main, so this pull adds only the missing test,
test/feed-unlike.test.ts. It passes,bun x tsc --noEmitis clean, andscripts/gate.ts --fixprinted nothing. I ran only this one test file, not the wider suite. The test is not one that fails without a change, because there was no change to make.What already held on main (
setLike/toggleLikeinsrc/feed/likes.ts; the like, ledger and ranking paths were not changed):unlikerow infeed_signalbeside the originallike. History is only added to, and the current-state row infeed_likeis the only thing removed.POST /api/v1/feed/interactionswith kindunliked, as thefeed_likeMCP tool with actunlike, and as/feed/like.feed_like, so it drops by one. Withdrawing when nothing is liked writes no row and cannot go below zero.rankInputsincludes thefeed_likerow count, so a withdrawal changes it and the feed re-ranks.What the new test checks, through the API:
bob:unlike,carol:like,bob:like.I did not touch
src/feed/interact.ts, because it only checks that the viewer may act on the item and does not handle likes themselves. I did not add a UI test, because the live like script is already tested intest/feed-like.test.ts.To try it, run
bun test test/feed-unlike.test.ts.🤖 Generated with Claude Code
Closes #13522