Skip to content

fix(convex): the team feed pager keeps a member's later sessions and ends when no member can be read - #115

Merged
ashot merged 3 commits into
codecast-sh:mainfrom
triptu:fix/team-feed-pager
Nov 23, 2026
Merged

ashot merged 3 commits into
codecast-sh:mainfrom
triptu:fix/team-feed-pager

Conversation

@triptu

@triptu triptu commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

From Tushar's coding agent.

This is the follow-up to #105 for two bugs in the web team feed's pager. A member with more sessions left than their share of a page could lose the rest of those sessions from the feed. And a team where no member's sessions could be read asked for the same empty page on every load, because its cursor never ended. Both now page correctly.

More detail from Coding agent

Sessions lost past a member's share. batchScanConversations stops reading a batch once it has the rows it wants. It still treated a short batch as the end of the index, though it had not read the rest of that batch. paginateTeamFeed then marked the member as done. A member's remaining sessions were lost when they fit in one fetch but outnumbered the member's share of a page. A short batch now ends the index only when the scan read it to its end. The cursor now sits at the last row the scan examined.

A cursor that never ends. When every member was hidden, paginateTeamFeed had no member to scan and still returned a non-null cursor. No member to read now returns { rows: [], nextCursor: null }.

Tests. There are two new tests in feedPagination.test.ts, one for each bug. Each one fails with its fix reverted and passes with it.

Checks

  • bun test convex/feedPagination.test.ts: 15 pass. No other test file imports feedPagination.
  • cast check convex: 0 errors.

The diff against main is 34 lines in feedPagination.ts and its test.

batchScanConversations stops a batch once it has the rows it wants, then
called the index exhausted whenever that batch was short, though it never read
the rest of it. paginateTeamFeed then marked the member done, so a member whose
remaining rows fit in one fetch but outnumbered their share of a page lost the
rest for good. The web team feed hits this whenever its per-member fetch is
larger than its per-member share. A short batch now ends the index only when
it was read to its end.

Codecast-Session: https://codecast.sh/conversation/jx79cm21j5mrr7qzwdvv3vd17d8jhz7s
With every member hidden, paginateTeamFeed had no member to scan and still
answered a non-null cursor, so the web team feed asked for the same empty page
again on every load. No member to read now ends the feed.

Codecast-Session: https://codecast.sh/conversation/jx79cm21j5mrr7qzwdvv3vd17d8jhz7s
@ashot
ashot merged commit 758d711 into codecast-sh:main Nov 23, 2026
16 checks passed
@ashot

ashot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merged, thanks. This is backend (Convex) code, so it goes live with the next Convex deploy.

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.

2 participants