Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Multiple judgments in a workflow cannot be combined with one discriminator #4146

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 9, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 9, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

)
return !is_c && !isLoop(sourceNode.id, targetNode.id)
},
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code you provided looks mostly intact, but there are some improvements that can be made:

  1. Function Documentation: Consider adding comments to explain the purpose of each function and its usage to improve readability.

  2. Variable Naming: While 'sourceAnchor' and 'targetAnchor' suggest they might represent anchors associated with nodes, make sure these names accurately reflect their roles if needed.

  3. Type Annotations: Using TypeScript or JavaScript's type system can help clarify the types of variables used, which could prevent errors during runtime.

  4. Code Readability: The comparison up_edge_list.find((up_edge) => ...) seems concise enough, but consider grouping related operations inside a helper function for better separation of concerns.

  5. Error Handling: If is_c could potentially be undefined, it'd be worth handling this case appropriately, perhaps returning a default value or throwing an error.

  6. Consistency: Ensure consistent spelling and formatting throughout the code for better maintainability.

Here's a slightly refined version of the code with these considerations:

class AppNodeModel extends HtmlResize.model {
  constructor(graphModel) {
    super();
    this.graphModel = graphModel;
  }

  updateTargetConnection(targetNode, sourceNode) {
    // Check for loop condition
    const isLoop = (nodeA, nodeB) => {
      let current = nodeB;
      while (current !== undefined && current.id !== nodeA) {
        current = this.graphModel.getNodeIncomingNode(current.id)[0] || null; // Simplified assumption
      }
      return current !== null;
    };

    // Return true if no cycle exists between targetNode and sourceNode
    const isValidConnection = () => {

      // Edge list approach
      const upEdgeList = this.graphModel.getNodeIncomingEdge(targetNode.id);
     
      // Filter edges based on anchor IDs
      const edgeForAnchors = upEdgeList?.find(
          (e) => e.targetAnchorId === targetAnchor.id && e.sourceAnchorId === sourceAnchor.id
      );

      // Return false if there's a direct path from source to target via anchor connections and not already connected
      return !edgeForAnchors && !isLoop(sourceNode.id, targetNode.id);
    };
    
    // Additional logic here...
  }
}

// Example usage
const appNodeModel = new AppNodeModel(new GraphModel());
appNodeModel.updateTargetConnection(nodeA, nodeB);

This refactoring improves the clarity and functionality of your code while enhancing maintainability and readability.

@shaohuzhang1 shaohuzhang1 merged commit d380a22 into v2 Oct 9, 2025
3 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch October 9, 2025 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants