Skip to content

feat(ci): List included PRs in sync PR bodies - #26028

Merged
MartinZikmund merged 4 commits into
masterfrom
dev/mazi/sync-pr-list
Nov 4, 2026
Merged

MartinZikmund merged 4 commits into
masterfrom
dev/mazi/sync-pr-list

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #26027

PR Type:

🤖 Project automation

What changed? 🚀

Follow-up to #26024. Every master-sync PR body (for feature/* branches and for release/stable/7.0) now ends with an Included PRs section listing each master PR the sync brings in, oldest first:

### Included PRs (7)

- ~~#25994~~ Version bump after 7.0 release branch — _excluded_
- #25965 fix: Subscribe to Command.CanExecuteChanged weakly
- #25996 fix(sdk)!: Ship only the WebView2 native loader
- …
  • Source: master's first-parent history between the target branch and the commit being synced. This covers merge commits (Merge pull request #N, with the title from the merge message) and squash merges (Title (#N)). It needs no API calls per PR.
  • Excluded PRs stay in the list, struck through and labelled excluded, so the list matches the range shown above it.
  • Partial syncs that stop before an excluded PR list only what was actually merged in.
  • Safety: titles are escaped in this order: & first, so entities already in a title such as &#64;name stay literal; then <, so generics like List<T> aren't swallowed as HTML tags; then @ is broken up with an empty HTML comment (@<!-- -->name). Listing a PR therefore never pings anyone. The list is capped at 250 entries and 50,000 characters, whichever comes first. The rest are counted in "…and N more" with a compare link, so even long-stale feature branches with long titles stay under GitHub's 65,536-character body limit. Going over it would make gh pr create fail.

Later runs on an open sync PR: any run that changes the sync branch already rebuilds the body and replaces it, so the list is recalculated against the target each time. On day 2 it shows day 1's PRs plus the new ones. A run that changes nothing leaves the PR alone, since the list would be the same. A failed body update was swallowed silently; it now shows a workflow warning.

