Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Restore Service RPC contracts and implementation for VS Code MSSQL#20625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge6 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/port-rpc-methods-to-vscode-mssql

Conversation

Copy link
Contributor

CopilotAI commentedNov 18, 2025
edited
Loading

Description

Adds the Restore service RPC contracts and implementation by porting functionality from SQL Tools Service to VS Code MSSQL extension. This provides the foundation for database restore operations including restore execution, restore planning, and configuration retrieval following the established DacFx service pattern.

Note: This PR adds the service contracts and implementation only. Integration into the extension API (mainController and extension.ts) will be handled in a separate PR.

Implementation Details

  • Type Definitions: AddedIRestoreService interface and supporting types tovscode-mssql.d.ts:
    • RestoreResponse,RestorePlanResponse,RestoreDatabaseFileInfo
    • RestorePlanDetailInfo,RestoreConfigInfoResponse
    • RestoreParams,RestoreConfigInfoRequestParams
  • RPC Contracts: CreatedrestoreContracts.ts with 4 RPC request definitions matching SQL Tools Service endpoints:
    • restore/restore - Execute database restore
    • restore/restoreplan - Create restore plan
    • restore/cancelrestoreplan - Cancel restore plan
    • restore/restoreconfiginfo - Get restore configuration info
  • Service Implementation: ImplementedRestoreService class insrc/services/restoreService.ts with full implementation of all 4 service methods

Reference Implementation

Follows the DacFx service pattern:

