Skip to content

CI runs the ptest_* files that pass; the rest are listed with their reason - #958

Merged
lmoresi merged 4 commits into
developmentfrom
bugfix/ptest-in-ci-900
Nov 7, 2026
Merged

lmoresi merged 4 commits into
developmentfrom
bugfix/ptest-in-ci-900

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

CI now runs the 16 ptest_* files that pass under pytest (14 at both np 2 and np 4, 2 at np 2 only), and the coverage check fails on any ptest_* file not accounted for.

What was wrong

39 files in tests/parallel/ are named ptest_*. CI's parallel phase enumerates test_*.py, and check_test_coverage.py looks only at tests/test_*.py, so nothing ran them and nothing could see that (#900). They include pins the design notes cite.

The fix

Shard 2 gains about 4 minutes here. Please read its time on this run.

Tests

  • scripts/test.sh --parallel-only --p 2 --shard 2/4: exit 0, 14, 21 and 27 passed in the three batches, 1 skipped. The np 4 loop has not been run in this final form.
  • ptest_jit_cache at np 2 with a seeded XDG_CACHE_HOME: 5 passed, the seeded files survive.
  • check_test_coverage.py: rc=1 on an unlisted file, a stale entry, a typo and a commented-out entry.
  • 001a and 003: exit 0 at np 2 and 4; they were TypeError and ValueError.

Review records are in the comments: the first pass, then the integration session's.

Refs #900

Underworld development team with AI support from Claude Code

…eason

