← All work

ci-test-picker

Given a patch to the sqlglot library, it picks the tests that could fail and splits them across CI workers, with the rule that no failing test may be missed.

Year
2026
Category
Developer tooling, program analysis
Status
Built. Results are from the repository README and have not been reproduced.

Overview

ci-test-picker takes a patch to the open-source SQL library sqlglot and decides which of its tests could fail, then divides those tests across up to eight CI workers. The rule is strict: every test that fails must be picked, because a missed failure counts far worse than running extra tests.

The problem

sqlglot's suite has 1,620 tests and, per the README, takes 103 seconds on one core, with a single test taking 28.8 seconds. Each commit is scored on the slowest worker's time plus 2 seconds per worker, plus 300 seconds for any missed failing test, plus the selector's own CPU time.

What was built

A selector that starts from a coverage map and then narrows it with rules. A rule may drop a test only when it can prove the test's result cannot change; otherwise the test stays.

  • Coverage map. Every test is run in isolation and records the statements, functions, classes and files it touched. A patch selects the tests that ran its changed lines.
  • Finer rules. Class-level changes keep only tests that used the class, edits to one dictionary entry keep only tests that looked it up, and comment, docstring or overload-stub edits select nothing if the package still imports.
  • Operator swaps. When an operator such as == becomes is, a profile of what each test saw decides whether the swap can change anything. The README notes the first version of this rule missed 20 failing tests and was fixed.
  • Run it for real. Small selections run on the patched code in a warm fork server, and some long tests re-run only the cases that reach the changed functions.
  • Worker packing. Chooses the number of workers and balances the load.

Tools in the repository rebuild the maps and generate mutant commits to check each rule for safety.

Technical details

The README reports that each rule was checked against generated mutant commits before it was kept. For example, the comparison-swap rule dropped 11,614 tests across 41 commits and none of them failed.

Status

Complete as described in the repository. The README reports 144.8 s against 1,614.1 s for running everything on 40 held-out commits, with no missed failures, including the selector's own CPU time.

What is not documented

The results have not been reproduced for this page. The held-out commits are not in the repository, and the benchmark's scorer and sample commits were supplied externally.