Coalesce concurrent connection-sharing permission prompts - #22617
Coalesce concurrent connection-sharing permission prompts#22617Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents duplicate connection-sharing permission prompts by coalescing concurrent permission requests per calling extension, so multiple simultaneous callers from the same extension share a single in-flight prompt/result.
Changes:
- Track in-flight permission requests in
ConnectionSharingServicekeyed byextensionIdand share the samePromise<boolean>with concurrent callers. - Ensure the in-flight entry is cleaned up on completion (success or failure) so later checks/retries behave normally.
- Add a unit test covering concurrent requests from the same extension to ensure only one prompt is shown.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| extensions/mssql/src/connectionSharing/connectionSharingService.ts | Adds per-extension in-flight permission request tracking and coalescing logic. |
| extensions/mssql/test/unit/connectionSharingService.test.ts | Adds a regression test for concurrent permission requests sharing one prompt. |
|
Chris Johnstone (@cjohnsto-nz) Are you building anything that uses the connection sharing mechanism? We're actually thinking about deprecating due to near-zero usage, but if there's still interest from the community, that'd be good to know. |
|
Benjin Dubishar (@Benjin) I did once upon a time, when I added SQL Notebook support to .NET Interactive, but that didn't last long 🥲 No future plans from me. The embedded AI tools in vscode mssql are the killer feature for me honestly. They reduce most of my need for connection sharing, since I can just get GHCP to execute whatever requests are required. |
|
Chris Johnstone (@cjohnsto-nz) Gotchya. I'll close this PR in that case. Please file an issue to let us know if you ever start looking to build tooling on top of vscode-mssql again, and we'll see what we can do to help you out! Also, really glad to hear this. 🙂 I'll share that bit of praise with the team.
|
Description
This PR extracts the connection-sharing prompt improvement from #22614 into a focused change.
Concurrent connection-sharing requests from the same extension can arrive before the user's permission choice has been persisted. Previously, each request could display its own permission prompt.
This change tracks the in-flight permission request for each extension and shares its result with concurrent callers. The request is removed after completion so later permission checks and retries continue to work normally. Requests from different extensions remain independent.
A regression test verifies that two concurrent requests from the same extension display only one permission prompt.
Validation performed:
npm run build -- --target mssqlnpm run test -- --target mssql --coverage=falsenpm run package -- --target mssql --onlineCode Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines