Dispose ConversationFeature in sanity test teardown#316719
Draft
benvillalobos wants to merge 1 commit into
Draft
Dispose ConversationFeature in sanity test teardown#316719benvillalobos wants to merge 1 commit into
benvillalobos wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a teardown leak in the Copilot Chat sanity test suite by disposing per-test ConversationFeature instances rather than only deactivating them, preventing accumulation of authentication-change listeners across retries.
Changes:
- Replace
conversationFeature.activated = false;withconversationFeature.dispose();in per-testfinallyblocks. - Ensure both
_activatedDisposablesand lifetime_disposables(e.g., auth listeners) are cleaned up for each test instance.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/test/vscode-node/sanity.sanity-test.ts | Updates test teardown to dispose ConversationFeature instances to avoid listener/provider re-registration flakiness. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Member
Author
|
Closing as superseded by #316732. That PR drops the per-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
conversationFeature.activated = false;withconversationFeature.dispose();in each per-testfinallyblock of the Copilot Chat Sanity Test suite.The previous teardown only flipped the
activatedsetter, which clears_activatedDisposables(commands, terminal quick-fix providers, participant registrations, etc.) but leaves_disposablesintact._disposablesholds the twoonDidAuthenticationChangelisteners that each test instance subscribes to. Across retries those listeners accumulate on the sharedIAuthenticationService, and on an auth-token oscillation they can re-trigger registration of the globalcopilot-chat.fixWithCopilotterminal quick-fix provider, surfacing as a flaky "already registered" failure.dispose()is a strict superset ofactivated = false— it clears both stores. EachConversationFeatureinstance's disposables are per-listener / per-registration (verified againstIAuthenticationService.onDidAuthenticationChangeandvscode.window.registerTerminalQuickFixProvider), so disposing the test-owned instance does not affect the contribution-registeredConversationFeaturefrom the extension activation path.No test reuses
conversationFeatureafter itsfinallyblock.