feat: add database health check to readiness probe and admin db-diagn… - #585
Open
playmaker410 wants to merge 2 commits into
Open
feat: add database health check to readiness probe and admin db-diagn…#585playmaker410 wants to merge 2 commits into
playmaker410 wants to merge 2 commits into
Conversation
…ostics endpoint - Add checkDbHealth() in src/db/index.ts with heartbeat upsert and PRAGMA quick_check - Integrate DB health check into readiness probes (/ready and /health/readiness) - Add GET /api/admin/db-diagnostics endpoint returning file size, last migration, and full integrity check - Add tests covering healthy and simulated-failure scenarios
Contributor
|
no tags |
…dpoint - Add checkDbHealth() to src/db/index.ts: upserts a heartbeat row into _healthcheck and runs PRAGMA quick_check for a cheap per-request probe - Add getDbFileSize(), getLastMigration(), getDbIntegrityCheck() helpers for the deeper admin diagnostics endpoint - Wire probeDb() into /ready, /health/readiness, and /health in app.ts so DB writability/integrity failures cause readiness to report 503 - Add GET /api/admin/db-diagnostics (admin-only) returning file size, last migration applied, and full PRAGMA integrity_check output - Add tests/routes/dbDiagnostics.test.ts covering: - checkDbHealth() healthy path and simulated read-only failure - /ready 503 when DB probe fails (mocked checkDbHealth) - GET /api/admin/db-diagnostics with 401/403/200 auth scenarios - getDbFileSize / getLastMigration / getDbIntegrityCheck unit tests - Update tests/routes/health.test.ts to assert db field in services - Fix TypeScript lint: use unknown instead of any in catch blocks Closes #<issue>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ostics endpoint