exportclassRestoreServiceimplementsmssql.IRestoreService{constructor(private_client:SqlToolsServiceClient){}publicrestore(ownerUri:string,options:{[key:string]:any},taskExecutionMode:TaskExecutionMode):Thenable<mssql.RestoreResponse>{constparams:mssql.RestoreParams={ ownerUri, options, taskExecutionMode};returnthis._client.sendRequest(restoreContracts.RestoreRequest.type,params);}// ... additional methods}

Code Changes Checklist

  • New or updatedunit tests added
  • All existing tests pass (npm run test)
  • Code followscontributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers:Please read our reviewer guidelines

Original prompt

Agent Instructions: Porting RPC Methods from Azure Data Studio to VS Code MSSQL

Overview

This guide enables an AI agent to port RPC-based functionality from Azure Data Studio (ADS) to the VS Code MSSQL extension following established patterns.

Prerequisites

Input Required

The agent needs:

  1. Functionality Name: The feature to port (e.g., "Profiler", "QueryPlan", "Backup", "Restore")
  2. ADS Source Path: Path in ADS repo where the functionality exists (e.g.,src/sql/workbench/services/profiler/)

Step-by-Step Porting Process

Phase 1: Discovery and Analysis in Azure Data Studio Repo

Step 1.1: Locate the Service Interface

Search Pattern:I{FunctionalityName}Service interface
Typical Location:src/sql/workbench/services/{functionality}/common/{functionality}Service.ts

Agent Actions:

  1. Find the interface definition (e.g.,IProfilerService)
  2. Extract all method signatures
  3. Note the return types (Promise types are important)
  4. Document any event emitters or notifications

Example Interface to Extract:

exportinterfaceIProfilerService{createSession(ownerUri:string,sessionName:string,template:ProfilerSessionTemplate):Promise<boolean>;startSession(ownerUri:string,sessionName:string):Promise<boolean>;stopSession(ownerUri:string,sessionName:string):Promise<boolean>;// ... more methods}

Step 1.2: Locate Request/Response Contracts

Search Pattern: Request and Response type definitions
Typical Location:src/sql/workbench/services/{functionality}/common/{functionality}Contracts.ts or similar

Agent Actions:

  1. Find all*Request and*Response types
  2. Find all*Params types
  3. Extract enums used by the functionality
  4. Note any notification types (e.g.,*NotificationParams)

Example Contracts to Extract:

exportinterfaceCreateSessionRequest{ownerUri:string;sessionName:string;template:ProfilerSessionTemplate;}exportinterfaceCreateSessionResponse{succeeded:boolean;errorMessage?:string;}

Step 1.3: Locate RPC Request Definitions

Search Pattern:RequestType andNotificationType definitions
Typical Location: Same file as contracts or in a separate*Contracts.ts file

Agent Actions:

  1. Find allRequestType<TParams, TResult> definitions
  2. Find allNotificationType<TParams> definitions
  3. Extract the RPC method names (string constants)
  4. Map each RequestType to its params and response types

Example RPC Definitions to Extract:

exportnamespaceCreateXEventSessionRequest{exportconsttype=newRequestType<CreateXEventSessionParams,CreateXEventSessionResponse,void,void>('profiler/createsession');}exportnamespaceProfilerEventsAvailableNotification{exportconsttype=newNotificationType<ProfilerEventsAvailableParams,void>('profiler/eventsavailable');}

Step 1.4: Locate Supporting Types

Agent Actions:

  1. Find all interface definitions used by the contracts (e.g.,ProfilerSessionTemplate,ProfilerEvent)
  2. Find all enums (e.g.,ProfilingSessionType)
  3. Extract complete type definitions with all properties
  4. Note any default values or constants

Phase 2: Generate VS Code MSSQL Extension Files

Step 2.1: Generatevscode-mssql.d.ts Types

File Location:mssql/typings/vscode-mssql.d.ts

Agent Instructions:

  1. Open the existingvscode-mssql.d.ts file
  2. Locate thedeclare module "vscode-mssql" section
  3. Add the service interface after existing service interfaces (e.g., afterIDacFxService)
  4. Add all supporting types in the following order:
    • Enums first
    • Simple interfaces
    • Complex interfaces that depend on simple ones
    • The service interface last

Template for Service Interface:

exportinterfaceI{FunctionalityName}Service{// Method signatures from ADS IService interface{methodName}({params}):Promise<{ReturnType}>;// Notification registration methodsregisterOn{NotificationName}(handler:(params:{NotificationParams})=>void):void;}

Template for Types:

// Enumsexportenum{EnumName}{{Value1}={Number},{Value2}={Number}}// Parameter interfacesexportinterface{FunctionalityName}{Operation}Params{{property}:{type};// ... more properties}// Response interfacesexportinterface{FunctionalityName}{Operation}Response{succeeded:boolean;    errorMessage?:string;// ... more properties}// Event/Notification interfacesexportinterface{FunctionalityName}{Event}Params{// ... event properties}

Important Notes:

  • Remove ADS-specific imports (likeimport * as azdata)
  • Convert azdata types to plain TypeScript types
  • Use `v...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

CopilotAIand others added2 commitsNovember 18, 2025 22:46
Co-authored-by: allancascante <755488+allancascante@users.noreply.github.com>
Co-authored-by: allancascante <755488+allancascante@users.noreply.github.com>
CopilotAI changed the title[WIP] Port RPC methods from Azure Data Studio to VS Code MSSQLAdd RPC porting guide for Azure Data Studio service migrationNov 18, 2025
@allancascante
Copy link
Contributor

@copilot the work is to use the provided instruction to implement the changes for restore service, no to include instructions; the instructions provided must be used to implement the classes in the code

@github-actions
Copy link

github-actionsbot commentedNov 18, 2025
edited
Loading

PR Changes

CategoryTarget BranchPR BranchDifference
Code Coverage59.72%59.72%⚪ 0.00%
VSIX Size5254 KB5254 KB⚪ 0 KB ( 0% )
Webview Bundle Size5284 KB5284 KB⚪ 0 KB ( 0% )

@github-actions
Copy link

Updates to localized strings required

Please update the localized strings in the PR with following steps:

  1. Runyarn localization in the PR branch.
  2. Based on the changes,
    • If there are changes in localized strings in source code, make sure thatsrc/localization/xliff/vscode-mssql.xlf andsrc/l10n/bundle.l10n.json files are updated.
    • If there are changes in localized strings inpackage.nls.json, make sure thatsrc/localization/xliff/vscode-mssql.xlf is updated.

@codecov-commenter
Copy link

codecov-commenter commentedNov 18, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.82%. Comparing base (00a4e54) to head (a37bc33).

Additional details and impacted files
@@           Coverage Diff           @@##             main   #20625   +/-   ##=======================================  Coverage   38.81%   38.82%           =======================================  Files         213      213             Lines       87257    87257             Branches    19522    19522           =======================================+ Hits        33867    33875    +8+ Misses      53140    53132    -8  Partials      250      250

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
ContributorAuthor

CopilotAI commentedNov 18, 2025
edited
Loading

@copilot the work is to use the provided instruction to implement the changes for restore service, no to include instructions; the instructions provided must be used to implement the classes in the co...

I understand you want me to implement the restore service code rather than just documentation. However, I cannot locate the RestoreService interface or contracts in the Azure Data Studio repository.

Could you please provide:

  1. The specific path or link to the restore service source code in Azure Data Studio, or
  2. Confirm if I should create a minimal example implementation of a restore service following the guide's patterns?

Without access to the actual ADS restore service interface and contracts, I cannot accurately port the functionality.

@copilot the work is to use the provided instruction to implement the changes for restore service, no to include instructions; the instructions provided must be used to implement the classes in the co...

I've now implemented the restore service code following the RPC porting pattern from DacFx service.

The implementation includes:

  • Type definitions invscode-mssql.d.ts for IRestoreService interface and related types
  • RPC contracts inrestoreContracts.ts matching SQL Tools Service endpoints
  • RestoreService implementation with 4 methods (restore, getRestorePlan, cancelRestorePlan, getRestoreConfigInfo)
  • Integration in mainController and extension API

Committed in3cec6bd.

CopilotAIand others added2 commitsNovember 18, 2025 23:09
…tionCo-authored-by: allancascante <755488+allancascante@users.noreply.github.com>
Co-authored-by: allancascante <755488+allancascante@users.noreply.github.com>
@allancascante
Copy link
Contributor

@copilot the changes to mainController.ts and extesion.ts are not needed in this PR

CopilotAI changed the titleAdd RPC porting guide for Azure Data Studio service migrationImplement Restore Service for VS Code MSSQLNov 18, 2025
Co-authored-by: allancascante <755488+allancascante@users.noreply.github.com>
Copy link
ContributorAuthor

@copilot the changes to mainController.ts and extesion.ts are not needed in this PR

Removed the integration changes from mainController.ts and extension.ts. The restore service implementation and contracts remain, but the wiring has been removed per your feedback. Committed in38b395a.

CopilotAI changed the titleImplement Restore Service for VS Code MSSQLAdd Restore Service RPC contracts and implementation for VS Code MSSQLNov 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@allancascanteallancascanteAwaiting requested review from allancascanteallancascante is a code owner

@kburtramkburtramAwaiting requested review from kburtramkburtram will be requested when the pull request is marked ready for reviewkburtram is a code owner

@aasimkhan30aasimkhan30Awaiting requested review from aasimkhan30aasimkhan30 will be requested when the pull request is marked ready for reviewaasimkhan30 is a code owner

@caohaicaohaiAwaiting requested review from caohaicaohai will be requested when the pull request is marked ready for reviewcaohai is a code owner

@laurenastrid1laurenastrid1Awaiting requested review from laurenastrid1laurenastrid1 will be requested when the pull request is marked ready for reviewlaurenastrid1 is a code owner

@lewis-sanchezlewis-sanchezAwaiting requested review from lewis-sanchezlewis-sanchez will be requested when the pull request is marked ready for reviewlewis-sanchez is a code owner

@BenjinBenjinAwaiting requested review from BenjinBenjin will be requested when the pull request is marked ready for reviewBenjin is a code owner

@ssreeramassreeramaAwaiting requested review from ssreeramassreerama will be requested when the pull request is marked ready for reviewssreerama is a code owner

@manujoseph85manujoseph85Awaiting requested review from manujoseph85manujoseph85 will be requested when the pull request is marked ready for reviewmanujoseph85 is a code owner

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@allancascante@codecov-commenter

[8]ページ先頭

©2009-2025 Movatter.jp