Skip to content

fix(timelock): record alerts under website protocol keys - #356

Merged
spalen0 merged 1 commit into
mainfrom
ytimelock
Sep 11, 2026
Merged

fix(timelock): record alerts under website protocol keys#356
spalen0 merged 1 commit into
mainfrom
ytimelock

Conversation

@spalen0

@spalen0 spalen0 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

Timelock alerts never appear on https://curation.yearn.fi/monitoring/ protocol pages (e.g. /monitoring/yearn/).

timelock_alerts.py passes its uppercase Telegram routing key (YEARN_TIMELOCK, CAP, 3JANE, INFINIFI, AAVE, …) to send_telegram_message, which also stores it as the alert's protocol. The website queries GET /v1/alerts?protocol=<key>&source=protocol with an exact-match key taken from each page's data-api-protocol (yearn, cap, 3jane, comp, ethplus, …), so every timelock alert was filtered out.

Live API confirms it: protocol=YEARN_TIMELOCK returns the missing Yearn timelock alerts; protocol=yearn does not.

Fix

  • Telegram routing is unchanged.
  • Alerts are now stored under the website key via the existing origin_protocol parameter: the lowercased routing key, with exceptions YEARN_TIMELOCK → yearn, RTOKEN → ethplus, LRT → pegs.
  • The YEARN_TIMELOCK_INTERNAL mirror keeps its own key so the Yearn page doesn't show each alert twice.
  • Tests for the key mapping and for how Yearn alerts are stored.

Open questions / follow-ups

  • LRT → pegs is a guess. The lrt-pegs (and maple) pages currently have no alert table. pegs matches what the lrt-pegs scripts use.
  • Past alerts are not moved. To show them, run on the production monitoring.db (not run):
    UPDATE alert_events
    SET protocol = CASE protocol WHEN 'YEARN_TIMELOCK' THEN 'yearn' WHEN 'RTOKEN' THEN 'ethplus'
                                 WHEN 'LRT' THEN 'pegs' ELSE lower(protocol) END
    WHERE source = 'protocol'
      AND protocol IN ('YEARN_TIMELOCK','CAP','RTOKEN','LRT','INFINIFI','AAVE','COMP','FLUID','LIDO','MAPLE','STRATA','3JANE');
  • /monitoring/timelock/ stays empty for source=protocol: it queries protocol=timelock, and an alert has one protocol key. Showing alerts there too needs a frontend/API change (multi-key filter or a metadata tag).

Testing

  • pytest tests/test_timelock_alerts.py tests/test_monitoring_config.py: 21 passed
  • ruff check: clean

🤖 Generated with Claude Code

Timelock alerts were stored under their uppercase Telegram routing key
(YEARN_TIMELOCK, CAP, 3JANE, ...), but protocol pages query the alerts API
with an exact-match lowercase key (yearn, cap, 3jane, comp, ethplus), so no
timelock alert ever appeared on the website. Keep routing unchanged and pass
the website key as origin_protocol. The internal Yearn mirror keeps its own
key to avoid duplicate rows on the Yearn page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@spalen0
spalen0 marked this pull request as ready for review September 11, 2026 15:20
@spalen0
spalen0 merged commit 312f588 into main Sep 11, 2026
3 checks passed
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.

1 participant