Skip to content

fix(catalog): clear named queries on re-merge and deep-copy to prevent caller mutation - #3081

Open
pboyd wants to merge 1 commit into
kubeflow:mainfrom
pboyd:removed-named-queries
Open

fix(catalog): clear named queries on re-merge and deep-copy to prevent caller mutation#3081
pboyd wants to merge 1 commit into
kubeflow:mainfrom
pboyd:removed-named-queries

Conversation

@pboyd

@pboyd pboyd commented Aug 12, 2026

Copy link
Copy Markdown
Member

Description

Named queries in MCPSourceCollection, SourceCollection, and AgentSourceCollection were accumulated in a flat map with no per-origin tracking, so entries from a source persisted even after the source's config was re-parsed without any named queries. Replace the flat map with per-origin storage (namedQueryEntries) and compute the merged view on read, mirroring the existing pattern for sources.

Also clone the namedQueries map and its nested FieldFilter.Value slices before storing them, so a caller mutating the map after Merge()/MergeWithNamedQueries() can no longer corrupt internal state or race with reads of the merged result.

How Has This Been Tested?

On a local dev cluster.

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.

…t caller mutation

Named queries in MCPSourceCollection, SourceCollection, and
AgentSourceCollection were accumulated in a flat map with no
per-origin tracking, so entries from a source persisted even after
the source's config was re-parsed without any named queries. Replace
the flat map with per-origin storage (namedQueryEntries) and compute
the merged view on read, mirroring the existing pattern for sources.

Also clone the namedQueries map and its nested FieldFilter.Value
slices before storing them, so a caller mutating the map after
Merge()/MergeWithNamedQueries() can no longer corrupt internal state
or race with reads of the merged result.

Assisted-by: Claude
Signed-off-by: Paul Boyd <paul@pboyd.io>
@google-oss-prow
google-oss-prow Bot requested review from chambridge and fege August 12, 2026 18:01
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from pboyd. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant