Skip to content

Replace ReferencingServers with ReferencingWorkloads on MCPToolConfig#4506

Merged
ChrisJBurns merged 1 commit into
mainfrom
migrate-toolconfig-referencing-workloads
Apr 3, 2026
Merged

Replace ReferencingServers with ReferencingWorkloads on MCPToolConfig#4506
ChrisJBurns merged 1 commit into
mainfrom
migrate-toolconfig-referencing-workloads

Conversation

@ChrisJBurns
Copy link
Copy Markdown
Collaborator

Summary

Migrates MCPToolConfig from ReferencingServers []string to ReferencingWorkloads []WorkloadReference, aligning it with the structured workload reference pattern established on MCPOIDCConfig in #4492. This enables the status field to distinguish between different workload kinds (MCPServer, VirtualMCPServer, MCPRemoteProxy) rather than assuming all referencing workloads are MCPServers.

Partial fix for #4491

Type of change

  • Enhancement to an existing feature

Changes

File Changes
toolconfig_types.go Replace ReferencingServers []string with ReferencingWorkloads []WorkloadReference, update printer column
toolconfig_controller.go Add findReferencingWorkloads(), update reconcile/deletion logic to use structured refs with DeletionBlocked condition
toolconfig_controller_test.go Update assertions to use WorkloadReference{Kind, Name} structs
toolconfig_controller_edge_cases_test.go Update assertions to use WorkloadReference{Kind, Name} structs
mcptoolconfig_controller_integration_test.go Update assertions to use WorkloadReference{Kind, Name} structs
Generated files Regenerated deepcopy, CRD YAML manifests

Test plan

  • Unit tests updated and passing (go test ./cmd/thv-operator/controllers/... -run ToolConfig)
  • Integration tests updated
  • CRD manifests regenerated via task gen

Special notes for reviewers

Follows the exact pattern from #4492 (MCPOIDCConfig migration). MCPExternalAuthConfig migration is in a separate PR. MCPTelemetryConfig will follow separately.

Generated with Claude Code

@github-actions github-actions Bot added the size/M Medium PR: 300-599 lines changed label Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 23.72881% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.06%. Comparing base (a78d9bf) to head (a5baa39).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../thv-operator/controllers/toolconfig_controller.go 23.72% 42 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4506      +/-   ##
==========================================
+ Coverage   69.04%   69.06%   +0.01%     
==========================================
  Files         502      502              
  Lines       51909    51924      +15     
==========================================
+ Hits        35843    35859      +16     
- Misses      13279    13283       +4     
+ Partials     2787     2782       -5     

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

@ChrisJBurns ChrisJBurns force-pushed the migrate-toolconfig-referencing-workloads branch from 4379e2c to ed2b9b2 Compare April 2, 2026 18:07
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Apr 2, 2026
…PToolConfig

Migrate MCPToolConfig from plain string server names to structured
WorkloadReference entries (kind + name) per RFC-0023, following the
pattern already implemented on MCPOIDCConfig in PR #4492.

- Replace ReferencingServers []string with ReferencingWorkloads []WorkloadReference
- Add findReferencingWorkloads returning []WorkloadReference
- Update handleDeletion to use DeletionBlocked condition with ReferencedByWorkloads reason
- Update watch handler to check ref.Kind and ref.Name for stale entry cleanup
- Update unit, edge-case, and integration tests for WorkloadReference assertions
- Regenerate deepcopy, CRD manifests, and Helm templates

Closes #4491

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisJBurns ChrisJBurns force-pushed the migrate-toolconfig-referencing-workloads branch from ed2b9b2 to a5baa39 Compare April 2, 2026 18:17
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Apr 2, 2026
@ChrisJBurns ChrisJBurns added the breaks-compatibility A change that breaks compatibility with a previous release label Apr 2, 2026
Comment thread cmd/thv-operator/controllers/toolconfig_controller.go
@ChrisJBurns ChrisJBurns merged commit 5627dcb into main Apr 3, 2026
41 checks passed
@ChrisJBurns ChrisJBurns deleted the migrate-toolconfig-referencing-workloads branch April 3, 2026 13:42
MatteoManzoni pushed a commit to DocPlanner/toolhive that referenced this pull request Apr 4, 2026
…stacklok#4506)

Replace ReferencingServers with structured ReferencingWorkloads on MCPToolConfig

Migrate MCPToolConfig from plain string server names to structured
WorkloadReference entries (kind + name) per RFC-0023, following the
pattern already implemented on MCPOIDCConfig in PR stacklok#4492.

- Replace ReferencingServers []string with ReferencingWorkloads []WorkloadReference
- Add findReferencingWorkloads returning []WorkloadReference
- Update handleDeletion to use DeletionBlocked condition with ReferencedByWorkloads reason
- Update watch handler to check ref.Kind and ref.Name for stale entry cleanup
- Update unit, edge-case, and integration tests for WorkloadReference assertions
- Regenerate deepcopy, CRD manifests, and Helm templates

Closes stacklok#4491

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-compatibility A change that breaks compatibility with a previous release size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants