Skip to content

Follows: a followed product stays followed after you leave the page - #61

Merged
vijayakrishnans merged 1 commit into
mainfrom
fix/product-follows-persist
Dec 3, 2026
Merged

vijayakrishnans merged 1 commit into
mainfrom
fix/product-follows-persist

Conversation

@vijayakrishnans

Copy link
Copy Markdown
Collaborator

What was wrong

Following a product showed Following, but on the next page, after a reload, or after signing out and back in, it read Follow again.

The follow was saved. The read was the bug: when a page asks the overlay which of its controls you follow, resolveFollowKeys (core/src/handlers/me.ts) only asked the table about topic and person keys. listing (product follows, PP1) was dropped, so a product follow was never in the answer.

Fix

  • resolveFollowKeys asks about listing targets as they are (a slug, like a topic) and answers them as listing:<slug>. Person keys still go handle → subject id → handle.
  • /me/follow answered ok even when core did not make the write. The enhanced button flips first and reverts only on a non-2xx, so it could keep saying Following for a follow that was never stored. It now answers failed (502 JSON / redirect back), and the button undoes itself.

Existing product follows reappear as soon as this deploys: the rows are already there.

Tests

  • tests/core/src/follows.test.ts: new overlay cases. A followed product, topic and person all come back in the page's keys, and an unfollowed product does not. The first case fails on main and passes here.
  • tests/web/src/follows.test.ts: the route answers a non-ok write as a failure.
  • Full tests/core (1147) and tests/web (2138) pass. core and web typecheck.

Security (OWASP)

  • A01: the overlay read is still bounded by the keys the page sent and by the signed-in subject. Nothing new can be listed, and no follower list exists.
  • No new input, no new route.

🤖 Generated with Claude Code

A product Follow wrote its row, but the overlay (what a page asks to learn
what you follow) only asked the table about topics and people. Every
product therefore read "Follow" again on the next page, after a reload or
after signing back in. resolveFollowKeys now asks about listings too, and
answers them in the key the page sent.

Also: /me/follow answered "ok" when core did not make the write, so the
button kept saying "Following" for a follow that was never saved. It now
answers a failure, and the button undoes itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vijayakrishnans
vijayakrishnans merged commit c4e73c3 into main Dec 3, 2026
12 checks passed
@vijayakrishnans
vijayakrishnans deleted the fix/product-follows-persist branch December 3, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant