Skip to content

chore(e2e): Send Release e2e report to the channel#3902

Open
yasserfaraazkhan wants to merge 7 commits into
masterfrom
add_channel_reporting_for_release
Open

chore(e2e): Send Release e2e report to the channel#3902
yasserfaraazkhan wants to merge 7 commits into
masterfrom
add_channel_reporting_for_release

Conversation

@yasserfaraazkhan

@yasserfaraazkhan yasserfaraazkhan commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Posts a small Mattermost summary after TSIO finishes for CMT, master, and PR E2E runs.

Channels

  • CMT (RC) and master → MM_DESKTOP_CMT_WEBHOOK_URL
  • PR → MM_DESKTOP_E2E_WEBHOOK_URL (already working)

Reports include overall pass/fail, OS sections with per-leg counts, and links to the full TSIO report plus each leg. Policy legs show for PR/master. Notify is best-effort and runs even when the run failed.

Secret to add: MM_DESKTOP_CMT_WEBHOOK_URL

Report examples

❌ Desktop PR E2E

PR: #3891 · Branch: fix-notifications · Commit: deadbee

🔴 3 failing tests

Platform Suite Failed
🍎 macOS Server 11.9.0 2
🪟 Windows Server 11.9.0 1
Overall Passed Failed Skipped
❌ Failed 700 3 40
Detailed results
Platform Suite Result Report
🐧 Linux Server 11.9.0 ✅ 231/231 View
🍎 macOS Server 11.9.0 ❌ 229/231 View
🍎 macOS Policy ✅ 14/14 View
🪟 Windows Server 11.9.0 ❌ 230/231 View
🪟 Windows Policy ✅ 13/13 View

➡️ Full report: ...

❌ Desktop CMT

Branch: v6.2.0-rc.1 · Commit: 55afc0b

🔴 2 failing tests

Platform Suite Failed
🐧 Linux Server 11.9.0 1
🪟 Windows Server 11.9.0 1
Overall Passed Failed Skipped
❌ Failed 1840 2 120
Detailed results
Platform Suite Result Report
🐧 Linux Server 10.5.14 ✅ 231/231 View
🐧 Linux Server 11.9.0 ❌ 230/231 View
🍎 macOS Server 10.5.14 ✅ 231/231 View
🍎 macOS Server 11.9.0 ✅ 231/231 View
🪟 Windows Server 10.5.14 ✅ 231/231 View
🪟 Windows Server 11.9.0 ❌ 230/231 View

➡️ Full report: ...

✅ Desktop Master E2E

Branch: master · Commit: a1b2c3d

Overall Passed Failed Skipped
✅ Passed 720 0 40
Detailed results
Platform Suite Result Report
🐧 Linux Server 11.9.0 ✅ 231/231 View
🍎 macOS Server 11.9.0 ✅ 231/231 View
🍎 macOS Policy ✅ 14/14 View
🪟 Windows Server 11.9.0 ✅ 231/231 View
🪟 Windows Policy ✅ 13/13 View

➡️ Full report: ...

NONE

Change Impact: 🟡 Medium

Regression Risk: Channel notifications are added as best-effort steps after TSIO commit status writing, and are gated to specific compositeIdentity.name values; failures are caught and only emit warnings. Risk is mainly limited to workflow wiring, webhook env resolution, and notifier parsing/report-link logic in a shared e2e/utils/tsio-report-status utility path.
QA Recommendation: Skip manual QA beyond one representative run for each of CMT, master, and PR TSIO summaries, plus a check with MM_DESKTOP_CMT_WEBHOOK_URL unset to confirm notifications are skipped while commit status flipping still succeeds. Generated by CodeRabbitAI

@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a CMT notification utility that aggregates TSIO results, formats Mattermost messages, posts them best-effort, and wires webhook configuration into compatibility and E2E workflows.

Changes

CMT Mattermost notifications

Layer / File(s) Summary
CMT parsing and leg summaries
e2e/utils/cmt-channel-notify.js, e2e/utils/cmt-channel-notify.test.js
Parses CMT job names, resolves webhook routing, builds sorted per-leg summaries, and tests these helpers.
Mattermost message rendering
e2e/utils/cmt-channel-notify.js, e2e/utils/cmt-channel-notify.test.js
Formats titles, metadata, result tables, failure details, and report links for passed and failed runs.
Report lookup and webhook delivery
e2e/utils/cmt-channel-notify.js, e2e/utils/tsio-report-status.js
Fetches consolidated per-job counts, posts Mattermost messages, and triggers best-effort notifications after TSIO status updates.
CI checkout and webhook wiring
.github/workflows/compatibility-matrix-testing.yml, .github/workflows/e2e-functional.yml
Adds the notification utility to sparse checkouts and supplies Mattermost webhook environment variables.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant reportTsioStatus
  participant notifyCmtChannel
  participant fetchPerJobCountsFromConsolidated
  participant postMattermostWebhook
  reportTsioStatus->>notifyCmtChannel: invoke notification after status update
  notifyCmtChannel->>fetchPerJobCountsFromConsolidated: fetch per-job counts
  fetchPerJobCountsFromConsolidated-->>notifyCmtChannel: return aggregated counters
  notifyCmtChannel->>postMattermostWebhook: post formatted markdown
