fix(taskmanager): drain all pages for workspace/board snapshots (#272)#275
Open
ProfSynapse wants to merge 2 commits into
Open
fix(taskmanager): drain all pages for workspace/board snapshots (#272)#275ProfSynapse wants to merge 2 commits into
ProfSynapse wants to merge 2 commits into
Conversation
Workspaces with >200 tasks undercounted in loadWorkspace summary and the Task Board. BaseRepository.queryPaginated hard-caps pageSize at 200, so a single large-pageSize request (pageSize:1000/10000) silently returned only the first 200 rows while totalItems still reported the true count — making byStatus/nextActions/recentlyCompleted/per-project counts inconsistent with the reported totals. Fix (keeps the 200 cap intact — the bug was consumers treating one page as the whole set): - TaskService.getWorkspaceSummary: drain all project + task pages via a new collectAllPages helper, then compute every count from visibleTasks (tasks whose owning project is not archived). Filtering at the TASK level (visible iff no owning project OR project not archived) subsumes the zero-project edge: archived-project tasks are never counted, genuinely orphan tasks stay visible. - TaskBoardDataController.loadBoardData: drain all project pages, filter archived projects FIRST, then per-visible-project drain listTasks with includeSubtasks:true (preserves the prior subtask-inclusion default). Intentional semantic change (user-confirmed, #272): getWorkspaceSummary tasks.total flips from all-task totalItems -> visibleTasks.length so it is consistent with byStatus. projects.total stays the TRUE count (includes archived) — #272 is a task-undercount bug; flipping projects.total would be unflagged scope expansion. Asymmetry documented at the return site. Regression tests cover the >200 drain (both task and project pages), archived-before-snapshot exclusion, all-projects-archived orphan visibility, the projects/tasks total asymmetry, and subtask parity. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NxKeRz1gihguL9wcidm78m
…atch coverage (#272) Closes two non-blocking peer-review coverage gaps on the #272 fix (TEST-ONLY): 1. Board-vs-summary orphan divergence was unpinned. TaskBoardDataController loads tasks per-visible-project and filters on projectMap, so orphan / archived-parent tasks can never reach the board (unlike getWorkspaceSummary, which keeps orphans visible). New test seeds a task whose projectId is not a visible project and asserts it is ABSENT from the board result. 2. The note-link-failure .catch path (TaskBoardDataController:189) lost coverage when its rejection case was tied to a now-unfetched archived task. New test rejects getNoteLinks for a VISIBLE task and asserts the task still appears with noteLinks: []. No production-code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NxKeRz1gihguL9wcidm78m
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.
Summary
Fixes the task-board / workspace-summary undercount reported in #272. Counts and status breakdowns were computed from a single 200-row page while totals reported the true count — so workspaces with >200 tasks (and archived-project tasks consuming page slots) showed wrong numbers.
Addresses #272. (Leaving the issue open for the author to close after manual verification.)
Root cause (verified against current main)
BaseRepository.queryPaginatedhard-capspageSizeatMath.min(pageSize ?? 25, 200)with plainLIMIT/OFFSET. Requests forpageSize: 10000silently clamp to 200, buttotalItemsstays the true count.TaskService.getWorkspaceSummaryandTaskBoardDataController.loadBoardDataboth treated that one clamped 200-row page as the whole set, computing per-project counts /byStatus/ next-actions / recently-completed from ≤200 rows. Archived-project filtering happened after the fetch (truncate-before-filter), so archived tasks burned page slots.Fix
{page, pageSize: 200}loop until!hasNextPage) via small helpers (collectAllPages/loadAllPages).TaskBoardDataControllerfilters archived projects first, then drains only visible projects' tasks (archived-project tasks are never fetched).BaseRepository's 200 cap is left intact (sane per-query cap); no cursor pagination introduced.Intentional semantic notes (please read)
tasks.totalis now visible-only (visibleTasks.length) rather than the all-tasktotalItems, so it is consistent withbyStatus/nextActionswhich are also visible-only.projects.totalstays the true count (incl. archived); onlytasks.totalis visible-only. Documented at the return site. If the project header should also be visible-only, that's a scoped follow-up.Tests
6 regression tests + 2 added in review: >200 task-page drain, >200 project-page drain, archived-before-snapshot, all-projects-archived → orphan-only visibility, projects/tasks total asymmetry, subtask parity, board orphan-task absence, and the restored note-link
.catchpath on a visible task.Verification
npm run buildclean ·npm run lintcleanTaskBoardEditCoordinatorjsdom-Modal issue (untouched files; not a regression).Non-blocking follow-ups (from peer review)
listTasksalready returns enrichedTaskWithNoteLinks, thenloadBoardDatadiscards and re-fetches viagetNoteLinks). Correctness fine; minor wasted work. Tracked as a follow-up, not changed here.OFFSETdrain → cursor pagination only if workspaces ever reach tens of thousands of tasks.Review
Peer-reviewed (APPROVE, 0 blocking):
docs/review/issue-272-fix-review-2026-06-22.md,docs/review/test-coverage-271-272-2026-06-22.md.🤖 Generated with Claude Code