refactor(web): one predicate decides what anchors into a root's cluster#564
Merged
Conversation
Two conditions described the same set — agent-voice broadcast events that anchor into their loaded root's cluster — and only one of them excluded question requests. A message dropped from the feed by the looser condition but skipped by the stricter one would render nowhere at all while still counting toward unread: the same shape as the deleted-tail bug in #562, where something counted but could never be seen. Nothing reaches it today, because question requests are not emitted as broadcasts. Nothing enforced that either. Both call sites now derive from one predicate, so the two cannot disagree: a message leaves the feed only if the cluster actually takes it, and a broadcast question request stays a row of its own rather than vanishing. No reachable behavior changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small invariant cleanup in the same area as #562. No reachable behavior change.
The gap
Two conditions in
Timeline.tsxdescribed the same set — agent-voice broadcast events that anchor into their loaded root's cluster — but only one excluded question requests:A broadcast
session.question_requestedwith a loaded root would be dropped from the feed by the second and skipped by the first — rendering nowhere while still counting toward unread. That's precisely the shape of #562: counted, but impossible to see.It's unreachable today only because the server emits question requests without
broadcast: true. Nothing enforced that; it was an accident waiting to happen.The fix
Both call sites now derive from one
anchorsIntoRootClusterpredicate, so they cannot disagree: a message leaves the feed only if the cluster actually takes it. A broadcast question request stays a row of its own instead of vanishing. The type guard also lets the non-null assertion go.Verification
The new test fails without the fix —
Unable to find an element with the text: Should this include the migration?, i.e. the event rendering nowhere.Local:
pnpm lint·typecheck(7/7) · web 776 · e2e 119/119.🤖 Generated with Claude Code