Skip to content

Remove dead vMCP discovery seam and default router#5627

Merged
tgrunnagle merged 1 commit into
mainfrom
vmcp-core-p3-2b-stage3_issue_5621
Jun 24, 2026
Merged

Remove dead vMCP discovery seam and default router#5627
tgrunnagle merged 1 commit into
mainfrom
vmcp-core-p3-2b-stage3_issue_5621

Conversation

@tgrunnagle

@tgrunnagle tgrunnagle commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Why: Once Serve became the sole *Server constructor and always builds the domain core, the legacy server.New path (s.core == nil) became unreachable. Capability aggregation and call admission now run entirely through the core, so the discovery middleware, its context seam, the discovery.Manager, and the context-coupled defaultRouter were dead code reachable only on that path. This is the final stage of the staged dead-code removal under #5621 (after #5622 and #5625).

What:

  • Delete the pkg/vmcp/discovery package (manager, middleware, context seam, mocks) — it had zero importers after the seam removal.
  • Delete router.defaultRouter (+ test), whose only coupling was reading discovered capabilities from context; core.New only needs a non-nil router for workflow validation, which does not route, so the CLI now passes an empty NewSessionRouter(&vmcp.RoutingTable{}).
  • Drop the discovery.Manager parameter from server.New (7 → 6 params) and remove the field, assignment, the s.core == nil discovery-middleware leg in Handler(), and the discovery Stop() call.
  • Update affected tests (drop the mockDiscoveryMgr setup, swap routers) and the comments that referenced the removed code (including the e2e circuit-breaker note and the core filterHealthyBackends doc, now the single source of truth for health filtering).

Net: +86 / −2315 across 25 files (1941 lines are whole-file deletions).

Part of #5621

Type of change

  • Code cleanup or refactoring

Test plan

  • go build ./... — clean
  • go vet ./... — clean
  • golangci-lint on the changed packages — 0 issues
  • go test -race on all affected packages (pkg/vmcp/server, cli, router, core, aggregator, session, test/integration/vmcp) — all pass, including the goleak-guarded suites (no goroutine leaks)

Does this introduce a user-facing change?

No.

Special notes for reviewers

  • API break for external embedders: server.New drops its discovery.Manager parameter (7 → 6 args). In-tree callers (cli/serve.go, tests, the integration helper) are updated here; an out-of-tree embedder must drop that argument. The New doc comment documents the change.
  • No behavior change on the live path: the discovery middleware's filterHealthyBackends was a copy of the core's own (pkg/vmcp/core/core_vmcp.go); circuit-breaker / unhealthy-backend filtering is unchanged and still covered by TestFilterHealthyBackends.
  • Out of scope (pre-existing): the convertAnnotations doc comment in pkg/vmcp/core/admission.go references a server.convertAnnotations copy that was already removed by an earlier stage; left for a focused follow-up. The vestigial Config.AuthzMiddleware field likewise remains for a separate PR.

Large PR Justification

  • Removes dead code after vMCP refactor

Generated with Claude Code

The legacy server.New path (s.core == nil) became unreachable once Serve
always builds the core: every server now routes capability aggregation
and call admission through the core. The discovery middleware, its
context seam, the discovery.Manager, and the context-coupled
defaultRouter were only reachable on that dead path.

Delete the pkg/vmcp/discovery package and router.defaultRouter, drop the
discovery.Manager parameter from server.New (7 -> 6 params), and point
the CLI at an empty SessionRouter (core.New needs a non-nil router only
for workflow validation, which does not route). Update the affected
tests and the comments that referenced the removed code.

Part of #5621

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Jun 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.03%. Comparing base (12fb161) to head (482e34f).

Files with missing lines Patch % Lines
pkg/vmcp/cli/serve.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5627      +/-   ##
==========================================
- Coverage   70.04%   70.03%   -0.02%     
==========================================
  Files         652      648       -4     
  Lines       66392    66208     -184     
==========================================
- Hits        46505    46367     -138     
+ Misses      16544    16503      -41     
+ Partials     3343     3338       -5     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions github-actions Bot dismissed their stale review June 24, 2026 19:32

Large PR justification has been provided. Thank you!

@github-actions

Copy link
Copy Markdown
Contributor

✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review.

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Jun 24, 2026
@tgrunnagle tgrunnagle merged commit 6132d91 into main Jun 24, 2026
77 of 78 checks passed
@tgrunnagle tgrunnagle deleted the vmcp-core-p3-2b-stage3_issue_5621 branch June 24, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants