Skip to content

refactor: rename user/users variables that actually hold service users #1726

Description

@rohilsurana

Problem

In a few places, variables that hold service users are named users, user, or currentUser. That name suggests the human user domain, which is a different thing in Frontier. It is easy to misread.

PR #1719 already fixed this in internal/bootstrap/bootstrapuser.go (the ServiceUserCreator param was renamed usersserviceUsers). This issue tracks the same cleanup for pre-existing code, kept out of that PR to avoid unrelated churn.

Known spots

  • internal/api/v1beta1connect/serviceuser.goListServiceUsers: var users []*frontierv1beta1.ServiceUser and for _, user := range usersList (~lines 43-57)
  • internal/api/v1beta1connect/project.govar users []serviceuser.ServiceUser and var transformedUsers []*frontierv1beta1.ServiceUser (~lines 249, 257)
  • internal/store/postgres/serviceuser_repository.govar transformedUsers []serviceuser.ServiceUser (~line 219)
  • core/serviceuser/service.gocurrentUser for the service user in Sudo/UnSudo (~lines 459-548)

Worth a quick repo-wide sweep for more, e.g.:

grep -rnE "\b(users|user|currentUser)\b.*(serviceuser\.ServiceUser|frontierv1beta1\.ServiceUser)" --include="*.go" .

Suggested naming

Follow the existing convention: serviceUsers for slices, serviceUser (or su in short loops) for single values.

Rename only — no behavior change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions