Repository navigation
Warm up viewer dynamic imports in a beforeAll hook so the pre-push gate doesn't flake under load - #2320
Merged
Conversation
…te doesn't flake under load (closes #2293) The viewer-resolution test's first assertion pays the one-time cost of Vite transforming BaseNodeViewer's whole ~1500-line subtree (~20 direct imports) on the first dynamic import() of a viewer component. Every import() after that resolves from the module cache in well under a millisecond, since date/task's viewer.lazyLoad closures are the exact same import() calls made in the test body. Measured locally: ~2.1-2.3s idle, up to ~4.5s under heavy concurrent CPU load (8-way contention on a 10-core machine) -- genuine, load-sensitive compile work, not a hang or a resource leak from an earlier test. Against the default 5s testTimeout, that left effectively no headroom under real machine load, which is exactly what this session hit twice today on two unrelated PRs' pre-push gates. Warms both lazyLoad closures in a beforeAll hook (30s timeout -- generous on purpose, since this is deliberately where the compile cost is meant to land) so the actual assertions measure only the already-warm resolution, restoring the 5s testTimeout as a meaningful regression guard instead of a race against a one-time compile cost. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
src/tests/plugins/core-plugins.test.ts's "should resolve viewer components for plugins with viewers" test's first assertion pays the one-time cost of Vite transformingBaseNodeViewer's whole ~1500-line subtree (~20 direct imports) on the first dynamicimport()of a viewer component. Everyimport()after that resolves from the module cache in well under a millisecond, sincedate/task'sviewer.lazyLoadclosures (registered by reference viaregisterCorePlugins) are the exact sameimport()calls made in the test body.This is genuine, load-sensitive compile work — not a hang and not a resource leak from an earlier test. Measured locally: ~2.1-2.3s idle, up to ~4.5s under heavy concurrent CPU load (8-way contention on a 10-core machine). Against the default 5s
testTimeout, that left effectively no headroom under real machine load — which is exactly what hit this session twice today on two unrelated PRs' pre-push gates.Fix
Warms both
lazyLoadclosures in abeforeAllhook (30s timeout — generous on purpose, since this is deliberately where the compile cost is meant to land) so the actual test assertions measure only the already-warm resolution, restoring the 5stestTimeoutas a meaningful regression guard instead of a race against a one-time compile cost with no headroom.Testing
bun run test:all: clean, no new failures.bun run quality:fix: clean.Closes #2293.