feat: implement alert dedup severity, price history, telegram role authz, and DEX XLM/USD#746
Merged
Mosas2000 merged 1 commit intoJun 27, 2026
Conversation
…thz, and DEX XLM/USD - StellaBridge#688: Replace severity/bridgeId placeholders in alertDeduplication.service.ts; escalate incident severity via new updateIncidentSeverity on IncidentService and derive bridgeId as bridge-<assetCode> instead of hard-coded "unknown" - StellaBridge#685: Implement getHistoricalPrices in price.service.ts using PriceModel.getTimeBucketed with per-interval bucket sizes (5m/1h/6h/1d) and configurable lookback windows - StellaBridge#686: Add migration 042 to store telegram_chat_id on admin_accounts; implement role check in isAdminChat querying admin_accounts for operator/super_admin roles - StellaBridge#687: Remove stale placeholder comment in dex.source.ts; add Binance public API as secondary fallback in fetchXlmUsd with a 1-hour stale cache before the hardcoded emergency value - Add unit tests for all four changes
|
@Godbrand0 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 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
Changes
closes #688 — Alert Deduplication Severity & Bridge Resolution
alertDeduplication.service.ts: ReplaceupdateIncidentStatus("investigating")placeholder with a realupdateIncidentSeveritycall that escalates to the higher priority; status is then set to"investigating"afterwardalertDeduplication.service.ts: Replace hard-codedbridgeId: "unknown"withbridgeId: bridge-<assetCode>derived from the alert event (consistent with the pattern inalert.service.ts)incident.service.ts: AddupdateIncidentSeveritymethod used by the abovecloses #685 — Historical Price Series TimescaleDB Query
price.service.ts: ImplementgetHistoricalPricesusingPriceModel.getTimeBucketedwith per-interval bucket widths (5 minutes/1 hour/6 hours/1 day) and matching lookback windowscloses #686 — Telegram Bot Role-Based Authorization
telegram.bot.service.ts: Replace TODO inisAdminChatwith a query againstadmin_accountscheckingtelegram_chat_idforoperatororsuper_adminroles; fails closed on DB errorsmigrations/042_admin_accounts_telegram_chat_id.ts: Addstelegram_chat_id(nullable, unique) column toadmin_accountscloses #687 — DEX XLM/USD Price Source
dex.source.ts: Remove misleading "placeholder" comment —fetchXlmUsdalready does a live fetchdex.source.ts: Add Binance public ticker as secondary fallback; also persist a 1-hour stale cache entry on successful fetches so the last-resort path can serve a recent value when both live sources are down, before falling back to the hardcoded0.12emergency valueTests
Unit tests added for all four changes:
__tests__/alertDeduplication.service.unit.ts__tests__/priceHistorical.service.unit.ts__tests__/telegramRoleAuthz.service.unit.ts__tests__/dexXlmUsd.source.unit.tsTest plan
npm run test:unit— all new unit tests passgetHistoricalPricesreturns correct shape against a TimescaleDB dev instancetelegram_chat_idon anadmin_accountsrow withoperatorrole and confirm the Telegram/pausecommand is now accessibleCloses #685
Closes #686
Closes #687
Closes #688
🤖 Generated with Claude Code