Repository navigation
Conversation
| remote: | ||
| repo_name: sentry-shared-postgres | ||
| branch: main | ||
| branch: chore/upgrade-postgres-to-v18 |
There was a problem hiding this comment.
Bug: The devservices/config.yml points the postgres dependency to a temporary feature branch, chore/upgrade-postgres-to-v18, which will likely be deleted after merging.
Severity: MEDIUM
Suggested Fix
After the changes in the chore/upgrade-postgres-to-v18 branch are merged into the main branch of the sentry-shared-postgres repository, update devservices/config.yml to point the postgres dependency back to branch: main.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: devservices/config.yml#L41
Potential issue: The `devservices/config.yml` file is configured to use a temporary
feature branch, `chore/upgrade-postgres-to-v18`, for the `sentry-shared-postgres`
dependency. Feature branches are typically deleted after being merged. Once this branch
is deleted from the upstream repository, the `devservices up` command will fail for any
developer trying to set up their local environment, as it will be unable to clone the
specified branch. This will break the local development setup process.
Did we get this right? 👍 / 👎 to inform future reviews.
| -p 127.0.0.1:5432:5432 \ | ||
| -v postgres-data:/var/lib/postgresql/data \ | ||
| -v postgres-data:/var/lib/postgresql \ | ||
| -v /tmp/pg-sock:/var/run/postgresql \ |
There was a problem hiding this comment.
Bug: The CI workflow's PostgreSQL volume mount path is updated for v18, but it doesn't validate the actual image version, risking startup failure or silent data reset with older images.
Severity: CRITICAL
Suggested Fix
Enforce the PostgreSQL version dependency. Either explicitly use a specific v18+ image tag instead of dynamically inspecting the running container, or add a step to verify the PostgreSQL version from the image before re-running the container with the new volume path. This ensures the volume mount path is compatible with the image being used.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/backend.yml#L253
Potential issue: The CI workflow in `.github/workflows/backend.yml` changes the
PostgreSQL volume mount path to be compatible with PostgreSQL v18. However, the actual
PostgreSQL image version is determined dynamically from a branch specified in
`devservices/config.yml` without any validation. If this process results in an older
(pre-v18) PostgreSQL image being used, the container will either fail to start or
silently initialize a new, empty database because the volume mount path will be
incorrect for that version. This could cause CI jobs to fail or to pass incorrectly with
tests running against an empty database.
Also affects:
devservices/config.yml:41~41
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e323490. Configure here.
| remote: | ||
| repo_name: sentry-shared-postgres | ||
| branch: main | ||
| branch: chore/upgrade-postgres-to-v18 |
There was a problem hiding this comment.
Temporary feature branch dependency pin
High Severity
postgres in devservices/config.yml is pinned to the temporary branch chore/upgrade-postgres-to-v18 instead of main. If this lands, local devservices and CI depend on that branch; once it is merged or deleted, postgres startup fails for everyone.
Reviewed by Cursor Bugbot for commit e323490. Configure here.
| --network devservices --label orchestrator=devservices \ | ||
| -p 127.0.0.1:5432:5432 \ | ||
| -v postgres-data:/var/lib/postgresql/data \ | ||
| -v postgres-data:/var/lib/postgresql \ |
There was a problem hiding this comment.
Bug: The PostgreSQL volume is mounted at /var/lib/postgresql instead of the expected /var/lib/postgresql/data, causing the database to be re-initialized mid-workflow and losing all test setup data.
Severity: HIGH
Suggested Fix
Revert the Docker volume mount path in the docker run command back to -v postgres-data:/var/lib/postgresql/data. This will ensure the restarted container finds the existing database data initialized by devservices and prevents data loss during the CI run.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/backend.yml#L252
Potential issue: The CI workflow first initializes a PostgreSQL database using
`devservices`, which stores data in the standard `/var/lib/postgresql/data` directory
within the `postgres-data` volume. However, a subsequent step in the workflow stops this
container and restarts it with the volume mounted at `/var/lib/postgresql` instead. When
the new container starts, PostgreSQL looks for its data at `/var/lib/postgresql/data`
relative to the new mount point, finds an empty directory, and re-initializes the
database from scratch. This erases all the initial database setup, including schema
migrations, causing subsequent tests that rely on the database to fail.
Also affects:
devservices/config.yml:41~41
Keep postgres v18 CI upgrade branch current after backend merges.
Keep PR #121448 current after backend-related master merges.
| docker run -d --name postgres-postgres-1 \ | ||
| --network devservices --label orchestrator=devservices \ | ||
| -p 127.0.0.1:5432:5432 \ | ||
| -v postgres-data:/var/lib/postgresql/data \ | ||
| -v postgres-data:/var/lib/postgresql \ | ||
| -v /tmp/pg-sock:/var/run/postgresql \ | ||
| -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=sentry \ | ||
| "$PG_IMAGE" postgres \ |
There was a problem hiding this comment.
Bug: The Postgres container is recreated without the PGDATA environment variable, which can cause data inaccessibility or loss in CI due to path mismatches in PostgreSQL 18.
Severity: HIGH
Suggested Fix
Explicitly pass the PGDATA environment variable to the docker run command in the "Reconnect postgres via Unix socket" step. This ensures the recreated container uses the same data directory as the original container. For example, add -e PGDATA=/var/lib/postgresql/18/docker or dynamically retrieve the value from the original container before stopping it.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/backend.yml#L250-L256
Potential issue: The CI workflow recreates the PostgreSQL container in the "Reconnect
postgres via Unix socket" step. However, the `docker run` command used for recreation
does not pass the `PGDATA` environment variable. The PostgreSQL 18 Docker image uses a
version-specific default for `PGDATA` (e.g., `/var/lib/postgresql/18/docker`). If the
original container used a specific `PGDATA` path, the recreated container will default
to a different one. This mismatch will cause the container to either fail to start or
initialize a new, empty database, leading to data loss within the CI run and causing
subsequent tests to fail.
| --network devservices --label orchestrator=devservices \ | ||
| -p 127.0.0.1:5432:5432 \ | ||
| -v postgres-data:/var/lib/postgresql/data \ | ||
| -v postgres-data:/var/lib/postgresql \ |
There was a problem hiding this comment.
Bug: The "Reconnect postgres" CI step hardcodes the volume name postgres-data, which may not match the volume name used by the new external PostgreSQL configuration, causing CI failures.
Severity: MEDIUM
Suggested Fix
Instead of hardcoding postgres-data, dynamically inspect the running postgres container to get its actual volume name and use that in the reconnect step. Alternatively, verify that the sentry-shared-postgres branch uses the postgres-data volume and add documentation to enforce this convention.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/backend.yml#L253
Potential issue: The "Reconnect postgres" step in the CI workflow at
`.github/workflows/backend.yml:253` hardcodes the Docker volume name as `postgres-data`.
The pull request changes the `devservices` configuration to use a branch from an
external repository, `sentry-shared-postgres:chore/upgrade-postgres-to-v18`. If this
external configuration uses a different volume name for the PostgreSQL container, the
reconnect step will fail. It would attempt to use a new, empty volume named
`postgres-data` instead of reusing the existing volume with the database data, leading
to initialization errors and CI failures.
| --network devservices --label orchestrator=devservices \ | ||
| -p 127.0.0.1:5432:5432 \ | ||
| -v postgres-data:/var/lib/postgresql/data \ | ||
| -v postgres-data:/var/lib/postgresql \ |
There was a problem hiding this comment.
Bug: The CI workflow reconnects to a PostgreSQL container with a new volume mount path. If the initial container from sentry-shared-postgres uses a different path, the database will be lost.
Severity: MEDIUM
Suggested Fix
Verify that the configuration in the sentry-shared-postgres repository's chore/upgrade-postgres-to-v18 branch mounts the PostgreSQL volume at /var/lib/postgresql. This ensures consistency with the volume mount path used in the reconnect step in the backend.yml workflow.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/backend.yml#L253
Potential issue: The CI workflow first starts a PostgreSQL container via `devservices`
using configuration from the `sentry-shared-postgres` repository. It then stops this
container and restarts it with a volume mount path defined in
`.github/workflows/backend.yml` as `-v postgres-data:/var/lib/postgresql`. Due to a
breaking change in PostgreSQL 18, the data directory path has changed. If the
configuration in the `sentry-shared-postgres` repository's
`chore/upgrade-postgres-to-v18` branch has not also been updated to use the new mount
point, it will be inconsistent with the reconnect step. This will cause the reconnected
container to not find the existing database, leading to CI test failures.
Also affects:
devservices/config.yml:41~41
|
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |


Run CI on Postgresql v18