Repository navigation
Description
Description
A failing browser-preview assertion can consume several GiB while Bun formats a Happy DOM element. A code-review subagent ran this test and nearly exhausted a 16 GiB VM. The failure needs to be reported promptly without recursively printing the DOM object graph, and the failing preview fixture needs its synchronization corrected.
Priority: high for the observed review workflow. This reproduction is in the legacy inspection-refresh-fix worktree at local commit 3009ae2f4c, not the current V2 component layout. The source file is absent at this path in CM-Split-v2@dafdcd4171. Do not port the old test wholesale into V2.
Reproduction and evidence
Observed while profiling the installed CookieMonster 2.0.29-cm.1, which automatically resumed the previous code review and its subagents. The browser-inspection subagent ran, from the legacy packages/app:
TMPDIR=/tmp/opencode bun run test:browserThat expands to:
bun test --conditions=browser --preload ./happydom.ts ./test-browserThe test runner reached 8,529 MiB RSS / 8,514 MiB PSS. The whole CM process tree reached 11,439 MiB PSS, with VM available memory down to 918 MiB. These are live /proc measurements, not a synthetic transcript probe. Heap profiling elsewhere in the app added transient overhead to the whole-tree measurement; the test process was measured separately.
The tool's output reached test-browser/browser-preview.test.ts and eventually timed out after 120 seconds. I interrupted the browser-inspection subagent and stopped further unbounded reproductions. Two earlier admissions of the same background command are recorded before the user's earlier memory-related shutdown; their output files are no longer present, so their historical peak memory and completion/overlap are unknown.
Isolate the second test:
bun test --conditions=browser --preload ./happydom.ts \
./test-browser/browser-preview.test.ts -t 'mounted preview validates'Use an external memory/time guard when reproducing. The unchanged isolated test exceeded a 1.2 GiB diagnostic cutoff in roughly 15–18 seconds.
Checkpoint instrumentation in a temporary copy identifies the failure at original line 523:
await requested.promise
expect(document.querySelector("[data-component=dropdown-menu-content]")).toBeNull()The dropdown is still present. Replacing just the raw-element assertion with the same boolean predicate, in the diagnostic copy only, produces an ordinary failure:
expect(document.querySelector("[data-component=dropdown-menu-content]") === null).toBe(true)Result: false versus true, exit 1 in 4.74 seconds, sampled peak RSS 409 MiB. The raw-element version of that diagnostic copy exceeded the guard at 1,456 MiB after 15.87 seconds. This isolates failure reporting as the memory amplifier; changing the predicate's representation does not fix the underlying fixture failure.
Environment: Ubuntu 26.04.1 amd64, Bun 1.4.2 (744846f84), legacy Vite 7.1.4, Solid 1.9.10, @happy-dom/global-registrator 20.12.0. Current V2 has different Happy DOM versions and has not been demonstrated to reproduce this same assertion.
Acceptance criteria and verification
- A deliberate failed DOM-presence assertion reports a bounded message and exits promptly, including when the element belongs to a mounted component.
- Correct the legacy preview fixture's menu-disposal/viewport synchronization if that worktree remains supported. Preserve the requirement that capture waits for both disposal and the relevant viewport acknowledgement.
- Check whether
requestedwas already resolved by the initial viewport update before the screenshot request. Do not weaken the capture-order assertion simply to make the test pass. - Run the isolated failing case under a memory guard and compare its duration and peak memory with the measurements above.
- Verify any equivalent V2 contract in its current owner and dependency versions separately. Avoid treating a legacy fixture fix as a proven V2 runtime fix.
The production repositories were not changed by this investigation. Temporary copies, process samples and heap snapshots remain local. Native stacks were captured but the Bun binary lacked useful symbols; no precise allocator implementation is claimed.
Related: review reconciliation #84, transcript retention #77. The transcript defect remains valid independently; it is not the source of the measured 8.3 GiB test-runner spike.
Activity
trmosala commentedon Oct 20, 2026
The legacy fix is published at f74d46a68d, on
bounded-dom-tests. It changes the assertion operand to a boolean, so failure reporting cannot traverse the mounted DOM graph. Its deliberate-failure child check requires exit 1, the expected true/false diagnostic, output below 64 KiB and termination within 20 seconds.The fixture investigation confirmed that the initial viewport update could resolve
requestedbefore screenshot selection. The corrected fixture creates fresh request/acknowledgement promises before opening the menu, and capture still waits for both menu disposal and its own viewport acknowledgement. No capture-order assertion was removed.The two bounded legacy checks passed with 95 assertions in 14.12 seconds, with a 743 MiB total scope peak. This includes the deliberate failing child check; it replaces the earlier runaway failure presentation, rather than declaring the original failed predicate correct.
The V2 owner was checked independently: its three real-browser
browser-panekeeper checks passed in 23.3 seconds. Its embed path presents a captured still before hiding the native view under floating content; the obsolete legacy fixture is not being ported into V2. The legacy patch is published separately and has not been merged into a legacy release branch. The installed app is unchanged.trmosala commentedon Oct 21, 2026
Merged into
CM-Split-v2as290d7d6353c0c7a4a356af780b5687f2dcfe5cfcthrough PR #96. Its tree exactly matches reviewed source68ab9205709350385471eb2d383b3cff3c18e678.Legacy/V2 disposition is complete. The bounded legacy correction is published as f74d46a68d on
bounded-dom-tests. It keeps the same null predicate as a boolean so Bun cannot traverse the mounted DOM during failure reporting. Capture has its own fresh post-menu viewport request/acknowledgement, rather than reusing the initial resolved promise.The existing guarded run passed both cases with 95 assertions in 14.12 seconds and a 743 MiB scope peak. The deliberate failing child must exit 1 within 20 seconds, print the expected true/false mismatch and stay below 64 KiB diagnostic output. These results were collected before the testing stop.
The obsolete legacy file is absent from the current V2 layout. Its current browser-pane keeper was checked independently, with three real-browser cases passing in 23.3 seconds. The legacy patch stays separate; it is not described as a deployed V2 runtime fix or silently ported into V2. Existing legacy worktrees remain unchanged.
Closing the implementation/investigation ticket under the user's requested implementation-first order. The remaining combined verification is deferred until all scoped tickets are closed. No claim is made that the exact earlier kernel OOM victim ran this command; that attribution remains unavailable in #84.