docs(health): document all health endpoint response fields and states#575
Merged
Merged
Conversation
Expands docs/health-endpoints.md to cover every response field for all four health endpoints (liveness, readiness, detailed, indexer heartbeat) with healthy/degraded/unhealthy values, liveness vs readiness distinction, and explicit non-200 trigger conditions per endpoint. Adds health.response-schema.test.ts with 70 tests that act as a living contract between the code and the documentation, covering field types, allowed enum values, and HTTP status mapping for every documented state. Fixes pre-existing setHeader TypeError in health.controllers.test.ts and health.controllers.integration.test.ts that caused 6 tests to fail.
Ajibose
force-pushed
the
feat/health-check-docs
branch
from
July 18, 2026 15:04
1728b7e to
9a0c809
Compare
4 tasks
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 #571
Summary
docs/health-endpoints.mdwith complete field-by-field documentation for all four health endpoints: liveness (/health), readiness (/health/ready), diagnostics (/health/detailed), and indexer heartbeat (/health/indexer)health.response-schema.test.ts— 70 tests that act as a living contract between the code and the documentationsetHeader is not a functionbug in two existing test files that caused 6 tests to fail on mainNew files
src/modules/health/health.response-schema.test.ts— response field schema tests for all four health endpointsModified files
docs/health-endpoints.md— expanded from partial docs to complete endpoint referencesrc/modules/health/health.controllers.test.ts— addedres.setHeaderstub tomockResponsehelper (fixes 6 pre-existing failures)src/modules/health/health.controllers.integration.test.ts— samesetHeaderfixImplementation details
Documentation (
docs/health-endpoints.md)The updated doc covers:
GET /health(liveness)GET /health/ready(readiness)ready: falsewhen any check is"fail"→ 503GET /health/detailed(diagnostics)database.status === "disconnected"in production → 503GET /health/indexer(worker heartbeat)data.status === "degraded"→ 503Each endpoint section includes: response shape example, field table with types and descriptions, state tables mapping field values to conditions, and the precise non-200 trigger condition.
The liveness vs readiness distinction is explained in a comparison table at the top of the document.
Tests (
health.response-schema.test.ts)Tests are organised by endpoint and state. Key coverage:
latencyMsready: falseas trigger,errorstring present,latencyMsstill present at top levelmemory,system,timeouts,database,syncingcomputation,servicesarray valuesdatabase.status: "disconnected", noresponseTime,Databaseservice"unhealthy"unknown,healthy,degraded) with HTTP code,lastSuccessfulRun, andstaleSinceMsassertionsPOST /health/indexer/heartbeatHow to test