Skip to content

fix: keep stored metadata when a project, group or user update does not set it #2030

Open

Description

@rohilsurana

Problem

When a project, group or user is updated, the whole metadata column is replaced with what the request sends. If a client leaves metadata out, the stored keys are wiped. #2019 fixed this for organizations. The other entities still have the bug.

Where it happens

  • Project: UpdateByID and UpdateByName in internal/store/postgres/project_repository.go, called from UpdateProject.
  • Group: UpdateByID in internal/store/postgres/group_repository.go, called from UpdateGroup.
  • User: UpdateByID and UpdateByEmail in internal/store/postgres/user_repository.go, called from UpdateUser and UpdateCurrentUser.
  • User UpdateByName is different. It skips metadata when the map is empty, so metadata can't be cleared on purpose.

Expected behavior

Same as organizations after #2019:

  • If metadata is not set in the request, the stored metadata stays and schema validation is skipped.
  • If metadata is set, it replaces the stored value. An empty {} clears it.

Tests

  • Handler, repository and e2e tests for three cases: not set, replaced, cleared.

Out of scope

  • Title and avatar are also replaced when omitted. That needs its own fix.

Activity

  1. rohilsurana commented on Oct 27, 2026

    @rohilsurana
    MemberAuthor

    We also need to make sure none of our UI components send {} by mistake. Else it would clear it anyways even after the fix.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions