Skip to content

feat: add health check endpoint with database and Stellar status (#32) - #247

Merged
K1NGD4VID merged 7 commits into
mergepay:mainfrom
dahmeezy:feat/health-check-endpoint
Sep 2, 2026
Merged

feat: add health check endpoint with database and Stellar status (#32)#247
K1NGD4VID merged 7 commits into
mergepay:mainfrom
dahmeezy:feat/health-check-endpoint

Conversation

@dahmeezy

Copy link
Copy Markdown
Contributor

Summary

  • add a public GET /health endpoint
  • report database connectivity and Stellar network status
  • return 503 with a degraded status when either check fails
  • add 5-second timeouts and concurrent health checks
  • add tests covering successful and degraded health states

Closes #32

…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>
@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@mergekeeper

mergekeeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

MergeKeeper review

Scope: in scope for linked issue #32.
Verdict: clean

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: a0cc1687be4b4f5431a90be12996abeb31d312e1.
CI and merge eligibility are checked separately.

@mergekeeper

mergekeeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

MergeKeeper merge status

Status: blocked
PR state: open
Mergeability: conflicts / not mergeable
Checked commit: a0cc1687be4b4f5431a90be12996abeb31d312e1.

Reason: One or more required CI checks failed.

Failing checks:

Next steps:

  1. Open the failing check details above and fix the reported error.
  2. Run the same checks locally where possible.
  3. Commit and push the fix.
  4. MergeKeeper will automatically re-review the updated PR.

@mergekeeper

mergekeeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

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/health
  • tests/health.test.ts:19: healthRoutes is not imported or defined in tests/health.test.ts
  • tests/health.test.ts:137: Test uses un-awaited response or mismatched variable name (res vs response)

Reviewed commit: 31de219200a479f4ed697e3a7fc5e4c4abf0b0fe.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/health
  • tests/health.test.ts:19: healthRoutes is not imported or defined in tests/health.test.ts
  • tests/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>
@mergekeeper

mergekeeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Needs review

Linked to #32, but the diff does not match the issue scope.

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: f38dfa9f7c30602ef2f2043dbacbc7bc2a2b61d9.

@K1NGD4VID
K1NGD4VID merged commit f55a6b4 into mergepay:main Sep 2, 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.

Add health check endpoint that reports database connectivity and Stellar network status

2 participants