Skip to content

Conversation

@theihor
Copy link
Contributor

@theihor theihor commented Jun 13, 2025

Implement "sticky" target branch: if a series has an associated open
PR without merge-conflict, then do not consider other target branches.

The config allows for multiple target branches to be associated with
the same tag, for example:

"tag_to_branch_mapping": {
"tag": ["target1", "target2"]
}

Whenever a series is being synced, KPD tries to apply it to each
target branch in order, stopping at the first successful apply. Then
it opens/updates a tracking PR, and closes all other PRs for this
series.

This works fine most of the time. However, this logic may lead to
series suddenly switching branches. Example scenario:

  • v1 successfully applied to target1, pr1 is created for it
    • submitter receives CI report with v1 applied to target1
  • v2 fails to apply to target1, but succeeds on target2
    • KPD opens pr2 for target2, and closes pr1
    • submitter receives CI report with v2 applied to target2 with no
      indication that something happened

What should've happened in this case is pr1 labeled as
"merge-conflict" and target2 not tried.

The "stickiness" is implemented by checking existing PRs when
determining the list of target branches to apply the series to.

@theihor
Copy link
Contributor Author

theihor commented Jun 13, 2025

Depends on #4

Copy link

@danielocfb danielocfb left a comment

Choose a reason for hiding this comment

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

Looks good to me. Left a few minor comments. Thanks!

@theihor theihor force-pushed the sticky-target branch 2 times, most recently from a20ad99 to 6532274 Compare June 16, 2025 23:14
Copy link

@danielocfb danielocfb left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks.

Implement "sticky" target branch: if a series has an associated open
PR without merge-conflict, then do not consider other target branches.

The config allows for multiple target branches to be associated with
the same tag, for example:

  "tag_to_branch_mapping": {
    "tag": ["target1", "target2"]
  }

Whenever a series is being synced, KPD tries to apply it to each
target branch in order, stopping at the first successful apply.  Then
it opens/updates a tracking PR, and closes all other PRs for this
series.

This works fine most of the time. However, this logic may lead to
series suddenly switching branches. Example scenario:

* v1 successfully applied to target1, pr1 is created for it
  * submitter receives CI report with v1 applied to target1
* v2 fails to apply to target1, but succeeds on target2
  * KPD opens pr2 for target2, and closes pr1
  * submitter receives CI report with v2 applied to target2 with no
    indication that something happened

What should've happened in this case is pr1 labeled as
"merge-conflict" and target2 not tried.

The "stickiness" is implemented by checking existing PRs when
determining the list of target branches to apply the series to.

Signed-off-by: Ihor Solodrai <[email protected]>
@theihor theihor merged commit f7d31a5 into main Jun 17, 2025
5 checks passed
@danielocfb danielocfb deleted the sticky-target branch July 1, 2025 17:40
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