Skip to content

validateCompositeToolRefs does not set ObservedGeneration consistently with other validation functions #2948

@jhrozek

Description

@jhrozek

Summary

The validateCompositeToolRefs function in virtualmcpserver_controller.go does not call statusManager.SetObservedGeneration() in any of its code paths, unlike all other validation functions in the VirtualMCPServer controller.

Context

All other validation functions in the VirtualMCPServer controller consistently set ObservedGeneration in all code paths:

Function Sets ObservedGeneration?
discoverBackends ✅ Yes (both paths)
validateGroupRef ✅ Yes (all 3 paths)
validateCompositeToolRefs No (none of 4 paths)
validateAndUpdatePodTemplateStatus ✅ Yes (both paths)
validateAndUpdateIncomingAuthStatus ✅ Yes (both paths)
applyStatusDecision ✅ Yes

validateCompositeToolRefs is the only validation function that doesn't set ObservedGeneration in any of its exit paths:

  1. Empty refs (success) - line 307-312
  2. Not found error - line 323-332
  3. Invalid status error - line 339-352
  4. All refs valid (success) - line 363-368

Impact

Without setting ObservedGeneration, it's harder for users to determine whether the controller has processed the current resource spec version when debugging reconciliation issues related to composite tool references.

Recommended Fix

Add statusManager.SetObservedGeneration(vmcp.Generation) to all 4 exit paths in validateCompositeToolRefs to match the pattern used by other validation functions.

Related

Identified during PR review of #2944.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions