Skip to content

refactor: rename service user variables#1802

Open
RushikeshBhavsar3605 wants to merge 1 commit into
raystack:mainfrom
RushikeshBhavsar3605:fix/service-user-variable-naming
Open

refactor: rename service user variables#1802
RushikeshBhavsar3605 wants to merge 1 commit into
raystack:mainfrom
RushikeshBhavsar3605:fix/service-user-variable-naming

Conversation

@RushikeshBhavsar3605

@RushikeshBhavsar3605 RushikeshBhavsar3605 commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Renames variables that hold service users to use explicit service user naming, avoiding confusion with human users.

Closes #1726

Changes

  • Renamed user, users, and currentUser variables that represent service users.
  • Used serviceUser/serviceUsers naming and su in short loops.
  • Updated additional occurrences found during the repo-wide sweep.
  • No behavior changes.

Technical Details

This is a naming-only refactor. No application logic or SQL queries were changed.

Test Plan

  • Manual testing completed

  • Build and type checking passes

  • Verified the repo-wide sweep for remaining service-user naming occurrences.

SQL Safety (if your PR touches *_repository.go or goqu.*)

No SQL/query logic was changed.

  • Values flow through ? placeholders, goqu.Ex{}, or goqu.Record{} — never fmt.Sprintf or + building a query that gets executed.
  • ToSQL() callers capture and forward params (query, params, err := stmt.ToSQL(); db.…Context(ctx, …, query, params...)). Never query, _, err := ….
  • No ? placeholders inside single-quoted SQL literals in goqu.L (use make_interval(hours => ?)-style functions instead).
  • Any //nolint:forbidigo or // #nosec G20x annotation has a one-line justification on the same line that a reviewer can verify.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

@RushikeshBhavsar3605 is attempting to deploy a commit to the Raystack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f96f838b-96b3-4665-8ef8-ae6f58155b0c

📥 Commits

Reviewing files that changed from the base of the PR and between b6871a1 and 78159c5.

📒 Files selected for processing (5)
  • core/serviceuser/service.go
  • internal/api/v1beta1connect/project.go
  • internal/api/v1beta1connect/serviceuser.go
  • internal/store/postgres/serviceuser_repository.go
  • test/e2e/regression/serviceusers_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/e2e/regression/serviceusers_test.go
  • internal/api/v1beta1connect/serviceuser.go
  • core/serviceuser/service.go
  • internal/api/v1beta1connect/project.go

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Improved consistency across service-user listing, impersonation (sudo/unsudo), and platform relation handling.
    • Enhanced error context when service-user data fails to transform during retrieval.
  • Tests
    • Updated end-to-end service-user listing assertions to use clearer local variable naming, without changing test behavior.

Walkthrough

Changes

Service-user naming cleanup

Layer / File(s) Summary
Core service-user flow
core/serviceuser/service.go
Renames service-user identifiers in organization listing and sudo/unsudo operations while preserving logic.
API response transformations
internal/api/v1beta1connect/project.go, internal/api/v1beta1connect/serviceuser.go
Renames service-user collection and loop variables in listing handlers without changing response shapes or error handling.
Repository and regression alignment
internal/store/postgres/serviceuser_repository.go, test/e2e/regression/serviceusers_test.go
Clarifies the repository transform error and service-user predicate parameter names.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: rohilsurana

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR renames service-user variables in the linked files and preserves behavior, matching the naming-only cleanup in #1726.
Out of Scope Changes check ✅ Passed All changes are limited to variable renames and related test variable names, with no behavior or SQL changes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmanGIT07
AmanGIT07 requested a review from rohilsurana July 24, 2026 09:23
@RushikeshBhavsar3605
RushikeshBhavsar3605 force-pushed the fix/service-user-variable-naming branch from b6871a1 to 78159c5 Compare July 25, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant