Skip to content

fix(tenant-manager): tenant renames reach the api-core tenant - #6102

Merged
Pavel910 merged 2 commits into
release/6.5.1from
issue/6mh312
Oct 23, 2026
Merged

Pavel910 merged 2 commits into
release/6.5.1from
issue/6mh312

Conversation

@Pavel910

Copy link
Copy Markdown
Collaborator

Renaming a tenant or changing its description in Tenant Manager now also updates the api-core Tenant. Before this change, Tenant Manager saved those edits to its wbyTenant CMS entry, but nothing passed them on to api-core, so the platform kept showing the old name. A new EntryAfterUpdate handler does that now. It follows the same pattern as the existing DeleteTenantOnEntryDelete feature.

What changed

Tenant Manager API (packages/tenant-manager/src/api)

  • New SyncTenantOnEntryUpdate feature, registered in api/Extension.ts right after DeleteTenantOnEntryDeleteFeature. Its handler only acts on wbyTenant entries (TENANT_MODEL_ID). It calls api-core's UpdateTenantUseCase with { name, description } from entry.values and uses entry.entryId as the tenant id.
  • The handler only syncs when name or description is different from original.values. DisableTenantUseCase/EnableTenantUseCase update api-core first and then save only status on the CMS entry. Those saves also fire this handler, which skips them, so status stays with the flows that already handle it. No other fields are synced.
  • If the api-core update returns a failed result or throws, the handler logs it as Failed to update tenant <id>! and does not rethrow. The CMS save still succeeds, but the api-core tenant can end up out of sync with the entry. The delete handler behaves the same way.
  • Nothing else changes: no migration, no config change, and no change to any public API. The frontend repository (website-builder-nextjs) has no changes on this branch.

How it was checked

  • New package test packages/tenant-manager/__tests__/syncTenantOnEntryUpdate.test.ts. It registers the feature against a fake api-core UpdateTenantUseCase and publishes EntryAfterUpdateEvents:
    • "should update the api-core tenant name and description when the tenant is renamed"
    • "should update the api-core tenant when only the description changes"
    • "should not update the api-core tenant when only the status changes"
    • "should not update the api-core tenant for entries of other models"
    • "should not fail the entry update when the api-core tenant update fails"
  • One check ran in the app via a script: "After renaming a tenant and changing its description in Tenant Manager, the platform shows the tenant under its new name." It failed once and passed after a fix. In the app, a tenant was renamed after being installed, then the user switched into it, and the header showed the new name.
  • The description isn't shown anywhere in the admin, so only the tests cover the description sync.
  • No reproduction check was run against the code without the fix, because the fix was already in the worktree before the app could run.
  • The safety, "shouldn't break anything else" and language reviews did not run. Disable/enable was not tried again in the app; only the status-only test covers the skip.

🤖 Generated with Claude Code

@Pavel910 Pavel910 added this to the 6.5.1 milestone Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b9343bc5-d2f5-4ebc-b130-c8d168f78bbf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Pavel910
Pavel910 merged commit fb6f864 into release/6.5.1 Oct 23, 2026
7 of 8 checks passed
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.

1 participant