Repository navigation
Closed
Labels
priority/p2-mediumPriority P2: standard workscope/ciGitHub Actions workflows, pre-commit hooks, CI gates, and runnersscope/cliCore CLI framework, Typer subcommands, options, and tablestype/featureType feature: a new function
Milestone
Description
Context & Rationale
AGENTS.md:11 sets zero tolerance for flaky tests, but nothing reorders or repeats them:
uv.lockhas no pytest-randomly, pytest-repeat or pytest-rerunfailures.addoptsis-n logical(pyproject.toml:105).- xdist's load scheduling turns order coupling into intermittent failures on later, unrelated runs.
Evidence:
- Order dependence causes 59% of flaky Python tests (arXiv 2101.09077).
- Meta's TestGen-LLM rejects a test that does not pass all of 5 runs (arXiv 2402.09171).
A serial run of two files took about 15 s, of which 9 s was setup, so N repeats cannot go into pre-push.
Scope & Deliverables
- Deliverable:
- Add pytest-randomly 5.x (pytest-dev) to the dev group, and add
-p no:randomlytoaddoptsso existing runs keep their order. - Add
devops ci test --repeat N --seed S:- it runs the selected targets N times serially (
-n 0) with-p randomly --randomly-seed=S+i; - S defaults to a value derived from HEAD's hash;
- on the first failure it prints the seed and a reproduction command;
- the default N lives in
config/defaults.py.
- it runs the selected targets N times serially (
- Add a 'Changed-Test Independence' job to
ci.yml, triggered onpull_request. It runs--repeat 3over the added or modified test files and is skipped when no test file changed.
- Add pytest-randomly 5.x (pytest-dev) to the dev group, and add
- Acceptance criteria:
- A pytester fixture with two tests that share module state passes in plain order and fails under a seed that reverses them; the output prints that seed.
- The argv of every repeat run is asserted, and the full-gate argv contains no randomly option.
- With the plugin installed,
uv run pytest --co -qgives the same collection order as before. - The job is skipped when no test file changed.
- The unit tests take at most 1 s.
- Key questions: none.
- Constraint:
- Shuffling the whole suite waits for the thread-leak entry (
ROADMAP.md:1070). - Timing-ceiling flakes are fixed at the source, by the CLI start-up item (
ROADMAP.md:1022).
- Shuffling the whole suite waits for the thread-leak entry (
Strategic Alignment
- Milestone: Backlog
- Depends on: feat(cli):
devops ci testselects tests from a coverage index built on demand bydevops ci coverage --build-index#406
Metadata
Metadata
Assignees
Labels
priority/p2-mediumPriority P2: standard workscope/ciGitHub Actions workflows, pre-commit hooks, CI gates, and runnersscope/cliCore CLI framework, Typer subcommands, options, and tablestype/featureType feature: a new function
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.32 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: URLs and host keys read by the library that dials, ollama hardening, and pull-request test-quality tooling. Position 8 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
feat(ci): shuffled repeat runs of a pull request's changed test files (…
feat(ci): shuffled repeat runs of a pull request's changed test files (…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1512, merged into
release/v0.2.32as a9d7fd8.17 file(s) changed.
How it was verified
Check runs at 470cf3a:
Acceptance Criteria of
docs/agent/tasks/task-852-shuffled-repeat-runs-of-changed-test-files.md:test_repeat_stops_at_the_seed_that_breaks_order_dependent_tests(tests/test_ci_repeat.py) runsdevops ci test --repeat 3 --seed 2 tests/test_shared.pywith each run going to an in-processpytester.runpytest. Seed 2 keeps file order and passes; seed 3 reverses it and fails; seed 4 never runs. The output holdsRun 2/3 failed with seed 3anduv run pytest -n 0 -p randomly --randomly-seed=3 tests/test_shared.py. The inner project blocks randomly in its ownaddopts, as the repository does, so the test also shows-p randomlyoverriding the block.test_each_repeat_runs_the_targets_serially_with_the_next_seedasserts the three argvs and their working directory for--repeat 3 --seed 10 -n 4 -v -k unit -x -- tests/test_x.py.test_the_gate_and_a_plain_run_stay_in_file_orderasserts that noget_check_specs()command and no run without--repeatnames randomly, and that the default is 0.uv run pytest --co -qgives the same collection order as before. On this branch's base, 10,277 tests collected; with the change, 10,288. After removing the 11 additions (the 10 tests oftests/test_ci_repeat.pyand this task file's own check intests/test_agent_task_files.py), the two lists are identical (diffprints nothing).test_pytest_randomly_is_installed_and_blocked_by_defaultpins the pin and the block.changed=false, and the toolchain and test steps run onlyif: steps.changed_tests.outputs.changed == 'true'.test_the_changed_test_job_reruns_added_or_modified_test_filespins the job's trigger, permissions, diff filter, pathspec, step conditions, cache inputs and command, and that no run script expands${{ }}.uv run pytest -n 0 --durations=0 tests/test_ci_repeat.py) in six of seven runs, at load average 12 to 15 on 16 cores; the seventh, during a burst of other worktrees' suites on the same host, measured 1.58 s. The pytester test is 0.39 s to 0.46 s of the total, and each CLI case 0.03 s to 0.06 s. The module builds thecicommand group once, astests/test_k8s_run_job.pydoes, rather than Typer rebuilding it on every invoke; before that, the same command measured 0.90 s to 0.96 s.tests/conftest.pysends the run to the whole suite,--repeatexits 1 and starts nothing (test_repeat_refuses_to_shuffle_the_whole_suite). When HEAD cannot be read it exits 1, names--seedand starts no test run (test_an_unreadable_head_asks_for_a_seed). The HEAD seed isint("deadbeef", 16)for HEADdeadbeef…(test_the_first_seed_defaults_to_heads_commit_hash).--dry-runplans every run and starts no process (test_a_dry_run_plans_every_repeat_and_starts_no_process).tests/test_ci.pyandtests/test_ci_repeat.py,uv run devops pr checks <number>lists Changed-Test Independence. With the run ID fromuv run devops gh runs list --branch feat/852-shuffled-repeat-changed-test-files,uv run devops gh runs view <run_id> --log | grep '^Changed-Test Independence' | grep -E 'tests/test_ci(_repeat)?\.py$|Using --randomly-seed='prints both file names from the Detect Changed Test Files step and threeUsing --randomly-seed=lines whose values are consecutive.release/v0.2.32that changes no test file,uv run devops gh runs view <run_id> --log | grep '^Changed-Test Independence', with the run ID fromuv run devops gh runs list --branch <head branch>, prints "No test file changed; skipping." and no line from the Set up uv toolchain or Run Changed Tests in Shuffled Order steps, which the run's summary page shows as skipped.feat(release): v0.2.32 (#1516)
feat(test): devops test and devops ci test choose tests through one s…
feat(release): v0.2.37 (#1720)