Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tnaum-ms
Copy link
Collaborator

@tnaum-ms tnaum-ms commented Nov 21, 2025

This pull request enhances the connection removal feature by adding support for batch deletion of connections, improving user feedback, and making the process more resilient to errors. The changes include updates to both the localization file and the connection removal logic to provide clear messages and robust error handling during single or multiple connection deletions.

Connection Removal Improvements:

  • Refactored the removeConnection command to support deleting multiple connections at once, including confirmation prompts tailored for single or multiple deletions. The deletion process now continues even if some deletions fail, and a summary of successes and failures is displayed to the user.

User Feedback and Localization:

  • Added new localized strings for batch deletion prompts, success notifications, and error messages related to connection removal, ensuring users receive clear and context-appropriate feedback. [1] [2] [3] [4]

@tnaum-ms tnaum-ms requested a review from a team as a code owner November 21, 2025 11:12
Copilot AI review requested due to automatic review settings November 21, 2025 11:12
@tnaum-ms tnaum-ms marked this pull request as draft November 21, 2025 11:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the unused removeAzureConnection wrapper function and adds performance timing for cluster connection deletion operations. However, the PR title suggests enabling multi-connection removal ("Allow users to remove one than 1 connection"), which doesn't align with the actual changes made - no multi-selection functionality has been added.

Key Changes:

  • Removed the deprecated removeAzureConnection function wrapper
  • Added performance.now() timing measurements for cluster connection deletion

Copilot AI and others added 6 commits November 21, 2025 11:24
- Add support for multi-selection (node and nodes parameters)
- Remove performance timing logs (performance.now() calls)
- Implement resilient deletion loop that continues on failure
- Add detailed logging to ext.outputChannel for each deletion
- Add summary messages for multi-deletion operations
- Add telemetry measurement for number of removed connections
- Update confirmation logic for single vs. multiple deletions
- Update localization files with new strings

Co-authored-by: tnaum-ms <[email protected]>
- Replace complex ternary chain with explicit if-else statements
- Add error handling for single connection deletion failure
- Update localization with new error message string

Co-authored-by: tnaum-ms <[email protected]>
- Renamed removedConnections to connectionsToDelete for clarity
- Added connectionsDeleted to track successfully deleted connections
- Now collects both metrics: connections targeted for deletion and actual deletions

Co-authored-by: tnaum-ms <[email protected]>
@tnaum-ms tnaum-ms marked this pull request as ready for review November 21, 2025 17:46
@tnaum-ms tnaum-ms requested a review from Copilot November 21, 2025 17:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +90 to +91
context.telemetry.properties.error = 'RemoveConnectionError';
context.telemetry.properties.errorMessage = error instanceof Error ? error.message : String(error);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

When multiple deletions fail, the telemetry properties for error and errorMessage are overwritten in each iteration of the loop. This means only the last error's details are preserved in telemetry, losing information about previous failures.

Consider either:

  1. Recording only the first error (move these lines outside the loop after it completes)
  2. Using array-based telemetry to capture all errors
  3. Using a different telemetry property for multi-connection deletion errors

Example fix for option 1:

let firstError: Error | undefined;
// ... in the catch block:
if (!firstError) {
    firstError = error instanceof Error ? error : new Error(String(error));
}
// ... after the loop:
if (firstError) {
    context.telemetry.properties.error = 'RemoveConnectionError';
    context.telemetry.properties.errorMessage = firstError.message;
}

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@copilot, this is totally fine, capturing one is enough, I was aware of it. Please add a comment explaining that we're aware of it. and.. well, add, once when metrics are set, the errorCount as well. This is a derived value, but will add context.


await removeConnection(context, node);
}
if (connectionsToDelete.length === 0) {
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

When the function is called with no connections to delete (both node and nodes are undefined or empty), it returns silently without any user feedback. This could leave users confused if the command is invoked unexpectedly without a selection.

Consider logging a warning or showing a message to inform the user:

if (connectionsToDelete.length === 0) {
    ext.outputChannel.warn(l10n.t('No connections selected to remove.'));
    return;
}
Suggested change
if (connectionsToDelete.length === 0) {
if (connectionsToDelete.length === 0) {
ext.outputChannel.warn(l10n.t('No connections selected to remove.'));

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@copilot agreed, please add this line, remember about running 'npm run prettier-fix' and 'npm run l10n' after making the edits.

Copy link
Contributor

Copilot AI commented Nov 21, 2025

@tnaum-ms I've opened a new pull request, #399, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 21, 2025

@tnaum-ms I've opened a new pull request, #400, to work on those changes. Once the pull request is ready, I'll request review from you.

@tnaum-ms tnaum-ms modified the milestones: 0.6.2, 0.7.0 "October 2025" Nov 24, 2025
@tnaum-ms tnaum-ms moved this from In review to Done in DocumentDB for VSCode: Release Plan Jan 8, 2026
@tnaum-ms tnaum-ms self-assigned this Jan 8, 2026
@tnaum-ms tnaum-ms moved this from Done to In review in DocumentDB for VSCode: Release Plan Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants