Skip to content

Add backport publish command - #3415

Open
tianyiy-tim wants to merge 1 commit into
aws:mainfrom
tianyiy-tim:add-backport-publish
Open

Add backport publish command#3415
tianyiy-tim wants to merge 1 commit into
aws:mainfrom
tianyiy-tim:add-backport-publish

Conversation

@tianyiy-tim

@tianyiy-tim tianyiy-tim commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Issues:

Addresses P425131803

Description of changes:

After apply you're left with one local branch per affected branch, and opening a pull request for each of them is still manual. For a fix that hits seven branches that's seven trips through the GitHub UI.

This pull request adds publish, which pushes those branches and opens one pull request each, in one command.

Most of the time you never type it. apply --open-pr offers to run it as soon as the cherry-picks are done, so a local session stays analyze then apply.

Stacked on #3414. The base here is backport-stack/apply, a scaffolding branch holding the commits below it, so this diff is only the 9 files this change touches. I will retarget it to main as the stack lands. Please don't merge it into the scaffolding branch.

Call-outs:

  • Branches go to your fork, pull requests are opened against aws/aws-lc. Pushing branches to aws/aws-lc is refused, so a mistyped --remote can't put half-reviewed work on the real repository.

  • Whether a branch is ready is read from git, not from anything apply recorded. So resolving a conflict by hand is enough for the next publish to pick that branch up, with no need to run apply again.

  • A branch that already has an open pull request is left alone, so re-running is safe.

  • Nothing is ever a draft and nothing is auto-merged.

  • Everything that talks to GitHub lives in util/github.py, so a second command needing to open a pull request later reuses this one rather than growing its own. The previous version of this tool grew two openers and they drifted apart.

  • A fix that reaches inside crypto/fipsmodule/ puts a FIPS boundary warning at the top of every pull request body and in the summary comment, plus a "needs FIPS review" line. analyze already prints it, but nobody reviewing a backport ran analyze, and the module is validated as a build of exactly that source. publish never reads the diff, so the file list comes from the saved run.

  • --dry-run pushes nothing, opens nothing, and prints the summary comment instead of posting it. It used to print what it would push and then comment on the source pull request anyway, which belongs to whoever wrote the fix. It also reports how many pull requests it would have opened, rather than "0 opened", which read as nothing to do.

  • gh is a new prerequisite, for this command only.

Testing:

Unit tests - 34 new, 188 total:

python3 -m unittest testing.test_engine

They cover reading a remote URL, the refusal to push to aws/aws-lc, how a branch is named to GitHub across repos versus within one, each outcome a branch can end in, that a dry run posts no comment while a real run does, and that the FIPS warning reaches both the pull request body and the summary.

Real fix - ran the whole chain against #3105 (the CRL scope check) with the release branches wound back to before its backports existed, so the tool had to work them out: analyze flagged the three branches that really did get backports, apply cherry-picked onto all three, and publish --dry-run reported those three and the conflicted ones separately. The three commits apply produced have the same patch-id as the human backports in #3109, #3106 and #3110.

Also verified --remote upstream is refused before anything is printed or pushed, and that resolving one conflict by hand moved that branch from unfinished to publishable without re-running apply.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from 86cc7f5 to f303452 Compare August 10, 2026 18:08
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 4ef4e67 to 80da763 Compare August 10, 2026 18:09
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from f303452 to ea3a08a Compare August 10, 2026 21:43
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 80da763 to a76adef Compare August 10, 2026 21:43
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from ea3a08a to 5f40255 Compare August 10, 2026 22:20
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from a76adef to e3e0ae2 Compare August 10, 2026 22:20
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from 5f40255 to a87a83d Compare August 11, 2026 17:53
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from e3e0ae2 to 4c1a2b2 Compare August 11, 2026 17:53
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from a87a83d to cefd5e7 Compare August 12, 2026 16:46
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 4c1a2b2 to 55b39ad Compare August 12, 2026 16:46
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from cefd5e7 to ea6425c Compare August 13, 2026 18:26
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 55b39ad to 89fe5fe Compare August 13, 2026 18:26
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from ea6425c to 2bd6434 Compare August 13, 2026 18:39
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 89fe5fe to f3823ea Compare August 13, 2026 18:39
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from 2bd6434 to bf2c1c4 Compare August 13, 2026 19:23
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch 2 times, most recently from 5dbb56f to ee46cde Compare August 17, 2026 22:02
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from f3823ea to 963e957 Compare August 17, 2026 22:02
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch 2 times, most recently from 57377eb to 258f262 Compare August 17, 2026 22:17
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 963e957 to fe8e27f Compare August 17, 2026 22:17
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from 258f262 to 0c5e4ca Compare August 17, 2026 22:28
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from fe8e27f to 621e230 Compare August 17, 2026 22:28
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from 0c5e4ca to b238fa1 Compare August 17, 2026 22:52
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 621e230 to 0497369 Compare August 17, 2026 22:52
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from b238fa1 to efe1412 Compare August 18, 2026 03:37
@tianyiy-tim
tianyiy-tim force-pushed the backport-stack/apply branch from 0497369 to 71c1a9a Compare August 18, 2026 03:37
@tianyiy-tim
tianyiy-tim force-pushed the add-backport-publish branch from efe1412 to ed04f36 Compare August 18, 2026 21:25
@github-actions

Copy link
Copy Markdown
Contributor

🔒 Security ReviewView Report

Please review before merging.

@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.26%. Comparing base (6e077c6) to head (34234b7).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3415      +/-   ##
==========================================
- Coverage   78.43%   78.26%   -0.18%     
==========================================
  Files         698      699       +1     
  Lines      124594   124592       -2     
  Branches    17292    17287       -5     
==========================================
- Hits        97729    97507     -222     
- Misses      25939    26215     +276     
+ Partials      926      870      -56     

☔ 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.

Comment thread util/backport/src/main.py
Comment thread util/backport/src/main.py
Comment thread util/backport/README.md
Comment thread util/backport/src/commands/publish.py Outdated
Comment thread util/backport/src/util/github.py
Pushes the branches apply built and opens one pull request per affected branch.
apply --open-pr offers it as soon as the cherry-picks are done.

A branch is publishable once its cherry-pick is finished, which is read from git,
so resolving a conflict by hand is enough for the next publish to pick it up. A
branch carrying no pick of its own is measured against the release ref apply cut
it from, so a stale fork cannot make it look ready.

Branches go to a fork and the pull requests are opened against aws/aws-lc, both
worked out from the checkout instead of assuming origin and upstream.
--base-repo points the pull requests elsewhere, for a staging repo. Pushing to
aws/aws-lc is refused. A branch that already has an open pull request is left
alone, so re-running is safe. Everything that talks to GitHub lives in
util/github.py.

--dry-run prints the summary comment instead of posting it, and says how many
pull requests it would have opened. A fix inside crypto/fipsmodule carries the
FIPS boundary warning into every pull request body and the summary comment, from
the file list analyze saved. Nothing is ever a draft and nothing is auto-merged.
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.

3 participants