Skip to content

Feat/health dependency latency age budgets 1228 - #1266

Open
dorismaduegbunam wants to merge 5 commits into
Talenttrust:mainfrom
dorismaduegbunam:feat/health-dependency-latency-age-budgets-1228
Open

Feat/health dependency latency age budgets 1228#1266
dorismaduegbunam wants to merge 5 commits into
Talenttrust:mainfrom
dorismaduegbunam:feat/health-dependency-latency-age-budgets-1228

Conversation

@dorismaduegbunam

Copy link
Copy Markdown

Summary

Extends the live health subsystem so each probe surfaces how fresh the dependency's data is, alongside availability and latency, and lets operators set budgets for both metrics.

Changes

  • Probes now report optional ageMs and lastSuccessfulAt in addition to ok and latencyMs.
  • A HealthBudget (maxLatencyMs, maxAgeMs) bounds how long a probe may run and how old its data may be before the dependency is reported as degraded, instead of healthy.
  • runHealthCheck clamps probe latency (a probe that times out is reported as down) and apples the freshness budget after each probe.
  • A new indexer probe derives freshness from the most recently indexed event, making indexer lag observable through the health API.
  • The health router exposes the new freshness fields in verbose and production responses; non-verbose responses still omit detailed diagnostics.
  • Documentation updated to describe the budget and freshness semantics.

Security

  • No new secrets, keys, or credentials are introduced.
  • Non-verbose health responses continue to strip detailed probe diagnostics, so the new fields only add a measure of data age, never internal details.
  • The new indexer probe reads a single aggregate value and adds no write path.

Test suite

  • 217 test suites / 4566 tests pass across the repository.
  • Health subsystem suites (checker, probes, router) are all green.
  • npm run lint (0 errors) and npm run build pass.

This branch also ships a dedicated commit repairing pre-existing regressions from earlier merged PRs that were failing on main before this work (mangled identifiers, a dropped schema migration, and rate-limit tests left stale by a limiter rewrite), so the branch lands on a fully green baseline.

Closes #1228

…1228)

Extend the live health subsystem to surface per-probe freshness on top of availability and latency:

- ProbeResult gains optional ageMs/lastSuccessfulAt so consumers can see how stale each dependency's data is.
- HealthBudget (maxLatencyMs, maxAgeMs) with a DEFAULT_HEALTH_BUDGET bounds probe runtime and degrades probes whose data is older than the budget instead of reporting them up.
- runHealthCheck clamps probe latency (timeouts count as down) and applies the freshness budget.
- New indexerProbe reads the latest indexed event timestamp from smart_contract_events so indexer freshness is observable.
- Production/verbose health responses include ageMs and lastSuccessfulAt for healthy probes; detail remains stripped in non-verbose mode.
- docs/health.md updated with the new budget and freshness semantics.
The baseline suite carried breakage from several merged PRs that shipped ahead of a green test run. Restore it:

- safeErrors/appError: fix mangled identifiers, corrupted transport-timeout regexes, and the SQL statement regex so error classification matches intent (Talenttrust#1236).
- contractsClient: correct mangled identifiers (RETRYABLE_KINDS, maxDelayMs, delayMs, classified); make upstreamHttpClient preserve failure diagnostics (transport code, HTTP status, headers, response body) on DependencyError so failure classification and Retry-After honored actually work (Talenttrust#1236); align mis-matched classification tests with the merged enum/API.
- middleware/eventIngestion: fix imports of the nonexistent ../context module to ../middleware/requestContext (Talenttrust#1237).
- db: restore the dropped add_transaction_lease_columns migration as version 16 (the version-14 slot was taken by api_keys when two PRs collided, so SqliteTransactionStore lease queries failed with 'no such column') (Talenttrust#1241 Talenttrust#1240).
- blockchain-processor: restore lost defaultFinalityPromoter definition and eventAuditService import (Talenttrust#1245).
- address.validation.test / reputation.api.test: regenerate corrupted VALID_ACCOUNT constant and add missing controller mocks.
- rate-limit tests: update window-reset tests to the sliding-window semantics from Talenttrust#1201 (previous bucket still counts until it leaves the trailing window).
- dlqStore: fix db:: typo.
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

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.

Expose dependency health latency and age budgets

1 participant