Skip to content

Remove config.groupRef fallback and external_auth_config_ref enum#4834

Merged
ChrisJBurns merged 7 commits intomainfrom
chrisburns/remove-groupref-and-external-auth-enum
Apr 15, 2026
Merged

Remove config.groupRef fallback and external_auth_config_ref enum#4834
ChrisJBurns merged 7 commits intomainfrom
chrisburns/remove-groupref-and-external-auth-enum

Conversation

@ChrisJBurns
Copy link
Copy Markdown
Collaborator

@ChrisJBurns ChrisJBurns commented Apr 14, 2026

Summary

Remove deprecated backwards-compatibility code from VirtualMCPServer: the config.groupRef fallback in ResolveGroupName()/Validate() and the external_auth_config_ref snake_case enum value from BackendAuthConfig.Type. Also promotes spec.groupRef from +optional to +kubebuilder:validation:Required.

Closes #4831

Medium level
  • ResolveGroupName() simplified to only return spec.groupRef.name (no fallback to Config.Group)
  • Validate() now requires spec.groupRef.name instead of accepting either field
  • GroupRef promoted from +optional to +kubebuilder:validation:Required — the API server now rejects resources missing groupRef at admission time
  • Converter explicitly sets config.Group = vmcp.ResolveGroupName() after DeepCopy so downstream runtime code still works
  • DeprecatedBackendAuthTypeExternalAuthConfigRef constant removed along with its deprecation warning, kubebuilder enum entry, and switch case handling
  • All test fixtures updated to use GroupRef; redundant Config.Group removed from fixtures
Low level
File Change
cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go Simplify ResolveGroupName(), tighten Validate(), make GroupRef required, remove deprecated constant and enum value, clean up comments
cmd/thv-operator/pkg/vmcpconfig/converter.go Add config.Group = vmcp.ResolveGroupName() after DeepCopy; remove deprecated snake_case handling
pkg/vmcp/config/config.go Update Config.Group comment to reflect current usage (no longer deprecated)
docs/operator/virtualmcpserver-api.md Remove deprecation notes, update examples to use camelCase externalAuthConfigRef
*_test.go (14 files) Add GroupRef to all VirtualMCPServer test fixtures, remove redundant Config.Group, add Validate_RequiresGroupRef test
CRD manifests + crd-api.md Regenerated

Migration guide

This is a breaking change for users of the deprecated fields:

spec.config.groupRefspec.groupRef

Before:

spec:
  config:
    groupRef: "my-group"

After:

spec:
  groupRef:
    name: "my-group"

spec.groupRef is now required — the API server will reject VirtualMCPServer resources that omit it. The old spec.config.groupRef string is no longer read by the operator.

external_auth_config_refexternalAuthConfigRef

Before:

spec:
  outgoingAuth:
    backends:
      my-backend:
        type: external_auth_config_ref

After:

spec:
  outgoingAuth:
    backends:
      my-backend:
        type: externalAuthConfigRef

The snake_case value is no longer accepted by the CRD schema.

Type of change

  • Breaking change

Test plan

  • task lint-fix passes
  • task test passes (operator unit tests)
  • go build ./cmd/... passes
  • CRD manifests and API docs regenerated
  • New unit test TestVirtualMCPServer_Validate_RequiresGroupRef covers nil and empty-name rejection paths

Special notes for reviewers

  • Config.Group in pkg/vmcp/config/config.go is deliberately kept — it is still used by the standalone CLI path. The operator converter populates it from spec.groupRef during conversion.
  • GroupRef is now +kubebuilder:validation:Required (without omitempty), matching the IncomingAuth pattern on the same struct. The Validate() check remains as defense-in-depth for the groupRef: {} edge case.

Generated with Claude Code

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

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.15%. Comparing base (60108a1) to head (230db24).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4834      +/-   ##
==========================================
+ Coverage   69.14%   69.15%   +0.01%     
==========================================
  Files         530      530              
  Lines       55278    55270       -8     
==========================================
+ Hits        38220    38223       +3     
+ Misses      14132    14120      -12     
- Partials     2926     2927       +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.

@ChrisJBurns ChrisJBurns requested a review from amirejaz as a code owner April 14, 2026 23:19
@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 14, 2026
Comment thread cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go
Comment thread cmd/thv-operator/controllers/virtualmcpserver_vmcpconfig_test.go
@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 14, 2026
Copy link
Copy Markdown
Collaborator Author

@ChrisJBurns ChrisJBurns left a comment

Choose a reason for hiding this comment

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

Multi-Agent Consensus Review

Agents consulted: kubernetes-expert, code-reviewer, toolhive-expert

Consensus Summary

