Skip to content

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
mainfrom
goal/goals-page-server-cost-scope-per-page-aggregates-bound-goalc
Draft

Goals page server cost: scope per-page aggregates, bound goalComputeRollups (10-17s TTFB)#1785
interactor-pm-service[bot] wants to merge 8 commits into
mainfrom
goal/goals-page-server-cost-scope-per-page-aggregates-bound-goalc

Conversation

@interactor-pm-service

Copy link
Copy Markdown
Contributor

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.

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant