Skip to content

test.sh: one batch line per decade from test_111*, so new tests stop colliding (shard map unchanged) - #1114

Merged
lmoresi merged 2 commits into
developmentfrom
ci/test-sh-decade-globs
Nov 12, 2026
Merged

lmoresi merged 2 commits into
developmentfrom
ci/test-sh-decade-globs

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 12, 2026

Copy link
Copy Markdown
Member

scripts/test.sh only. This stops the 11xx block being the merge conflict in every PR that adds a test.

Why. Every PR that added a test_11NN file appended its own batch 4 tests/test_11NN*py # comment line next to the last one, so the block conflicted in nearly every merge: seven merges were held up on 2026-11-12. Tests below 1100 never collide, because range globs (batch 4 tests/test_01*py) cover them.

Change.

  • The 25 single-file lines become one line per decade, tests/test_111*py to tests/test_117*py. test_118* and test_119* are added now, ahead of the open PRs that bring test_1181–1186. A new test in an existing decade needs no edit to the script.
  • The three files in that block that run on shard 3 (test_1131, test_1141, test_1142) keep their own lines. They are taken out of their decade's line with a whole-file --deselect, the idiom test_0022 already uses.
  • batch() now skips a line whose patterns match no file. The script has no nullglob, so an empty decade reaches pytest as its own literal pattern, and pytest would fail on a path that doesn't exist.
  • The per-line comments go; each test's docstring says the same thing.
  • The parallel pass, including the np 2, 3 and 4 lines Run the opt-in --full-parallel pass at np 3 as well as np 4 #1092 arranged, is untouched.

Checks.

  • Reachability: python3 scripts/check_test_coverage.py passes, unchanged: all 437 test files are reachable.
  • Shard assignment, file by file: I expanded every batch line's globs from the repo root and removed its whole-file --deselects, before and after. The two maps are identical: 451 files, none in more than one shard. --print-shards is still [1,2,3,4,5,6].
  • New files: a new tests/test_1181_*.py lands on shard 4 with no edit.
  • Wall-clock on hyperion (serial phase only, WORKERS=4 as in CI, ./scripts/test.sh --shard N/6):
shard before after tests passed
4 1835 s 1305 s 1224 before and after
3 2492 s 2276 s 887 before and after

Shards 1, 2, 5 and 6 have byte-identical batch lines, so they can't change. A decade's files now share one pytest process, as the tests below 1100 already do; on shard 4 that removes about 20 pytest start-ups.

For the other sessions. Once this lands, each open PR loses its own test.sh line at its next merge of development. That gives one last conflict each, resolved by taking development's side.

Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)

  • I have read the Style Charter and followed it over the surrounding code (S2)
  • No drive-by refactors, renames, or "while I was here" cleanups (S9)
  • Bug fixes ship the regression test, written first, with level_* and tier_* markers (S8): not applicable (a script change). The checks above are the evidence.
  • No hedging names (maybe_ / try_ / do_) and no commented-out code (S3, S4)
  • Every exception swallow states its sanctioned failure mode in a comment (S4)
  • New data access uses .array / mesh.X.coords — no with ....access(...), no mesh.data (S7)
  • Parallel safety considered (S11): the parallel pass is not touched
  • No pixi.toml / pixi.lock or other dependency changes riding in an unrelated PR
  • AI-assisted work carries the attribution line below

Underworld development team with AI support from Claude Code

🤖 Generated with Claude Code

…op colliding here

Every PR that adds a test_11NN file appended its own `batch 4 tests/test_11NN*py`
line next to the last one, and the block became the merge conflict in every
PR (seven merges held up on 2026-11-12). Tests below 1100 never collided,
because range globs cover them.

- The 25 single-file lines become one line per decade: test_111* to
  test_117*, plus test_118* and test_119* ahead of the PRs that bring them.
  A new test in an existing decade needs no edit here.
- The three files that run on shard 3 (test_1131, test_1141, test_1142)
  keep their own lines, and are taken out of their decade's line with a
  whole-file --deselect, the idiom test_0022 already uses.
- batch() skips a line whose patterns match no file (no nullglob, so an
  empty decade arrives as its own pattern), rather than handing pytest a
  path that does not exist.
- The per-line comments go; each test's docstring says the same.

The shard assignment is unchanged file by file: every batch line expanded,
deselects applied, 451 files, before and after identical.
check_test_coverage passes unchanged (437 files), --print-shards is still
[1..6], and a new test_1181 file lands on shard 4 with no edit. The
parallel pass is untouched.

Underworld development team with AI support from Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

The conflict was development's new test_1154 line in the old layout; the
test_115* decade covers it. The new parallel line for test_1101 merged as
it was. The shard map (development's test.sh against this one, on the
merged tree) is identical over 453 files, and check_test_coverage passes
(438 files).

