Skip to content

[Quality-2] Make readiness probes reflect required dependency classes - #942

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
Gwther:fix/issue-939-readiness-probes
Aug 29, 2026
Merged

[Quality-2] Make readiness probes reflect required dependency classes#942
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
Gwther:fix/issue-939-readiness-probes

Conversation

@Gwther

@Gwther Gwther commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR updates the deep readiness probe so /api/health/ready reflects all required runtime dependency classes. The endpoint now reports ready only when Postgres, Soroban RPC, indexer lag, Redis/BullMQ, and Horizon are all healthy.

Related Issue

Closes #939

Changes

Readiness dependency coverage

  • [MODIFY] src/services/readinessService.ts

    • Adds a Horizon readiness probe using the configured HORIZON_URL.
    • Treats non-2xx Horizon responses, network failures, and 1-second timeout aborts as readiness failures.
    • Includes Horizon in the aggregate Promise.allSettled readiness result.
  • [MODIFY] src/routes/health/ready.ts

    • Updates endpoint documentation to list all five required readiness checks.
  • [MODIFY] tests/healthReady.test.ts

    • Adds Horizon success, HTTP failure, network failure, and timeout coverage.
    • Verifies the HTTP response includes all five required checks.
    • Verifies a Horizon failure produces a 503 unready response.
    • Keeps aggregate readiness tests isolated from real Stellar network calls.
  • [MODIFY] README.md, docs/health-ready.md

    • Updates readiness examples, dependency descriptions, environment-variable docs, and logging examples for the Horizon check.

Verification Results

git diff --check origin/main...HEAD
PASS

npm test -- tests/healthReady.test.ts --runInBand
BLOCKED: local dependencies are not installed; `jest` is not available.

npm ci
BLOCKED: local C: drive has insufficient free space for dependency installation.

Acceptance Criteria

Acceptance Criteria Status
Deterministic valid, invalid, duplicate, and boundary behavior Addressed: Horizon pass, HTTP failure, network failure, timeout boundary, and aggregate unready behavior are covered in focused tests.
Authorization, validation, and state-transition invariants remain enforced Addressed: readiness remains unauthenticated by design and does not change request validation or application state.
Retries, partial failure, and concurrent execution cannot produce unsafe or inconsistent results Addressed: probes still run independently via Promise.allSettled; a Horizon failure only marks readiness unready and does not suppress other probe results.
Focused tests cover success, rejection, boundary, and regression scenarios Addressed: tests/healthReady.test.ts adds Horizon success/rejection/timeout/HTTP regression coverage.
Existing callers remain compatible, or the PR includes a tested migration path Addressed: response shape is additive (checks.horizon) and status semantics remain ready/unready with HTTP 200/503.
Relevant diagnostics make failures diagnosable without exposing sensitive data Addressed: Horizon probe failures are logged as readiness_horizon_check_failed and returned as health metadata only.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Gwther 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

@Gwther
Gwther force-pushed the fix/issue-939-readiness-probes branch from 0acb1fa to 4e2c79c Compare August 28, 2026 08:02
@greatest0fallt1me
greatest0fallt1me merged commit f27a819 into Predictify-org:main Aug 29, 2026
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.

[Quality-2][Medium] Make readiness probes reflect required dependency classes

2 participants