Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

When patching nodes across 3+ branches, PatchNodeCommand incorrectly used the first branch in the list as the source instead of the current context branch (origin). This caused patches to propagate from the wrong branch when the origin wasn't first.

Changes:

  • patchNodeInBranch(): Use ContextAccessor.current().getBranch() instead of this.branches.first() when pushing patched nodes
  • verifyPermissions(): Use origin branch from context for permission checks and version comparisons instead of first branch

Before:

this.nodeStorageService.push(
    NodeBranchEntry.fromNodeVersionMetadata(patchedNode.metadata()),
    this.branches.first(),  // Wrong: uses first branch, not origin
    internalContext
);

After:

this.nodeStorageService.push(
    NodeBranchEntry.fromNodeVersionMetadata(patchedNode.metadata()),
    ContextAccessor.current().getBranch(),  // Correct: uses origin branch
    internalContext
);

Added test modify_with_origin_branch_not_first that patches from branch2 to [branch1, branch2, branch3] and verifies all branches receive content from branch2 (the origin), not branch1 (the first in the list).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Patch should use originBranch</issue_title>
<issue_description>The first branch is considered as source branch during the patch for now. But in the case of 3+ branches, it could be a case when the source branch is different from the first one. </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 12, 2025 08:47
Co-authored-by: vbradnitski <8234920+vbradnitski@users.noreply.github.com>
Co-authored-by: vbradnitski <8234920+vbradnitski@users.noreply.github.com>
…ch version

Co-authored-by: vbradnitski <8234920+vbradnitski@users.noreply.github.com>
Co-authored-by: vbradnitski <8234920+vbradnitski@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix patch to use origin branch instead of first branch Fix patch to use origin branch instead of first branch Dec 12, 2025
Copilot AI requested a review from vbradnitski December 12, 2025 08:56

// Now patch from branch2 (origin) to branch1 and branch3
// branch2 is origin but not first in the list
final PatchNodeResult result = ContextBuilder.from( ContextAccessor.current() )

Choose a reason for hiding this comment

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

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.

Patch should use originBranch

2 participants