Repository navigation
Add DynamicRegistry with version-based cache invalidation - #3188
Conversation
There was a problem hiding this comment.
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 transformationAlternative:
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.
6b7c539 to
62dc596
Compare
62dc596 to
da23ff2
Compare
da23ff2 to
d77cf60
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3188 +/- ##
==========================================
- Coverage 57.17% 57.15% -0.02%
==========================================
Files 341 343 +2
Lines 34145 34377 +232
==========================================
+ Hits 19521 19649 +128
- Misses 13011 13087 +76
- Partials 1613 1641 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d77cf60 to
64efa89
Compare
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
Large PR justification has been provided. Thank you!
64efa89 to
345fd47
Compare
345fd47 to
d07754e
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements a DynamicRegistry for virtual MCP servers with version-based cache invalidation to support real-time backend changes in Kubernetes-aware dynamic discovery mode. The implementation uses lazy cache invalidation with monotonic version tracking to avoid thundering herd problems when backends are added or removed.
- Adds
DynamicRegistryinterface with thread-safeUpsert,Remove, andVersionoperations - Integrates version-based cache invalidation into the discovery manager
- Provides comprehensive unit and E2E tests (E2E tests marked as Pending awaiting operator integration)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pkg/vmcp/registry.go |
Adds DynamicRegistry interface and dynamicRegistry implementation with RWMutex-based thread safety, version tracking, and defensive copying for immutability |
pkg/vmcp/registry_test.go |
Comprehensive unit tests for DynamicRegistry covering concurrent access, version tracking, and immutability guarantees |
pkg/vmcp/discovery/manager.go |
Extends discovery manager with NewManagerWithRegistry constructor and version-based cache invalidation logic |
pkg/vmcp/discovery/manager_test.go |
Unit tests verifying cache invalidation behavior when registry version changes |
pkg/vmcp/mocks/mock_registry.go |
Generated mocks for both BackendRegistry and DynamicRegistry interfaces |
pkg/vmcp/mocks/mock_backend_registry.go |
Deleted old mock file (consolidated into mock_registry.go) |
test/e2e/thv-operator/virtualmcp/virtualmcp_lifecycle_test.go |
End-to-end tests for dynamic backend discovery lifecycle (marked Pending until operator integration) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d07754e to
ce5d28f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implement mutable registry for vMCP K8s-aware dynamic discovery mode. Supports thread-safe backend updates with lazy cache invalidation to enable real-time backend changes without thundering herd problems. Closes: #2999
5329adf to
60c614b
Compare
Implement mutable registry for vMCP K8s-aware dynamic discovery mode. Supports thread-safe backend updates with lazy cache invalidation to enable real-time backend changes without thundering herd problems.
This is the first of several PRs , the k8s integration, watcher, etc... will be implemented in follow ups
Large PR Justification
This is a complete and atomic PR that covers a single functionality. It includes proper testing. Can't be split.
Closes: #2999