Skip to content

Real-time Slack alerts on release publish - #173

Merged
PavelMakarchuk merged 1 commit into
mainfrom
real-time-slack-release-alerts
Jun 23, 2026
Merged

Real-time Slack alerts on release publish#173
PavelMakarchuk merged 1 commit into
mainfrom
real-time-slack-release-alerts

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Contributor

What

Sends a Slack notification the moment a Populace release is published, instead of relying on a polling cron job.

The alert fires inline from populace-publish-release (the publish CLI) right after latest.json is uploaded — so it's truly event-driven, real-time, and runs wherever the publish runs.

How it works

  • New populace.data.slack.notify_release(...) posts to a per-country Slack incoming webhook.
  • Channel is chosen from the repo id: populace-uk* → UK, everything else → US.
  • Webhook URL comes from an env var per country:
    • SLACK_WEBHOOK_POPULACE_US
    • SLACK_WEBHOOK_POPULACE_UK
  • No-op when the relevant env var is unset, so this is safe to merge before the webhooks exist.
  • Never fatal: a failed post is logged (::warning::) but never raised, so a Slack outage can't fail an otherwise-successful publish.
  • Uses only the stdlib (urllib) — no new dependencies.

Setup (to activate)

Create an incoming webhook for each channel (#populace-us, #populace-uk) and set SLACK_WEBHOOK_POPULACE_US / SLACK_WEBHOOK_POPULACE_UK in whatever environment runs populace-publish-release. Until then it's a silent no-op.

Tests

tests/test_slack.py — country inference, no-op without webhook, posts to the country webhook, and never raises on post failure. All passing locally alongside test_release.py.

🤖 Generated with Claude Code

Fire a Slack notification inline from the publish CLI, the moment
latest.json goes live, instead of polling for new releases. The alert
goes to a per-country channel via an incoming webhook
(SLACK_WEBHOOK_POPULACE_US / _UK) and is a no-op unless that env var is
set. A failed post is logged, never raised, so a Slack hiccup can never
fail an otherwise-successful publish.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PavelMakarchuk
PavelMakarchuk merged commit 46b933c into main Jun 23, 2026
4 checks passed
@PavelMakarchuk
PavelMakarchuk deleted the real-time-slack-release-alerts branch June 23, 2026 13:11
PavelMakarchuk added a commit to PolicyEngine/calibration-diagnostics that referenced this pull request Jun 23, 2026
Release alerts now fire in real time from the Populace publish pipeline
(PolicyEngine/microcosm#173), the moment latest.json goes live. The
polling cron was a fragile fallback that could double-post, so drop it:
the cron route, its Slack/KV helpers, and the crons block in vercel.json.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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