Underworld development team with AI support from Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmoresi

lmoresi commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Review of #1114 (H3, second review desk)

Verdict: READY at 7f7a675, merged on green CI (4 of 6 jobs green, 2 running when checked). A scripts/test.sh change that keeps every file on the shard it had.

What we checked

  • Shard-map identity.
    • Method: on one tree (the PR's tests), each script was run for every --shard k/6 with fake pytest and python on PATH that print their arguments. Each batch's globs were expanded, and the --deselect node ids (relative to tests/, the rootdir of tests/pytest.ini) taken out.
    • Development's script and the PR's give the same file-to-shard map: 453 files each, 0 differences, and no file on two shards.
    • (--print-shards prints only the shard list, [1,2,3,4,5,6], so this is the per-file check.)
  • The deselects work in pytest itself. pytest --collect-only on the PR's two decade lines, tests/test_113*py --deselect=test_1131... and tests/test_114*py --deselect=test_1141... --deselect=test_1142..., collects none of test_1131, test_1141 or test_1142. This is the same mechanism development already uses for test_0022.
  • New files: a new tests/test_1157_*.py in an existing decade and a new tests/test_1185_*.py in the empty 118 decade both run on shard 4, with no edit. check_test_coverage.py passes with them.
  • Empty decades: batch() skips them, with "batch 4: no test files match: tests/test_118*py" (and the same for 119).
  • A deselected file cannot go dark: with the line batch 3 tests/test_1131*py deleted, check_test_coverage.py fails and names tests/test_1131_rotated_nullspace_from_mesh.py. It sees through the shard-4 deselect.
  • Parallel passes: no changed line touches a parallel, ptest, mpirun or supervisor line.

Not checked

The wall-clock claim (shard 4 from 1835 s to 1305 s). It follows from fewer pytest start-ups, but we didn't time it.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

PR #1114 review: scripts/test.sh, one batch line per decade

READY at 7f7a675. It merges cleanly onto current development 264400a (git merge-tree, no conflicts). All four checks below pass on the merged script, run on development's tree.

Method:

  • Development 264400a and the PR head were taken from git archive. The merged scripts/test.sh is the one from git merge-tree --write-tree origin/development 7f7a6756.
  • To read off the shard map, each script was run with --shard N/6 for N = 1..6, with a stub pytest on PATH. The stub prints the files each batch call would collect, after --deselect, with node ids taken relative to tests/ as pytest's rootdir is.

1. The shard map is identical. Every one of the 456 files is in the same shard under development's script and under the merged one (0 differences). --print-shards gives [1,2,3,4,5,6] on both.

I checked the --deselect form with real pytest (--collect-only, --config-file=tests/pytest.ini) on development's tree:

glob test_1131/1141/1142 items with the deselect without
tests/test_113*py --deselect=test_1131_….py 0 28
tests/test_114*py --deselect=test_1141_….py --deselect=test_1142_….py 0 27

So the three shard-3 files leave shard 4's decades and run once, in shard 3.

2. New files are picked up without an edit. I added tests/test_1179_h1_probe.py (an existing decade) and tests/test_1188_h1_probe.py (the empty 118x decade). The merged script runs both, in shard 4. Development's script runs neither, and its check_test_coverage.py reports them as unreachable.

3. A deselected file cannot go dark.

  • scripts/check_test_coverage.py passes on the merged script: all 443 test files are reachable, and 18 of 40 ptest files run, with 22 deferred with a reason.
  • Deleting the shard-3 line for test_1131, or the one for test_1141, makes it fail and name that file.

4. The parallel phase is untouched. No changed line mentions mpirun, PARALLEL, ptest, tests/parallel or shard_owns. Everything from if [ $PARALLEL_RANKS … to the end of the file is byte-identical (md5 c7067f37… on both). In total the diff against development removes 26 lines and adds 31.

Not run: the batches themselves. That is CI's job, and H4 reports the wall-clock times.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit ba68af0 into development Nov 12, 2026
10 checks passed
lmoresi pushed a commit that referenced this pull request Nov 12, 2026
…alls

One conflict, in scripts/test.sh: development's side is taken (#1114, one line
per decade), so the batch line for tests 1181 to 1185 is gone and the
test_118* decade covers them.

Underworld development team with AI support from Claude Code
lmoresi pushed a commit that referenced this pull request Nov 12, 2026
One conflict, in scripts/test.sh: #1114 replaced the per-file batch lines with
one line per decade. Development's side is taken, so the batch line for tests
1184 and 1185 is gone (the test_118* decade covers them); the np 4 line for
test_1184 in the parallel phase is kept.

Underworld development team with AI support from Claude Code
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.

3 participants