Skip to content

Handle stale ReferencingWorkloads in telemetry watch handler#4508

Merged
ChrisJBurns merged 1 commit intomainfrom
migrate-telemetryconfig-referencing-workloads
Apr 3, 2026
Merged

Handle stale ReferencingWorkloads in telemetry watch handler#4508
ChrisJBurns merged 1 commit intomainfrom
migrate-telemetryconfig-referencing-workloads

Conversation

@ChrisJBurns
Copy link
Copy Markdown
Collaborator

Summary

The MCPTelemetryConfig types were already migrated to ReferencingWorkloads []WorkloadReference in #4487, but the watch handler in SetupWithManager only enqueued the currently-referenced MCPTelemetryConfig when an MCPServer changed. If a server removed its telemetryConfigRef or was deleted, the previously-referenced config was never re-reconciled, leaving stale entries in ReferencingWorkloads.

This updates the watch handler to also scan all MCPTelemetryConfigs in the namespace and enqueue any that still list the changed server in their ReferencingWorkloads status, matching the pattern from the MCPOIDCConfig controller (#4492).

Partial fix for #4491

Type of change

  • Bug fix

Changes

File Changes
mcptelemetryconfig_controller.go Update watch handler to enqueue configs with stale ReferencingWorkloads entries using ref.Kind == "MCPServer" && ref.Name == server.Name matching, with deduplication via seen map

Test plan

  • Unit tests passing (go test ./cmd/thv-operator/controllers/... -run TelemetryConfig)
  • Operator builds cleanly (go build ./cmd/thv-operator/...)
  • Lint passes

Special notes for reviewers

The types/status migration was already done in #4487. This PR only addresses the watch handler gap that could leave stale refs when servers are deleted or stop referencing a telemetry config.

Generated with Claude Code

The MCPTelemetryConfig watch handler only enqueued the
currently-referenced config when an MCPServer changed. If a
server removed its telemetryConfigRef, the previously-referenced
config was never reconciled to clean up its stale
ReferencingWorkloads entry.

Update the watch handler to also enqueue any MCPTelemetryConfig
that still lists the changed server in ReferencingWorkloads,
matching the pattern already used by MCPOIDCConfig.

Closes #4491

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.09%. Comparing base (a78d9bf) to head (c9cb148).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...rator/controllers/mcptelemetryconfig_controller.go 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4508      +/-   ##
==========================================
+ Coverage   69.04%   69.09%   +0.04%     
==========================================
  Files         502      502              
  Lines       51909    51922      +13     
==========================================
+ Hits        35843    35873      +30     
+ Misses      13279    13264      -15     
+ Partials     2787     2785       -2     

☔ 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 merged commit 2f98143 into main Apr 3, 2026
40 checks passed
@ChrisJBurns ChrisJBurns deleted the migrate-telemetryconfig-referencing-workloads branch April 3, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants