Repository navigation
test(web): keep FakeHappyView's SQLite temp tables in memory - #254
Merged
Merged
Conversation
SQLite writes the temp b-trees of materialized CTEs and sorts to files in $TMPDIR by default, even for a :memory: database. The support queries in the instruction budget test spilled about 15 MB per query there, so their wall time followed disk contention from other processes (31 s to over 250 s, timing out at 120 s) while CPU time stayed under a second each. With temp_store = MEMORY the test takes 4 to 6 s, and results and instruction counts are unchanged.
Coverage Report for apps/web
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bnb
approved these changes
Oct 25, 2026
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.
What and why
directory.test.ts > instruction budgettook anywhere from 31 s to over 250 s and timed out at 120 s on loaded machines, on main too. SQLite writes the temporary b-trees of materialized CTEs and sorts to files in$TMPDIRby default, even for a:memory:database. The support queries (getCharts,getArtist,searchArtists) spilled about 15 MB per query there, so their wall time followed whatever else was using the disk, while their CPU time stayed under a second each.Changed:
FakeHappyView(src/lib/server/testing/happyview.ts) runsPRAGMA temp_store = MEMORYbefore its schema. Results and instruction counts are the same, and the test, its assertions and its timeout are unchanged. Production is untouched: this is the test harness only.How it was tested
pnpm vitest run --project server,pnpm check,pnpm lint,pnpm knip,pnpm format:check, andpnpm test:integrationagainst HappyView 2.16Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does