Description
The health router (src/routes/health.ts, src/services/health/probes.ts, checks.ts) provides probes, but the Horizon listener's liveness (last event/cursor heartbeat) and outbox publisher lease health are not represented. Kubernetes (k8s/deployment.yaml) can route traffic to a pod whose listener has silently died or whose outbox is stalled, so readiness must reflect background-worker health, not just process up.
Requirements and context
- Add readiness checks for: Postgres connectivity (
src/db/pool.ts), Redis (src/cache/redis.ts), Horizon listener last-heartbeat age, and outbox publisher running state.
- Distinguish liveness (process up) from readiness (dependencies + workers healthy) in
src/services/health/probes.ts.
- Surface degraded subsystems in the JSON body with per-check status.
- Align with
k8s/deployment.yaml probe paths.
Suggested execution
Create branch feature/deep-readiness-probes.
- Extend
src/services/health/checks.ts and probes.ts.
- Expose listener/outbox heartbeats for the checks to read.
- Extend
tests/routes/health.test.ts and src/services/health/checks.test.ts.
- Update
docs/k8s.md and docs/monitoring.md.
Test and commit
Run npm run test. Edge cases: Redis down → ready=false, listener heartbeat stale, partial degradation. Security: health body must not leak connection strings.
Example commit message
feat: deep readiness probe including listener and outbox health
Guidelines
- Minimum 95% test coverage
- Clear documentation in
docs/k8s.md
- Timeframe: 96 hours
Description
The health router (
src/routes/health.ts,src/services/health/probes.ts,checks.ts) provides probes, but the Horizon listener's liveness (last event/cursor heartbeat) and outbox publisher lease health are not represented. Kubernetes (k8s/deployment.yaml) can route traffic to a pod whose listener has silently died or whose outbox is stalled, so readiness must reflect background-worker health, not just process up.Requirements and context
src/db/pool.ts), Redis (src/cache/redis.ts), Horizon listener last-heartbeat age, and outbox publisher running state.src/services/health/probes.ts.k8s/deployment.yamlprobe paths.Suggested execution
Create branch
feature/deep-readiness-probes.src/services/health/checks.tsandprobes.ts.tests/routes/health.test.tsandsrc/services/health/checks.test.ts.docs/k8s.mdanddocs/monitoring.md.Test and commit
Run
npm run test. Edge cases: Redis down → ready=false, listener heartbeat stale, partial degradation. Security: health body must not leak connection strings.Example commit message
feat: deep readiness probe including listener and outbox healthGuidelines
docs/k8s.md