Skip to content

ci: fix the Slack alert for failed scheduled tests - #2155

Open
vdusek wants to merge 3 commits into
masterfrom
worktree-fix-slack-alerting
Open

ci: fix the Slack alert for failed scheduled tests#2155
vdusek wants to merge 3 commits into
masterfrom
worktree-fix-slack-alerting

Conversation

@vdusek

@vdusek vdusek commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

The scheduled e2e tests failed on 2026-08-11 and 2026-08-12 without any Slack alert, while the Notify Slack on failure job reported success both times.

What was wrong

Slack rejected the message with 400 invalid_blocks. A section block's text is capped at 3000 characters, and the *Failed jobs:* list blew past it once the whole matrix went red:

Run Failed section.text Slack
2026-07-01 36/90 1982 chars accepted
2026-08-11 90/90 4778 chars 400 invalid_blocks
2026-08-12 90/90 4778 chars 400 invalid_blocks

So the alerting worked for partial failures and broke precisely when everything failed.

Nothing surfaced it because the send step never set errors, taking the action's default of false. That turns every delivery error into a debug log line and reports success, so a rejected alert is indistinguishable from a sent one. Running the v4.0.0 bundle directly confirms 200 ok, 404 no_service and a DNS failure all produce exit code 0 and no output.

What this changes

  • Trims the job list at a line boundary to a 2500-character budget and counts off the remainder, prefixed with a 90 failed, 0 succeeded line. Both counts come from job conclusions, so the still-running notify job leaves itself out without matching on its own name.
  • Sets errors: true, so an undeliverable alert fails the job instead of passing quietly.
  • Adds a slack_test dispatch input that skips the matrix and notifies anyway, under a distinct :white_circle: heading. The alert path was previously reachable only from a real scheduled failure, which is why this went unnoticed.
  • Requires .jobs to be an array before accepting the API response. Splitting gh api from its --jq filter means a malformed body that still exits 0 would otherwise abort the step under bash -e; now it falls back to the existing "unable to fetch job list" message.

Verification

Ran the workflow's own payload script over the real job lists from all three failures and checked every block against Block Kit's limits: 2021, 2547 and 2546 characters, all under 3000, with the two full-matrix cases listing 46 jobs plus ... and 44 more. Replaying the 2026-08-12 data with the notify job still in progress yields 90 failed, 0 succeeded, confirming the self-exclusion. The slack_test and unreachable-API paths both produce valid messages. actionlint 1.7.12 with shellcheck is clean.

apify/apify-client-python carries a copy of this notify job with the same errors: false blind spot. Its payload is static so it cannot hit the size limit, but a dead webhook there would be equally invisible; worth a follow-up.

✍️ Drafted by Claude Code

@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Aug 12, 2026
@vdusek vdusek self-assigned this Aug 12, 2026
@github-actions github-actions Bot added this to the 147th sprint - Tooling team milestone Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.62%. Comparing base (263fff4) to head (40ea510).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2155      +/-   ##
==========================================
+ Coverage   93.51%   93.62%   +0.11%     
==========================================
  Files         181      181              
  Lines       12653    12653              
==========================================
+ Hits        11832    11846      +14     
+ Misses        821      807      -14     
Flag Coverage Δ
unit 93.62% <ø> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from Pijukatel August 12, 2026 13:37
@vdusek
vdusek marked this pull request as ready for review August 12, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants