wso2 / wso2/api-platform

Scope in-memory uniqueness maps by Kind in ConfigStore

Open
#1,323 1 comment 0 reactions 1 assignee View on GitHub

@renuka-fernando is already working on this.

Since Mar 8, 2026.

Area/Gateway Type/Bug
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Description

The in-memory uniqueness maps cs.handle and cs.nameVersion in ConfigStore (gateway/gateway-controller/pkg/storage/memory.go) enforce global uniqueness across all configuration kinds, but GetByKindAndHandle and GetByKindNameAndVersion scope their lookups by Kind. This means two configurations of different kinds (e.g., RestApi and LlmProvider) with the same handle or name:version would incorrectly conflict on Add, even though they are logically distinct.

Expected behavior: Uniqueness for handle and name:version should be enforced per-Kind. A RestApi with handle "my-api" and an LlmProvider with handle "my-api" should coexist.

Actual behavior: The second Add call fails with ErrConflict because the maps are flat (handle → UUID, name:version → UUID) without Kind scoping.

Fix: Update cs.handle and cs.nameVersion to use composite keys that include cfg.Kind (e.g., kind:handle and kind:displayName:version). Update Add, Update, Delete, and the Kind-scoped retrieval functions accordingly. The cross-kind GetByHandle and GetByNameVersion should fall back to scanning cs.configs.

Version

No response

Related Issue

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.