Sanity tests: stop constructing a second ConversationFeature#316732
Draft
benvillalobos wants to merge 3 commits into
Draft
Sanity tests: stop constructing a second ConversationFeature#316732benvillalobos wants to merge 3 commits into
benvillalobos wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the test-local ConversationFeature instances from sanity tests to eliminate a race with the globally-activated ConversationFeature registered by ContributionCollection during extension activation. Instead, suiteSetup mints a Copilot token to drive the global feature's auth listeners to flip activated = true before tests run.
Changes:
- Import
IAuthenticationService; removeConversationFeatureimport. - In
suiteSetup, callgetCopilotToken()and wait 500ms so the globalConversationFeaturegets activated. - Drop per-test
ConversationFeaturecreation andtry/finally activatedtoggling across all four tests.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/test/vscode-node/sanity.sanity-test.ts | Replace per-test ConversationFeature setup with a one-time token mint + brief wait in suiteSetup so the global ConversationFeature activates once. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
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.
Sanity tests currently construct their own
ConversationFeatureand forceactivated = truesynchronously, in addition to the global one thatContributionCollectioncreates during extension activation. Both instances react toonDidAuthenticationChangeand try to register global ids (e.g. thecopilot-chat.fixWithCopilotterminal quick-fix provider, chat participants), which races and produces flakyalready registeredfailures — sometimes synchronously duringnew ConversationFeature()in the test, sometimes asynchronously from the global's auth listener firing inside aTimeout._onTimeout.This change removes the test-local
ConversationFeatureentirely.suiteSetupnow:IAuthenticationService.getCopilotToken()so the Copilot token is minted, thenonDidAuthenticationChangelisteners to run, which flips the globalConversationFeaturetoactivated = true(registering chat participants and other global state) before any test runs.Tests then use
ChatParticipantRequestHandlerdirectly against the production-activated global feature, which is what the real chat flow does anyway.Net effect: only one
ConversationFeatureexists at runtime, eliminating the registration race. Companion to #316709 (Mocha retries) and #316719 (proper dispose in finally).