Skip to content

fix(test): the scf-core OOM was one typo'd vi.mock path (#504, #593) - #611

Merged
thinkclay merged 1 commit into
mainfrom
claude/fix-504-oom
Aug 12, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/fix-504-oom

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #504. Unblocks and closes #593.

The suite does not have a memory problem

One test file hung, and the pooled worker's heap grew while vitest waited for it.

wall clock result
with ProfileWizard.test.tsx ~900s worker RSS → 2.8GB, OOM, exit 1
without it 36s 139 passed, exit 0

ProfileWizard.test.tsx mocked ../components/steps/GeneralStep. The module is GeneralInfoStep. A vi.mock for a specifier nothing imports is not an error — the factory is registered and simply never used — so the real step component loaded, pulled StepNavigation and the @scaffald/ui theme chain with it, and left the worker holding a handle it never released.

It passed in isolation the whole time, because a single-file run tears the process down at the end regardless of what is still open. Only a pooled run, where the worker has to be reusable, exposed it. That is why this read as "the suite OOMs" rather than "one file hangs" for so long.

Fixing the path also un-skips that file's three tests — they were reported as skipped because the worker died before running them. There is no .skip in the file.

Measuring beat guessing

Four things I ruled out first were all wrong: the json reporter, a single memory-hungry file, raw file count, and fork reuse (maxForks: 4 changed nothing).

What settled it was sampling RSS per pid during a failing run — the vitest parent sat flat at 54MB while one child climbed to 2.8GB:

t=85s    pid=29635 rss=732MB
t=205s   pid=29635 rss=1868MB
t=285s   pid=29635 rss=2781MB

and the duration breakdown said the worker was waiting, not working:

Duration 431.37s (transform 243ms, setup 852ms, import 1.10s, tests 1.21s)

Then --reporter=verbose over the full suite: 142 of 143 files reported completion. The 143rd was the answer.

Stopping it recurring

Adds vi-mock-paths-resolve.test.ts, asserting every relative vi.mock target in the package resolves to a real module. It found three more silent no-ops immediately, all fixed here:

file mocked should be
OrganizationForm ./OrganizationLocationsInput ../
PortfolioManager ../components ../../
useCompletionStatus ../constants/sectionMetadata ../../

Bare specifiers are deliberately not checked — resolving those means replicating vitest's alias table, and a typo'd package name fails loudly at import anyway. It is the relative paths that fail silently.

scf-core is back in the run

Removed from test:unit and affected:test. CI runs the latter, so scf-core had never run in CI under either arrangement — un-excluding only test:unit (which I did in #604 and reverted in #606) would not have been enough.

pnpm test:unit    exit 0, 7 projects, no OOM
scf-core alone    144 files, 983 passed, 58 skipped, exit 0, 36.6s

CI checks will show red without running — Actions billing block, #375.

🤖 Generated with Claude Code

The suite does not have a memory problem. One test file hung, and the pooled
worker's heap grew while vitest waited for it.

  with ProfileWizard.test.tsx     ~900s, worker RSS to 2.8GB, OOM, exit 1
  without it                       36s, exit 0, 139 passed

ProfileWizard.test.tsx mocked `../components/steps/GeneralStep`. The module is
GeneralInfoStep. A vi.mock for a specifier nothing imports is not an error —
the factory is registered and simply never used — so the real step component
loaded, pulled StepNavigation and the @scaffald/ui theme chain with it, and left
the worker holding a handle it never released.

It passed in isolation the whole time, because a single-file run tears the
process down at the end regardless of what is still open. Only a pooled run,
where the worker has to be reusable, exposed it. That is why this looked like
"the suite OOMs" rather than "one file hangs" for so long.

Fixing the path also un-skips that file's three tests: they were reported as
skipped because the worker died before running them. There is no `.skip` in the
file.

Measuring beat guessing here. The four things ruled out first — the json
reporter, a single memory-hungry file, raw file count, and fork reuse (maxForks
4 changed nothing) — were all wrong. What settled it was sampling RSS per pid
during a failing run: the vitest parent sat flat at 54MB while one child climbed
to 2.8GB, and `Duration 431s (tests 1.21s)` said the worker was waiting, not
working.

Adds vi-mock-paths-resolve.test.ts, which asserts every relative vi.mock target
in the package resolves to a real module. It found three more silent no-ops
immediately, all fixed here:

  OrganizationForm      ./OrganizationLocationsInput   -> ../
  PortfolioManager      ../components                  -> ../../
  useCompletionStatus   ../constants/sectionMetadata   -> ../../

Bare specifiers are not checked — resolving those means replicating vitest's
alias table, and a typo'd package name fails loudly at import anyway. It is the
relative paths that fail silently.

scf-core is back in test:unit, and removed from affected:test as well — CI runs
the latter, so it had never run scf-core under either arrangement.

  pnpm test:unit                       exit 0, 7 projects, no OOM
  scf-core alone   144 files, 983 passed, 58 skipped, exit 0, 36.6s

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit 2e4844c into main Aug 12, 2026
5 of 7 checks passed
@thinkclay
thinkclay deleted the claude/fix-504-oom branch August 12, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant