Skip to content

replace real sleeps and a 22.7M-element Python fixture in the detachedSpawn and trellis2 runner suites - #6093

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-6007
Sep 3, 2026
Merged

replace real sleeps and a 22.7M-element Python fixture in the detachedSpawn and trellis2 runner suites#6093
atomantic merged 1 commit into
mainfrom
claim/issue-6007

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

Removes the real wall-clock waits from two of the slowest server suites.

  • server/lib/detachedSpawn.test.js — 13 fixed setTimeout sleeps (25–200ms, paid unconditionally) become a bounded waitUntil condition poll on the state each test is actually about: the job is alive under its recorded PID, the cleanup rm landed, the log holds a line. The two reattachDetached fixtures that ran a real sleep 1 inside sh now block on a marker file the test writes, so the replay window stays open exactly as long as the test needs it. The "replayed fires before the live line" assertion is now ordered by the event instead of by winning a race against a one-second sleep.
  • reapAndCleanDetachedDirs gains an opts passthrough to reapDetached (default unchanged), so the sweep test uses the same 25ms cadence as every other job it spawns rather than the 250ms production default, twice.
  • server/services/imageTo3d/trellis2GenerateRunner.test.js — this one was not sleeping at all. Its fixture built the 22.7M-face decoder mesh as list(range(...)): ~300ms of Python list allocation per test and hundreds of MB per worker. Nothing (neither the adapter nor either stub) does more than len() on it, so range yields identical numbers for free. Under the parallel-worker contention CI actually runs at, that allocation dominated everything else.

No test is skipped, and no assertion is weakened. One assertion got stronger: bypass-probing the change surfaced that the pre-decimation-capture test matched no pre-decimation mesh was captured, a wording the adapter no longer prints — it passed with the capture ripped out entirely. It now matches the real normal map skipped message.

Test plan

Both suites pass unchanged (45 + 24 tests). Timings from the same machine:

run before after
detachedSpawn.test.js alone, idle 4.44s wall / 4.25s tests 2.56s wall / 1.99s tests
trellis2GenerateRunner.test.js alone, idle 5.02s wall / 4.78s tests ~2.9s wall / 2.38s tests
both together, under parallel-agent contention (two back-to-back runs) 28.42s / 22.20s wall 3.73s / 3.61s wall

The contended row is the one that matters for CI: the fixture allocation is what turns a 9s pair into a 28s pair once workers compete for memory.

Bypass probes confirming the converted tests still catch their regressions:

  • disabling the cleanup rm in finish()removes the control dir after the job ends when cleanup is set fails.
  • disabling _CAPTURED["source"] in trellis2GenerateRunner.pycaptures the pre-decimation mesh for the normal bake fails (it passed before the assertion fix).

Also ran server/services/mediaJobQueue (the only production caller of reapAndCleanDetachedDirs): 116 tests pass.

Closes #6007

…6007)

detachedSpawn.test.js replaced 13 fixed `setTimeout` sleeps (25-200ms each,
paid unconditionally) with a bounded `waitUntil` condition poll on the state
each test is actually about: the job is alive under its recorded PID, the
cleanup rm landed, the log holds a line. The two `reattachDetached` fixtures
that slept a real `sleep 1` inside `sh` now block on a marker file the test
writes, so the replay window stays open exactly as long as the test needs it
— and the "replayed fires before the live line" assertion is now ordered by
the event rather than by winning a race against a one-second sleep.
`reapAndCleanDetachedDirs` grew an opts passthrough to `reapDetached` (default
unchanged) so the sweep test can use the same 25ms cadence as every other job
it spawns instead of the 250ms production default, twice.

trellis2GenerateRunner.test.js was not sleeping at all: its fixture built the
22.7M-face decoder mesh as `list(range(...))`, ~300ms of Python list
allocation per test and hundreds of MB per worker. Nothing — neither the
adapter nor either stub — does more than `len()` on it, so `range` gives the
identical numbers for free. Under the parallel-worker contention CI actually
runs at, that allocation dominated: the pair measured 28.4s wall before and
3.7s after.

Also fixes a vacuous assertion found while bypass-probing the change: the
pre-decimation-capture test matched "no pre-decimation mesh was captured", a
wording the adapter no longer prints, so it passed with the capture removed
entirely. It now matches the real "normal map skipped" message and fails when
the capture is disabled.
@atomantic

Copy link
Copy Markdown
Owner Author

CI-run confirmation (Server tests job on this PR, Linux runner) — the numbers the issue asked to record:

✓ services/imageTo3d/trellis2GenerateRunner.test.js (24 tests) 1774ms
✓ lib/detachedSpawn.test.js                          (45 tests) 1461ms

Against the baselines quoted in #6007detachedSpawn.test.js 4.7s and trellis2GenerateRunner.test.js ~17s (both runners) — that is roughly 3x and 10x. Same test counts, nothing skipped.

@atomantic
atomantic merged commit 48d4757 into main Sep 3, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6007 branch September 3, 2026 17:22
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.

CI: replace real sleeps in detachedSpawn and trellis2GenerateRunner tests

1 participant