Skip to content

Comments

Address PR review feedback on vmcp/session#3905

Open
yrobla wants to merge 1 commit intomainfrom
issue-3865-v1
Open

Address PR review feedback on vmcp/session#3905
yrobla wants to merge 1 commit intomainfrom
issue-3865-v1

Conversation

@yrobla
Copy link
Contributor

@yrobla yrobla commented Feb 20, 2026

Extract the shared MCP operation methods (CallTool, ReadResource, GetPrompt, Close) from backend.Session and MultiSession into a new types.Caller interface in pkg/vmcp/session/types, eliminating duplication between the two interfaces. This is a first step toward the future consolidation of the two session types.

Factor the in-flight request tracking logic (sync.RWMutex, sync.WaitGroup, closed bool) out of defaultMultiSession into a new AdmissionQueue interface with a concrete admissionQueue implementation. This makes the concurrency contract independently testable and removes synchronization noise from the session struct. Snapshot methods (Tools, Resources, Prompts, BackendSessions) no longer need locks since those fields are immutable after construction.

Add unit tests for the HTTP round trippers (httpRoundTripperFunc, authRoundTripper, identityRoundTripper) in the internal/backend package, covering request cloning, auth error propagation, and identity context propagation.

@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Feb 20, 2026
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Feb 20, 2026
@yrobla yrobla requested a review from Copilot February 20, 2026 09:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses review feedback on the vmcp/session package by extracting common interfaces, factoring out concurrency logic, and adding test coverage for HTTP round trippers. The changes improve code organization and testability without altering functionality.

Changes:

  • Extract shared MCP operation methods into a new types.Caller interface to eliminate duplication between backend.Session and MultiSession
  • Factor in-flight request tracking into a new AdmissionQueue interface with comprehensive unit tests, removing synchronization noise from the session struct
  • Add unit tests for HTTP round trippers (httpRoundTripperFunc, authRoundTripper, identityRoundTripper) covering request cloning, auth error propagation, and identity context handling

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/vmcp/session/types/session.go New Caller interface defining common MCP protocol operations shared by backend and multi-session types
pkg/vmcp/session/session.go Updated MultiSession to embed sessiontypes.Caller, removing duplicate method declarations
pkg/vmcp/session/internal/backend/session.go Updated Session to embed sessiontypes.Caller, removing duplicate method declarations
pkg/vmcp/session/admission.go New AdmissionQueue interface and implementation for managing concurrent request admission and graceful shutdown
pkg/vmcp/session/admission_test.go Comprehensive unit tests for admission queue covering concurrency, idempotency, and drain semantics
pkg/vmcp/session/default_session.go Refactored to use AdmissionQueue, removing mutex/waitgroup fields and lock operations from snapshot methods
pkg/vmcp/session/default_session_test.go Updated test fixtures to initialize the new queue field
pkg/vmcp/session/factory.go Updated factory to initialize the admission queue when creating sessions
pkg/vmcp/session/internal/backend/roundtripper_test.go New unit tests for HTTP round trippers validating request cloning, auth handling, and identity propagation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Feb 20, 2026
Extract the shared MCP operation methods (CallTool, ReadResource,
GetPrompt, Close) from backend.Session and MultiSession into a new
types.Caller interface in pkg/vmcp/session/types, eliminating
duplication between the two interfaces. This is a first step toward
the future consolidation of the two session types.

Factor the in-flight request tracking logic (sync.RWMutex,
sync.WaitGroup, closed bool) out of defaultMultiSession into a new
AdmissionQueue interface with a concrete admissionQueue implementation.
This makes the concurrency contract independently testable and removes
synchronization noise from the session struct. Snapshot methods
(Tools, Resources, Prompts, BackendSessions) no longer need locks
since those fields are immutable after construction.

Add unit tests for the HTTP round trippers (httpRoundTripperFunc,
authRoundTripper, identityRoundTripper) in the internal/backend
package, covering request cloning, auth error propagation, and
identity context propagation.
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Feb 20, 2026
@yrobla yrobla requested a review from Copilot February 20, 2026 09:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.21%. Comparing base (65f28eb) to head (dee5c2c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3905      +/-   ##
==========================================
+ Coverage   67.18%   67.21%   +0.02%     
==========================================
  Files         448      449       +1     
  Lines       45218    45220       +2     
==========================================
+ Hits        30380    30393      +13     
+ Misses      12469    12459      -10     
+ Partials     2369     2368       -1     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants