Skip to content

jir-ogc#554

Merged
jirhiker merged 1 commit intostagingfrom
jir-ogc
Feb 27, 2026
Merged

jir-ogc#554
jirhiker merged 1 commit intostagingfrom
jir-ogc

Conversation

@jirhiker
Copy link
Copy Markdown
Member

Why

This PR addresses the following problem / context:

  • Use bullet points here

How

Implementation summary - the following was changed / added / removed:

  • Use bullet points here

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Use bullet points here

Copilot AI review requested due to automatic review settings February 27, 2026 16:28
@jirhiker jirhiker merged commit 5c9b0c7 into staging Feb 27, 2026
12 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ea1c80a82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +707 to +710
if db_driver == "cloudsql":
db_name = os.getenv("CLOUD_SQL_DATABASE", "")
instance_name = os.getenv("CLOUD_SQL_INSTANCE_NAME", "")
iam_auth = os.getenv("CLOUD_SQL_IAM_AUTH", "")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reinstate test-database block for Cloud SQL path

When DB_DRIVER=cloudsql, this branch only logs Cloud SQL settings and no longer enforces the prior guard that aborted on test databases. As a result, a run with CLOUD_SQL_DATABASE=ocotilloapi_test or nmsamplelocations_test now continues into transfer_all and can mutate/drop data that was previously protected by a fail-fast check. Add the same test-database validation in the Cloud SQL branch before the transfer starts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
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

Updates the transfer runner to better support managed runtimes by defaulting into Cloud SQL configuration when Cloud SQL env vars are present, and by logging Cloud SQL connection configuration instead of local Postgres settings.

Changes:

  • Default DB_DRIVER to cloudsql when CLOUD_SQL_INSTANCE_NAME is set but DB_DRIVER is missing.
  • Default CLOUD_SQL_IAM_AUTH to "true" when using Cloud SQL (unless explicitly set).
  • Update startup logging in main() to display Cloud SQL connection details when DB_DRIVER=cloudsql.

message(
"Database Configuration: "
f"driver=cloudsql instance={instance_name} db={db_name} iam_auth={iam_auth}"
)
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safety guard that blocks running transfers against known test DBs only runs in the non-Cloud SQL branch. When DB_DRIVER=cloudsql, db_name can still point at *_test and the script will proceed. Consider applying the same check to CLOUD_SQL_DATABASE (and failing fast for the same test DB names / non-dev DBs) so Cloud SQL executions get the same protection.

Suggested change
)
)
# Double-check we're using the development database for Cloud SQL as well
if db_name != "ocotilloapi_dev":
message(f"WARNING: Using database '{db_name}' instead of 'ocotilloapi_dev'")
if db_name in ("ocotilloapi_test", "nmsamplelocations_test"):
raise ValueError(
"ERROR: Cannot run transfer on test database! "
"Set CLOUD_SQL_DATABASE=ocotilloapi_dev in environment"
)

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
# In managed runtime environments, DB_DRIVER is occasionally omitted while
# CLOUD_SQL_* vars are present. Default to cloudsql in that case to avoid
# silently falling back to localhost/postgres settings.
if (
not (os.getenv("DB_DRIVER") or "").strip()
and (os.getenv("CLOUD_SQL_INSTANCE_NAME") or "").strip()
):
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment/condition mismatch: the comment says "CLOUD_SQL_* vars are present", but the fallback to cloudsql only checks CLOUD_SQL_INSTANCE_NAME. Either update the comment to match the actual condition, or expand the condition to check the required Cloud SQL vars you expect to be present (e.g., database/user) before forcing DB_DRIVER=cloudsql.

Copilot uses AI. Check for mistakes.
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