Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@whitdog47
Copy link
Contributor

Adds an additional layer of checks for database init and restore CLI commands to verify database configuration.

@whitdog47 whitdog47 requested review from Copilot and mvilanova May 7, 2025 21:52
@whitdog47 whitdog47 self-assigned this May 7, 2025
@whitdog47 whitdog47 added the enhancement New feature or request label May 7, 2025
Copy link
Contributor

Copilot AI left a 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")

@whitdog47 whitdog47 requested a review from Copilot May 7, 2025 21:54
Copy link
Contributor

Copilot AI left a 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
Copy link
Contributor

May want to investigate why playwright is complaining before merging...

@whitdog47 whitdog47 merged commit a97c011 into main May 11, 2025
9 checks passed
@whitdog47 whitdog47 deleted the fix/adds-confirmation-to-db-init-restore branch May 11, 2025 23:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants