Skip to content

Simplify controller and add E2E tests for status reporting#3468

Merged
yrobla merged 4 commits intomainfrom
issue-3149-v3
Jan 29, 2026
Merged

Simplify controller and add E2E tests for status reporting#3468
yrobla merged 4 commits intomainfrom
issue-3149-v3

Conversation

@yrobla
Copy link
Contributor

@yrobla yrobla commented Jan 27, 2026

Simplify VirtualMCPServer controller by delegating to runtime status reporter

Remove ~1200 lines by delegating backend discovery and health monitoring
from controller to vMCP runtime StatusReporter.

Key changes:

  • Remove discoverBackends() from controller reconciliation (~130 lines)
  • Fix RBAC permissions to work in all modes (discovered and inline)
  • Remove obsolete controller-side discovery tests (807 lines)
  • Add comprehensive E2E status reporting tests (408 lines)
  • Improve health monitoring with dynamic backend management
  • Remove duplicate slow test from yardstick suite (saves 133s per run)

Controller now focuses on infrastructure (RBAC, Deployment, Service).
Runtime handles discovery, health monitoring, and status updates.

Related-to: #3149

Large PR Justification

This is a cleanup pr, that removes substantial lines of code to replace with newer ones. It also includes tests to validate the new behaviour.

@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Jan 27, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

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.

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 pull request simplifies the VirtualMCPServer controller by removing duplicate backend discovery logic (~130 lines) and delegating all backend discovery and health monitoring to the vMCP runtime via its StatusReporter mechanism. The change aligns with the architectural principle of separation of concerns: the controller manages infrastructure (RBAC, Deployment, Service, ConfigMap), while the vMCP runtime handles backend discovery, health monitoring, and status updates.

Changes:

  • Removed discoverBackends() method from controller (delegated to vMCP runtime with K8sReporter)
  • Removed controller-side backend discovery tests (virtualmcpserver_discover_backends_test.go)
  • Removed integration test TestDiscoverBackendsWithExternalAuthConfigIntegration from virtualmcpserver_externalauth_test.go
  • Added comprehensive E2E tests for status reporting (virtualmcp_status_reporting_test.go) with 2 test cases covering backend discovery, health monitoring, and failure recovery
  • Added GetMCPServerDeployment helper function for E2E tests

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
test/e2e/thv-operator/virtualmcp/virtualmcp_status_reporting_test.go New E2E test suite validating vMCP runtime status reporting for backend discovery and health monitoring
test/e2e/thv-operator/virtualmcp/helpers.go Added GetMCPServerDeployment helper function to retrieve MCPServer deployments by name
cmd/thv-operator/controllers/virtualmcpserver_externalauth_test.go Removed TestDiscoverBackendsWithExternalAuthConfigIntegration (170 lines) as backend discovery moved to runtime
cmd/thv-operator/controllers/virtualmcpserver_discover_backends_test.go Deleted entire file (643 lines of controller-side backend discovery tests)
cmd/thv-operator/controllers/virtualmcpserver_controller.go Removed discoverBackends method and unused imports (groups, aggregator); added comprehensive documentation explaining responsibility split

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

@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 Jan 27, 2026
@github-actions
Copy link
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 dismissed their stale review January 27, 2026 16:15

Large PR justification has been provided. Thank you!

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 5 out of 5 changed files in this pull request and generated 2 comments.


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

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 64.53202% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.25%. Comparing base (fc01a6c) to head (c64af60).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/health/monitor.go 73.73% 18 Missing and 8 partials ⚠️
cmd/vmcp/app/commands.go 0.00% 19 Missing ⚠️
pkg/vmcp/server/status_reporting.go 29.41% 10 Missing and 2 partials ⚠️
pkg/vmcp/health/status.go 78.57% 4 Missing and 2 partials ⚠️
pkg/vmcp/errors.go 78.94% 2 Missing and 2 partials ⚠️
pkg/vmcp/client/client.go 0.00% 2 Missing and 1 partial ⚠️
pkg/vmcp/server/server.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3468      +/-   ##
==========================================
- Coverage   65.27%   65.25%   -0.03%     
==========================================
  Files         399      399              
  Lines       38955    39004      +49     
==========================================
+ Hits        25429    25452      +23     
- Misses      11560    11572      +12     
- Partials     1966     1980      +14     

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

@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 Jan 27, 2026
@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 Jan 27, 2026
@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 Jan 28, 2026
@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 Jan 28, 2026
Base automatically changed from issue-3149-v2 to main January 28, 2026 06:58
@yrobla yrobla requested a review from Copilot January 29, 2026 04:41
@github-actions github-actions bot removed the size/XL Extra large PR: 1000+ lines changed label Jan 29, 2026
@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Jan 29, 2026
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 25 out of 25 changed files in this pull request and generated 2 comments.


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

@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 Jan 29, 2026
@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 Jan 29, 2026
@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 Jan 29, 2026
@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 Jan 29, 2026
@yrobla yrobla requested a review from Copilot January 29, 2026 06:49
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 26 out of 26 changed files in this pull request and generated 6 comments.


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

@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 Jan 29, 2026
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@yrobla yrobla requested a review from jhrozek January 29, 2026 07:28
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

I think tightening the RBAC should be a follow-up

@yrobla yrobla merged commit 6db09ab into main Jan 29, 2026
51 of 52 checks passed
@yrobla yrobla deleted the issue-3149-v3 branch January 29, 2026 12:01
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

Comments