Skip to content

perf(reports): cache /consolidated and /suites responses - #91

Open
saturninoabril wants to merge 3 commits into
cursor/orchestration-status-cache-a8f4from
cursor/reports-read-cache-a8f4
Open

perf(reports): cache /consolidated and /suites responses#91
saturninoabril wants to merge 3 commits into
cursor/orchestration-status-cache-a8f4from
cursor/reports-read-cache-a8f4

Conversation

@saturninoabril

Copy link
Copy Markdown
Collaborator

Summary

Reduces per-viewer load on the completed-report pages. The consolidated view fetches a large /reports/consolidated body (measured ~448 KB) plus /reports/{id}/suites (~133 KB), both uncached and recomputed per request; the consolidated query joins test_cases → suites → reports → report_groups with a per-case LATERAL screenshot aggregate and was observed taking up to ~8.8s under contention.

Both endpoints now serve through a short-TTL single-flight read cache (internal/cache, introduced in the stacked PR below), so concurrent viewers of the same completed run collapse onto one backing execution per window:

  • Keyed by the response-affecting inputs — consolidated: repository/branch/commit/name/run_attempt/gid/gh_run_id; suites: group id.
  • TTL default 3s via TSIO_REPORTS_READ_CACHE_TTL_MS (<= 0 disables); responses carry Cache-Control: max-age=3, stale-while-revalidate=10.
  • The consolidated query + shaping pipeline is extracted into computeConsolidated so the handler can serve it through the cache; behavior/response shape unchanged.
  • The e2e harness disables the read cache so read-after-write assertions stay deterministic (production keeps it).

Stacked on #90 (base branch cursor/orchestration-status-cache-a8f4) because it reuses the internal/cache package added there. Retarget to main once #90 merges.

Test Plan

  • Full non-e2e Go suite green; go vet and gofmt clean.
  • e2e: orchestration suite (which reads /reports/consolidated in two tests) and the reports upload suite both pass with the read cache disabled in the harness.

Release Note

The consolidated report and suites endpoints are now cached briefly server-side, reducing load when many viewers open the same report.
Open in Web Open in Cursor 

The consolidated-report page fetches a large /reports/consolidated body
(observed ~448KB) plus /reports/{id}/suites (~133KB), both uncached and
recomputed per viewer; the consolidated query joins test_cases -> suites ->
reports -> report_groups with a per-case LATERAL screenshot aggregate.

Serve both through a short-TTL single-flight read cache (internal/cache)
so concurrent viewers of the same completed run collapse onto one backing
execution per window. Keyed by the response-affecting inputs
(consolidated: repository/branch/commit/name/run_attempt/gid/gh_run_id;
suites: group id). TTL default 3s via TSIO_REPORTS_READ_CACHE_TTL_MS
(<=0 disables); responses carry Cache-Control. Consolidated's query +
shaping pipeline is extracted into computeConsolidated so the handler can
serve it through the cache. The e2e harness disables the read cache so
read-after-write assertions stay deterministic.

Co-authored-by: saturnino <saturnino@mattermost.com>
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

@coderabbitai review

@saturninoabril
saturninoabril marked this pull request as ready for review July 24, 2026 09:48
cursoragent and others added 2 commits July 24, 2026 10:07
…e-a8f4' into cursor/reports-read-cache-a8f4

Co-authored-by: saturnino <saturnino@mattermost.com>
Consistency with the orchestration status cache: build the consolidated and
suites read-cache keys via cache.Key (length-prefixed) instead of joining raw
values with \x00, so request params with embedded separators/NUL bytes can't
collapse distinct requests onto one cache entry. Also merges the latest #90
(cache.Key + detached-compute-context).

Co-authored-by: saturnino <saturnino@mattermost.com>
@saturninoabril
saturninoabril requested review from yasserfaraazkhan and removed request for yasserfaraazkhan July 24, 2026 13:44
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.

2 participants