feat(coretime-alert): optional discord mention and --fake-alert drill - #1528
Conversation
|
Runtime version has not been increased. |
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate issues and one documentation nit remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds optional Discord mentions and a synthetic --fake-alert drill to the coretime renewal watchdog.
Changes:
- Adds top-level mention payloads with explicit mention permissions.
- Adds synthetic alerts without RPC access or state changes.
- Documents configuration and wires
ALERT_MENTIONinto the stack.
File summaries
| File | Summary |
|---|---|
scripts/coretime-alert/README.md |
Documents configuration and drill behavior; cooldown wording needs to distinguish test modes (nit, 3 votes). |
scripts/coretime-alert/lark-stack.yml |
Wires ALERT_MENTION into the deployment stack. |
scripts/coretime-alert/check.mjs |
Implements mentions and fake alerts; moderate issues remain with dry-run compatibility and configurable fake-alert shortfalls (1 vote each). |
Review details
Suppressed comments (2)
scripts/coretime-alert/check.mjs:231
- With
ALERT_MENTIONunset, this changes the--dry-runoutput from the previous{ embeds }shape to{ username, embeds }. That contradicts the stated byte-identical compatibility claim and the dry-run verification; either preserve the old diagnostic shape when unset or update the claim to distinguish the HTTP payload from the dry-run output.
console.log(JSON.stringify(payload, null, 2));
scripts/coretime-alert/check.mjs:300
- This fixture assumes the configured target is exactly three: it hard-codes one secured core and two pending renewals but derives
shortfallfromdesiredCores - 1. With a valid override such asHYDRATION_DESIRED_CORES=1or4, the drill displays a zero/incorrect shortfall while still emitting an alert. Derive the synthetic core lists and shortfall from the configured target, or make the fixture explicitly independent of that setting.
shortfall: chain.desiredCores - 1,
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| It applies to **every** alert the watchdog posts, including the throttled | ||
| `🔌 check failed` notice, `--test` and `--fake-alert`. Sends are already | ||
| rate-limited by `ALERT_COOLDOWN_HOURS`, so this is at most a couple of pings a | ||
| day per condition. |
|
drilled and deployed. basilisk was sitting at URGENT when I started (0/3 secured, 5.5d to region begin) and got renewed mid-deploy, so both chains are 3/3 now and no real alert is pending. |
|
Quick benchmark at commit 80b7e09 has been executed successfully. |
why
Alerts currently post an embed with no top-level
content. Discord does not send a notification for mentions inside an embed — only messagecontentdoes. So today a coretime renewal alert lands silently in the channel and is only seen by whoever happens to scroll past it. The renewal right is genuinely lost at the region deadline, so a silent alert is close to no alert.There was also no way to see what a real alert looks like without waiting for an actual deadline —
--testonly proves the webhook is reachable.what
ALERT_MENTION(new, optional env var) — posted as top-levelcontentabove the embed, so alerts actually ping. Takes@here,<@&ROLE_ID>or<@USER_ID>. Setsallowed_mentionsexplicitly rather than relying on the webhook default, so a role not flagged "mentionable" still pings. Unset, the payload is byte-identical to today's.--fake-alert(new flag) — posts one synthetic alert per configured chain (HydrationURGENT, BasiliskWARNING) through the realbuildEmbedpath. Each is titled🧪 [DRILL]with a "this is a test alert" line and asynthetic drillfooter so it can't be mistaken for a live deadline. Contacts no RPC and does not touch the state file, so it cannot disturb the cooldown of a real standing alert.lark-stack.yml:ALERT_MENTIONwired up.Both chains were already watched — Hydration (task 2034, Polkadot) and Basilisk (task 2090, Kusama); no change to coverage.
testing
Dry-run verified with and without the var — unset produces exactly the current payload; set produces:
Not yet run against the live webhook — that happens at deploy.
deploy notes
Needs an image rebuild;
autoredeployon the larkcoretime-alertstack picks up:latest, andALERT_MENTIONmust be set on the service.Unrelated, but worth flagging:
DISCORD_WEBHOOK_URLis stored in plaintext in the stack env, so it surfaces in any Swarmpit service dump. The script already supportsDISCORD_WEBHOOK_URL_FILEif we want to move it to a Swarm secret.