Skip to content

Stop prefixing vector_search_endpoints names#5209

Merged
janniklasrose merged 6 commits intomainfrom
janniklasrose/remove-vsendpoint-prefixing
May 8, 2026
Merged

Stop prefixing vector_search_endpoints names#5209
janniklasrose merged 6 commits intomainfrom
janniklasrose/remove-vsendpoint-prefixing

Conversation

@janniklasrose
Copy link
Copy Markdown
Contributor

@janniklasrose janniklasrose commented May 7, 2026

Changes

  • Stop applying presets.name_prefix (and the dev-mode [dev <user>] rename) to vector_search_endpoints in bundle/config/mutator/resourcemutator/apply_presets.go.
  • Add .agent/rules/name-prefix.md capturing the principle (only prefix display-name fields; never primary-key / object-id Names), scoped via globs to apply_presets.go, apply_target_mode*.go, and bundle/direct/dresources/*.go. Mirror as .cursor/rules/name-prefix.mdc.
  • Rename TestAllNonUcResourcesAreRenamedTestAppropriateResourcesAreRenamed (the carve-out list now includes a non-UC resource), and refactor the long resourceType == OR chain into a slices.Contains over a named slice hoisted to the outer loop.
  • NEXT_CHANGELOG.md entry under Bundles.

Why

The vector search endpoint name is the API primary key — it's how GET, UPDATE, and DELETE address the resource (bundle/direct/dresources/vector_search_endpoint.go: id := config.Name; recreate_on_changes for the resource doesn't list name only because there's no rename API at all, so a name change would silently drift). Prefixing it changed which remote endpoint the bundle pointed at, not just the label the user saw. The rule we want to encode is broader (display-name fields can be prefixed; identity-bearing Names cannot), but this PR only fixes the vector_search_endpoints case to keep the change focused; mlflow Models, ModelServingEndpoints, etc. have the same issue and are tracked for follow-up.

Tests

  • go test ./bundle/config/mutator/resourcemutator/ passes; TestProcessTargetModeDevelopment now asserts vs_endpoint1 (not dev_lennart_vs_endpoint1), and TestAppropriateResourcesAreRenamed includes *resources.VectorSearchEndpoint in the carve-out list and verifies the Name doesn't pick up a dev prefix.
  • Confirmed locally that re-introducing the prefix loop in apply_presets.go causes both the explicit assertion and the reflective sweep to fail with clear diffs.
  • ./task fmt, ./task checks, ./task lint, ./task test clean.

This PR was written by Claude Code.

The vector search endpoint name is the resource's primary key — it's how
GET, UPDATE, and DELETE address it. Prefixing it (via dev-mode or
presets.name_prefix) changes the resource's identity rather than just
its display name, which is the wrong semantic.

Co-authored-by: Isaac
Capture the rule the previous commit relies on: prefixing only applies
to display-name fields, never to fields the API treats as the primary
key / object id. Also point future maintainers at TestAllNonUcResourcesAreRenamed
as the enforcement mechanism.

Co-authored-by: Isaac
…enamed

The carve-out list now includes VectorSearchEndpoint, which isn't a UC
resource, so the old name no longer matches what the test does. Also
refactor the long OR chain that listed resource types to skip into a
slices.Contains over a named slice, hoisted to the outer loop so the
skip happens once per resource type instead of once per instance. Update
the agent rule that referenced the old test name.

Co-authored-by: Isaac
@janniklasrose janniklasrose requested a review from pietern May 7, 2026 13:17
@janniklasrose janniklasrose requested a review from denik May 8, 2026 11:17
Comment thread .agent/rules/name-prefix.md Outdated
To check whether a field is identity-bearing, look at the matching `bundle/direct/dresources/<resource>.go`:

- If `DoCreate` returns the name as the deployment id (e.g. `id := config.Name`) and `DoRead`/`DoUpdate`/`DoDelete` look the resource up by that name, the name is the primary key — do not prefix it.
- If the name is purely cosmetic and the API addresses the resource by a separate id (numeric, UUID, etc.), prefixing is fine.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can shorten this without any loss of signal or even drop this.

The agents are going to read apply_presets.go anyway and should be able figure out from the comments and existing resources what to do for a new one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed and dropped in 6d240dc — checked with both Claude and Cursor (GPT) for a second opinion on whether a rule like this would actually change agent behavior, and both said they would read apply_presets.go and the test first and that the in-code comment + notRenamedFields list with its primary-key rationale is sufficient evidence. The rule was a restatement that got in the way more than it helped.

Per review feedback: the in-code comment in apply_presets.go plus
TestAppropriateResourcesAreRenamed (with its notRenamedFields list and
the "primary key / object id" rationale in the doc comment) carry the
load. The agent rule was largely a restatement and gets in the way more
than it helps. Also remove the dead reference to the file from the test
doc comment.

Co-authored-by: Isaac
@janniklasrose janniklasrose merged commit 3ff74bd into main May 8, 2026
23 of 25 checks passed
@janniklasrose janniklasrose deleted the janniklasrose/remove-vsendpoint-prefixing branch May 8, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants