Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The timelock bug was a wrong protocol key, not a missing one: alert_events.protocol is NOT NULL and send_telegram_message requires it, so an untagged alert cannot exist. The keys were real values (YEARN_TIMELOCK, CAP, ...) that matched nothing the website queries, so the alerts were invisible for months. Add utils/alert_protocols.py, declaring which keys the site can display: a monitoring.yaml slug, the two slug->key overrides the frontend applies (comp, ethplus), or an explicit page-less allowlist. Tests assert every PROTOCOL constant and every timelock key resolves to one, and that process_events really stores them that way — dropping the origin_protocol wiring reproduces the original bug and fails. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Follow-up to #356, from the review suggestion: "ask AI to write a CI test to trigger an error for any alert that is missing a protocol tag."
The bug was a wrong key, not a missing one
A "missing tag" test would have passed on #356's bug.
alert_events.protocolisNOT NULLandsend_telegram_messagerequires the argument, so an untagged alert can't exist. The timelock alerts were taggedYEARN_TIMELOCK,CAP,3JANE— real values that matched no key the website queries, so they were invisible on https://curation.yearn.fi/monitoring/ for months.So these tests check the opposite: that every key an alert can be stored under is one a page can display.
What's here
utils/alert_protocols.pydeclares the displayable keys: amonitoring.yamlslug, one of the two slug→key overrides the frontend applies (compound → comp,rtoken → ethplus), or a key in an explicit page-less allowlist (pegs,origin,lrt, the per-asset peg monitors,YEARN_TIMELOCK_INTERNAL,automation), each with a comment saying why.tests/test_alert_protocol_keys.pyasserts:PROTOCOL = "..."underprotocols/andutils/(AST scan, ~36 found) resolves to a displayable key;process_eventsreally stores them that way — this is the end-to-end one. Removingorigin_protocol=reproduces the original bug and fails with{'CAP': 'CAP', 'RTOKEN': 'RTOKEN', ..., 'YEARN_TIMELOCK': 'YEARN_TIMELOCK'};YEARN_TIMELOCK → yearnspecifically, pinning the reported bug;Also carries the
LRTcomment change discussed on #356: theLRT → pegsmapping pointed at nothing (the LRT Pegs page has no alert key, because its scripts emitpegs,originandlombard), so LRT now stores aslrt, allowlisted as page-less.Known limits
SLUG_TO_ALERT_PROTOCOLinrisk-score/src/data/monitoring.tsis the real source of truth, so the two can drift. The sturdier fix is analert_protocol:field inmonitoring.yaml, exposed viaGET /v1/monitoring, with the frontend reading it instead of hardcoding — worth a follow-up issue.utils/pegged_assets.py, the Safe monitor's per-multisig routing) aren't scanned. A daily ops check querying the API for distinct protocols and alerting on unknown keys would close that gap.Testing
pytest: 961 passed, 4 skippedruff format/ruff check: cleanmypy utils/alert_protocols.py: clean (repo-wide mypy has pre-existing failures)🤖 Generated with Claude Code