Skip to content

fix(test): revert the scf-core un-exclude — the suite still cannot exit clean (#504, #593) - #606

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

thinkclay merged 1 commit into
mainfrom
claude/fix-604-oom-regression

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Reverts the test:unit change from #604 and repairs two test files I broke. Corrects the record on #504 and #593.

What I got wrong

I un-excluded scf-core from test:unit on the strength of a JSON report showing 957 passed / 0 failed. That was the wrong signal: vitest run exits 1 regardless, so pnpm test has been red on main for anyone running it locally since #604 merged.

The OOM is real — #504 is not stale. I grepped the background task's output file for "heap out of memory" and got nothing, because that file held only my own echo lines; vitest's stderr went elsewhere and I never read it. At --max-old-space-size=4096 the main process dies with "Ineffective mark-compacts near heap limit" at ~4GB.

Raising it to 8192 does not fix it either. With the two collection failures below repaired, more files collect, more is retained, and it OOMs again at 8GB:

heap files assertions success exit
4096 142 957 passed, 0 failed true 1 (OOM)
8192 143 978 passed, 0 failed true 1 (OOM)

Every test passes and the report says success: true. The failure is entirely the parent process at teardown. That is #504's actual subject, and it needs the retention fixed — not a bigger ceiling.

A file that fails to collect is invisible to a pass/fail count

This is the process error worth keeping. A file that fails to collect contributes zero passed and zero failed, so summing assertions cannot see it. Two files were failing that way and I shipped both — my own, from #599 and #605:

  • ScaffaldLogo.test.tsx — Unexpected token 'typeof', react-native-svg's untransformed source. A mock has existed at tests/infrastructure/vitest/mocks/react-native-svg.tsx since it was written but was never aliased in vitest.config.ts, unlike the react-native, lucide-react-native and expo-updates mocks sitting beside it. Now aliased — which fixes any test rendering an SVG, not just this one.
  • ProfileWizard.test.tsx — the commit hook added in feat(profile): make the guided wizard reachable, and have it write a real profile (#584) #605 pulled @scf/core/provider, and through it UniversalThemeProvider → expo-router/react-navigation, which does not resolve under vitest. Mocked in the test; the commit path keeps its own unit tests.

The logo test also asserted something false

It claimed two separate render() calls produce byte-identical markup. They are two React roots, and useId is only required to be deterministic by position within a root — so a correct implementation fails that assertion. Replaced with what actually regresses if the id goes random again:

  • not drawn from a random source (the literal Math.random().toString(36) shape)
  • stable across re-renders, including when unrelated props change
  • distinct between two logos in one tree
  • referenced by the url(#id) that fills the mark

6 assertions, all passing, and they now fail for the right reason.

Net effect

pnpm test is green again. scf-core is back in the exclude list, so #593 is not closed by #604 — reopened with the memory evidence above.

🤖 Generated with Claude Code

…it clean (#504, #593)

I un-excluded scf-core from test:unit in #604 on the strength of a JSON report
showing 957 passed / 0 failed. That was the wrong signal. `vitest run` exits 1
regardless, so `pnpm test` went red on main for anyone running it locally.

Two things were wrong with how I checked.

The OOM is real. I grepped the background task's output file for "heap out of
memory" and got nothing, because that file held only my own echo lines — vitest's
stderr went elsewhere and I never read it. #504 is not stale: at
--max-old-space-size=4096 the main process dies with "Ineffective mark-compacts
near heap limit" at ~4GB. Raising it to 8192 does not fix it either; with the two
collection failures below repaired, more files collect, more memory is retained,
and it OOMs again at 8GB. Every test passes and the report says success: true —
the failure is entirely the parent process at teardown, not the tests.

My pass/fail summary could not see a broken file. A file that fails to *collect*
contributes zero passed and zero failed, so it is invisible to a count of
assertions. Two files were failing that way and I shipped both:

  - ScaffaldLogo.test.tsx (mine, #599) — "Unexpected token 'typeof'".
    react-native-svg's untransformed source. A mock for it has existed at
    tests/infrastructure/vitest/mocks/react-native-svg.tsx since it was written
    but was never aliased in vitest.config.ts, unlike the react-native, lucide
    and expo-updates mocks. Now aliased, which fixes any test rendering an SVG.
  - ProfileWizard.test.tsx (mine, #605) — the commit hook I added pulled
    @scf/core/provider, and through it UniversalThemeProvider ->
    expo-router/react-navigation, which does not resolve under vitest. Mocked in
    the test; the commit path keeps its own unit tests.

The logo test also asserted something false: that two separate render() calls
produce byte-identical markup. They are two React roots, and useId is only
required to be deterministic by position within a root, so a correct
implementation fails that. It now asserts what actually regresses if the id goes
random again — not drawn from a random source, stable across re-renders, distinct
between two logos in one tree, and referenced by the url(#id) that fills the mark.

scf-core goes back in the exclude list. Making it runnable is #504's job and it
needs the parent-process retention fixed, not a bigger ceiling.

Co-Authored-By: Claude Opus 5 <[email protected]>
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.

1 participant