Repository navigation
Empty every table in the test database helper - #1511
Draft
akalongman wants to merge 1 commit into
Draft
akalongman wants to merge 1 commit into
akalongman wants to merge 1 commit into
Conversation
TestHelpers::emptyDb() deleted from 11 of the 21 tables in one multi-statement batch. A statement that failed, such as the delete from message while an edited_message row referenced it, ended the batch unnoticed and left the remaining tables full, so a later test ran on the rows of an earlier one. It now reads the table list from the server and deletes from each table in its own statement with foreign key checks off, so a failure throws.
akalongman
marked this pull request as draft
November 19, 2026 05:55
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.
TestHelpers::emptyDb()runs before every database test, but it deleted from only 11 of the schema's 21 tables, in one multi-statement batch. When a statement in the batch failed, for example the delete frommessagewhile anedited_messagerow referenced it, the batch ended without an error and the tables after it kept their rows. A test could then pass or fail on the rows of an earlier run.The helper now reads the table list from the server and deletes from each table in its own statement, with foreign key checks off for that connection, so a table added to the schema later is covered and a failing statement throws.
The new test stores a message and an edit of it, calls the helper and checks that
edited_message,message,chatanduserare empty; it fails on the old helper.CLAUDE.mdis updated to say that the helper empties every table of the test database.