Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

OSAC-1532: Update cli references to use tenant, update tenant table/display - #781

Merged
openshift-merge-bot[bot] merged 3 commits into
osac-project:mainfrom
DakCrowder:osac-1532/update-cli-to-use-tenants
Jun 26, 2026
Merged

openshift-merge-bot[bot] merged 3 commits into
osac-project:mainfrom
DakCrowder:osac-1532/update-cli-to-use-tenants

Conversation

@DakCrowder

@DakCrowder DakCrowder commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor
  • Adds tenant display logic to the cli commands
  • Modifies organization display column to now read tenant
  • Modifies field under a user to be tenant from org
  • Includes a proto rename (field modified uses the same underlying number) and db migration

Summary by CodeRabbit

  • New Features

    • Tenant is now shown consistently across user and tenant views.
    • Added tenant table support in the UI.
  • Bug Fixes

    • Existing user records now migrate from organization to tenant in stored data.
    • User lists and detail views now use the tenant field consistently.
  • Documentation

    • Updated field descriptions to reflect tenant terminology instead of organization terminology.

@openshift-ci-robot

openshift-ci-robot commented Jun 25, 2026 •

Copy link
Copy Markdown

@DakCrowder: This pull request references OSAC-1532 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

  • Adds tenant display logic to the cli commands
  • Modifies organization display column to now read tenant
  • Modifies field under a user to be tenant from org
  • Includes a proto rename (field modified uses the same underlying number) and db migration

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@DakCrowder, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes and 8 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b48bc74f-6905-48b6-b4d5-0b315df80808

📥 Commits

Reviewing files that changed from the base of the PR and between 84453aa and 1c59d57.

📒 Files selected for processing (4)
  • internal/database/migrations/65_rename_organization_to_tenant_in_user_data.up.sql
  • internal/database/migrations/65_rename_organization_to_tenant_in_user_data_test.go
  • internal/servers/private_users_server_test.go
  • internal/servers/users_server_test.go

Walkthrough

This PR renames user JSON data from spec.organization to spec.tenant in a database migration, updates the migration checksum and tests, adds Tenant table renderers, and replaces organization references with tenant references in protobuf comments and server tests.

Changes

Tenant rename across storage and contracts

Layer / File(s) Summary
Database migration and validation
internal/database/migrations/65_rename_organization_to_tenant_in_user_data.up.sql, internal/database/migrations.sha256, internal/database/migrations/65_rename_organization_to_tenant_in_user_data_test.go
users and archived_users rows rename data.spec.organization to data.spec.tenant, the checksum is updated, and the migration test suite covers legacy and already-migrated JSON cases.
Tenant table definitions
internal/rendering/tables/osac.private.v1.Tenant.yaml, internal/rendering/tables/osac.public.v1.Tenant.yaml, internal/rendering/tables/osac.private.v1.User.yaml
New Tenant table YAMLs are added, and the User table changes its document column from ORGANIZATION to TENANT via this.spec.tenant.
User tenant contract and server tests
proto/private/osac/private/v1/user_type.proto, proto/public/osac/public/v1/user_type.proto, internal/servers/private_users_server_test.go, internal/servers/users_server_test.go
User protobuf comments now refer to tenant identity-provider ownership, and server tests create, filter, and assert users with Tenant/GetTenant() instead of organization fields.

Estimated review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

approved, lgtm

Suggested reviewers

  • adriengentil
  • eliorerz
  • jhernand

Poem

A tenant slipped into the schema gate,
Old names of orgs now fade in state.
Tables tuned their quiet song,
Tests marched in and proved it strong.
One checksum hummed, then wandered free,
💫 tenant-shaped and tidy as can be.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Hardcoded-Secrets ❌ Error Hardcoded passwords are present in test fixtures (password := "secret123"), which matches the check’s secret pattern. Replace literal passwords with generated/test-only values from helpers or constants that are clearly non-secret, or reuse approved admin/admin defaults if applicable.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main change: switching CLI references and table/display labels from organization to tenant.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Weak-Crypto ✅ Passed PASS: The only crypto-looking change is a SHA-256 checksum file; no MD5/SHA1/DES/RC4/ECB, custom crypto, or secret comparisons appear in the touched files.
No-Injection-Vectors ✅ Passed No injection vectors found: the migration uses static SQL with parameterized $1 inputs, and the YAML/proto/test changes contain no eval/exec/load/shell or string-concat sinks.
Container-Privileges ✅ Passed PASS: No touched file contains privileged:true, hostPID/hostNetwork/hostIPC, SYS_ADMIN, or allowPrivilegeEscalation:true; the new YAML files are table configs, not pod specs.
No-Sensitive-Data-In-Logs ✅ Passed No changed file adds logging of secrets/PII; the PR only updates migrations, proto/docs, table config, and tests with logger setup but no new log output.
Ai-Attribution ✅ Passed HEAD commit includes the Red Hat AI trailer "Assisted-by: Claude Code" and no AI-related Co-Authored-By trailer was found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
internal/servers/private_users_server_test.go (1)

38-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert Tenant on the create response.

This test now sends Spec.Tenant, but it never verifies that the private create path returns/persists it. If the rename is dropped anywhere below the request boundary, this still passes.