# Finding Consensus Severity Action
1 crd-api.md needs rebase (telemetry note conflict) 10/10 MEDIUM Rebase
2 Missing Validate() test for Config.Group-only rejection 8/10 MEDIUM Discuss
3 No migration/upgrade documentation for breaking change 7/10 MEDIUM Discuss
4 Stale test fixtures (DefaultValues, NamespaceIsolation) 10/10 LOW Discuss
5 Redundant Config.Group in controller test fixtures 10/10 LOW Info
6 GroupRef +optional despite being required at runtime 9/10 INFO Info

Overall

Clean deprecation removal that correctly eliminates all three aspects of the backwards-compatibility code: the Go constant, the kubebuilder enum value, and the fallback logic. The converter bridge (config.Group = vmcp.ResolveGroupName()) is well-placed and follows the established pattern of overriding authoritative fields after DeepCopy.

The main concern is that the PR branch appears to predate the telemetry deprecation note addition to crd-api.md on main, which will likely cause a merge conflict on the config field description line. The fix is straightforward — rebase and regenerate. The two MEDIUM test/docs findings are worth discussing but not blocking: adding a Validate() test for the specific breaking-change path would strengthen coverage, and migration guidance would help users upgrading from the deprecated patterns.

Additional Findings (not in diff)

  • [LOW] Stale test fixtures (F4): TestVirtualMCPServerDefaultValues (~line 140) and TestVirtualMCPServerNamespaceIsolation (~line 167) in virtualmcpserver_types_test.go still construct fixtures using only Config.Group without GroupRef. These tests don't call Validate() so they pass, but they represent stale patterns inconsistent with the rest of the PR. Adding GroupRef to these two tests would be a minimal fix.

Generated with Claude Code

Comment thread docs/operator/crd-api.md
Comment thread cmd/thv-operator/api/v1alpha1/virtualmcpserver_types_test.go
Comment thread cmd/thv-operator/controllers/virtualmcpserver_controller_test.go
Comment thread cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go Outdated
@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 14, 2026
@ChrisJBurns ChrisJBurns force-pushed the chrisburns/remove-groupref-and-external-auth-enum branch from d95da04 to ddfc9e9 Compare April 14, 2026 23:55
@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 14, 2026
rdimitrov
rdimitrov previously approved these changes Apr 15, 2026
ChrisJBurns and others added 5 commits April 15, 2026 12:33
Remove the deprecated config.groupRef fallback from ResolveGroupName()
and Validate() on VirtualMCPServer. The converter now explicitly sets
config.Group from spec.groupRef so downstream runtime code still works.

Remove the deprecated DeprecatedBackendAuthTypeExternalAuthConfigRef
constant ("external_auth_config_ref") from the kubebuilder enum, the
converter's deprecation handling, and the Validate() switch case.

Update all test fixtures to use spec.GroupRef instead of Config.Group.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The field is no longer deprecated — it is actively used by the
standalone CLI and populated by the operator converter from
spec.groupRef.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The E2E tests were creating VirtualMCPServer objects with only
Config.Group and no spec.groupRef, causing validation failures
now that the config.groupRef fallback is removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ixtures

Make GroupRef +kubebuilder:validation:Required on VirtualMCPServer (F6),
matching the IncomingAuth pattern. The API server now rejects resources
missing groupRef at admission time.

Add TestVirtualMCPServer_Validate_RequiresGroupRef covering nil and
empty-name rejection paths (F2).

Fix stale DefaultValues and NamespaceIsolation fixtures to use GroupRef
instead of Config.Group (F4).

Remove redundant Config.Group from all controller test fixtures that
already have GroupRef, and replace direct Spec.Config.Group reads with
ResolveGroupName() (F5).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisJBurns ChrisJBurns force-pushed the chrisburns/remove-groupref-and-external-auth-enum branch from ddfc9e9 to cbf98ef Compare April 15, 2026 11:35
@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 15, 2026
22 E2E test files were creating VirtualMCPServer objects directly
(not via helpers) without GroupRef. Now that the CRD schema requires
groupRef at admission time, these all fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisJBurns ChrisJBurns force-pushed the chrisburns/remove-groupref-and-external-auth-enum branch from cbf98ef to f35496e Compare April 15, 2026 11:49
@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 15, 2026
21 integration test fixtures in test-integration/ were creating
VirtualMCPServer objects without spec.groupRef, causing admission
failures now that the field is required.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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 15, 2026
@ChrisJBurns ChrisJBurns merged commit cafa963 into main Apr 15, 2026
95 of 97 checks passed
@ChrisJBurns ChrisJBurns deleted the chrisburns/remove-groupref-and-external-auth-enum branch April 15, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove config.groupRef fallback and external_auth_config_ref enum

2 participants