Skip to content

UpdateClient never adds new OAuth2 credentials (duplicate add/update blocks) #54

Open

Description

@brinehart

File: core/csharp/MicroZen.Api/Services/ClientsGrpcService.cs (UpdateClient)

What this is: Mapping a request into updated Client + credentials.

Problem: The two credentialsToUpdate / credentialsToAdd blocks in UpdateClient are identical — both use the same Where(... existing.Any(... ClientId match ...)), so "add" can never add a genuinely new credential (it only keeps ones that already exist) and the two lists are always the same set. New credentials are silently dropped on update.

Fix: The "add" set should be credentials not already present (!client.OAuth2Credentials.Any(...)); the "update" set should be those present. Deduplicate the two near-copy projections into one helper.

If we skip it: Updating a client never adds new OAuth2 credentials.

Activity

  1. added
    Should FixRisky code without a test, real slowness, duplication, or code that should not exist
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Should FixRisky code without a test, real slowness, duplication, or code that should not exist

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions