Skip to content

feat(ci): clear backport labels when a PR stops being a fix - #9612

Open
Ma77Ball wants to merge 2 commits into
apache:mainfrom
Ma77Ball:fix/backport-label-cleanup-on-unfix
Open

Ma77Ball wants to merge 2 commits into
apache:mainfrom
Ma77Ball:fix/backport-label-cleanup-on-unfix

Conversation

@Ma77Ball

@Ma77Ball Ma77Ball commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • backport-auto-label now removes the actively-supported release/* labels it auto-added when a PR's title transitions away from a backportable fix (to a non-fix type, or to fix(ci):) on an edit, and leaves body-only edits and labels hand-added to PRs that were never fixes untouched.
  • The removal runs in the PAT-authored Label step so the resulting unlabeled event reruns the required Backport Approvals check; a removal under the default GITHUB_TOKEN would not retrigger it and could leave that check red after the labels are gone.
  • Whether a past label removal counts as a deliberate opt-out is now decided by the PR title at the time of removal (reconstructed from the timeline's renamed events): removed while a fix is a human decline and is remembered, removed while not a fix is this workflow's own cleanup and is ignored, so retitling back to fix: re-adds the labels.

Any related issues, documentation, discussions?

Closes: #9611

How was this PR tested?

  • No unit harness exists for GitHub Actions workflows in this repo; verified by logic review, YAML parse, and node --check of both github-script blocks.
  • Reviewer check: open a fix: PR into main and confirm release/* labels appear; retitle to chore: (or fix(ci):) and confirm the actively-supported labels are removed, the report comment updates, and Backport Approvals reruns green; retitle back to fix: and confirm they return.
  • Edge checks: remove a release/* label by hand while the title is fix: and confirm it stays off (opt-out preserved); make a body-only edit on a non-fix PR and confirm no label is removed.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions github-actions Bot added fix ci changes related to CI labels Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Committers with relevant context: @parshimers
    You can request their reviews formally with /request-review @parshimers.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.67%. Comparing base (9647f58) to head (41f7c27).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9612      +/-   ##
============================================
+ Coverage     91.57%   91.67%   +0.10%     
+ Complexity     5182     5134      -48     
============================================
  Files          1300     1304       +4     
  Lines         58133    58088      -45     
  Branches       7615     7582      -33     
============================================
+ Hits          53236    53253      +17     
+ Misses         2959     2923      -36     
+ Partials       1938     1912      -26     
Flag Coverage Δ
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø)
amber 85.75% <ø> (+0.30%) ⬆️
computing-unit-managing-service 63.83% <ø> (-0.05%) ⬇️
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <ø> (-0.01%) ⬇️
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.38% <ø> (ø)
result-service 85.71% <ø> (ø)
workflow-compiling-service 78.30% <ø> (ø)

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ma77Ball

Copy link
Copy Markdown
Contributor Author

/request-review @parshimers

@github-actions
github-actions Bot requested a review from parshimers November 21, 2026 13:01
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

🟢 7 better · 🔴 0 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main f030df1 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 571 0.349 17,042/24,244/24,244 us 🟢 -36.6% / 🔴 +77.0%
🟢 bs=100 sw=10 sl=64 1,255 0.766 79,779/98,004/98,004 us 🟢 -15.0% / 🔴 +13.1%
⚪ bs=1000 sw=10 sl=64 1,468 0.896 680,508/747,824/747,824 us ⚪ within ±5% / 🟢 -13.3%
Baseline details

Latest main f030df1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 571 tuples/sec 529 tuples/sec 1,018 tuples/sec +7.9% -43.9%
bs=10 sw=10 sl=64 MB/s 0.349 MB/s 0.323 MB/s 0.622 MB/s +8.0% -43.9%
bs=10 sw=10 sl=64 p50 17,042 us 18,165 us 10,127 us -6.2% +68.3%
bs=10 sw=10 sl=64 p95 24,244 us 38,237 us 13,693 us -36.6% +77.0%
bs=10 sw=10 sl=64 p99 24,244 us 38,237 us 16,105 us -36.6% +50.5%
bs=100 sw=10 sl=64 throughput 1,255 tuples/sec 1,276 tuples/sec 1,364 tuples/sec -1.6% -8.0%
bs=100 sw=10 sl=64 MB/s 0.766 MB/s 0.779 MB/s 0.832 MB/s -1.7% -8.0%
bs=100 sw=10 sl=64 p50 79,779 us 76,445 us 79,321 us +4.4% +0.6%
bs=100 sw=10 sl=64 p95 98,004 us 115,303 us 86,661 us -15.0% +13.1%
bs=100 sw=10 sl=64 p99 98,004 us 115,303 us 98,907 us -15.0% -0.9%
bs=1000 sw=10 sl=64 throughput 1,468 tuples/sec 1,460 tuples/sec 1,406 tuples/sec +0.5% +4.4%
bs=1000 sw=10 sl=64 MB/s 0.896 MB/s 0.891 MB/s 0.858 MB/s +0.6% +4.4%
bs=1000 sw=10 sl=64 p50 680,508 us 687,752 us 776,724 us -1.1% -12.4%
bs=1000 sw=10 sl=64 p95 747,824 us 759,856 us 814,345 us -1.6% -8.2%
bs=1000 sw=10 sl=64 p99 747,824 us 759,856 us 862,305 us -1.6% -13.3%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,350.20,200,128000,571,0.349,17042.48,24243.68,24243.68
1,100,10,64,20,1593.26,2000,1280000,1255,0.766,79778.94,98003.98,98003.98
2,1000,10,64,20,13627.11,20000,12800000,1468,0.896,680507.57,747823.69,747823.69

@Ma77Ball
Ma77Ball force-pushed the fix/backport-label-cleanup-on-unfix branch from 5d11ae3 to 5665069 Compare November 21, 2026 13:17
backport-auto-label's decide() now reads the configured release/* labels currently on a PR and, when the PR title is no longer a fix, returns a "cleanup" outcome carrying that label list instead of doing nothing. The report step removes those labels as github-actions[bot] and rewrites its in-place report comment to say the PR is no longer a fix and that the labels return if the title goes back to fix.

The remembered-opt-out set that suppresses re-adding a label is built from unlabeled timeline events excluding github-actions[bot], so the bot's own cleanup removals are not read as a decline: re-titling a PR back to fix re-adds the labels, while a deliberate human or PAT removal is still remembered and keeps that branch declined.

The report comment posted when labels are applied also explains how to clear a red Backport Approvals check: remove one branch's release/* label to decline just it, add no-backport-needed to decline every branch, or retitle the PR away from fix to drop all of them at once.
@Ma77Ball
Ma77Ball force-pushed the fix/backport-label-cleanup-on-unfix branch from 5665069 to 526666a Compare November 21, 2026 13:29

@xuang7 xuang7 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.

Thanks for working on this. Left a few comments, mainly on which labels get removed and whether Backport Approvals reruns after the removal.

Comment on lines +132 to +136
function cleanupOrNone() {
const toRemove = configuredBranches.filter((b) => currentLabels.has(b));
if (toRemove.length === 0) return { mode: "none" };
return { mode: "cleanup", toRemove };
}

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.

This also removes release/* labels that were added by hand to non-fix PRs (docs, licensing, CI changes), and it runs on every edit, including body edits. It should only run when the title actually changes from a fix to a non-fix, and only for active branches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cleanup now runs only on an edited event whose title actually changed away from a backportable fix (via changes.title.from) and only removes the actively-supported release/* labels, so a body-only edit and a label hand-added to a PR that was never a fix are both left untouched.

Comment on lines 154 to 155
core.info(`PR #${pr.number} is fix(ci), CI-only and never backported; skipping.`);
return { mode: "none" };

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.

The description says retitling to fix(ci): also clears the labels, but this branch still returns none, so they stay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Folded the fix(ci): case into the same isBackportableFix test as non-fix titles, so retitling a labeled PR to fix(ci): now clears its release labels instead of returning none.

Comment on lines +415 to +417
await github.rest.issues.removeLabel({
owner, repo, issue_number: pr.number, name: label,
});

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.

I have not tested this, but a removal made with the default GITHUB_TOKEN should not trigger an unlabeled event, so Backport Approvals may not rerun and could stay red after the labels are gone. One option is to remove them with the PAT in the Label step. The opt-out check would then need to depend on the title at the time of removal rather than on the actor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the label removal into the PAT-authored Label step so the unlabeled event reruns Backport Approvals, and switched the opt-out test from the removing actor to the PR title at the time of removal (reconstructed from the timeline's renamed events), so the workflow's own cleanup is not mistaken for a decline.

backport-auto-label collapses "is this auto-backportable?" into one isBackportableFix(title) test: a conventional-commit fix: that is not fix(ci):. Both a non-fix type and fix(ci): route through cleanupDecision(), which removes the actively-supported release/* labels only when the PR's title actually transitioned away from a backportable fix on this edit (context.payload.changes.title.from was a fix and the current title is not). A body-only edit carries no title change and a label hand-added to a PR that was never a fix has no such transition, so both are left untouched, and only the branches this workflow would itself auto-label are considered.

The stale-label removal now runs in the PAT-authored Label step rather than the default-token Report step, so the resulting unlabeled event retriggers the required Backport Approvals check; a removal under the default GITHUB_TOKEN does not retrigger downstream workflows and could leave that check red after the labels are gone. The Report step's cleanup branch now only upserts the report comment.

Opt-out detection is judged by the PR title at the moment each label was removed instead of by the removing actor. titleAt(whenISO) reconstructs the title in effect at any time from the timeline's renamed events; a label removed while the title was a backportable fix is a deliberate human decline and is remembered, while a removal made when the title was not a backportable fix is this workflow's own cleanup and is ignored, so retitling back to fix: re-adds the labels.
@Ma77Ball
Ma77Ball requested a review from xuang7 November 23, 2026 22:17

This branch has not been deployed

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

Labels

ci changes related to CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove stale backport release labels when a PR is no longer a fix

3 participants