Pin down bucketOf and unreadForRow against a repeat

Testkamo-internal
Shipped
August 26, 2026 at 4:03 AM UTC
Author
kamo
Commit
2801501

This file just shipped four silent defects in one review round — an AI row that fell through to the wrong bucket, a title that was never read off the row, a bucket missing from the persisted-preference allowlist, and an unread computation that (as an earlier draft of it stood) would have zeroed every SOCIAL row's badge — none of which a typecheck or a build would have caught. There was no test on this file at all, before or after. bucketOf and the row-unread ternary were already pure and already side-effect-free; they just were not reachable from a test. Both are now exported, and the unread ternary is lifted out to unreadForRow verbatim — the call site is a single delegating line, and the branching itself is untouched. ALL_BUCKETS is exported too, for the one-line assertion that 'ai' is actually in it. The SOCIAL regression test was checked the way a guard against a specific past mistake should be: by reintroducing that mistake. Dropping the `row.sessionType === 'SOCIAL' ||` clause (i.e. routing SOCIAL through the live sessions map, exactly what the plan's own unreadFor() example did) made exactly one of the fourteen new tests fail — this one, with the planted decoy value instead of row.unreadCount — and left the other thirteen green. Reverted immediately after.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing