Skip to content

ci: send smoke Telegram alerts only when status changes - #77

Merged
Kzoeps merged 6 commits into
mainfrom
ci/smoke-alert-on-change
Nov 24, 2026
Merged

Kzoeps merged 6 commits into
mainfrom
ci/smoke-alert-on-change

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem
Scheduled smoke runs every 30 min and alerts on every failing run, so one broken check pings repeatedly.

Fix
Compare with the previous run of the same workflow and environment. Alert once on pass->fail and once on fail->pass; stay silent otherwise. Deploy failures still alert as before. CONTRIBUTING updated.

Summary by CodeRabbit

  • New Features
    • Telegram alerts can report failures and recoveries, with smoke-test notifications sent when results change. Failures before smoke testing completes continue to trigger alerts on each run.
    • Smoke tests are skipped when the test file is unavailable, with a notice shown instead.
  • Bug Fixes
    • Alert delivery retries transient request failures and falls back to failure alerts when status comparisons are unavailable.
  • Documentation
    • Clarified alert timing, result comparisons, and permissions in the live-API checks guide.

smoke.yml and the post-deploy smoke in deploy.yml now alert once when the
smoke test starts failing and once when it recovers, and stay silent while the
status is unchanged. The previous result comes from the GitHub API (previous
completed run of the same workflow and target), using the job's GITHUB_TOKEN
with actions: read; no new secrets or state store.

- telegram-alert: new status-change.mjs decides failed/recovered/none; an
  unknown previous result alerts on failure and stays silent on a pass.
- smoke.yml: run-name carries the environment so runs can be matched.
- deploy.yml: smoke compared per branch using the smoke step's conclusion;
  deploy failures still alert every time. A rollback to a commit without
  smoke.js now skips the step instead of reporting a pass.
- e2e-nightly.yml is unchanged and keeps alerting on every failure.
The change check compared whole-run conclusions, so a lost Telegram send, an
install flake, or a run that never finished the smoke test counted as "already
alerted" and silenced the next real failure. Give the smoke step an id and
compare its outcome and the previous run's step of the same name, as deploy.yml
does. Failures before the smoke test finished alert every time in a separate
step.
The checkout now runs after successful deploys too, so a GitHub fetch error
would turn a good deploy red and then run an alert step with a missing action.
Make it continue-on-error and run the alert steps only when it succeeded.
curl --retry 2 shrinks the chance that a transient Telegram error loses an
alert. If status-change.mjs exits 0 without writing send= (for example when the
entry-point guard is false), alert on failure like any other script error. A
spawn test covers the script run as a program, and the test that asserted the
impossible "current run is in the completed list" case is trimmed.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-endpoints Ready Ready Preview Nov 23, 2026 5:31am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Telegram action now compares smoke results with prior workflow results and sends failure or recovery alerts when the status changes. The deploy and scheduled smoke workflows configure the comparison and handle failures that occur before a smoke result is available.

Changes: Smoke status-change alerts

Layer / File(s) Summary
Status comparison and validation
.github/actions/telegram-alert/status-change.mjs, happyview-modules/tests/unit/tooling/status-change.test.js
The status module maps conclusions to pass or fail, selects comparable prior runs by title or branch, and decides whether to alert. Tests cover result selection, error handling, API requests, and command-line output.
Action decision and message delivery
.github/actions/telegram-alert/action.yml
The action accepts current and prior-result settings, invokes the status module, and sends failure or recovery messages. It warns and falls back to failure-only behavior if the decision step fails or produces no send decision. The Telegram request retries twice.
Deploy and smoke workflow integration
.github/workflows/deploy.yml, .github/workflows/smoke.yml, CONTRIBUTING.md
The workflows configure status comparisons and separate smoke-result alerts from earlier workflow failures. The documentation describes alert conditions, comparison behavior, and permissions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant SmokeWorkflow
  participant TelegramAlertAction
  participant StatusChangeModule
  participant GitHubAPI
  participant Telegram
  SmokeWorkflow->>TelegramAlertAction: pass smoke result and prior-run settings
  TelegramAlertAction->>StatusChangeModule: evaluate current result
  StatusChangeModule->>GitHubAPI: find comparable completed runs
  GitHubAPI-->>StatusChangeModule: prior run and step results
  StatusChangeModule-->>TelegramAlertAction: failed, recovered, or no alert
  opt decision is failed or recovered
    TelegramAlertAction->>Telegram: send failure or recovery message
  end
Loading

Possibly related PRs

  • hypercerts-org/api#67: Adds the post-deploy smoke step and scheduled smoke workflow that this change configures for status-based alerts.
  • hypercerts-org/api#62: Adds the deploy environment and branch outputs used by this change in alert summaries and prior-run matching.

Suggested reviewers: kristoferlund

Merge Risk: Minimal · up to ae45b

This change reduces repeated Telegram alerts by sending them only when the smoke result changes, and it keeps failure alerts for deploy failures and for failures before the smoke step finishes. The alert path warns and falls back to failure alerts if the comparison fails. No concrete merge-blocking risk was found. One minor gap remains: a successful rerun may not send a recovery alert.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "ci: send smoke Telegram alerts only when status changes" matches the main change in the changeset. The PR limits smoke-run Telegram alerts to result changes (pass-to-fail, fail-to-pass), ad…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "ci: send smoke Telegram alerts only when status changes" matches the main change in the changeset. The PR limits smoke-run Telegram alerts to result changes (pass-to-fail, fail-to-pass), adds the status-change.mjs logic, and updates the smoke and deploy workflows to match. The title is short, specific, and uses a conventional commit prefix. It does not mention the deploy-failure alert split or the retry changes, which is expected for a title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d6b8ba05-e505-42ae-96e6-b9c021bf950a
Commits

Reviewing files that changed from the base of the PR and between d37408e and ae45b5f.

Files selected for processing: 6

  • .github/actions/telegram-alert/action.yml
  • .github/actions/telegram-alert/status-change.mjs
  • .github/workflows/deploy.yml
  • .github/workflows/smoke.yml
  • CONTRIBUTING.md
  • happyview-modules/tests/unit/tooling/status-change.test.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ae45b5f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@Kzoeps
Kzoeps merged commit 5ac54b5 into main Nov 24, 2026
10 of 11 checks passed
@Kzoeps
Kzoeps deleted the ci/smoke-alert-on-change branch November 24, 2026 09:50

This branch was successfully deployed

1 active deployment
Preview — ae45b5f3 Deployed Nov 23, 2026 by vercel[bot]
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