Validation

  • The new block run against the real refs (release/stable/7.0, Version bump after 7.0 release branch #25994 excluded) produced exactly the 7 PRs above, with Version bump after 7.0 release branch #25994 marked excluded ✅. A partial sync stopping before Version bump after 7.0 release branch #25994 produced an empty list, which is correct because 7.0 was cut right after the previous merge ✅. With the cap forced to 3, the "…and 4 more" line and compare link appeared ✅
  • Scratch repo: squash, merge and direct-push commits are handled (direct pushes aren't listed) ✅. @ and < render as plain text, with no mention link, checked against GitHub's /markdown API ✅. (&#64;name turned out to still render as a mention, so it was replaced.) Simulated day 1 and day 2 runs give 2 and then 3 PRs ✅
  • Found while testing: in bash 5.2, & in a ${t//@/…} replacement means "the matched text", which gave @#64;. The escape now uses sed.
  • Size stress test: 300 PRs with 256-character titles made entirely of @ (the worst-case escape) → 38 listed plus "…and 262 more", a 49,180-character list ✅
  • actionlint clean. Not yet run on Actions; the next nightly run (or a manual dry_run: false dispatch) will update the open sync PRs.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNtxsNdxekRBBuN5UKmF

Each run rebuilds the list from master's first-parent history
(merge and squash commits), marks excluded PRs, escapes @ and
caps it at 250 entries. A failed body update now warns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtxsNdxekRBBuN5UKmF
Copilot AI balanced review requested due to automatic review settings November 4, 2026 10:39
@MartinZikmund MartinZikmund self-assigned this Nov 4, 2026
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 23s —— View job


Review summary

Verdict: ship (one non-blocking nit).

Findings: 0 blocking, 1 minor (posted inline).

  • The logic is sound. --first-parent --reverse "$upto" --not "origin/${FEATURE}" gives the right range. The two regexes cover merge and squash commits, and revert commits (…(#N)")) are correctly skipped.
  • excluded_prs is defined earlier in the script and handled safely under set -euo pipefail. pr_lines is never expanded while empty, because the _No PR merges…_ fallback fills it.
  • The partial-sync upper bound ($PARTIAL, a short SHA) is resolved to a full SHA through rev-parse for the compare link.
  • Replacing the swallowed || true with a ::warning:: is a good improvement.
  • Not verified: I only read the diff and did not run the workflow. As the PR notes, it hasn't run on Actions yet, so the first nightly or manual dry_run: false run is the real check.

Comment thread .github/workflows/master-sync.yml Resolved

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.

🟡 Changes recommended

The 250-entry cap can still exceed GitHub’s PR-body character limit, causing PR creation or description updates to fail, so escaped entries need a character budget that reserves space for the remaining body and counts all omissions.

1 open issue
What changed in this PR

Adds an Included PRs section to automated master-sync PRs for feature and stabilization branches, addressing #26027 and extending #26024.

Changes:

  • Lists merge and squash PRs oldest first, marks exclusions, and respects partial-sync boundaries.
  • Escapes @ in titles and limits the list to 250 entries with an overflow comparison link.
  • Emits a workflow warning when updating an existing PR description fails.
File Description
.github/​workflows/​master-sync.yml Generates the included-PR list and reports description-update failures.

Review effort: Balanced

Comment thread .github/workflows/master-sync.yml Resolved
- Escape < so generic types in titles aren't eaten as HTML tags
- Break @mentions with an empty HTML comment; GitHub still turns
  &#64;name into a mention link

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtxsNdxekRBBuN5UKmF
Copilot AI balanced review requested due to automatic review settings November 4, 2026 10:43
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 16s —— View job


Review summary

Verdict: ship. I found 0 blocking issues and 1 minor one, which is posted inline.

  • Logic: The first-parent range "$upto" --not "origin/${FEATURE}" is correct. The merge-commit and squash-commit patterns are sound, and the partial-sync bound is handled.
  • Escaping: The sed escaping for < and @ follows the earlier review feedback. Using sed avoids the bash 5.2 & replacement problem.
  • Error handling: Replacing the silent || true with a ::warning:: is a good change. pr_lines is never empty, so expanding it under set -u is safe.
  • Not verified: I read the diff only and did not run the workflow. It hasn't run on Actions yet, so the next nightly or a manual dry_run: false dispatch is the real test.

Comment thread .github/workflows/master-sync.yml Resolved

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.

🔵 Needs a closer look

The entry cap does not enforce GitHub’s body-length limit after title escaping, which can cause PR creation to fail or leave existing descriptions stale.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

Medium severity Escape encoded mentions to prevent unintended pings

.github/​workflows/​master-sync.yml:518

A title containing &#64;name bypasses this replacement because it contains no literal @. GitHub renders that entity as a mention, as confirmed in the PR's validation, so the generated body can still ping someone. Escape existing ampersands before escaping < and breaking literal mentions so encoded mentions remain literal title text.

Medium severity Refresh the PR body on the no-op sync path

.github/​workflows/​master-sync.yml:543

If a maintainer resolves a draft sync by merging newer master commits into the sync branch, the no-op guard at lines 321–343 exits before refreshing this list. The open PR then omits those newly included PRs until another ref change forces a rebuild. Share the body refresh with the no-op path so it does not depend on the bot pushing a commit.

Review effort: Balanced

Cap the included-PR list by characters as well as entries, so a
stale branch with long titles can't push the body past GitHub's
65,536-character limit and fail PR creation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtxsNdxekRBBuN5UKmF
Copilot AI balanced review requested due to automatic review settings November 4, 2026 10:51
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 19s —— View job


Review summary

Verdict: ship (one minor inline nit; nothing blocking).

Issues: 0 blocking, 1 minor.

  • The latest push adds a 50,000-character budget on top of the 250-entry cap, and omitted entries are counted in the "…and N more" total. That resolves the earlier Copilot concern about GitHub's 65,536-character body limit.
  • The review of the @ mention bypass is posted inline. Escaping & first fixes it.
  • No-op path: the PR description says a run that changes nothing leaves the PR alone. Copilot suggested refreshing the body in that case, for example after a maintainer merges master into the sync branch by hand. I did not post that as an inline finding. It is a design choice stated in the PR, and the list refreshes on the next run that changes the branch.
  • Not verified: I read the diff only and did not run the workflow. The first nightly or a manual dry_run: false dispatch is the real test.

Comment thread .github/workflows/master-sync.yml Resolved

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.

🔵 Needs a closer look

Encoded PR titles can still trigger user or team mentions, and the no-op path can leave the sync PR’s included-PR list stale after conflict resolution.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Escape encoded mentions to prevent unintended notifications

.github/​workflows/​master-sync.yml:525

A title containing &#64;name or &#x40;name passes through this expression unchanged. GitHub can decode these into mentions—the PR's validation notes this for &#64;—so an included title can still ping a user or team. Escape existing ampersands before replacing < and literal @ so encoded mentions remain literal text.

Medium severity Refresh the PR list after conflict resolution

.github/​workflows/​master-sync.yml:557

If a maintainer resolves a conflicted sync by merging newer master into the sync branch, the next run can exit through the no-op guard at line 342 before refreshing this list. The open PR then omits the newly included PRs, even though its branch contains them. Share the body/list update with that path without rebuilding or pushing the branch, while preserving dry-run behavior.

1 resolved since last review

Review effort: Balanced

Escape & before the other title escapes, so an entity already in a
title (&#64;name, &#x40;name) stays literal instead of decoding to a
mention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtxsNdxekRBBuN5UKmF
Copilot AI balanced review requested due to automatic review settings November 4, 2026 11:00
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 16s —— View job


Review summary

Verdict: ship. 0 blocking issues, 0 minor issues, and no new inline comments.

  • Mention bypass: The latest push fixes the open @name finding. The sed now runs s/&/\&amp;/g first, then <, then @, in that order. An existing entity in a title therefore stays literal text, and the empty `` comment inserted after @ can't be re-escaped. A title that contains `<!--` also becomes `<!--`, so it can't open a comment.
  • Size cap: The 250-entry cap and the 50,000-character budget are both checked against the escaped line. Once either is hit, pr_full stops further entries, so the list stays contiguous and oldest first. Skipped entries are counted in "…and N more", and the heading total still counts every PR.
  • Error handling: The ::warning:: on a failed gh pr edit replaces the silent || true. It is a good change.

Cross-cutting notes:

  • No-op path: The Copilot comment about refreshing the body when a run changes nothing remains a design choice that the PR describes. It is not a defect in this diff.
  • Not verified: I read the diff only and did not run the workflow. It hasn't run on Actions yet, so the next nightly run or a manual dry_run: false dispatch is the real test.

@MartinZikmund
MartinZikmund merged commit 8493909 into master Nov 4, 2026
18 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/sync-pr-list branch November 4, 2026 11:02

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.

🔵 Needs a closer look

Human assessment is needed because multibyte PR bodies can exceed Linux’s per-argument byte limit despite fitting the character budget, blocking PR creation or leaving descriptions stale.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

master-sync PRs should list the PRs they bring in

2 participants