Skip to content

fix: resilience for analytics, Soroban and Horizon calls; remove unsafe any casts - #605

Merged
martinzhames merged 2 commits into
dupdab:mainfrom
unrealtim-tech:fix/453-454-455-456-resilience-and-type-safety
Oct 23, 2026
Merged

martinzhames merged 2 commits into
dupdab:mainfrom
unrealtim-tech:fix/453-454-455-456-resilience-and-type-safety

Conversation

@unrealtim-tech

Copy link
Copy Markdown

Changes

  • [P1] Add materialized view refresh error handling and alerting #453: AnalyticsRefreshService.refresh() wraps the refresh in try/catch with detailed logging, raises an analytics_refresh admin alert on failure or after 60s, and records analytics_refresh_duration_seconds and analytics_refresh_last_success_timestamp_seconds. POST /admin/analytics/refresh (superadmin) triggers it manually. Adds the analytics_refresh alert type with a migration.
  • [P1] Add Soroban RPC fallback and retry strategy #454: SorobanService and StellarService use a shared SorobanRpcResilience helper: 3 attempts with exponential backoff, optional fallback endpoint from SOROBAN_RPC_FALLBACK_URL, a circuit breaker that opens after 5 consecutive failures, and an admin alert when it opens.
  • [P1] Add circuit breaker to Stellar Horizon API calls #455: Horizon calls in StellarService go through a circuit breaker with the stellar_horizon_circuit_state gauge and an admin alert on open. StellarMonitorService skips polling while the circuit is open instead of failing.
  • [P1] Remove unsafe any type casts from cache and auth services #456: removed all as any casts in production code (cache/auth casts from the issue were already gone) using typed local shapes; strict: true was already enabled in tsconfig.json.

Notes

  • opossum is not a dependency and dependencies were not changed, so the breaker is a small in-repo implementation (src/common/circuit-breaker.ts).
  • AnalyticsRefreshService and SorobanService take new injected services (AdminAlertService; SorobanService also an optional fallback client); existing specs that construct them directly were not updated.
  • No tests, builds or lint were run.

Closes #453
Closes #454
Closes #455
Closes #456

…e unsafe any casts

dupdab#453: analytics view refresh logs failures, alerts admins on failure or runs over
60s, exposes duration and last-success Prometheus metrics, and can be triggered
by a superadmin via POST /admin/analytics/refresh.
dupdab#454: Soroban RPC calls retry with exponential backoff, fall back to
SOROBAN_RPC_FALLBACK_URL, open a circuit after 5 consecutive failures and
raise an admin alert when it opens.
dupdab#455: Horizon calls go through a circuit breaker with a state metric and admin
alert; Stellar polling pauses while the circuit is open.
dupdab#456: remove every `as any` cast from production code in favour of typed shapes.

Closes dupdab#453
Closes dupdab#454
Closes dupdab#455
Closes dupdab#456
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@unrealtim-tech 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

…-resilience-and-type-safety

# Conflicts:
#	src/runtime-config/runtime-config-admin.controller.ts
@martinzhames
martinzhames merged commit 2993d51 into dupdab:main Oct 23, 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

2 participants