Suggested assertion
 		Expect(response.Object.Id).ToNot(BeEmpty())
 		Expect(response.Object.Metadata.Name).To(Equal("test-user"))
 		Expect(response.Object.Spec.Username).To(Equal("testuser"))
+		Expect(response.Object.Spec.Tenant).To(Equal("org-123"))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/servers/private_users_server_test.go` around lines 38 - 65, The
private user create test in privateServer.Create currently verifies the returned
object fields but not Spec.Tenant, so it can miss a dropped tenant mapping.
Update the Create request assertion block to check that the response object’s
Spec.Tenant matches the input tenant, alongside the existing checks for
Metadata.Name and Spec.Username, using the privateServer.Create and
response.Object symbols to locate the test.
internal/servers/users_server_test.go (1)

40-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert Tenant in the public create test too.

The request now populates Spec.Tenant, but the test still only checks unrelated fields. Add a response assertion so the public server coverage actually proves the rename survives the create flow.

Suggested assertion
 		Expect(response.Object.Id).ToNot(BeEmpty())
 		Expect(response.Object.Metadata.Name).To(Equal("test-user"))
 		Expect(response.Object.Spec.Username).To(Equal("testuser"))
+		Expect(response.Object.Spec.Tenant).To(Equal("org-123"))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/servers/users_server_test.go` around lines 40 - 67, The public
create test in UsersServer currently sets Spec.Tenant but never verifies it in
the returned object, so update the Create flow assertions to check the response
preserves that field. Add an assertion alongside the existing response checks in
the UsersServer public create test to confirm response.Object.Spec.Tenant equals
the expected tenant value, using the Create response from publicServer.Create.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@internal/database/migrations/65_rename_organization_to_tenant_in_user_data_test.go`:
- Around line 50-95: Add a new fixture to the migration test table in
65_rename_organization_to_tenant_in_user_data_test.go that includes both
spec.organization and spec.tenant in the same user payload. Update the
expectations to assert the migration preserves the existing spec.tenant value
while removing the legacy organization key, and place it alongside the other
cases in the test entries for the migration behavior.

In
`@internal/database/migrations/65_rename_organization_to_tenant_in_user_data.up.sql`:
- Around line 17-23: The migration update in the users data rewrite is
overwriting an existing spec.tenant when spec.organization is still present;
adjust the jsonb_set logic so the legacy spec.organization key is removed but
spec.tenant is only populated when it does not already exist. Use the update
statement in the migration to preserve existing tenant values and only map
organization into tenant for rows that lack spec.tenant.

---

Outside diff comments:
In `@internal/servers/private_users_server_test.go`:
- Around line 38-65: The private user create test in privateServer.Create
currently verifies the returned object fields but not Spec.Tenant, so it can
miss a dropped tenant mapping. Update the Create request assertion block to
check that the response object’s Spec.Tenant matches the input tenant, alongside
the existing checks for Metadata.Name and Spec.Username, using the
privateServer.Create and response.Object symbols to locate the test.

In `@internal/servers/users_server_test.go`:
- Around line 40-67: The public create test in UsersServer currently sets
Spec.Tenant but never verifies it in the returned object, so update the Create
flow assertions to check the response preserves that field. Add an assertion
alongside the existing response checks in the UsersServer public create test to
confirm response.Object.Spec.Tenant equals the expected tenant value, using the
Create response from publicServer.Create.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b0af2672-07fb-4b25-909f-2270dfa978c6

📥 Commits

Reviewing files that changed from the base of the PR and between 59f6043 and 84453aa.

⛔ Files ignored due to path filters (4)
  • internal/api/osac/private/v1/user_type.pb.go is excluded by !**/*.pb.go
  • internal/api/osac/private/v1/user_type_protoopaque.pb.go is excluded by !**/*.pb.go
  • internal/api/osac/public/v1/user_type.pb.go is excluded by !**/*.pb.go
  • internal/api/osac/public/v1/user_type_protoopaque.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (10)
  • internal/database/migrations.sha256
  • internal/database/migrations/65_rename_organization_to_tenant_in_user_data.up.sql
  • internal/database/migrations/65_rename_organization_to_tenant_in_user_data_test.go
  • internal/rendering/tables/osac.private.v1.Tenant.yaml
  • internal/rendering/tables/osac.private.v1.User.yaml
  • internal/rendering/tables/osac.public.v1.Tenant.yaml
  • internal/servers/private_users_server_test.go
  • internal/servers/users_server_test.go
  • proto/private/osac/private/v1/user_type.proto
  • proto/public/osac/public/v1/user_type.proto

@DakCrowder

Copy link
Copy Markdown
Contributor Author

/hold

Assisted-by: Claude Code

OSAC-1532: Update db migration hash
@DakCrowder
DakCrowder force-pushed the osac-1532/update-cli-to-use-tenants branch from eebf991 to 1c59d57 Compare June 25, 2026 21:19
@DakCrowder

Copy link
Copy Markdown
Contributor Author

/unhold

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DakCrowder, jhernand

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 075185e into osac-project:main Jun 26, 2026
14 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants