Hive Hive
Sign in

fix(server): add id tiebreaker to test case runs pagination

GitHub issue · Closed

Metadata
Source
tuist/tuist #11045
Updated
Jun 24, 2026
Details

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.

Comments
TA
tuist-atlas[bot] Jun 5, 2026

The changes from this PR are now available in release xcresult-processor-image@0.11.0. The id tiebreaker for test case runs pagination is now live.

TA
tuist-atlas[bot] Jun 5, 2026

This fix is now available in server@1.206.0. Update to receive the improvement: an id tiebreaker has been added to test case runs pagination, preventing duplicate rows and missing data when multiple rows share the same ran_at timestamp.