-
Notifications
You must be signed in to change notification settings - Fork 57
fix: scope branch-merge and proposed-change-review events to the default branch (closes #9761) #10422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
polmichel
merged 11 commits into
develop
from
ai-bug-pipeline-9761-event-branch-scoping
Aug 27, 2026
+140
−34
Merged
fix: scope branch-merge and proposed-change-review events to the default branch (closes #9761) #10422
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8d0b079
test: add failing test for 9761-event-branch-scoping
polmichel d480917
test: add failing test for review event branch scoping (9761)
polmichel 8199e31
fix(events): scope branch-merge and PC-review events to the default b…
polmichel 78abe0c
style: apply ruff format
polmichel 0c2612f
chore(changelog): add fragment for event branch scoping fix (9761)
polmichel d122260
docs(events): trim comment
polmichel 97d3b7b
refactor(merge): drop now-unused global_branch from PostMergeDispatcher
polmichel 9f0543a
docs: document default-branch scoping for branch and PC review events
polmichel 910d4ff
docs: reword review-event scoping comment to drop webhook reference
polmichel 116eab2
docs: correct branch lifecycle event scoping list in events.md
polmichel 9bae3f7
test: assert branch-merge event scoping from a non-default context
polmichel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Branch merge and proposed change review events are now emitted on the default branch, so webhooks scoped to the default branch reliably match them regardless of which branch triggered the change. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,15 @@ The `EventMeta` class provides rich context: | |
|
|
||
| Use `EventMeta.from_parent()` to create child events that maintain hierarchy. | ||
|
|
||
| ## Scoping branch for webhook matching | ||
|
|
||
| Webhook branch scoping matches an event against `meta.context.branch` (see [Webhooks](webhooks.md)). Not every branch-agnostic event overrides the caller's context, so the scoping branch is set per event: | ||
|
|
||
| - Proposed change merge and review events (merged, approved, rejected, and the approval/rejection revoke variants) are stamped to the default branch, so scoping is independent of the branch the mutation ran on. | ||
| - `branch.merged` is stamped to the default branch as well, since the merge lands there. Its payload still carries the merged branch in `branch_name` / `branch_id`; only the scoping branch is the default one. | ||
| - `branch.created` and `branch.deleted` are stamped to the global branch, pending a general rule for branch-agnostic node events. | ||
| - `branch.rebased` and `branch.migrated` inherit the caller's context branch; they are not overridden. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether it would be relevant to assign the target branch for those operations |
||
|
|
||
| ## Querying Events | ||
|
|
||
| Events can be queried through: | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted as this is now reused in other test classes