registry icon indicating copy to clipboard operation
registry copied to clipboard

Define and enforce case-only name collision policy for GitHub server identities

Open xixi-box opened this issue 1 month ago • 1 comments

Summary

Follow-up to #1788 and the discussion in #689.

GitHub user and organization identifiers are case-insensitive, while the Registry preserves mixed-case server names. #1788 addresses authorization by matching the GitHub owner portion of io.github.<owner>/* grants without regard to case. It deliberately does not canonicalize persisted server identities.

The persistence path currently keys versions and publish locks by the supplied server_name. Depending on the storage constraints and existing data, this can allow io.github.Foo/tool and io.github.foo/tool to become independent records, even though they refer to the same GitHub owner. Simply lowercasing existing names would break stable registry identities and existing publishers.

Proposed investigation / acceptance criteria

  • Audit existing io.github.* records for names that differ only by case before introducing a constraint; decide how existing collisions should be treated.
  • Specify which portions of a GitHub server name should be case-insensitive for uniqueness (owner only vs. complete name) without silently changing existing stored names or URL identities.
  • Preserve the exact stored name across subsequent versions; avoid rewriting published records.
  • Prevent publishing a new case-only alias for an existing identity, including concurrent publishes. Consider canonicalized advisory lock keys and a transaction-safe database constraint/check, not an application-only pre-check.
  • Add tests covering legacy mixed-case records, new case-only aliases, distinct owners, normal version updates, and concurrent publication.
  • Keep other namespace types' uniqueness/matching behavior unchanged unless explicitly designed otherwise.

Scope

This issue concerns storage-level identity and concurrency, not the publish authorization 403 resolved in #1788. As requested in the PR review, the storage policy should be considered separately rather than delaying that compatibility fix.

References: #689, #1788, #1623.

xixi-box avatar Nov 05 '26 14:11 xixi-box

Ran a read-only full pagination audit of production (https://registry.modelcontextprotocol.io/v0.1/servers, both default and include_deleted=true, latest and all versions, 0 duplicates / clean cursor termination) on 2026-11-19 UTC to quantify the first bullet before any constraint or migration is designed.

Production counts (include_deleted=true = full DB view)

  • All servers: 68,875 unique names / 276,301 version rows (default non-deleted: 67,180 names / 271,453 rows).
  • io.github.*: 38,176 unique names / 167,266 version rows (non-deleted: 37,028 names / 163,930 rows). 10,070 (26.4%) contain uppercase characters (10,020 in owner, 119 in repo name).
  • Non-io.github.*: 30,699 unique names — 0 full-name and 0 namespace-level case-only collisions.

1. io.github.* full-name case-only collisions: 11 pairs (22 servers, 69 version rows)

9 pairs are active / active, and 2 are deleted / active (only visible with include_deleted=true). 9 differ in owner casing only; 2 differ only in the repo/server-name part:

Lowercased name Diff Variants (versions, status, latest) Version overlap
io.github.aggrete/aggrete owner Aggrete/aggrete (7, active, 0.8.3) vs aggrete/aggrete (10, active, 0.13.4) —
io.github.atlasent/mcp-server owner AtlaSent/mcp-server (9, active, 2.21.0) vs Atlasent/mcp-server (5, active, 2.16.0) —
io.github.clocknext/mcp owner ClockNext/mcp (2, active, 0.6.0) vs Clocknext/mcp (9, active, 0.13.0) —
io.github.cohexa-ai/stale-write-guard-fs owner Cohexa-ai/... (3, active, 0.14.1) vs cohexa-ai/... (2, active, 0.16.1) —
io.github.ddter/roamdial owner DDTer/roamdial (2 active + 1 del, 1.0.2) vs ddter/roamdial (1, active, 1.0.2) 1.0.2
io.github.localsynapse/localsynapse-mcp repo LocalSynapse/LocalSynapse-mcp (1, active, 2.1.0) vs .../localsynapse-mcp (1, active, 2.1.0) 2.1.0
io.github.roomza-inc/roomza owner Roomza-Inc/roomza (1, deleted, 1.0.0) vs roomza-inc/roomza (3, active, 1.1.0) 1.0.0
io.github.sceneview/mcp owner SceneView/mcp (1, active, 3.4.4) vs sceneview/mcp (2, active, 3.4.7) —
io.github.silbercue/silbercueswift owner Silbercue/silbercueswift (2, active, 3.6.3) vs silbercue/silbercueswift (1, active, 0.2.0) —
io.github.utilify-io/utilify-mcp owner Utilify-io/utilify-mcp (1, deleted, 0.1.0) vs utilify-io/utilify-mcp (2, active, 0.1.1) 0.1.0
io.github.zuga-luga/zugabot repo Zuga-luga/Zugabot (2, active, 1.1.0) vs Zuga-luga/zugabot (1, active, 1.0.0) 1.0.0

2. io.github.* owner-namespace case-only collisions: 10 owners (out of 18,511 lower(owner))

8 are active / active, 2 are deleted / active (roomza-inc, utilify-io), 0 involve deprecated.

  • 9 are the exact owner-casing pairs above (ddter also has ddter/china-shebao; silbercue also has Silbercue/public-browser).
  • Only 1 owner mixes casing strictly across different repos: io.github.FabianIMV/voice-coach-mcp (2 active) and io.github.fabianimv/madeleine (3 active).

Migration & locking notes (checked at 115f85225c9f)

  • Watch out for is_latest = true on deleted servers: recalculateLatest (internal/service/registry_service.go:349-354) intentionally leaves is_latest = true on the highest deleted version when all versions are deleted. Both Roomza-Inc/roomza and Utilify-io/utilify-mcp currently have isLatest: true on their deleted rows, so a partial unique index keyed only on WHERE is_latest = true (like idx_unique_latest_per_server in 009_separate_official_metadata.sql:194-196) would fail on all 11 pairs (or 9 under owner-only), not just the active ones, unless status != 'deleted' is also considered or legacy pairs are reconciled/exempted.
  • Scope trade-off: Complete-name (lower(server_name)) vs. owner-only uniqueness differs by just 2 active legacy pairs (LocalSynapse, Zuga-luga); canonicalizing AcquirePublishLock / hashServerName (internal/database/postgres.go:941-968) to match the chosen uniqueness key will close the concurrent-publish race.

AI assistance disclosure: An AI assistant was used to run the read-only pagination audit script, inspect the registry schema/locking code, and draft this comment.

KilianTheMagnificent avatar Nov 19 '26 04:11 KilianTheMagnificent