• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 23951051179

03 Apr 2026 03:11PM UTC coverage: 65.338% (+0.03%) from 65.309%
23951051179

push

github

web-flow
Extract shared WorkloadReference helpers into controllerutil (#4520)

* Extract shared WorkloadReference helpers into controllerutil

The ReferencingWorkloads pattern was duplicated across four config
controllers with inconsistent sorting behavior: MCPTelemetryConfig and
MCPExternalAuthConfig sorted refs, but MCPToolConfig and MCPOIDCConfig
did not. This caused unnecessary API server writes when the same set of
workloads was discovered in a different list order across reconcile runs.

Extract SortWorkloadRefs, WorkloadRefsEqual, and
FindWorkloadRefsFromMCPServers into the shared controllerutil package
so all controllers use deterministic, consistent ordering. Each
controller's findReferencingWorkloads now delegates to the shared
helper, removing ~50 lines of duplicated list-filter-build logic.

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

* Add WorkloadKind constants to replace string literals

Define WorkloadKindMCPServer, WorkloadKindVirtualMCPServer, and
WorkloadKindMCPRemoteProxy constants in the API types and use them
across all controllers. This fixes a goconst lint violation where
"MCPServer" appeared as a raw string literal 4+ times.

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

57 of 67 new or added lines in 7 files covered. (85.07%)

11 existing lines in 4 files now uncovered.

54399 of 83258 relevant lines covered (65.34%)

63.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/pkg/vmcp/server/sessionmanager/cache.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc