fix(database): report the actual database status in list commands#2006
Merged
Conversation
The status column was derived from the `isReady` boolean instead of the status reported by the API, collapsing the five possible states into "ready" and "pending". A database that was migrating, importing or in an error state was therefore displayed as "pending", which is particularly misleading for "error", as a failed database was indistinguishable from one that is still being worked on. RedisDatabases have no `isReady` field at all and were hardcoded to be ready in "database list", so they always appeared as "ready" regardless of their actual state. Both resources do report `status`, so use it directly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
database mysql listdisplayedpendingfor a database that the API reported asmigrating.Cause
The status column did not use the
statusfield returned by the API. It derived the value from theisReadyboolean instead:DatabaseDatabaseStatushas five values —pending,ready,migrating,importinganderror— so this collapsed everything that was not ready intopending. Besidesmigrating, this also affectederror: a failed database was indistinguishable from one that is still being worked on.The same code existed in
database list, which had a second problem.DatabaseRedisDatabasehas noisReadyfield, so Redis rows were hardcoded toisReady: trueand always displayed asready, whatever their actual state.Fix
Both MySQL and Redis databases report
status, so the column now uses it directly and the RedisisReadyhardcode is gone. Since the column key already matches the field, the custom getter is no longer needed.Verified against a mock serving all five states; each is now reported verbatim, and a pending Redis database no longer shows as ready.
Found while testing #2005, where an upgrade puts the database into
migrating, but this is an independent pre-existing bug, hence the separate PR.🤖 Generated with Claude Code