fix: honour bypass_author_approval in integration-branch creation gate#274
Open
eg-ayoub wants to merge 1 commit into
Open
fix: honour bypass_author_approval in integration-branch creation gate#274eg-ayoub wants to merge 1 commit into
eg-ayoub wants to merge 1 commit into
Conversation
`check_integration_branches` decides whether to raise `RequestIntegrationBranches` (asking the user to send `/create_integration_branches`) or let the flow proceed to actually create the branches. When the author has not explicitly approved the PR, the gate relied on `job.settings.approve` alone to detect author consent — meaning `/approve` unblocked integration-branch creation but the equivalent admin escape hatch `/bypass_author_approval` did not. `check_approvals` (in gitwaterflow/__init__.py) already treats `bypass_author_approval` as equivalent to author approval; the two functions had simply drifted apart, leaving admins with a UX where a `/bypass_author_approval` comment first triggers a "please request integration branches" reply instead of moving forward. Reuse the existing `bypass_author_approval` helper from `gitwaterflow.utils` (which also folds in the per-author `pr_author_options` bypass) inside `check_integration_branches`, so both entry points agree on what "author has approved" means. Update the two existing tests that relied on the previous asymmetric behaviour by explicitly leaving `bypass_author_approval` un-bypassed — their intent (verifying the "request integration branches" gate) is preserved. Add a new positive test that exercises the fixed path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
==========================================
+ Coverage 89.62% 89.63% +0.01%
==========================================
Files 81 81
Lines 10614 10627 +13
==========================================
+ Hits 9513 9526 +13
Misses 1101 1101
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split off from #273 per review feedback so the two changes can be released and reverted independently.
Problem
check_integration_branchesdecides whether to raiseRequestIntegrationBranches(asking the user to send/create_integration_branches) or let the flow proceed to actually create the branches. When the author has not explicitly approved the PR, the gate relied onjob.settings.approvealone to detect author consent — meaning/approveunblocked integration-branch creation but the equivalent admin escape hatch/bypass_author_approvaldid not.check_approvals(ingitwaterflow/__init__.py) already treatsbypass_author_approvalas equivalent to author approval; the two functions had simply drifted apart, leaving admins with a UX where a/bypass_author_approvalcomment first triggers a "please request integration branches" reply instead of moving forward.Fix
Reuse the existing
bypass_author_approvalhelper fromgitwaterflow.utils(which also folds in the per-authorpr_author_optionsbypass) insidecheck_integration_branches, so both entry points agree on what "author has approved" means.Tests
bypass_author_approvalun-bypassed — their intent (verifying the "request integration branches" gate) is preserved.test_creation_integration_branch_by_bypass_author_approvalthat exercises the fixed path.