all_tool_descriptions: pay the cold import once, outside the 5 s test body (#14) #17
Loading…
Reference in a new issue
No description provided.
Delete branch "juno/14-cold-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
all_tool_descriptionstest paid the cold import of 27 tool modules inside vitest's 5 s default. Under a loaded box that import alone runs past five seconds, so the first test timed out on a green tree.Refs #14
What changes
Discovery and both captures move into a
beforeAllwith a 60 s timeout, computed once for both tests (they used to capture twice each); the test bodies keep vitest's 5 s default for their own assertions.Why that is the cause, not the number
Measured on a 4-core host at load ~21, full
vitest run, three workers: the first test took 5098 ms and timed out, while the file alone at the same load takes ~0.7 s. Per-module timing of the cold pass: ~4.9 s across 27 modules, five first imports dominating —mesh_identity1.38 s (carryingconnect_to_mesh,realm,citizenship,serve_rings),mesh_dht1.01 s,mesh_role0.91 s,mesh_call0.40 s,mesh_help0.39 s; the warm pass totals 102 ms. None of the modules does top-level work: the cost is Vite transforming each module graph on first import and Node evaluating it (the run reports transform 34 %, import 17 %), multiplied by CPU contention. The assertions cost 2 ms and 0 ms. No test-body timeout is raised.Proof
MACULA_MCP_TERSE_TOOLSis set fails the first test (expected [ 'mesh_agents', …(35) ] to deeply equal [ 'mesh_agents', …(34) ]); reverted.vitest runs in a row at load 12.6 / 12.8 / 13.4: 749 passed, three times. Typecheck and eslint clean.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.