Hive
fix(server): add id tiebreaker to test case runs pagination
GitHub issue · Closed
What
Add :id as a secondary sort key to the test case runs list endpoint pagination.
Why
The endpoint orders by ran_at only. When multiple rows share the same ran_at timestamp (common in parallel test runs), ClickHouse reshuffles their relative order between page fetches. This causes:
- Duplicate rows appearing on adjacent pages
- Rows that never appear on any page (skipped during the reshuffle)
In practice, a test run with 5681 test cases only returns ~4254 unique rows through pagination, with ~1427 rows lost. This means downstream consumers (like our CI test reporting) miss quarantined test failures that should be filtered from results.
How
Add :id to order_by and :asc to order_directions in render_test_case_runs, matching the pattern already used in apply_quarantined_order which has a comment explaining the exact same issue (lines 2396-2399 of tests.ex).
Also added :id to the sortable list in TestCaseRunByTestRun and TestCaseRunByProject schemas so Flop accepts it.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.