Repository navigation
Support GO batches and database context sync - #79
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesQuery batching and execution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant QueryExecutor
participant SqlCommand
participant SqlDataReader
participant QueryStore
participant QueryTab
QueryExecutor->>QueryExecutor: Split SQL into GO-separated batches
QueryExecutor->>SqlCommand: Create one command per batch
SqlCommand->>SqlDataReader: Execute batch and return reader
QueryExecutor->>SqlDataReader: Stream rows and advance result sets
QueryExecutor->>QueryStore: Emit database context in query payload
QueryStore->>QueryTab: Update database field
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces SQL batch splitting using a GO separator regex in QueryExecutor and updates the frontend to track and update the active database context per tab. The review feedback suggests compiling the regex for better performance, checking the cancellation token within the batch loop, and optimizing the frontend state updates to prevent unnecessary re-renders. Additionally, the reviewer notes that regex-based splitting may incorrectly split inside multi-line strings or comments, and points out that the database context could become stale on the frontend if a multi-batch query fails.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR updates the query execution pipeline to support client-side GO batch separators (executed sequentially on the same SQL connection) and to propagate the final database context back to the frontend so the query tab’s database selector stays in sync after successful USE statements.
Changes:
- Split incoming SQL scripts into multiple batches using
GOas a standalone separator and execute each batch sequentially on one connection. - Include the final
Databasecontext in the query completion payload and update the active tab’s database accordingly. - Add unit coverage for case-insensitive standalone
GOseparators and avoiding splits whenGOappears as normal SQL text.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/features/query/types.ts | Extends streamed query payload shape to include an optional final database context. |
| src/features/query/store/queryStore.ts | Updates the query tab’s selected database when a completion payload includes database. |
| sidecar/tests/Ssmsx.Core.Tests/Query/QueryExecutorTests.cs | Adds a unit test validating basic GO batch splitting behavior. |
| sidecar/src/Ssmsx.Protocol/Messages/QueryMessages.cs | Adds database to the JSON-serialized query result payload. |
| sidecar/src/Ssmsx.Core/Query/QueryExecutor.cs | Implements batch splitting/execution and returns the final connection database context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36a55f9ad4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eedce52d0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a06d7f6ea2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
GOseparators as sequential SQL batches on the same connection.USE.GOinside SQL text as a separator.Why
The editor sent the complete script to SQL Server as one command, even though
GOis a client-side separator. A successfulUSEchanged the connection context but left the database selector stale.User impact
Multi-batch scripts now run as expected, and the selected database follows successful context changes.
Validation
dotnet test sidecar/Ssmsx.Sidecar.slnxdotnet format sidecar/Ssmsx.Sidecar.slnx --verify-no-changes --no-restorenpm run buildgit diff --checkSummary by CodeRabbit
GOstatements.GOis recognized only as a standalone, case-insensitive separator, while being ignored inside string literals and block comments.GOsplitting coverage (preserves line feeds, rejects unsupported repeat counts aboveInt32.MaxValue).