Skip to content

ci(post-release): name conflicting files in merge-failure Slack alert#372

Open
jason10lee wants to merge 7 commits into
mainfrom
ci/post-release-name-conflict-files
Open

ci(post-release): name conflicting files in merge-failure Slack alert#372
jason10lee wants to merge 7 commits into
mainfrom
ci/post-release-name-conflict-files

Conversation

@jason10lee

@jason10lee jason10lee commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

When the post-release release → alpha/release → main back-merge hits a conflict, the Slack alert previously said only that a merge failed and linked the build — leaving the reader to open the Actions log to find out what conflicted or who to involve. This makes the alert self-contained and routable.

The alert now names each conflicting file and, for each, the incoming release-side PR (as a clickable link) and its author, so a reader can tell what needs reconciling and who to ping straight from the message:

⚠️ Post-release merge to main failed for: Automattic/newspack-workspace.
Conflicting files:
path/to/file — incoming: #000 (PR Author)
Check <…|the build> for details.

Attribution identifies the incoming change being merged forward (not sole blame — the merge is mutual), resolved from the squash commit that last touched each file.

Built to be robust on this already-failed path:

  • Size-safe. The named list is capped (first 10 files + "…and N more"); a hard line-boundary trim backstops Slack's 3000-char section limit so a many-conflict merge can't produce an oversized payload that Slack rejects (which would drop the entire alert). The build link is always preserved.
  • JSON-safe. The payload is built with node's JSON.stringify rather than hand-rolled string interpolation, correctly escaping the variable-length file list.
  • Always notifies. If the node payload build fails, it falls back to a minimal hand-rolled alert instead of going silent; it never aborts the script (set -e) or leaves subsequent merges / status reporting unreported.
  • Edge cases. Non-ASCII paths stay literal (core.quotePath=false) so attribution matches; PR/author parsing is robust to merge commits (--no-merges), tabs in commit subjects, and issue-vs-PR refs; gracefully degrades when a commit has no (#NNN).

When there are no conflicting paths to report, the message is unchanged from before.

How to test the changes in this Pull Request:

  1. In a throwaway git repo, create a release branch and a default branch that both modify the same line of a file, so git merge release conflicts; give the release-side commit a (#NNN) subject.
  2. Run post-release.sh (or exercise notify_slack / attribute_conflicts) with Slack env vars pointed at a test channel, and trigger the failing merge path.
  3. Confirm the conflicting path is captured before git merge --abort, and that the posted message lists it under Conflicting files: with the incoming PR rendered as a clickable Slack link (<url|#NNN>) and the author name.
  4. Confirm size-safety: with many (or pathologically long-pathed) conflicts, the rendered text stays ≤ 2900 chars, the file list is capped with "…and N more", and the build link survives (backticks stay balanced).
  5. Confirm graceful degradation: a no-conflict failure path renders the previous (unchanged) message; a commit with no (#NNN) shows just the file (or author); a forced node failure still posts the minimal fallback alert.
  6. Confirm the generated payload is valid JSON in the multi-file, no-conflict, and fallback cases.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable? (No test harness exists for post-release.sh; verified manually — bash -n, shellcheck, node payload generation across size/edge cases, and simulated conflicting merges.)
  • Have you successfully run tests with your changes locally?

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 19, 2026 22:08

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jason10lee jason10lee self-assigned this Jun 19, 2026
@jason10lee jason10lee requested a review from Copilot June 19, 2026 22:11

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

jason10lee and others added 6 commits June 19, 2026 15:30
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jason10lee jason10lee marked this pull request as ready for review June 20, 2026 00:13
@jason10lee jason10lee requested a review from a team as a code owner June 20, 2026 00:13
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