fix(portal): count only open posts beside a board - #30
Merged
Merged
Conversation
The number beside a board in the portal sidebar counted every post the viewer was allowed to see, while the list under it hides complete and closed posts by default and never shows a post that was merged into another. A board read "3" over two visible posts. The count now applies the same default as the list: a post counts when it has no status or an active-category status, and is not merged, deleted, or hidden from the viewer by moderation. The status predicate moves into post.portal-default-status.ts and both the list and the count read it from there, so the two cannot drift apart again. After deploying, the portal sidebar shows smaller numbers on boards with completed or closed posts. Settings > Boards and GET /api/v1/boards keep counting every post; the apps API does not expose a count. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…board count Nothing in the running service changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What changes
The number beside a board in the portal sidebar counted every post the viewer was allowed to see, while the list under it hides complete and closed posts by default and never shows a post that was merged into another. A board read "3" over two visible posts.
The count now applies the same default as the list: a post counts when it has no status or an active-category status, and is not merged, deleted, or hidden from the viewer by moderation. The status predicate moves into
post.portal-default-status.ts, and both the list and the count read it from there, so the two cannot drift apart again.After deploying: the portal sidebar shows smaller numbers on boards with completed or closed posts. Settings > Boards and
GET /api/v1/boardskeep counting every post; the apps API does not expose a count. A status filter chosen in the portal does not change the number beside a board — it describes the default view.Contract
V1–V7 are in the header of
board-public-post-count.db.test.ts, verbatim as confirmed; every test names its number. A fast-check property (100 runs, up to ten generated posts per board across status category, deleted status row, merged, deleted, pending; anonymous and team viewer) checks the count against the existing list function and against a number computed from the seed alone.Measured
post.portal-default-status.ts: 3 mutants, 3 killed, 0 survived, 0 never executed — PASS.board.public.tsandpost.public.tsare reported by name as not mutation-graded (declaring them would assert suites pingetPublicBoardBySlug,countBoardsand error strings this change never touched). The five join lines this change touched inboard.public.tswere checked by hand instead: five mutants applied one at a time, five caught by the new suite.🤖 Generated with Claude Code