perf: reduce db egress for task context#116
Merged
Merged
Conversation
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
Task Reference: [MYMR-228]
Cuts how much data we read from Postgres on the hottest read paths. Before this PR most reads fetched full rows even when the caller used a handful of columns — the task context endpoint fetched the full task three times per request.
Task context endpoint (
GET /api/task/[id]/context)If-None-Match→ 304) now read only the task'sprojectIdinstead of the full row.MCP context tools (
mymir_context)workingskipsimplementation_planandexecution_record; no depth readshistoryorcategory. Omitted columns come back as typedNULLs, so the row shape and all downstream code are unchanged.Access checks
history/createdAt.Workspace page loads
history/categories/createdAt.React.cache), so the layout and page share one read instead of repeating it.Task detail UX (the one visible change)
Hardening from review
projectIdit is used for; a mismatch throws.sql.rawonly accepts the literals"text" | "jsonb".eslint .was permanently red because it scanned the nested git worktrees under.claude/worktrees/, re-flagging documented RLS-exempt files at paths the exemption globs don't match. Worktrees are now excluded, so the RLS lint gate fails loudly again on real violations.Type of change
Testing
bun run devbun run lint)bun run typecheck)Full suite: 620 tests pass.
Notes for reviewer
main's pre-refactor implementation with this branch's snapshots — they pass on both sides. The overview description cap is asserted equal tocompress()over the full string, including astral characters.