39 files in tests/parallel/ were named ptest_*, so nothing ran them and nothing
could see that (#900). 14 run tests under pytest and pass at np 2 and np 4 on
eddab70, and scripts/test.sh now runs them, after the test_* files, so that adding
one does not move a test_* batch. scripts/check_test_coverage.py fails on a ptest_*
file in neither place, and on an entry that no longer applies. The other 25 are
listed there with why: 19 scripts with no test functions, one whose test is skipped
unconditionally, 5 that fail or hang at a rank count CI's passes run.

Three old scripts are brought up to date, none of which CI runs yet:
- ptest_001a: setCoordinateDisc now needs `localized`. Before: TypeError. After:
  exit 0 at np 2 and 4.
- ptest_003: evaluate returns (N,1,1). Before: ValueError. After: exit 0 at np 2 and 4.
- ptest_0851: needs the residual strength #759 asks for, set as test_0851 sets it.
  Before: ValueError at the floor rule. After: it reaches its assertion and fails:
  "Cross_1: parallel peak 0.0064 vs serial 0.0142". That is listed in #900 and #956.

Refs #900

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 6, 2026 06:11

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.

@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Adversarial review of #958

Independent pass on the branch at 0171eef6, before this PR; fixes applied in e8e606b. Probes on hyperion in runs/2026-11-06/rev900/. Verdict at 0171eef6: merge after two small fixes.

Findings

  1. Must-fix, fixed. dark_ptests read comments too: commenting a file out of test.sh left the check saying OK, the 39 parallel test files (tests/parallel/ptest_*.py) never run in CI, and the coverage check cannot see them #900 failure again. It now reads uncommented lines; a commented-out entry gives rc=1.
  2. Must-fix, fixed. ptest_0763's one test is skipped unconditionally, so "15 pass" overstated. It is now deferred with that reason: 14 run.
  3. Fixed in wording. The 72 test_* files fill 12 batches of 6 exactly, so existing batches stay put, but adding a test_* file regroups the appended ones.
  4. To check on this run. Shard 4 gains about 3 minutes here, perhaps 5 to 6 on a runner, against a 60-minute cap. The test.sh header table is not updated.
  5. Fixed. The 0864_seam and 0865 reason now says they pass at np 2 and fail at np 4, which only --full-parallel runs.
  6. Open. 0844_reconnect's hang and 0863's failure were unconfirmed at low silence: both were killed as "stuck" after 135 s at --silence 100. A long silent solve reads as a hang there. 0851 at --silence 450 finished in 211 s on its stated assertion, so it would need PARALLEL_SILENCE raised to join.
  7. Style. A name in test.sh with no file behind it is not caught by the check; pytest fails on it at run time.

Attacks that failed

  • Run as test.sh runs them, with 0763 still in: np 2, 26 passed / 2 skipped, 21 passed, 10 passed (22 s, 132 s, 28 s), rc=0; np 4, the same counts (26 s, 188 s, 28 s), rc=0. No stray files, collisions or state leak. Not repeated after removing 0763.
  • --print-shards and shard counting are unaffected. The coverage check runs in test.sh's serial phase on every shard.
  • The check gives rc=1 on an unlisted file, a stale entry and a typo.
  • Test edits are right: 001a's localized=False matches setCoordinateDisc(disc, localized, project); 003's reshape is right for a scalar; 0851's -sympy.oo copies tests/test_0851_fault_network_3d.py:148 and touches no comparison.
  • The 19 script files have no def test_ or import pytest. 000c and 000d read files nothing makes.

Issues

Merge conditions

  • Read shard 4's time on this run, and update the test.sh header table if it moves.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Adversarial review of #958 at e8e606b

An independent pass on the laptop: serial only, with no MPI. Probes ran in two local worktrees: the branch, and development eddab70 (the branch's merge base). We also read the CI logs of runs 42172869834 (this PR) and 42095953261 (development eddab70).

Must fix

  1. High. tests/parallel/ptest_jit_cache.py:160-166, 269-275: under pytest, the file deletes every file in the user's real JIT cache. The file sets up its isolated cache only in main() (lines 388-389, which call _setup_isolated_cache, lines 72-81). pytest never calls main(), so _jc.get_cache_dir() returns ~/.cache/underworld3/jit (or $XDG_CACHE_HOME/underworld3/jit). In that directory rank 0 of test_2 and test_5 unlinks every file.

    • Failure scenario: anyone who runs ./scripts/test.sh --p N loses the JIT cache that every worktree and environment on the machine shares. On a machine where sessions run side by side (hyperion), test_2's exact check so_files == [expected_so] (line 191) fails whenever another process publishes into the cache during that window. _fail then calls COMM.Abort(1) (lines 61-63), which kills the batch, and pytest reports nothing.
    • Probe: we seeded a scratch XDG_CACHE_HOME/underworld3/jit with sentinel_user_file.txt and a fake 0123456789abcdef.so, then ran pytest ptest_jit_cache.py -k test_2 serially (1 passed). Afterwards the directory held only 554df0f52f794743.so, its manifest and its lock. Both seeded files were gone. Without XDG_CACHE_HOME, get_cache_dir() in the runtime env prints /Users/lmoresi/.cache/underworld3/jit.
    • Fix: a module-scoped autouse fixture that does what _setup_isolated_cache does (a temp dir shared by every rank, set as UW_JIT_CACHE_DIR) and restores the variable afterwards. main() can call the same helper.
  2. High. scripts/test.sh:442-463 + .github/workflows/build_uw3_and_test.yaml:93: shard 4 already sits at its 60-minute cap, and on this PR's own run it was cancelled before the ptests started.

Should fix

  1. Medium. scripts/test.sh:437-457: whether the ptest batches stay separate from the test_ batches depends on there being exactly 72 test_ files.** At this commit the 72 files fill batches 1-12, and the ptest files start at batch 13. Open PRs A rebuild-memory test on the rotated free-slip + custom-FMG + split-fault path (refs #948) #951, #946: refining a spherical mesh no longer folds cells; a missing label moves nothing (#903) #952 and After a mesh move, solves see the remapped field; a move is decided over all ranks #959 each add one tests/parallel/test_*.py file. After any one of them merges, batch 13 becomes test_1140_rotated_analytic_normal_wall_nodes_parallel.py plus five ptest files, and every ptest batch shifts.

    • Probe: we touched test_0766_mover_refreshes_mesh_vector_parallel.py in the worktree and printed the batches with a script that expands the globs as test.sh does. Batch 13 then held test_1140 + ptest_0762, 0843, 0844_line_cut, 0845, 0845_relax.
    • A separate loop over a PTEST_FILES array keeps the two sets in separate mpiruns, and their batches cannot move each other.
  2. Medium. scripts/check_test_coverage.py:57-58: 0864_seam_ligament and 0865 are deferred for a rank count CI does not run. The stated reason is "passes at np 2, fails at np 4, which --full-parallel runs". CI runs --p 2 (workflow line 134), and no workflow passes --full-parallel (grep of .github/workflows/ finds none). These are two of the pins that 39 parallel test files (tests/parallel/ptest_*.py) never run in CI, and the coverage check cannot see them #900 and the design note cite at np 2, and they stay dark at the one rank count CI uses. test.sh:478-486 already handles this case for test_0760 with --deselect in the np 4 loop. Running them at np 2, and deselecting the failing np 4 node ids under Fault pins ptest_0863, 0864, 0865 fail at np 4, back to at least 2026-10-29 #956, keeps that coverage.

  3. Medium. scripts/check_test_coverage.py:73-102: the check still cannot see the tests/parallel/test_* glob (39 parallel test files (tests/parallel/ptest_*.py) never run in CI, and the coverage check cannot see them #900 item 3). globs_run_by reads only batch and ${PYTEST lines, and every is tests/test_*.py. Probe: we narrowed PARALLEL_FILES=(tests/parallel/test_*.py) to test_07*.py, which takes 46 of the 72 test_* files out of the mpirun phase. The check still printed OK: ... 14 of 39 ptest files run, rc=0.

  4. Low. scripts/check_test_coverage.py:65-67: any mention of the path on a line that does not start with # counts as "run". Probe with an unlisted dummy tests/parallel/ptest_9999_dummy_review958.py:

    • named only in a trailing comment (tests/parallel/ptest_jit_cache.py # tests/parallel/ptest_9999_...py to follow): rc=0, "15 of 40 ptest files run";
    • named only inside an echo string in the serial phase: rc=0.
    • Reading only the entries of the PARALLEL_FILES+=(/PTEST_FILES=( block, with trailing comments stripped, closes both cases.
  5. Low. tests/parallel/ptest_0864_split_checkpoint_parallel.py:86-92: test_partition_can_separate_the_two_sides_of_a_cut cannot fail.

    • serial_dofs is bcast of global_dofs, which is a global size and equal on every rank by construction, so global_dofs == serial_dofs always holds.
    • allreduce(local_pairs) >= 0 holds for any count.
    • The PR now counts this test as a gating pass. Either pin global_dofs to the serial count as a constant, or delete the test.

Notes

  1. ptest_0852:21-22, ptest_0859:20-21, ptest_jit_cache.py: no mpi mark and no timeout mark. 0852 and 0859 carry parallel_safe, which tests/pytest.ini does not register. Their only bound is the supervisor's 300 s of silence.

  2. The supervisor sees whole lines (mpi_supervisor.py:342-345). pytest's progress dots do not end a line, so "silence" lasts roughly one file. In the eddab70 log, test_1064's ..ss appears only at the kill (20:25:32 to 20:31:03). Any one ptest file that runs longer than 300 s on a runner will be killed as a hang. No ptest file has been timed on a runner (Must-fix 2).

  3. Rank-local asserts sit before collectives in the included files: ptest_0845_fault_split_parallel.py:172 (before _global on line 173) and ptest_0859:66-67 (before the allreduce on line 73). If one of these fails on one rank only, it shows up as a 330 s hang, which is ptest_0844_reconnect hangs in parallel: a rank-dependent assert leaves its peers in a collective #961's pattern. On a shard at its cap, that 330 s decides whether the run is red or cancelled.

  4. ptest_0852:97 asserts 0.10 < max(peaks) < 0.20 against a serial value of 0.1462. That band is +/-32%, which is not tight enough to fail when a default changes (Charter §8). It now gates.

  5. DEFERRED_PTESTS reasons:

  6. ptest_001a:38 passes localized=False for every PETSc version above 3.20.5. The library passes it only for 3.24 and later (discretisation_mesh.py:2773-2776). The file is deferred, so CI does not see it.

  7. ptest_003:37: the edited line keeps sw_values.data and swarm.data (Charter §7). This is a deferred script.

  8. Add CitcomS predictor-corrector DDt manager for composed transport #689 adds tests/parallel/ptest_1119_supg_restart.py. Once this PR merges, Add CitcomS predictor-corrector DDt manager for composed transport #689 fails the coverage check until it renames the file to test_* or lists it. That is the intended effect.

  9. The test_00[0-4]* serial batch on shard 4 took 17:32 to 53:40 across these runs (header table: 5:14). This PR does not touch it. That variance alone is enough to push shard 4 past its cap.

Attacks that failed

  • The test_ batches did not move.*
    • Batches 1-12 are the same file by file on development and on the branch: 72 files under LC_ALL=C, C.UTF-8 and en_US.UTF-8 (the batches printed on each tree and diffed).
    • An emulation of glibc en_US collation (punctuation ignored at the first level) gives the same order. It also gives the same order with the 8 test_* names added by open PRs.
    • The file order CI ran on eddab70 matches the local C order for all 68 files that ran. 1065-1069 never ran, because batch 7 was killed.
    • Batches 13-15 at this commit are ptest files only.
  • The coverage check fires where it should. It gives rc=1 for an unlisted ptest dummy (prints "in neither scripts/test.sh nor DEFERRED_PTESTS"). It gives rc=1 with the whole PARALLEL_FILES+=( block commented out (14 dark). The dummy is removed and git status in the worktree is clean.
  • Every added mpirun goes through $SUPERVISE: it is the same loop, test.sh:460-463.
  • The 19 SCRIPT_STYLE files have no def test_ and no import pytest.
  • The skip in 0763 is unconditional (line 24).
  • The 0851 floor change weakens nothing. It matches tests/test_0851_fault_network_3d.py:148. damage_yield is dial*(1+2*edot_II), which is at least dial, which is above 0, with tau_far above 0 (fault_network.py:1397-1398). So a -oo floor admits no negative yield, and no assertion is weakened.
  • 001a matches DM.setCoordinateDisc(self, disc, localized, project) on petsc4py 3.25.3.
  • The 003 reshape is right for a scalar.
  • The seam skips in 0845 are decided together (allgather of the outcomes).

Issue verdicts

Not checked, and what the Linux server or CI should run

  • Nothing ran under MPI here. On hyperion, run batches 13-15 as test.sh runs them, at np 2 with OMP_NUM_THREADS=1, and record per-file wall time. Any file over about 150 s there is at risk under the 300 s silence on a 2-core runner.
  • Which 0845 test skips at np 2. If it is test_a_rank_interior_fault_splits_cleanly, the file's main assertion is not exercised at CI's rank count.
  • The ptest_jit_cache fix: run it at np 2 with a seeded ~/.cache/underworld3/jit and confirm the seeded files survive.
  • The node ids of 0864_seam/0865 that fail at np 4, for a --deselect.
  • A CI run that reaches the mpirun phase (after Must-fix 2), reading shard 4 and the owning shard's times and the ptest summary lines.

Underworld development team with AI support from Claude Code

Shard 4 was cancelled at its cap before any ptest ran, and the appended files would
have shared a batch with test_* files as soon as one more test_* file arrived. They now
have their own arrays and mpirun loop on shard 2. 0864_seam and 0865 run at np 2 and are
left out of the np 4 pass (#956), which adds them to CI's np 2 run: 16 files.

ptest_jit_cache deletes the cache's files, and only main() isolated it: under pytest it
emptied the user's real JIT cache. A module-scoped fixture now gives pytest a private
directory, shown with a seeded XDG_CACHE_HOME whose files survive.

check_test_coverage reads only the PTEST arrays, so a path in a comment or an echo no
longer counts as run, and it fails if test.sh stops enumerating tests/parallel/test_*.py.
test_partition_can_separate_the_two_sides_of_a_cut is removed: it could not fail.

Refs #900

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Review addressed at 1258542.

  • Must-fix 1, fixed. ptest_jit_cache.py has a module-scoped autouse fixture giving pytest a private directory. With a seeded XDG_CACHE_HOME at np 2: 5 passed, seeded files survive. main() is unchanged.
  • Must-fix 2, fixed. The ptest list is in its own mpirun loop owned by shard 2. scripts/test.sh --parallel-only --p 2 --shard 2/4 exits 0 here.
  • 3, fixed by the same loop. 4, fixed: 0864_seam and 0865 run at np 2, and a PTEST_NOT_AT_4 array leaves them out of the np 4 loop. A list, rather than a --deselect, because they are whole files.
  • 5, fixed: the check fails if test.sh stops enumerating tests/parallel/test_*.py. 6, fixed: only PTEST_* array bodies count as run.
  • 7, fixed: the test that could not fail is removed.
  • The deferred reasons now cite Fault pins ptest_0863, 0864, 0865 fail at np 4, back to at least 2026-10-29 #956 and ptest_0844_reconnect hangs in parallel: a rank-dependent assert leaves its peers in a collective #961.

Underworld development team with AI support from Claude Code

…961)

It passes 7 of 7 at np 2 and np 4 on this base, where it hung for 840 s before
#970.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Merged 37aa2a1 and pushed for fresh CI, now that #970 is in. ptest_0844_reconnect_parallel.py moves out of DEFERRED_PTESTS into PTEST_FILES, as planned: 7 passed at np 2 (11 s) and np 4 (7 s) here. check_test_coverage: 17 of 39 ptest files run, 22 deferred with a reason. Refs #961.

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