Skip to content

fix(affected): skip a mix test shard whose partition gets no selected file - #98

Merged
calvin-archastro merged 1 commit into
mainfrom
fix/related-empty-partition
Oct 9, 2026
Merged

calvin-archastro merged 1 commit into
mainfrom
fix/related-empty-partition

Conversation

@calvin-archastro

Copy link
Copy Markdown
Contributor

What

A narrowed mix test --partitions N shard is skipped when its partition gets none of the selected test files.

Why

mix test --partitions N sorts the files it is given and deals them out in turn. Partition K of fewer than K files is empty, and Mix then fails:

Paths given to "mix test" did not match any directory/file: test/a_test.exs

--related handed every shard the whole selection, whatever its partition. A change that reached one test file therefore failed every shard but the first.

Seen in CI on a private monorepo with four shards: a one-file selection passed in shard 1 in seconds, failed in shards 2 to 4, and each of those was then retried in full (about 10 minutes each).

How

  • The partition number is read from MIX_TEST_PARTITION=K written in front of the command in the shard's one-liner, and the total from --partitions N or --partitions=N.
  • With fewer than K selected files, the shard has nothing to run and is reported as skipped. The count is enough; the order Mix sorts in does not matter.
  • When the partition number is not written in the command (it comes from the caller's environment), nothing changes.

Tests

  • New: a_shard_whose_partition_gets_no_selected_file_is_skipped.
  • shard_projects_run_their_slice_of_the_selected_tests now selects two files so that both shards run; it previously asserted the failing behaviour for the second shard.
  • Replayed the failing pull request's four shard lanes with this build: shard 1 runs the one file, shards 2 to 4 have no targets.
  • cargo test: all pass except dev_services::dynamic_port_bundles_are_distinct_propagated_and_released, which fails the same way on main on my machine.
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check are clean.

🤖 Generated with Claude Code

… file

`mix test --partitions N` deals the files it is given out in turn, so
partition K of fewer than K files is empty, and Mix fails with "Paths
given to mix test did not match any directory/file". A narrowed shard
was handed the whole selection whatever its partition, so a change that
reached one test file failed every shard but the first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@calvin-archastro
calvin-archastro requested a review from a team October 9, 2026 17:55
@calvin-archastro
calvin-archastro merged commit 0280b3b into main Oct 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant