Test the deep health probe degraded and paused states
Description
GET /api/v1/health/deep in src/index.ts returns status: "ok", "degraded" (503), or "paused" based on runHealthChecks() and the paused flag, and it reports checks[], uptime, memory, pid, and node. Only the happy ok path is covered today; the degraded 503 branch (a failing check) and the paused 200 branch are untested, as is the per-check { name, status, durationMs } shape. This issue adds coverage for all three states.
Requirements and context
- Repository scope: StableRoute-Org/Stableroute-backend only.
- Assert the
ok path returns 200 with both storage and clock checks present and status: "ok".
- Force the
degraded branch (e.g. by stubbing pairMeta/storage so the storage check fails, or by injecting a failing check) and assert a 503 with status: "degraded".
- Toggle pause via
POST /api/v1/admin/pause, assert GET /api/v1/health/deep returns 200 with status: "paused", then unpause to restore state.
- Assert the response carries
uptimeSeconds, memory.rssMb, memory.heapUsedMb, pid, and node.
Suggested execution
- Fork the repo and create a branch
git checkout -b test/health-33-deep-probe-branches
- Implement changes
- Write comprehensive tests in: create
src/__tests__/healthDeep.test.ts.
- Add documentation: none beyond test names.
- Restore any stubbed globals and the pause flag in
afterEach to avoid cross-test bleed.
- Validate security: confirm the probe body exposes no secrets.
- Test and commit
Test and commit
- Run
npm run build, npm run lint, and npm test.
- Cover edge cases: ok, degraded (503), paused (200), all check fields present.
- Paste the full
npm test output and a coverage summary in the PR.
Example commit message
test(health): cover deep probe degraded and paused branches
Guidelines
- Minimum 95 percent test coverage for impacted code.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Test the deep health probe degraded and paused states
Description
GET /api/v1/health/deepinsrc/index.tsreturnsstatus: "ok","degraded"(503), or"paused"based onrunHealthChecks()and thepausedflag, and it reportschecks[], uptime, memory, pid, and node. Only the happyokpath is covered today; thedegraded503 branch (a failing check) and thepaused200 branch are untested, as is the per-check{ name, status, durationMs }shape. This issue adds coverage for all three states.Requirements and context
okpath returns 200 with bothstorageandclockchecks present andstatus: "ok".degradedbranch (e.g. by stubbingpairMeta/storage so the storage check fails, or by injecting a failing check) and assert a503withstatus: "degraded".POST /api/v1/admin/pause, assertGET /api/v1/health/deepreturns200withstatus: "paused", then unpause to restore state.uptimeSeconds,memory.rssMb,memory.heapUsedMb,pid, andnode.Suggested execution
git checkout -b test/health-33-deep-probe-branchessrc/__tests__/healthDeep.test.ts.afterEachto avoid cross-test bleed.Test and commit
npm run build,npm run lint, andnpm test.npm testoutput and a coverage summary in the PR.Example commit message
test(health): cover deep probe degraded and paused branchesGuidelines
Community & contribution rewards