Skip to content

Conversation

@venky-mediboina
Copy link
Contributor

… class pr1

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

< DESCRIBE THE CONTEXT OF THE ISSUE >

by making the following changes

< DESCRIBE YOUR CHANGES >

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@venky-mediboina venky-mediboina requested review from a team as code owners November 20, 2025 17:25
@marcin-bazyl marcin-bazyl added the validated If the pull request is validated for automation. label Nov 24, 2025
latency: number,
publicIp?: string | null,
serverIp?: string | null,
reachedSubnets?: Set<string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is reachedSubnets optional? this function is called from only 1 place and with reachedSubnets always provided.

* @param {Set<string>} [reachedSubnets] - Optional set to track reached subnets
* @returns {boolean} true if a new IP was added, false otherwise
*/
function processIceCandidateResult(
Copy link
Collaborator

@marcin-bazyl marcin-bazyl Nov 25, 2025

Choose a reason for hiding this comment

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

Some questions about this:

  1. I don't really understand the purpose of the refactor of existing ClusterReachability.saveResult() into the new ReachabilityPeerConnection.saveResult() and the free function processIceCandidateResult(). Can you explain the reasoning behind it?
  2. Why is processIceCandidateResult() not just a method inside ReachabilityPeerConnection?
  3. Why ReachabilityPeerConnection has reachedSubnets as a property? it's being added to, but never read from.


this.reachabilityPeerConnection = new ReachabilityPeerConnection(clusterInfo, name);

this.reachabilityPeerConnection.on('resultReady', (data) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably would be better to have an enum for all the ReachabilityPeerConnection events

public readonly isVideoMesh: boolean;
public readonly name;
public readonly reachedSubnets: Set<string> = new Set();
private result: ClusterReachabilityResult;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need the result in ClusterReachability now. We have it inside ReachabilityPeerConnection and for now we only have a single instance of ReachabilityPeerConnection in every ClusterReachability, so there is no need to have a duplication of the result in the 2 classes. In one of your future PRs, maybe we'll have to introduce the result in ClusterReachability so that it will aggregate the results from all ReachabilityPeerConnection instances used, but right now ClusterReachability.getResult() can just return the result from this.reachabilityPeerConnection, right?

private numTcpUrls: number;
private numXTlsUrls: number;
private result: ClusterReachabilityResult;
class ReachabilityPeerConnection extends EventsScope {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we usually try to have a single class in each file, so it's probably better to move this new class into a new file


// Make sure that gatherIceCandidates is called before setLocalDescription
// as setLocalDescription triggers the ICE gathering process
assert.isTrue(gatherIceCandidatesSpy.calledBefore(fakePeerConnection.setLocalDescription));
Copy link
Collaborator

Choose a reason for hiding this comment

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

why has this check been removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants