Skip to content

When getting tables to truncate, panic on unknown version#1198

Open
brandur wants to merge 1 commit intomasterfrom
brandur-panic-unknown-version
Open

When getting tables to truncate, panic on unknown version#1198
brandur wants to merge 1 commit intomasterfrom
brandur-panic-unknown-version

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented Apr 6, 2026

This one's related to code review feedback here [1]. When getting a list
of tables that need to be truncated for the TestSchema helpers, it was
possible to receive migration versions that didn't exist and the
function would tolerate it, returning the latest known list of tables.
This often works, but even where it does there's some risk of a new
table coming in that doesn't end up getting cleaned up properly.

Here, panic when receiving an unknown version number so that the problem
can be corrected immediately. The panic may seem undesirable, but these
functions are only used in tests, so it should be fine.

[1] https://github.com/riverqueue/riverpro/pull/281#discussion_r3040295326

This one's related to code review feedback here [1]. When getting a list
of tables that need to be truncated for the `TestSchema` helpers, it was
possible to receive migration versions that didn't exist and the
function would tolerate it, returning the latest known list of tables.
This often works, but even where it does there's some risk of a new
table coming in that doesn't end up getting cleaned up properly.

Here, panic when receiving an unknown version number so that the problem
can be corrected immediately. The panic may seem undesirable, but these
functions are only used in tests, so it should be fine.

[1] riverqueue/riverpro#281 (comment)
@brandur brandur requested a review from bgentry April 6, 2026 20:57
@bgentry
Copy link
Copy Markdown
Contributor

bgentry commented Apr 7, 2026

This one's related to code review feedback here [1]. When getting a list
of tables that need to be truncated for the TestSchema helpers, it was
possible to receive migration versions that didn't exist and the
function would tolerate it, returning the latest known list of tables.
This often works, but even where it does there's some risk of a new
table coming in that doesn't end up getting cleaned up properly.

I may have misread the code in question, but I thought it was not returning any pro tables when the version wasn't explicitly listed in the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants