Repository navigation
perf(competitors): send head-to-head as per-engine summaries and load runs on demand - #942
Merged
Merged
Conversation
… runs on demand (#923) getHeadToHeadComparison returned one row per tracked answer, each with its full answer text and citations, which the Competitors page never displays. It now returns one summary per (prompt, engine, model, region) with run counts and averages; a group's individual runs load via getHeadToHeadRuns when the user opens it or views its latest answer. Gaps and strengths rank those summaries instead of single runs. The data source is unchanged (one page of raw results), so large brands are still summarised from their newest answers; moving it onto the daily rollups is the remaining part of #923.
7 of 12 tasks
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
First part of #923.
getHeadToHeadComparisonreturned one row per tracked answer — each with its full answer text and citations — and the Competitors page grouped them in the browser. The page never displays the answer text or citations; the eye button links to the result's own page.web/src/lib/head-to-head.ts, with unit tests.getHeadToHeadRunsloads a group's newest runs (max 50) when the user expands it, and the eye button fetches the latest run when clicked.Behaviour changes worth noting:
platform/model_used/region, so two raw platforms that resolve to the same provider show as two rows.Not in this PR: the data source is still a single page of raw results (PostgREST's 1,000-row cap), so large brands are still summarised from their newest answers. Moving the summaries onto the daily rollups depends on #867 and is the remaining part of #923.
Related issue
Part of #923
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
yarn test src/lib/head-to-head.test.tsfromweb/.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)🤖 Generated with Claude Code