feat: add deep health check endpoint validating DB, Stellar RPC, Twilio, and Agent Loop#276
Open
AugistineCreates wants to merge 1 commit into
Open
Conversation
…io, and Agent Loop
|
@AugistineCreates 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! 🚀 |
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.
Closes #270
Summary
This PR implements a deep health check endpoint (
GET /health/deep) to validate the reachability and status of the application's external dependencies (Database, Stellar RPC, Twilio, and the Agent Loop). It also updates the Kubernetes readiness probe to utilize this endpoint securely.Changes
1. Backend Core & Routes
src/routes/health.ts: Added the/health/deependpoint.X-Internal-Tokenheader (orBearertoken) matched against theINTERNAL_SERVICE_TOKENenvironment variable.503 Service Unavailableif any dependency is unhealthy.200 OKwith statusdegradedif any dependency is degraded but none are unhealthy.src/agent/loop.ts: Added tracking oflastTickAttimestamp. Exposed the last tick time ingetAgentStatus()to allow checking if the background loop is actively ticking.2. Kubernetes Configuration
deploy/k8s/deployment.yaml: Updated thereadinessProbeto use anexeccommand utilizingwgetto query/health/deepwith theINTERNAL_SERVICE_TOKENpassed in the request header.3. Testing & Tooling
tests/unit/routes/health.test.ts: Created unit tests mocking each dependency failure independently, verifying:package.json: Added missing dependencies and type declarations to support compiling and running the test suite in the local workspace.Verification
Executed the unit tests:
All 8 tests passed successfully.