Loading

Possibly related PRs

  • mattermost/desktop#3891: Modifies the TSIO reporting flow extended here with best-effort CMT channel notifications.

Suggested reviewers: saturninoabril, esarafianou

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: sending E2E reports to a channel, though it understates the full CMT/PR/master scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add_channel_reporting_for_release

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
e2e/utils/cmt-channel-notify.js (1)

326-350: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No timeout on either fetch call.

fetchPerJobCountsFromConsolidated and postMattermostWebhook both await bare fetch with no abort/timeout. This is a best-effort notification path — a hung TSIO or Mattermost endpoint would stall the summary step indefinitely instead of degrading gracefully.

♻️ Proposed fix
-    const res = await fetch(`${baseUrl}/api/v1/reports/consolidated?${params}`);
+    const res = await fetch(`${baseUrl}/api/v1/reports/consolidated?${params}`, {
+        signal: AbortSignal.timeout(10_000),
+    });
     const res = await fetch(webhookUrl, {
         method: 'POST',
         headers: {'Content-Type': 'application/json'},
         body: JSON.stringify(body),
+        signal: AbortSignal.timeout(10_000),
     });

Also applies to: 391-412

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/utils/cmt-channel-notify.js` around lines 326 - 350, Update fetch calls
in fetchPerJobCountsFromConsolidated and postMattermostWebhook to use an
AbortController-based timeout, ensuring hung TSIO or Mattermost requests abort
after a bounded interval and the existing best-effort error handling allows the
summary flow to continue.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/utils/cmt-channel-notify.js`:
- Around line 194-203: Update formatLegResultText to handle legs with passed ===
0, failed === 0, and skipped > 0 before the passed-status formatting, rendering
them as not executed rather than ✅ 0/0. Preserve the existing missing,
no-results, and normal passed/failed output behavior.
- Around line 250-264: The formatCmtChannelMessage flow must account for failed
TSIO shards when computing overallFailed. Thread the existing hasFailures or
overallState value from tsio-report-status.js into formatCmtChannelMessage and
include it in the failure condition, preserving the current checks for test
failures, incomplete status, and upstream job failures.

In `@e2e/utils/cmt-channel-notify.test.js`:
- Around line 4-6: Move the cmt-channel-notify test from the utils location into
the Playwright-discovered e2e/specs tree, and rename it with a .test.ts
extension so the existing testDir and testMatch configuration includes it.
Preserve the test’s current behavior and assertions.

In `@e2e/utils/tsio-report-status.js`:
- Around line 239-261: Wrap the entire channel-notify wiring in a try/catch,
including require('./cmt-channel-notify.js'), resolveWebhookUrl,
channelReportUrl computation, and notifyCmtChannel invocation. Preserve the
existing notification behavior on success, but swallow and optionally log any
notification setup or delivery error so reportTsioStatus remains successful
after the commit status is written.

---

Nitpick comments:
In `@e2e/utils/cmt-channel-notify.js`:
- Around line 326-350: Update fetch calls in fetchPerJobCountsFromConsolidated
and postMattermostWebhook to use an AbortController-based timeout, ensuring hung
TSIO or Mattermost requests abort after a bounded interval and the existing
best-effort error handling allows the summary flow to continue.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 257ed8f2-df58-4025-865f-cea26f87b977

📥 Commits

Reviewing files that changed from the base of the PR and between dac0e92 and 23b9e40.

📒 Files selected for processing (5)
  • .github/workflows/compatibility-matrix-testing.yml
  • .github/workflows/e2e-functional.yml
  • e2e/utils/cmt-channel-notify.js
  • e2e/utils/cmt-channel-notify.test.js
  • e2e/utils/tsio-report-status.js

Comment thread e2e/utils/cmt-channel-notify.js
Comment thread e2e/utils/cmt-channel-notify.js
Comment on lines +4 to +6
const {describe, it} = require('node:test');
const assert = require('node:assert/strict');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd package.json e2e
cat e2e/package.json 2>/dev/null
echo "--- test.js files under e2e ---"
fd -e test.js . e2e
echo "--- any jest config in e2e ---"
fd -i jest.config . e2e

Repository: mattermost/desktop

Length of output: 1396


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "--- e2e Playwright config files ---"
fd -a -H 'playwright.config.*' e2e
echo "--- root Playwright config files ---"
fd -a -H 'playwright.config.*' .
echo "--- inspect likely config ---"
for f in $(fd -a -H 'playwright.config.*' e2e .); do
  echo "### $f"
  cat -n "$f"
done

Repository: mattermost/desktop

Length of output: 12187


