Repository navigation
feat(backend): add relay distributed locking, harden and instrument Horizon retry manager, add French dashboard locale - #1601
Open
Andreschuks101 wants to merge 1 commit into
Conversation
…orizon retry manager, add French dashboard locale
|
@Andreschuks101 is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Andreschuks101 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! 🚀 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#1455 - Distributed concurrency control and locking for the WebSocket Relay Service
backend/src/lib/websocket-relay-lock.js:SET NX PX.withRelayLock(scope, resource, fn)renews the lease every ttl/3. If a renewal fails, it aborts theAbortSignalpassed tofnwithRELAY_LOCK_LOSTinstead of letting the work continue without exclusion.waitMs, max 30s).redis.js, it falls back to an in-process lock table.createSingleFlight()gives a single in-flight promise per key inside one process, so reconnects don't stampede.event,dlq-drain,reconnect,connection). Resources are SHA-256 hashed intolock:ws-relay:<scope>:<sha256>, with a 512-char cap and no key-separator/CRLF injection.CircuitBreaker(websocket-relay-recovery.js) now admits exactly one probe in HALF_OPEN, as its docs already said. Before, every concurrent caller was let through to the recovering upstream.getStatus()gainsprobeInFlight.relay_lock_acquisitions_total{scope,result},relay_lock_wait_duration_seconds,relay_lock_hold_duration_seconds,relay_lock_lost_total,relay_circuit_breaker_probe_rejected_total.backend/docs/WEBSOCKET_RELAY_CONCURRENCY.md. Alert rules:backend/docs/alerts/websocket-relay-locking.rules.yml.#1437 - Payload sanitization and strict validation for the Horizon Client Retry Manager
backend/src/lib/stellar/horizon-client/sanitizer.js.TypeError,code: HORIZON_CLIENT_VALIDATION_ERROR:retryDelays: array, at most 10 entries, integers 0-60000 ms. Stored as a frozen copy.operationName: must match/^[A-Za-z][A-Za-z0-9_]{0,63}$/, because it becomes a Prometheus label.operation: must be a function. It is never called if validation fails.horizon_client_data_validation_errors_total{operation,validation_type}.[REDACTED].detailand network error text are sanitized and capped at 512 chars.error-handler.js(handleError,formatContext) and the retry log line now use the sanitized values.#1438 - Prometheus alert metrics and health telemetry for the Horizon Client Retry Manager
horizon_client_retry_exhausted_total{operation,error_type}horizon_client_consecutive_failures{operation}horizon_client_last_success_timestamp_seconds{operation}horizon_client_health_state(0 healthy, 1 degraded, 2 unhealthy)RetryManager#getHealth()gives per-operation status, success/failure totals, last success/failure time and last error type. The worst operation decides the overall status. Unhealthy meansunhealthyAfterFailuresconsecutive failures (default 5, configurable throughHorizonClientoptions). The table is capped at 64 operations.HorizonClient#getHealth()adds the lastisReachable()probe. A failed probe downgrades a healthy client to degraded.backend/docs/alerts/horizon-client-retry-manager.rules.yml: unhealthy, degraded, retries exhausted, high error ratio, no recent success, validation rejections.backend/docs/HORIZON_CLIENT_RETRY_MANAGER.md.#428 - Dashboard multi-language switcher (i18n)
LocaleSwitcherand ES/PT catalogues.frinsrc/i18n/config.ts(mapped tofr-FR) and a fullmessages/fr.jsonwith all 705 keys.fr.network.*,portfolioChart.*), so core pages no longer show raw keys in those locales.aria-label) intodashboardShell.openNavigationMenu.src/i18n/messages.test.tschecks that every locale has the same keys asen, keeps the same ICU arguments, has no empty strings, and that the switcher lists every locale.LocaleSwitcher.test.tsxcovers the options, the cookie write plus route replace, a no-op when re-selecting, and the fallback for an unsupported locale.frontend/I18N.md.Notes
RetryManager/HorizonClientnow throw at construction ifretryDelaysis invalid (negative, non-integer, over 60s, more than 10 entries). The defaults and every existing caller are valid.[object Object].backend/tests/helpers/fake-redis.jsgains support for the compare-and-pexpire EVAL script, which lease renewal needs. This is purely additive; existing behaviour is unchanged.../metrics.jsmock inhorizon-client.test.jsgains the five new metric exports, because Vitest throws on access to undefined mock exports.websocket-relay-recovery.test.jsandhorizon-client.test.jsgain new test cases only.messages/*.json. Locale names in the switcher follow the existing unaccented style (Espanol,Portugues,Francais).relay_lock_lost_total).closes #1455
closes #428
closes #1437
closes #1438