Skip to content

fix(api): harden healthcheck probe failure handling#73

Merged
gregagi merged 1 commit intomainfrom
fix/sentry-status-probe-5dcb5ffa
Feb 28, 2026
Merged

fix(api): harden healthcheck probe failure handling#73
gregagi merged 1 commit intomainfrom
fix/sentry-status-probe-5dcb5ffa

Conversation

@gregagi
Copy link
Copy Markdown
Owner

@gregagi gregagi commented Feb 28, 2026

Summary

  • add an explicit Ninja response schema for GET /api/healthcheck for both 200 and 503
  • downgrade unhealthy healthcheck dependency logs from error to warning to avoid noisy Sentry issue creation from probes
  • add regression tests for DB/Redis unhealthy paths to verify 503 responses and no logger.error calls

Root cause

/api/healthcheck could return (503, payload) on dependency failure, but the endpoint only declared a 200 response model. Django Ninja raised a ConfigError when serializing the 503 response, turning an expected unhealthy result into an exception.

Verification

  • ENVIRONMENT=test SECRET_KEY=test SITE_URL=http://localhost DEBUG=1 uv run pytest -q apps/api/tests.py -k healthcheck
  • ENVIRONMENT=test SECRET_KEY=test SITE_URL=http://localhost DEBUG=1 uv run pytest -q apps/api/tests.py

@gregagi gregagi merged commit fcef6f0 into main Feb 28, 2026
1 check passed
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.

1 participant