Move this test into Playwright’s test tree e2e/package.json runs playwright test with testDir: './specs' and testMatch: '**/*.test.ts', so e2e/utils/cmt-channel-notify.test.js is not picked up. Rename or move it under e2e/specs, or update the config if it needs to run.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/utils/cmt-channel-notify.test.js` around lines 4 - 6, Move the
cmt-channel-notify test from the utils location into the Playwright-discovered
e2e/specs tree, and rename it with a .test.ts extension so the existing testDir
and testMatch configuration includes it. Preserve the test’s current behavior
and assertions.

Source: Coding guidelines

Comment thread e2e/utils/tsio-report-status.js
@github-actions github-actions Bot removed the E2E/Run Run Desktop E2E Tests label Jul 14, 2026
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
e2e/utils/cmt-channel-notify.js (1)

490-501: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use ES module exports instead of module.exports.

This JavaScript source violates the repository rule requiring import/export syntax. Replace the CommonJS export block with named export statements and update callers consistently.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/utils/cmt-channel-notify.js` around lines 490 - 501, Replace the CommonJS
module.exports block with ES module named exports for parseCmtJobName,
resolveWebhookUrl, buildIndividualReportUrl, buildLegSummaries,
formatLegResultText, reportTitleForIdentity, formatCmtChannelMessage,
fetchPerJobCountsFromConsolidated, postMattermostWebhook, and notifyCmtChannel;
update all callers of this module to use ES module import syntax consistently.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/utils/cmt-channel-notify.js`:
- Around line 283-286: Update the headline aggregation in buildLegSummaries to
account for detail.test_stats.flaky, matching the existing behavior that folds
flaky tests into passed totals or otherwise surfaces flaky separately. Preserve
the current defaults for passed, failed, and skipped.
- Around line 25-31: Update fetchWithTimeout so the abort timeout remains active
until the response body has been consumed, not merely until fetch() returns
headers. Adjust the flow around fetchWithTimeout and its callers to clear the
timer only after res.json()/res.text() completes, while preserving existing
timeout cancellation and response handling.

---

Outside diff comments:
In `@e2e/utils/cmt-channel-notify.js`:
- Around line 490-501: Replace the CommonJS module.exports block with ES module
named exports for parseCmtJobName, resolveWebhookUrl, buildIndividualReportUrl,
buildLegSummaries, formatLegResultText, reportTitleForIdentity,
formatCmtChannelMessage, fetchPerJobCountsFromConsolidated,
postMattermostWebhook, and notifyCmtChannel; update all callers of this module
to use ES module import syntax consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5466aea3-d076-49e5-aa7c-f27147b0ff5c

📥 Commits

Reviewing files that changed from the base of the PR and between 23b9e40 and 3bd2850.

📒 Files selected for processing (3)
  • e2e/utils/cmt-channel-notify.js
  • e2e/utils/cmt-channel-notify.test.js
  • e2e/utils/tsio-report-status.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • e2e/utils/cmt-channel-notify.test.js
  • e2e/utils/tsio-report-status.js

Comment thread e2e/utils/cmt-channel-notify.js Outdated
Comment thread e2e/utils/cmt-channel-notify.js
@github-actions github-actions Bot removed the E2E/Run Run Desktop E2E Tests label Jul 14, 2026
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
e2e/utils/cmt-channel-notify.js (1)

290-347: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

overallFailed can be true with no explanation shown to readers.

passed correctly folds flaky in now (line 292), addressing the earlier aggregation gap. However, overallFailed (line 295-298) can flip to true via hasFailures or detail?.status !== 'completed', but only the !upstreamJobsSucceeded branch (line 345-347) renders explanatory text. If a TSIO shard fails without incrementing test_stats.failed, the message shows "❌ Failed" with Failed: 0 and no leg-level breakdown reason — leaving on-call viewers with an unexplained failure signal.

♻️ Proposed fix
     if (!upstreamJobsSucceeded) {
         lines.push('_One or more CI jobs failed outside tracked tests (install/build/teardown)._', '');
+    } else if (hasFailures && failed === 0) {
+        lines.push('_TSIO reported failed shard(s) not reflected in the test totals; check the full report._', '');
+    }
+    if (detail?.status && detail.status !== 'completed' && upstreamJobsSucceeded) {
+        lines.push(`_TSIO report status: ${detail.status}._`, '');
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/utils/cmt-channel-notify.js` around lines 290 - 347, Update the
summary-building flow around overallFailed and the final explanatory messages so
every non-test failure cause is surfaced to readers. When overallFailed is true
because detail?.status is not completed or hasFailures is true, add clear
explanatory text alongside the existing upstreamJobsSucceeded message, while
preserving the current test-failure and per-leg output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@e2e/utils/cmt-channel-notify.js`:
- Around line 290-347: Update the summary-building flow around overallFailed and
the final explanatory messages so every non-test failure cause is surfaced to
readers. When overallFailed is true because detail?.status is not completed or
hasFailures is true, add clear explanatory text alongside the existing
upstreamJobsSucceeded message, while preserving the current test-failure and
per-leg output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 361c35b6-1506-4863-90fb-ee53b57b280a

📥 Commits

Reviewing files that changed from the base of the PR and between 3bd2850 and 09c2c7a.

📒 Files selected for processing (2)
  • e2e/utils/cmt-channel-notify.js
  • e2e/utils/cmt-channel-notify.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/utils/cmt-channel-notify.test.js

@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 14, 2026
@yasserfaraazkhan yasserfaraazkhan added the E2E/Run Run Desktop E2E Tests label Jul 14, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 14, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants