-
Notifications
You must be signed in to change notification settings - Fork 943
fix: fix workspace status filter returning more statuses that requested #7732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
c0e2804
50b2873
2cb3ece
7d4b7ea
93d8bf9
6fd2b21
a4ba58d
8704afd
01e9fb0
befd8eb
558ef48
aee97f8
f6857d5
985e821
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,10 +157,12 @@ WHERE | |
latest_build.canceled_at IS NULL AND | ||
latest_build.completed_at IS NOT NULL AND | ||
latest_build.updated_at - INTERVAL '30 seconds' < NOW() AND | ||
latest_build.transition = 'delete'::workspace_transition | ||
latest_build.transition = 'delete'::workspace_transition AND | ||
-- If the error field is null, the status is 'failed' | ||
latest_build.error IS NULL | ||
|
||
WHEN @status = 'deleting' THEN | ||
latest_build.completed_at IS NOT NULL AND | ||
latest_build.completed_at IS NULL AND | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the only fix needed for prod. All other fixes were just for the dbfake There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so, it's really difficult to read this query and convince yourself that these WHERE clauses are a) non-overlapping What do you think about the strategy of introducing a stored procedure that computes the status? Then the filter logic in this query becomes a trivial WHERE clause, and we can use the DB-computed status in prod, rather than computing the status in the API layer. Annoyingly, we'd still have to keep the golang implementation around for the dbfake, but they could both be written in an imperative style and so it will be much easier to verify the algorithm matches. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh it was a headache. Are we using stored procedures anywhere else, or would this be the first case? I'm open to anything that makes this easier. Ideally though, it would be in the next PR so this bug is fixed in main. The major contribution from this PR is the test imo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have triggers for deletion of tokens stored in the DB. This would be the first computed column, though. Fine to follow up in another PR. |
||
latest_build.canceled_at IS NULL AND | ||
latest_build.error IS NULL AND | ||
latest_build.transition = 'delete'::workspace_transition | ||
|
Uh oh!
There was an error while loading. Please reload this page.