You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removes the snapshot system (~250 lines) which was an anti-pattern that cached database state between test runs. The system was db-adapter specific (only supported Mongoose and Drizzle) and didn't work with newer adapters we're integrating.
Changes:
Deleted /test/helpers/snapshot.ts (151 lines)
Simplified /test/helpers/seed.ts from 170 to 71 lines (58% reduction)
Removed snapshotKey parameter from seed functions
Tests now simply reset and re-seed the database directly via resetDB() + seedFunction() without caching
Side effect - SQLite fix: Removal revealed a bug in reset.ts where multiple DELETE statements were concatenated into a single string. SQLite requires each statement to be executed separately, which now works correctly.
Performance Impact
Removal of caching reveals the true cost of database reset+seed operations:
Suite
With snapshots
Without snapshots
Difference
Setup pattern
fields
60.53s
60.00s
-0.53s (-0.9%) ✅
beforeAll (seeds once)
queues
64.38s
68.72s
+4.34s (+6.7%)⚠️
beforeEach (71 tests)
lexical
7.90s
52.28s
+44.38s (+561%) ❌
beforeEach (108 tests)
Mitigation plan: The lexical suite will be refactored so tests create their own documents instead of relying on beforeEach seeding. This will eliminate the performance regression.
Status
⏸️ PR on hold - Waiting for lexical suite refactor to eliminate beforeEach seed dependency before merging.
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
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.
Remove snapshot system from test helpers
Summary
Removes the snapshot system (~250 lines) which was an anti-pattern that cached database state between test runs. The system was db-adapter specific (only supported Mongoose and Drizzle) and didn't work with newer adapters we're integrating.
Changes:
/test/helpers/snapshot.ts(151 lines)/test/helpers/seed.tsfrom 170 to 71 lines (58% reduction)snapshotKeyparameter from seed functionsresetDB()+seedFunction()without cachingSide effect - SQLite fix: Removal revealed a bug in
reset.tswhere multiple DELETE statements were concatenated into a single string. SQLite requires each statement to be executed separately, which now works correctly.Performance Impact
Removal of caching reveals the true cost of database reset+seed operations:
Mitigation plan: The lexical suite will be refactored so tests create their own documents instead of relying on beforeEach seeding. This will eliminate the performance regression.
Status
⏸️ PR on hold - Waiting for lexical suite refactor to eliminate beforeEach seed dependency before merging.