feat: coretime renewal watchdog#1470
Conversation
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
|
Runtime version has not been increased. |
There was a problem hiding this comment.
Pull request overview
Adds an operational watchdog script (scripts/coretime-alert/) that monitors Hydration's (Polkadot, task 2034) and Basilisk's (Kusama, task 2090) bulk coretime cores via the broker pallet and pings a Discord webhook when cores risk lapsing before the sale's renewal deadline. Scripts-only addition; no runtime/crate changes.
Changes:
- New Node.js check script with phase/shortfall assessment, cooldown-throttled state, and
--dry-run/--test/--forcemodes. - Dockerfile + Swarm stack file for deployment as the
coretime-alertstack on lark. - README documenting alert logic, env vars, cron/systemd/Docker setups, and webhook-handling guidance.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/coretime-alert/check.mjs | Core watchdog: connects to coretime chain via fallback endpoints, queries broker storage, decides URGENT/WARNING alerts, posts to Discord with cooldown state. |
| scripts/coretime-alert/package.json | npm manifest declaring @polkadot/api dependency and helper scripts. |
| scripts/coretime-alert/Dockerfile | Builds galacticcouncil/coretime-alert image that loops the check on CHECK_INTERVAL_SECONDS. |
| scripts/coretime-alert/lark-stack.yml | Swarm stack manifest with state volume, env vars, and autoredeploy label. |
| scripts/coretime-alert/README.md | Documentation of trigger logic, configuration, and deployment options. |
| scripts/coretime-alert/.gitignore | Ignores node_modules, state file, logs. |
| scripts/coretime-alert/.dockerignore | Excludes non-runtime files from build context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
what
Adds an operational watchdog (
scripts/coretime-alert/) that alerts a Discord webhook when Hydration's (Polkadot, task2034) or Basilisk's (Kusama, task2090) bulk coretime cores are at risk of lapsing before the current sale's renewal deadline.Bulk cores are not leases — they must be renewed every ~28-day sale cycle or they fall back to the open market. The watchdog inspects the
brokerpallet on each coretime chain and pings before the window closes.alert logic
Fires for a chain only when it is short of its target core count for the upcoming region and the deadline is near:
URGENT—< 7d(TOTAL_ALERT_DAYS) until the region begins (hard deadline; renewal right lost after)WARNING— inside the lead-in period with< 3d(LEADIN_ALERT_DAYS) left"Short" = secured cores for next region (
workplan) < desired (default 3). The alert lists the pendingbroker.renew(core)calls (with encoded hex) needed to close the gap. State is persisted so a standing condition only re-pings everyALERT_COOLDOWN_HOURS(default 12).contents
check.mjs— the check (one-shot; cron/systemd friendly, or looped by the image)Dockerfile/.dockerignore— buildsgalacticcouncil/coretime-alertlark-stack.yml— Swarm stack (webhook injected via env at deploy, never in repo)package.json,README.mddeployment
Built and pushed
galacticcouncil/coretime-alert:{latest,1.0.0}; deployed as thecoretime-alertstack on lark (single replica, hourly loop,autoredeploy). First check verified live against both chains.verification
--forceoverride confirmedNo runtime/crate changes — scripts-only addition.