Stop wiping the whole database between tests - #18
Merged
Conversation
Every startTestServer ran TRUNCATE workspaces CASCADE, so two suite runs against one TEST_DATABASE_URL deleted each other's rows mid-test. The failures read as auth bugs, since the credential row vanished between the seed and the request, and nothing in the output pointed at the other process. Nothing needed the wipe. Every test already creates its own workspace and everything else cascades from it. One assertion counted oauth_states across the whole table; it now names the state it is actually about. Closes #15
fajarhide
force-pushed
the
fix/scoped-test-cleanup
branch
from
August 17, 2026 04:16
f9e8092 to
134ebcc
Compare
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.
startTestServerranTRUNCATE workspaces CASCADEon every call, so two suite runs against oneTEST_DATABASE_URLdeleted each other's rows mid-test. The failures came out asexpected 401 to be 200, because the credential row went away between the seed and the request, and nothing in the output suggested another process was involved.Nothing needed the wipe. Every test already creates its own workspace, and credentials, grants, enablements and usage rows all cascade from it. One assertion did read the whole table, counting
oauth_statesto prove an expired row was swept; it now names the state it is about.Before and after, both suites started at the same moment against the same database.
On
main:On this branch, same two commands, same overlap:
Full suite: 35 files, 351 tests, green. Typecheck clean.
Worth naming the tradeoff: rows now accumulate in the test database across runs instead of being cleared. Nothing reads across workspaces, so that is invisible to assertions, and a
dropdbis the reset if it ever gets large.Closes #15