This repository was archived by the owner on Sep 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 642
feat(db): adds user confirmation to database cli commands #5964
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an additional layer of confirmation for critical database CLI commands to prevent unintended configuration changes.
- Introduces a new function prompt_for_confirmation for verifying database details before executing commands.
- Integrates the confirmation prompt into the init, restore, and drop database commands.
Comments suppressed due to low confidence (2)
src/dispatch/cli.py:295
- The variable 'config' is used without being imported. Consider importing config or replacing these references with the appropriate variables from the dispatch.config module.
sqlalchemy_database_uri = f"postgresql+psycopg2://{config._DATABASE_CREDENTIAL_USER}:{config._QUOTED_DATABASE_PASSWORD}@{database_hostname}:{config.DATABASE_PORT}/{database_name}"
src/dispatch/cli.py:340
- The error message for the restore command incorrectly states 'Aborting database initialization.' It should be updated to 'Aborting database restore.'
click.secho("Aborting database initialization.", fg="red")
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds an additional layer of confirmation for database CLI commands to ensure that the specified database configuration matches the expected environment settings.
- Introduces a new function, prompt_for_confirmation, to validate user input against environment configurations.
- Updates the database init, restore, and drop commands to incorporate the new confirmation prompt.
Comments suppressed due to low confidence (1)
src/dispatch/cli.py:295
- The variable 'config' is used without being imported or defined in this scope. Ensure that the correct configuration object or variables are imported before usage.
sqlalchemy_database_uri = f"postgresql+psycopg2://{config._DATABASE_CREDENTIAL_USER}:{config._QUOTED_DATABASE_PASSWORD}@{database_hostname}:{config.DATABASE_PORT}/{database_name}"
mvilanova
approved these changes
May 7, 2025
Contributor
|
May want to investigate why playwright is complaining before merging... |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Adds an additional layer of checks for database
initandrestoreCLI commands to verify database configuration.