perf(reports): cache /consolidated and /suites responses - #91
Open
saturninoabril wants to merge 3 commits into
Open
perf(reports): cache /consolidated and /suites responses#91saturninoabril wants to merge 3 commits into
saturninoabril wants to merge 3 commits into
Conversation
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>
|
@coderabbitai review |
saturninoabril
marked this pull request as ready for review
July 24, 2026 09:48
…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
requested review from
yasserfaraazkhan
and removed request for
yasserfaraazkhan
July 24, 2026 13:44
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
Reduces per-viewer load on the completed-report pages. The consolidated view fetches a large
/reports/consolidatedbody (measured ~448 KB) plus/reports/{id}/suites(~133 KB), both uncached and recomputed per request; the consolidated query joinstest_cases → suites → reports → report_groupswith a per-caseLATERALscreenshot 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:repository/branch/commit/name/run_attempt/gid/gh_run_id; suites: group id.TSIO_REPORTS_READ_CACHE_TTL_MS(<= 0disables); responses carryCache-Control: max-age=3, stale-while-revalidate=10.computeConsolidatedso the handler can serve it through the cache; behavior/response shape unchanged.Test Plan
go vetandgofmtclean./reports/consolidatedin two tests) and the reports upload suite both pass with the read cache disabled in the harness.Release Note