Repository navigation
authentication: remove unused service APIs and their tests - #351262
Open
Dmitriy Vasyura (dmitrivMS) wants to merge 3 commits into
Open
Dmitriy Vasyura (dmitrivMS) wants to merge 3 commits into
Dmitriy Vasyura (dmitrivMS) wants to merge 3 commits into
Conversation
Removes about 2,000 lines of dead code from the workbench authentication services. Every removed member had no remaining references, and code that was only referenced from tests counts as dead, so those tests and mocks are removed with it. Co-authored-by: Copilot <[email protected]>
Delete the commented-out `AuthenticationExtensionsContribution` and `AuthenticationMcpContribution` classes and their registrations. They were disabled in #253810 and were the only remaining references to the query service methods removed in the previous commit (`getProviderIds`, `forEachAccount`, `removeUsage`), so they could no longer be re-enabled as written. Co-authored-by: Copilot <[email protected]>
TestAuthenticationService implements IAuthenticationService, which no longer declares manageTrustedExtensionsForAccount, removeAccountSessions, requestNewSession, getSession or supportsHeimdallConnection. The only test that uses the mock reaches it through the interface, so these stubs can never be called. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the authentication-service API cleanup.
No open issues 🎉
What changed in this PR
This PR reduces the workbench authentication services to APIs with production callers, removing unused implementations and their tests without intending to change user-facing behavior.
Changes:
- Removes unused query APIs, MCP session-request machinery, events, and usage-cache initialization.
- Deletes previously commented-out cleanup contributions and obsolete helper members.
- Updates retained tests and mocks to use the remaining service interfaces.
| File | Description |
|---|---|
src/vs/workbench/services/authentication/test/browser/authenticationQueryServiceMocks.ts |
Removes obsolete mock members and call-tracking helpers. |
src/vs/workbench/services/authentication/test/browser/authenticationQueryService.test.ts |
Removes tests of deleted APIs and adapts retained coverage. |
src/vs/workbench/services/authentication/test/browser/authenticationMcpService.test.ts |
Removes setup for deleted service dependencies. |
src/vs/workbench/services/authentication/test/browser/authenticationMcpAccessService.test.ts |
Removes event and bulk-removal tests. |
src/vs/workbench/services/authentication/common/authenticationQuery.ts |
Narrows query interfaces to the retained API surface. |
src/vs/workbench/services/authentication/common/authentication.ts |
Removes an unused type guard and session-preference APIs. |
src/vs/workbench/services/authentication/browser/dynamicAuthenticationProviderStorageService.ts |
Removes the unused getClientId helper. |
src/vs/workbench/services/authentication/browser/authenticationQueryService.ts |
Deletes unused query implementations and event forwarding. |
src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.ts |
Removes the unused cache, initialization listener, and removal API. |
src/vs/workbench/services/authentication/browser/authenticationMcpService.ts |
Removes unused session-request machinery and preference APIs. |
src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.ts |
Removes unused access-change events and bulk removal. |
src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts |
Removes unused session-preference readers and removal methods. |
src/vs/workbench/contrib/authentication/browser/authentication.contribution.ts |
Deletes commented-out cleanup contributions and registrations. |
src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.ts |
Removes an unused quick-pick type property. |
src/vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction.ts |
Removes an unused quick-pick type property. |
Review effort: Balanced
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
November 30, 2026 17:39
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge
November 30, 2026 17:39
This branch has not been deployed
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.
Removes about 2,100 lines of dead code from the workbench authentication services (15 files, +60/−2,119: about 1,300 lines of production code, 100 of them commented out, and about 800 lines of tests and mocks). Nothing observable changes: every removed member had no remaining caller, and the one side effect that goes away is described under the evidence below. Members that were only referenced from tests count as dead, so those tests and mocks are removed with them.
The branch has three commits that can be reviewed, or dropped, independently:
authentication: remove unused service APIs and their testsis the bulk of the change.authentication: remove disabled cleanup contributionsdeletes 100 lines of commented-out code.authentication: remove orphan stubs from TestAuthenticationServicedeletes 5 mock members that no interface declares.What is removed
All paths are under
src/vs/workbench/.Query facade (
services/authentication/common/authenticationQuery.ts−226,services/authentication/browser/authenticationQueryService.ts−441)IAuthenticationUsageStatsandIActiveEntitiestypes.remove,addUsage,removeUsage,setAsPreferred,isPreferred,allowAccess,removeAccess,forEach,hasAnyUsageandremoveAllAccess, plusisAccessAllowed()on a single extension entity andisTrusted()on MCP server entities.removeAccountPreference,getLastUsedAccount,getUsedAccounts,getActiveEntities,getAccountNames,getUsageStatsandforEachAccount, plus theprovider(...)accessors onIExtensionQueryandIMcpServerQuery.onDidChangePreferences,onDidChangeAccess,getProviderIdsandclearAllData.setAccessAllowedandgetUsageon both entity kinds,isAccessAllowedon MCP server entities,isTrustedon extension entities (used bygetAllowedExtensions),getAllowedExtensions,getAllowedMcpServers,getEntityCount,getPreferredAccount,setPreferredAccount,getProvidersWithAccessandgetAllAccountPreferences.MCP service (
services/authentication/browser/authenticationMcpService.ts−371)requestSessionAccess,requestNewSession,updateNewSessionRequests,updateAccessRequests,updateBadgeCount,removeAccessRequest,showGetSessionPrompt,completeSessionAccessRequestand the listener registration behind them.onDidChangeAccountPreference,removeAccountPreference,getSessionPreferenceandremoveSessionPreferencefrom the interface and the implementation. The extensions service keeps its ownonDidChangeAccountPreferenceandremoveAccountPreference, which are still used.IActivityService,IDialogServiceandIAuthenticationMcpUsageServicedependencies, and the 6 localized strings that only the removed code used.Other services
authenticationMcpUsageService.ts(−74):initializeUsageCache,hasUsedAuthandremoveAccountUsage, the cache they maintained, and the provider registration listener that filled it. The extension usage service'sremoveAccountUsageis still used and stays.authenticationMcpAccessService.ts(−13): theonDidChangeMcpSessionAccessevent andremoveAllowedMcpServers.authenticationExtensionsService.ts(−28) andcommon/authentication.ts(−44):getSessionPreferenceandremoveSessionPreference, the unreferencedisAuthenticationSessiontype guard and a stale doc comment.dynamicAuthenticationProviderStorageService.ts(−7):getClientId, which isn't on the interface either.contrib/authentication/browser/actions/(−1 each): an unusedlastUsedproperty on a local quick pick item type in two actions.contrib/authentication/browser/authentication.contribution.ts(−100): the commented-outAuthenticationExtensionsContributionandAuthenticationMcpContributionclasses and their registrations.Tests and mocks
authenticationQueryService.test.ts(49 → 24 tests): the tests of removed members are gone, and the rest now run against the surface that still exists.authenticationMcpAccessService.test.ts(43 → 36 tests) andauthenticationMcpService.test.ts(−8 lines of setup for the removed dependencies).authenticationQueryServiceMocks.ts(−44): the stubs for the removed interface members, plus 5 members ofTestAuthenticationService(manageTrustedExtensionsForAccount,removeAccountSessions,requestNewSession,getSessionandsupportsHeimdallConnection) thatIAuthenticationServicedoesn't declare and nothing calls.Evidence that these were dead
main, with references from tests not counted as callers, flagged these members as unreferenced. After the change it finds nothing in this area that newly became unreferenced.any-typed or string-keyed uses, so a repo-widegit grep -wfor the removed names backs it up. It finds no remaining reference. The only names that still appear are same-named members of other live code, such asrequestSessionAccess,requestNewSessionandremoveAccountPreferenceonIAuthenticationExtensionsService, which are kept.IAuthenticationQueryServicehas a production caller: themanage*actions incontrib/authentication,mcpCommands.ts,mcpServerActions.ts,mainThreadAuthentication.tsandmainThreadGitHub.ts.getProviderIds,forEachAccount,removeUsage, entityforEach), so they couldn't be re-enabled as they are. Git history keeps them.authenticationQueryService.test.ts, which calls justregisterAuthenticationProviderandaddAccountson the mock and reaches everything else throughIAuthenticationService, which doesn't declare these members.manageTrustedExtensionsForAccountandremoveAccountSessionsleft the interface in Tear down the Authentication monolith #206495.getAccountsto warm its cache. The cache's only reader,hasUsedAuth, had no callers, so nothing depends on it.Validation
All run on the final commit.
pnpm run typecheck-client: 26 errors, all insrc/vs/platform/agentHost/, which this PR doesn't touch (SDK type mismatches such as a missingfusionproperty, from an out-of-date local@microsoft/copilot-sdk). None anywhere else.node build/oxlint.ts <the 15 changed files>: 15 files checked, no problems.git diff --check: clean.pnpm run transpile-client, then.\scripts\test.bat --reporter dot --run <file> [--run <file> ...]for these 10 files: 312 passing.src/vs/workbench/services/authentication/test/browser/:authenticationQueryService,authenticationMcpAccessService,authenticationMcpService,authenticationAccessServiceandauthenticationServicesrc/vs/workbench/api/test/browser/:mainThreadAuthentication,extHostAuthenticationandmainThreadMcpsrc/vs/workbench/services/accounts/test/browser/defaultAccount.test.tssrc/vs/workbench/services/github/test/browser/githubService.test.tsNot run: the
*.integrationTest.tsfiles (they are only type-checked, and the stubs in them are unchanged) and the full unit and integration suites.