Repository navigation
feat(results): split mix test partitions by recorded duration (T24) - #149
Merged
Merged
Conversation
… suites GET /v1/test-results/durations?target=&day= returns each test file's median duration over the named targets' latest 20 complete, uncached runs in the 7 days before `day` began. Every shard of one commit asks with the same targets and day and gets the same answer; a day that has not begun is 409. Answers are kept per replica since they cannot change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A `MIX_TEST_PARTITION=K mix test --partitions N` target (a firstlanding shard) now runs an explicit file list: the files Mix would deal out, split longest-first by their median durations from aster-srv as of the commit's UTC day, so every shard reaches the same split. No server, no history, an error, an unknowable file set or ASTER_BALANCE_PARTITIONS=off keep the command as written. MIX_TEST_PARTITION stays set for per-partition databases; retry and result capture work on the rewritten command. Tests a shard runs for another project (`cd ../platform && mix test`) are now identified by that project, so a test keeps its id whichever shard runs it. This changes the ids of shard tests once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 15, 2026
Merged
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.
Merge order: independent of the P4 quarantine PR. After merge: release aster, deploy the new aster-srv image, bump firstlanding's
ASTER_VERSION. Shards keep Mix's split until the server answers.What (T24)
Splits partitioned
mix testsuites by recorded time rather than by file count.GET /v1/test-results/durations?target=…&day=YYYY-MM-DDreturns each test file's median duration.daybegan count, less 15 minutes for uploads still committing.MIX_TEST_PARTITION=K mix test --partitions Ntarget, including the firstlandingbash -c 'cd ../platform && …'shards, runs an explicit file list instead.--partitionsis dropped.MIX_TEST_PARTITIONstays set, because projects name their per-partition databases after it.Determinism: a file must run on exactly one shard
Every shard computes its split independently, so every shard must work from the same inputs.
.aster/durations/.test_paths/test_pattern/load filters, umbrella apps,file:line,--failed/--stale, and symlinks undertest/.ASTER_SRV_URL, with no history, after an error, or withASTER_BALANCE_PARTITIONS=off, the command runs byte-for-byte as written.Known risk: a partial outage. If one shard can't reach the server after 3 tries (10s timeout each) while the others can, that shard falls back to Mix's split. Some files would then run twice and some not at all. Its log line says so ("split by Mix (durations unavailable: …)"). A failed fetch can't fail the build safely, and checking across shards would need coordination between jobs that this PR does not add.
Test identity change (deliberate, one-time)
Before this PR, a test's id hashed in the shard project's address, e.g.
//services/platform-test-shard-1. Two things break that:Shard tests are now identified by the project that owns the suite: the directory the one-liner
cds to, e.g.//services/platform. The project is derived from the target's configured command, so overrides never change it.targeton each result is still the shard. Onlytest_idchanges.Measured vs simulated
PASS //…-shard-N:test-ci (…)lines, taken from runs where all four ran.That headroom is an upper bound: run-to-run noise and each partition's fixed boot time stay. The real drop gets measured after rollout from the same log lines.
Query cost on a seeded copy with 14M result rows (4 shard targets of 3,000 tests, 20 runs each): 1–2.5 s per answer. Each answer is then cached.
Verification
crates/aster-srv/tests/durations.rs): medians across shards; cached, partial and other-target runs left out; window edges; the 20-latest-runs cap; 409/403/401.cargo fmt,clippy -D warnings(all features),cargo docwith-D warnings, and the workspace tests with Postgres all pass. The one failure istests/dev_services.rs, a known local flake.🤖 Generated with Claude Code