Skip to content

Code quality: Rename credentialId to clusterId in ClustersClient methods #567

@tnaum-ms

Description

@tnaum-ms

Problem

Two methods in ClustersClient.ts use credentialId as a parameter name for what is semantically a clusterId — the stable cluster identifier used for cache lookups:

  • exists(credentialId: string) — line 431
  • deleteClient(credentialId: string) — line 445

This is inconsistent with:

  1. The Cluster ID Architecture documented in copilot-instructions.md which marks clusterId as the correct stable key for CredentialCache and ClustersClient
  2. Other ClustersClient methods: getClient(clusterId), getExistingClient(clusterId)
  3. All methods in CredentialCache.ts which consistently use clusterId

Investigation

  • CredentialCache.ts: All 10+ methods use clusterId consistently ✅
  • ClustersClient.ts: 2 of 4 methods use credentialId ❌, 2 use clusterId

The inconsistency appears to be a naming oversight — functionally, both parameters are used as keys into the same _clients Map which is keyed by clusterId.

Recommendation

Rename the parameter from credentialId to clusterId in both methods. This is a purely cosmetic rename with no functional impact but improves code clarity and alignment with the documented architecture.

Context

Identified during PR #508 review (Finding M10).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In review

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions