feat: add health check endpoint with database and Stellar status (#32) - #247
Conversation
…gepay#32) Implement GET /health that returns overall API health including database connectivity (prisma.$queryRawUnsafe SELECT 1) and Stellar Horizon network status. Returns 200 with status 'ok' when both checks pass, 503 with status 'degraded' when either fails. Uses Promise.allSettled for concurrent checks with a 5-second timeout per check. No auth required. Includes unit tests mocking failures and verifying response structure. Closes mergepay#32 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@dahmeezy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
MergeKeeper review Scope: in scope for linked issue The pull request correctly implements the GET /health endpoint with database connectivity check via Prisma, Stellar network status, proper error handling, 503 status code on failure, and comprehensive tests. Reviewed commit: |
|
MergeKeeper merge status Status: blocked Reason: One or more required CI checks failed. Failing checks:
Next steps:
|
|
Needs changes The PR tests reference undefined variables and break the test suite by modifying existing readiness tests instead of implementing the requested GET /health endpoint correctly.
Reviewed commit: |
There was a problem hiding this comment.
Needs changes
The PR breaks existing test files by referencing undefined variables (like healthRoutes and mockReadiness) and modifying tests incorrectly.
tests/health.test.ts:15: Reference to undefined variable 'mockReadiness' in mock setup.tests/health.test.ts:20: Reference to undefined variable 'healthRoutes' when registering routes in createApp().
Reviewed commit: 838f913751ee86147a47b81167b97e0d28bd9d7f.
There was a problem hiding this comment.
Needs changes
The PR tests reference undefined variables and break the test suite by modifying existing readiness tests instead of implementing the requested GET /health endpoint correctly.
tests/health.test.ts:15: Reference to undefined mockReadiness function in vi.mock for ../src/services/healthtests/health.test.ts:19: healthRoutes is not imported or defined in tests/health.test.tstests/health.test.ts:137: Test uses un-awaited response or mismatched variable name (res vs response)
Reviewed commit: 31de219200a479f4ed697e3a7fc5e4c4abf0b0fe.
Mock only the underlying dependencies (db, network) instead of the entire health service module. This allows the real service code to run with mocked DB and network calls, fixing: - /health tests: mock h.queryRawUnsafe/h.feeStats for degraded responses - /health/ready tests: variable name mismatches (res vs response) - /health/live test: correct liveness response shape - /health/deep tests: proper getDeepHealth behavior via real service 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Needs review Linked to The pull request diff only contains minor documentation and test formatting adjustments without implementing the requested GET /health endpoint, route registration, or implementation files. Reviewed commit: |
Summary
Closes #32