* fix(test): load compiled-subprocess declarations at collection
The first load of a compiled-subprocess declaration in a Vitest invocation
prepares the whole compiled worker generation (tens of seconds warm, minutes
cold). 387 test files first reached a declaration through an await import()
inside a test body or hook, so their first test or hook absorbed that
preparation and could time out.
Move those loads to collection at their owner: static subject imports,
static imports in the shared helpers that owned the lazy load, and a named
side-effect preload (src/test-utils/prepare-compiled-subprocesses.ts) for
suites that re-import their subject per test or whose first load happens in
production code they call. plugin-test-runtime keeps the host-capability
fixture lazy so its other consumers do not start loading that graph.
Document the rule in docs/help/testing/writing-tests.md.
335 of the 387 files now load their first declaration before collection
ends; 52 remain (48 extension tests needing an SDK preload, one package
test, three files over the line cap).
* fix(test): retain npm install fixture reuse
Preserve the existing failedSpawn reuse after merging main so the collection-time preload stays within the line-cap ratchet. Assertions and import ordering are unchanged.
* fix(test): keep memory-core facade cold-import assertion meaningful
The static subject import ran before beforeEach reset the loader mock, so the cold-import assertion passed vacuously. Restore the in-test subject imports after mock setup and preload the compiled-subprocess declaration during collection instead.
Protect the shared cleanup join introduced by ec78e8e0d6. Exercise the
registered runtime reset hook with a real plugin disposal callback held by a
deferred promise. Verify that cleanup waits for disposal, reports complete
failure records, and consumes the retirement outcome before returning.
Both cases failed against the prior setup because its reset returned early.
Validation: both cases pass with the exact ec78 setup bytes on the 76c0724
proof baseline; the cache and disposal owners match current main. This
single-worker invocation took 25.96s wall (22.49s Vitest) on Node24.19.
Cold loading of the actual shared setup dominates this boundary proof; the
test adds no subprocess harness or production seam. The unchanged test also
passed 20 standalone runs during diagnosis. Selected repository checks and
fresh independent review with complete setup/owner context are clean.