-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset feature flags when switching through logins (#2182)
Fixes #2181 Fixes #2154 This PR attempts to clean up the auth flow and makes it so that when the user account is switched, we never accidentely use feature flags of a wrong server URL and also ensures we reconfigure Autocomplete so it works. It does this by removing the relationship between the `AuthProvider` and a specific webview. This is necessary because: - With features like Autocomplete, we have things that depend on the AuthProvider unrelated on wether a web view is enabled or not - We have more than one web view right now and this doesn't make sense Instead, we make it so that the web views subscribe to the auth state like every other service. In untangling this, the biggest issue was undocumented dependencies into how events were passed. What I noticed was that the `ContextProvider` plays a major role in initializing the web views. This is something we should clean up in a follow up PR (IMO the web views should subscribe to the ContextProvider and not the other way around). I also noticed that the `cody.auth.sync` action isn't really necessary as we can subscribe to the `AuthProvider` via `addChangeListener` anyways (which most of the services did). Also: Apparently there were two ways on when we reconfigure the `Configuration` object. I now made sure both ways at least reconfigure the same components by extracting a `onConfigurationChange` function inside `main.ts`. Two unrelated fixes: - The code to update the upgrade state when the editor was focused would also run on enterprise instances causing a bunch of errors in the console. Fixed. - Added the remote URL to the completion loggers we can easily see where the request is sent to.⚠️ This PR has a potential to break areas depending on auth, so please take some time to test it. I've been testing it as thorough as I could though! ## Test plan The canonical test case was: - Be signed in to dotcom and have the starcoder-hybrid feature flag enable - Now switch account to an enterprise instance - Ensure that requests are made to the enterprise instance and that we do not use starcoder model strings https://github.com/sourcegraph/cody/assets/458591/ab5a19a6-a906-42e6-8f76-ae61b500e30c <!-- Required. See https://docs.sourcegraph.com/dev/background-information/testing_principles. -->
- Loading branch information
1 parent
18b56f5
commit b46bb30
Showing
14 changed files
with
67 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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