Goals page server cost: scope per-page aggregates, bound goalComputeRollups (10-17s TTFB)#1785
Draft
interactor-pm-service[bot] wants to merge 8 commits into
Conversation
…s (G#368 #1356) assembleGoalRows fired ~10 project-wide aggregates on every 50-row page fetch (and on every single-row surgical refetch), scanning the whole project's task/run/finding history per request. Each helper now accepts an optional goalIds scope applied in its WHERE clause; assembleGoalRows passes the page's ids. Omitting the scope preserves the project-wide behaviour for all other callers.
…1357) goalComputeRollups loaded every EngineRun ever recorded on the project's goaled tasks — a cost that grows forever with history — and ran on every goals-page request via getProjectGoalActiveWork's fallback. It now takes a goalIds array (alongside the existing single goalId), the active-work reader forwards the page scope, and the legacy GET path scopes its direct call to the goals it just listed.
…G#368 #1358) The existence probe ran as a fresh DB query on every goals page/row assembly. It is now served through unstable_cache (keyed by projectId, 60s TTL), and every project-scoped connection connect/disconnect route revalidates the tag so the cached boolean heals immediately; org-level integration toggles ride the TTL.
…connect too (G#368 #1358 rework) The DELETE handler dropped the connection without healing the cached hasProjectGithubConnection boolean, leaving the goals page reading a stale true for up to the 60s TTL after a disconnect.
The connections/connect-project routes now call revalidateTag, and the real implementation requires a Next request store that vitest lacks — the tests/unit/api suites (unlike the colocated src suites) didn't mock next/cache and failed on CI with 'static generation store missing'.
…p G#368 scoping comment + multi-repo S6 repoRows batch)
…rough Pre-existing main breakage: f3ceb68 added the opts forward (resumeGoalBacklog(goalId, projectId, actor, opts)) without updating this assertion — every PR's shard 2 has been red since.
…r-cost-scope-per-page-aggregates-bound-goalc # Conflicts: # src/lib/engine/pause.test.ts
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.
Integration PR for this goal — its tasks commit onto this branch (one PR per goal). Opened automatically by the engine on first push; left as a draft until the goal completes.