Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/shared/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies = [
"django-model-utils>=4.5.1",
"django-postgres-extra>=2.0.8",
"django-prometheus>=2.3.1",
"django>=4.2.25,<5.0.0",
"django>=4.2.26,<5.0.0",
"google-auth>=2.21.0",
"google-cloud-pubsub>=2.18.4",
"httpx>=0.23.0",
Expand Down
8 changes: 8 additions & 0 deletions libs/shared/shared/django_apps/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@

TEST = True

# Disable connection health checks for tests to avoid issues with Django 4.2.26+
# Connection health checks can interfere with test database setup/teardown
for db_config in DATABASES.values(): # noqa: F405
db_config["CONN_HEALTH_CHECKS"] = False
if "TEST" not in db_config:
db_config["TEST"] = {}
db_config["TEST"]["CONN_HEALTH_CHECKS"] = False
Copy link

Choose a reason for hiding this comment

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

Bug: Health check fix missing from API test settings

The CONN_HEALTH_CHECKS = False fix was applied only to shared.django_apps.settings_test, but codecov.settings_test (used for API tests) follows a different import chain through settings_devsettings_basedb_settings, which does not include this override. If Django 4.2.26+ connection health checks interfere with test database setup/teardown as the comment indicates, API tests could still experience these issues since they inherit the default CONN_HEALTH_CHECKS = True from db_settings.

Fix in Cursor Fix in Web


# # Database
# # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
Comment on lines +92 to 97
Copy link

Choose a reason for hiding this comment

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

Bug: CodecovAPI tests will fail or hang due to CONN_HEALTH_CHECKS=True with Django 4.2.26+, as the fix in settings_test.py is not applied.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The CodecovAPI application's test suite will run with CONN_HEALTH_CHECKS=True when using Django 4.2.26/4.2.27 because its settings inheritance chain does not include shared.django_apps.settings_test. This will cause database connection issues during test setup/teardown, leading to test failures or hangs. The pull request intended to set CONN_HEALTH_CHECKS=False for Django 4.2.26+ to avoid these issues, but the fix was not applied to CodecovAPI.

💡 Suggested Fix

Ensure apps/codecov-api/codecov/settings_test.py or its imported settings correctly inherit or explicitly set CONN_HEALTH_CHECKS=False for Django 4.2.26+ to prevent test failures.

🤖 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: libs/shared/shared/django_apps/settings_test.py#L92-L97

Potential issue: The `CodecovAPI` application's test suite will run with
`CONN_HEALTH_CHECKS=True` when using Django 4.2.26/4.2.27 because its settings
inheritance chain does not include `shared.django_apps.settings_test`. This will cause
database connection issues during test setup/teardown, leading to test failures or
hangs. The pull request intended to set `CONN_HEALTH_CHECKS=False` for Django 4.2.26+ to
avoid these issues, but the fix was not applied to `CodecovAPI`.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5891920

# DATABASES = {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ shared = [
"django-model-utils>=4.5.1",
"django-postgres-extra>=2.0.8",
"django-prometheus>=2.3.1",
"django>=4.2.25,<5.0.0",
"django>=4.2.26,<5.0.0",
"google-auth>=2.21.1",
"google-cloud-pubsub>=2.27.1",
"httpx>=0.23.1",
Expand Down
16 changes: 8 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading