Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Dec 23, 2025

As per SUP-871, this PR fixes the issue where "Workspace not registered" incorrectly shows for all users with access to the workspace administration page, even when the workspace is actually registered.

Proposed changes (including videos or screenshots)

  • API endpoint: Changed /v1/cloud.registrationStatus authorization from admin role to manage-cloud permission (aligns with frontend)
  • Hook: Exposed canViewRegistrationStatus flag and fixed typo (canViewregistrationStatus -> canViewRegistrationStatus)
  • VersionCard.tsx: Conditionally display registration status only when canViewRegistrationStatus is true
  • SubscriptionPage.tsx: Show "Sync license update" button based on canViewRegistrationStatus instead of isRegistered

Issue(s)

Steps to test or reproduce

  1. Ensure your workspace is registered with Rocket.Chat Cloud
  2. Create a user with access to the admin info page but WITHOUT the manage-cloud permission
  3. Log in as that user and navigate to /admin/info

Before: "Workspace not registered" shows incorrectly even though workspace is registered
After: Registration status is hidden for users without manage-cloud permission (no false "not registered" message)

Summary by CodeRabbit

  • Bug Fixes

    • Fixed authorization so registration status is gated by the appropriate permission; UI now shows registration actions only to permitted users.
  • Tests

    • Added unit and end-to-end tests covering registration-status permission and API behavior.
  • Changelog

    • Added a release note entry documenting the permission-related patch.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

🦋 Changeset detected

Latest commit: 0282b05

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

Replaced a role-based authorization check with a permission-based check for cloud.registrationStatus and propagated that change through the client hook, affected UI components, tests, and changelog to align access with the manage-cloud permission (instead of the admin role).

Changes

Cohort / File(s) Summary
API Authorization
apps/meteor/app/api/server/v1/cloud.ts
Replaced hasRoleAsync(..., 'admin') with hasPermissionAsync(..., 'manage-cloud'); updated import from hasRolehasPermission.
Client Hook
apps/meteor/client/hooks/useRegistrationStatus.ts, apps/meteor/client/hooks/useRegistrationStatus.spec.ts
Hook now exposes canViewRegistrationStatus (casing fix); query guards use this permission; added unit tests covering permission scenarios.
UI Components
apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx, apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
Conditional rendering and action/button visibility switched to rely on canViewRegistrationStatus; memo dependencies updated to include the flag.
End-to-end Tests
apps/meteor/tests/end-to-end/api/cloud.ts
Added e2e tests verifying 401 unauthenticated, 403 unauthorized (no manage-cloud), and 200 authorized responses for the registrationStatus endpoint.
Changelog
.changeset/little-steaks-itch.md
Added changelog entry documenting the permission fix and alignment of API/UI with manage-cloud.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • tassoevan

Poem

🐰 Hopping through code with a twitch and a twitch,
Swapped admin for manage-cloud — a clean little switch,
Hooks and UI now peek where permissions are set,
Tests nod and pass, no surprises to fret,
A tiny carrot of change — polished and lit!

🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR addresses SUP-871 by implementing permission-based access control for workspace registration status across API, hooks, and UI, though the linked issue lacks detailed coding requirements. Review SUP-871 to confirm all coding requirements are fully addressed and that the manage-cloud permission scope is appropriate.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing permission checks for workspace registration status visibility, matching the code changes in API, hook, and UI components.
Out of Scope Changes check ✅ Passed All changes are scope-aligned: API authorization correction, hook exposure of canViewRegistrationStatus, UI updates to respect permissions, tests, and changelog. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/workspace-registration-status

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 and usage tips.

@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.62%. Comparing base (5fa1509) to head (0282b05).
⚠️ Report is 85 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37951      +/-   ##
===========================================
- Coverage    70.63%   70.62%   -0.02%     
===========================================
  Files         3143     3146       +3     
  Lines       108693   108853     +160     
  Branches     19577    19557      -20     
===========================================
+ Hits         76779    76876      +97     
- Misses       29904    29968      +64     
+ Partials      2010     2009       -1     
Flag Coverage Δ
e2e 60.21% <75.00%> (+0.05%) ⬆️
e2e-api 47.45% <ø> (+0.06%) ⬆️
unit 71.70% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/10 13:51 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37951
  • Baseline: develop
  • Timestamp: 2026-01-10 13:51:13 UTC
  • Historical data points: 30

Updated: Sat, 10 Jan 2026 13:51:13 GMT

@ricardogarim ricardogarim marked this pull request as ready for review December 23, 2025 18:49
@ricardogarim ricardogarim requested review from a team as code owners December 23, 2025 18:49
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx">

<violation number="1" location="apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx:51">
P1: The `isRegistered` value will be `undefined` during loading, which is falsy and will incorrectly show &quot;Workspace not registered&quot; until the data loads. Consider destructuring `isPending` from `useIsRegistered()` and including it in the loading condition, or defaulting `isRegistered` to handle the loading state.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/client/hooks/useIsRegistered.ts (1)

8-14: Consider simplifying the query function.

The queryFn wraps the result in a new object, but the endpoint already returns { isRegistered: boolean }. You can return the result directly.

🔎 Proposed simplification
 	return useQuery({
 		queryKey: ['cloud', 'isRegistered'],
-		queryFn: async () => {
-			const result = await getIsRegistered();
-			return { isRegistered: result.isRegistered };
-		},
+		queryFn: getIsRegistered,
 		staleTime: Infinity,
 	});
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a8a84ab and b2c5dd9.

📒 Files selected for processing (6)
  • .changeset/polite-oranges-attack.md
  • apps/meteor/app/api/server/v1/cloud.ts
  • apps/meteor/client/hooks/useIsRegistered.ts
  • apps/meteor/client/hooks/useRegistrationStatus.ts
  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
  • apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
💤 Files with no reviewable changes (1)
  • apps/meteor/client/hooks/useRegistrationStatus.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
  • apps/meteor/app/api/server/v1/cloud.ts
  • apps/meteor/client/hooks/useIsRegistered.ts
  • apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
🧠 Learnings (3)
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • .changeset/polite-oranges-attack.md
📚 Learning: 2025-12-02T22:23:49.593Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37654
File: apps/meteor/client/hooks/useAppSlashCommands.ts:32-38
Timestamp: 2025-12-02T22:23:49.593Z
Learning: In apps/meteor/client/hooks/useAppSlashCommands.ts, the `data?.forEach((command) => slashCommands.add(command))` call during render is intentional. The query is configured with `structuralSharing: false` to prevent React Query from keeping stable data references, and `slashCommands.add` is idempotent, so executing on every render is acceptable and ensures the command registry stays current.

Applied to files:

  • apps/meteor/client/hooks/useIsRegistered.ts
🧬 Code graph analysis (3)
apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx (1)
apps/meteor/client/hooks/useIsRegistered.ts (1)
  • useIsRegistered (5-16)
apps/meteor/app/api/server/v1/cloud.ts (4)
apps/meteor/app/api/server/index.ts (1)
  • API (51-51)
packages/rest-typings/src/v1/Ajv.ts (1)
  • ajv (24-24)
apps/meteor/app/api/server/ApiClass.ts (1)
  • ExtractRoutesFromAPI (73-77)
packages/rest-typings/src/index.ts (1)
  • Endpoints (48-93)
apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx (1)
apps/meteor/client/hooks/useIsRegistered.ts (1)
  • useIsRegistered (5-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🔇 Additional comments (5)
.changeset/polite-oranges-attack.md (1)

1-5: LGTM!

The changeset correctly documents the fix as a patch version bump with a clear description of the issue being resolved.

apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx (1)

34-34: LGTM!

The migration to useIsRegistered is correctly implemented. The optional chaining on registrationData?.isRegistered appropriately handles loading and error states, defaulting to undefined which safely hides the sync button until the registration status is confirmed.

Also applies to: 57-57, 68-68

apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx (1)

50-51: LGTM!

The migration to useIsRegistered is correctly implemented. Note that while the registration status is loading, isRegistered will be undefined, causing !isRegistered (line 86) to evaluate as truthy. This briefly shows the "Register Workspace" button during loading, which is acceptable UX since it resolves quickly.

apps/meteor/app/api/server/v1/cloud.ts (2)

183-210: LGTM!

The new cloud.isRegistered endpoint correctly implements the PR objective. Key observations:

  • Security: authRequired: true without permissionsRequired is intentional, allowing all authenticated users to check registration status. This is appropriate since the endpoint only exposes a single boolean value, not sensitive workspace details.
  • Response schema: Properly validates the response with AJV.
  • Type extraction: Uses ExtractRoutesFromAPI to derive type-safe route definitions.

212-221: LGTM!

The type augmentation correctly extends the Endpoints interface with both the auto-extracted CloudEndpoints and the manually declared /v1/cloud.checkoutUrl route that uses the older addRoute pattern.

Copy link
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

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

what is wrong with the registrationStatus ? Is there no way to fix this by altering this endpoint? It seems to me that it was designed precisely for what we're trying to fix. otherwise will this endpoint no longer be used? Should it be deprecated? I think there should be a changeset about the new endpoint, one about deprecation, and then one about fixing it.

@ricardogarim
Copy link
Contributor Author

ricardogarim commented Dec 23, 2025

what is wrong with the registrationStatus ? Is there no way to fix this by altering this endpoint? It seems to me that it was designed precisely for what we're trying to fix. otherwise will this endpoint no longer be used? Should it be deprecated? I think there should be a changeset about the new endpoint, one about deprecation, and then one about fixing it.

/v1/cloud.registrationstatus intentionally restricts access to admins only. as i understand it, this is to avoid exposing sensitive data, such as the admin email, to any authenticated user.

if we agree that exposing this information more broadly is acceptable, then we could consider reusing the existing endpoint. however, that would result in a breaking change either by removing sensitive fields from the response or by removing the role check, right?

edit: i’ve added the code assuming we move forward with a new route and deprecate the existing one. also, waiting on team’s input on which approach makes more sense, since adjusting the current route would introduce a breaking change.

@dougfabris dougfabris added this to the 8.1.0 milestone Dec 23, 2025
@ricardogarim ricardogarim force-pushed the fix/workspace-registration-status branch from a4ed873 to 284060d Compare December 26, 2025 19:36
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 26, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@ricardogarim ricardogarim force-pushed the fix/workspace-registration-status branch from 284060d to 8bfa2d6 Compare December 26, 2025 19:37
@ricardogarim ricardogarim changed the title fix: allow all authenticated users to view workspace registration status fix: hide workspace registration status from users without manage-cloud permission Dec 26, 2025
@ricardogarim ricardogarim force-pushed the fix/workspace-registration-status branch from 8bfa2d6 to e7c5048 Compare December 26, 2025 19:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/app/api/server/v1/cloud.ts (1)

86-100: Consider using permissionsRequired in route options for consistency.

The manual permission check using hasPermissionAsync works correctly, but other routes in this file use permissionsRequired in the route configuration (lines 42, 58, 68, 106, 126). For consistency and idiomatic code, consider refactoring to:

🔎 Proposed refactor
 API.v1.addRoute(
 	'cloud.registrationStatus',
-	{ authRequired: true },
+	{ authRequired: true, permissionsRequired: ['manage-cloud'] },
 	{
 		async get() {
-			if (!(await hasPermissionAsync(this.userId, 'manage-cloud'))) {
-				return API.v1.forbidden();
-			}
-
 			const registrationStatus = await retrieveRegistrationStatus();
 
 			return API.v1.success({ registrationStatus });
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8bfa2d6 and e7c5048.

📒 Files selected for processing (5)
  • .changeset/little-steaks-itch.md
  • apps/meteor/app/api/server/v1/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.ts
  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
  • apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/little-steaks-itch.md
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/app/api/server/v1/cloud.ts
  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
  • apps/meteor/client/hooks/useRegistrationStatus.ts
  • apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
🧠 Learnings (2)
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx
📚 Learning: 2025-12-02T22:23:49.593Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37654
File: apps/meteor/client/hooks/useAppSlashCommands.ts:32-38
Timestamp: 2025-12-02T22:23:49.593Z
Learning: In apps/meteor/client/hooks/useAppSlashCommands.ts, the `data?.forEach((command) => slashCommands.add(command))` call during render is intentional. The query is configured with `structuralSharing: false` to prevent React Query from keeping stable data references, and `slashCommands.add` is idempotent, so executing on every render is acceptable and ensures the command registry stays current.

Applied to files:

  • apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx
🧬 Code graph analysis (3)
apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx (1)
apps/meteor/client/hooks/useRegistrationStatus.ts (1)
  • useRegistrationStatus (11-31)
apps/meteor/client/hooks/useRegistrationStatus.ts (2)
packages/rest-typings/src/index.ts (1)
  • OperationResult (191-193)
packages/ui-contexts/src/index.ts (1)
  • usePermission (57-57)
apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx (1)
apps/meteor/client/hooks/useRegistrationStatus.ts (1)
  • useRegistrationStatus (11-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 📦 Meteor Build (coverage)
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (3)
apps/meteor/client/views/admin/subscription/SubscriptionPage.tsx (1)

57-57: LGTM! Proper permission-based gating.

The change from isRegistered to canViewRegistrationStatus correctly ensures that the "Sync license update" button is only visible to users with the manage-cloud permission, which aligns with the PR objectives.

Also applies to: 111-115

apps/meteor/client/hooks/useRegistrationStatus.ts (1)

6-31: LGTM! Important typo fix and proper API expansion.

The changes correctly:

  • Fix the typo (canViewregistrationStatuscanViewRegistrationStatus)
  • Expose canViewRegistrationStatus in the return type for consumers
  • Compute isRegistered as !queryResult.isPending && queryResult.data?.registrationStatus?.workspaceRegistered, which properly handles the loading state (returns false during loading rather than undefined)
apps/meteor/client/views/admin/workspace/VersionCard/VersionCard.tsx (1)

50-50: LGTM! Proper permission-based gating of registration status.

The changes correctly ensure that registration-related UI elements (register button and status indicators) are only shown to users with the manage-cloud permission. The useMemo dependencies are properly updated to include canViewRegistrationStatus.

Note: The previous concern about isRegistered being undefined during loading has been addressed by the useRegistrationStatus hook, which now returns false during loading rather than undefined.

Also applies to: 85-96, 110-110, 157-167

@ricardogarim ricardogarim requested a review from ggazzo December 26, 2025 20:36
Copy link
Member

@cardoso cardoso left a comment

Choose a reason for hiding this comment

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

Needs an e2e test to confirm the fix

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @apps/meteor/tests/e2e/administration.spec.ts:
- Around line 72-77: The test is calling the wrong endpoint path; change the
user1Api.get call in the test named 'expect API endpoint to return 403' to
remove the '/api/v1/' prefix so it uses '/cloud.registrationStatus' (match other
calls like api.post('/permissions.update', ...) and
api.get('/livechat/triggers')); update the string in the
user1Api.get('/api/v1/cloud.registrationStatus') invocation to
'/cloud.registrationStatus' so the fixture's base path is used.
🧹 Nitpick comments (2)
apps/meteor/tests/e2e/administration.spec.ts (2)

55-60: Consider using a semantic locator for the workspace status text.

Per coding guidelines, prefer semantic locators over page.locator(). While the regex pattern is useful for matching either "registered" or "not registered", consider using page.getByText() with a regex pattern instead:

♻️ Suggested refactor
 		test('expect admin to see workspace registration status', async ({ page }) => {
 			// Admin has manage-cloud by default, so should see registration status
 			await page.goto('/admin/info');
 			await expect(page.getByRole('heading', { name: /Version/ })).toBeVisible();
-			await expect(page.locator('text=/Workspace (registered|not registered)/i')).toBeVisible({ timeout: 10000 });
+			await expect(page.getByText(/Workspace (registered|not registered)/i)).toBeVisible({ timeout: 10000 });
 		});

65-70: Same suggestion: use getByText for consistency.

♻️ Suggested refactor
 			test('expect not to see registration status on UI', async ({ page }) => {
 				// user1 can access /admin/info (has view-statistics) but cannot see registration status (no manage-cloud)
 				await page.goto('/admin/info');
 				await expect(page.getByRole('heading', { name: /Version/ })).toBeVisible();
-				await expect(page.locator('text=/Workspace (registered|not registered)/i')).not.toBeVisible();
+				await expect(page.getByText(/Workspace (registered|not registered)/i)).not.toBeVisible();
 			});
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e7c5048 and 3959422.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/administration.spec.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧠 Learnings (8)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/administration.spec.ts (1)
packages/apps-engine/src/server/permissions/AppPermissions.ts (1)
  • defaultPermissions (137-168)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
apps/meteor/tests/e2e/administration.spec.ts (2)

29-30: LGTM on the test suite setup.

Using test.describe.serial is appropriate here since the tests depend on permission modifications in beforeAll/afterAll. The fallback to ['admin'] is good defensive coding for the roles lookup.


32-53: Good use of beforeAll/afterAll for permission setup and teardown.

The setup correctly grants view-statistics to the user role so user1 can access /admin/info, and properly restores permissions afterward. This ensures test isolation and prevents side effects on other tests. Based on learnings, maintaining clean state for each test execution is important.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/meteor/tests/e2e/administration.spec.ts">

<violation number="1" location="apps/meteor/tests/e2e/administration.spec.ts:75">
P1: The API endpoint path includes `/api/v1` but `api.login()` returns an `APIRequestContext` with `baseURL` already containing `/api/v1`. This will result in a double-prefixed URL (`/api/v1/api/v1/cloud.registrationStatus`). Remove the `/api/v1` prefix from the path.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @apps/meteor/tests/e2e/administration.spec.ts:
- Around line 65-70: In the test "expect not to see registration status on UI"
replace the non-semantic page.locator('text=/Workspace (registered|not
registered)/i') call with a semantic locator such as page.getByText(/Workspace
(registered|not registered)/i) (or another appropriate getBy* semantic locator)
and keep the existing .not.toBeVisible() assertion so the test uses a readable,
resilient semantic locator instead of page.locator().
- Around line 55-60: In the test 'expect admin to see workspace registration
status' replace the non-semantic call to page.locator('text=/Workspace
(registered|not registered)/i') with a semantic locator such as
page.getByText(/Workspace (registered|not registered)/i), carrying over the
timeout option (e.g., toBeVisible({ timeout: 10000 })); locate the call by the
test name and the exact page.locator(...) expression and swap it for
page.getByText(...) so the assertion uses a semantic locator.
🧹 Nitpick comments (2)
apps/meteor/tests/e2e/administration.spec.ts (2)

10-10: Consider API-based permission querying instead of importing server constants.

Importing server-side constants directly into e2e tests creates tight coupling between test code and server implementation. If the server permission structure changes, these tests may break unexpectedly.

Consider querying default permissions via API endpoint instead, which would make tests more resilient and better aligned with e2e testing principles.


72-77: Use fixture data instead of hard-coded password.

Line 74 uses a hard-coded password 'password' instead of referencing fixture data. Consider using Users.user1.data.password or a centralized test data source for better maintainability and consistency.

Suggested improvement

If Users.user1.data contains a password field:

-const user1Api = await api.login({ username: 'user1', password: 'password' });
+const user1Api = await api.login({ username: Users.user1.data.username, password: Users.user1.data.password });

Otherwise, consider defining test credentials in a central location rather than hard-coding them.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3959422 and e421f53.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/administration.spec.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧠 Learnings (13)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/administration.spec.ts (1)
packages/apps-engine/src/server/permissions/AppPermissions.ts (1)
  • defaultPermissions (137-168)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
apps/meteor/tests/e2e/administration.spec.ts (1)

30-30: No changes needed. The 'view-statistics' permission exists in apps/meteor/app/authorization/server/constant/permissions.ts with default roles ['admin'], making the fallback appropriate defensive coding. The test correctly uses test.beforeAll() and test.afterAll() for setup and teardown, properly maintaining test isolation.

@ricardogarim ricardogarim force-pushed the fix/workspace-registration-status branch from e421f53 to 6753279 Compare January 8, 2026 16:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @apps/meteor/tests/e2e/administration.spec.ts:
- Around line 62-72: The test 'expect not to see registration status on UI' uses
page.locator('text=/Workspace (registered|not registered)/i'); replace that with
a semantic Playwright locator as done earlier (e.g., page.getByText(/Workspace
(registered|not registered)/i) or another appropriate getByRole/getByLabelText
if the element has ARIA/role), so change the assertion to await
expect(page.getByText(/Workspace (registered|not
registered)/i)).not.toBeVisible() and remove the page.locator(...) usage.
- Around line 55-60: The test "expect admin to see workspace registration
status" uses page.locator(...) matching localized text; replace that with a
semantic locator: add a stable attribute to the element in the UI such as
data-testid="workspace-registration-status" and update the test to use
page.getByTestId('workspace-registration-status') to assert visibility (or, if
the element already exposes a role/label, use page.getByRole(...) or
page.getByLabel(...) instead); update the assertion in the test to await
expect(page.getByTestId('workspace-registration-status')).toBeVisible({ timeout:
10000 }) (or the equivalent getByRole/getByLabel call) so the test no longer
relies on localized text.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e421f53 and 6753279.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/administration.spec.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧠 Learnings (18)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Avoid using `page.locator()` in Playwright tests - always prefer semantic locators such as `page.getByRole()`, `page.getByLabel()`, `page.getByText()`, or `page.getByTitle()`

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `page.waitFor()` with specific conditions instead of hardcoded timeouts in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-09-23T19:22:59.217Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 36987
File: apps/meteor/tests/e2e/page-objects/fragments/room-toolbar.ts:10-20
Timestamp: 2025-09-23T19:22:59.217Z
Learning: In Playwright e2e tests, prefer stable selectors like data-qa-id attributes over localized text in getByRole() or getByText() calls to prevent test failures when UI language changes. Test translations separately by validating actual text content after ensuring UI interactions work with stable selectors.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/administration.spec.ts (1)
packages/apps-engine/src/server/permissions/AppPermissions.ts (1)
  • defaultPermissions (137-168)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (3)
apps/meteor/tests/e2e/administration.spec.ts (3)

10-10: LGTM!

The import is necessary for retrieving and restoring default permission roles in the new test suite.


29-31: LGTM!

The .serial marker appropriately ensures sequential execution for tests that modify global permissions, and the default roles retrieval with fallback is sound.


32-53: This describe block is already serial—no parallel test isolation issue.

The nested test.describe.serial() on line 29 already isolates these tests from parallel execution. Permission modifications are scoped within this serial context, and no other test files depend on the view-statistics permission. The current implementation is correct and no changes are needed.

Likely an incorrect or invalid review comment.

@ricardogarim ricardogarim requested a review from cardoso January 8, 2026 17:08
Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

can't we just test useRegistrationStatus instead?
I think e2e is too costly for this case

cardoso
cardoso previously approved these changes Jan 8, 2026
@cardoso
Copy link
Member

cardoso commented Jan 8, 2026

can't we just test useRegistrationStatus instead?
I think e2e is too costly for this case

Wouldn't that be testing just the frontend portion of this PR?

@dougfabris
Copy link
Member

not if we also add one more test case for this API route

@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Jan 9, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/meteor/tests/end-to-end/api/cloud.ts">

<violation number="1" location="apps/meteor/tests/end-to-end/api/cloud.ts:210">
P2: Missing error message assertion for consistency with other 403 tests in this file. All other permission-denied tests verify the specific error message.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @apps/meteor/client/hooks/useRegistrationStatus.spec.ts:
- Around line 50-68: The test for useRegistrationStatus can false-pass because
it only checks isRegistered; update the test to also assert
result.current.canViewRegistrationStatus is true and that the
mockGetRegistrationStatus mock was called (e.g.,
expect(mockGetRegistrationStatus).toHaveBeenCalled()). Locate the test using
renderHook(() => useRegistrationStatus()) and the mockGetRegistrationStatus
mock, then add assertions for canViewRegistrationStatus and the API call to
ensure the permission gating and endpoint invocation are actually exercised.

In @apps/meteor/tests/end-to-end/api/cloud.ts:
- Around line 209-211: The test only asserts success:false; update the anonymous
expect callback to also assert the error message on res.body (e.g.,
expect(res.body).to.have.property('message', '<same error string used in other
unauthorized tests>')) so it matches the established pattern used in the other
unauthorized tests in this file (lines with similar assertions) — use the same
property name ('message') and exact message string those tests use to keep
consistency.
🧹 Nitpick comments (2)
apps/meteor/client/hooks/useRegistrationStatus.spec.ts (2)

7-22: Prefer explicit boolean assertions (avoid toBeFalsy() for boolean state).
This reads clearer and avoids “truthy/falsy” surprises if the hook ever returns undefined/null during transitions.

Proposed diff
-		expect(result.current.isRegistered).toBeFalsy();
+		expect(result.current.isRegistered).toBe(false);

24-48: Tighten the “API called” assertion to prevent silent multiple calls.

Proposed diff
 		await waitFor(() => {
-			expect(mockGetRegistrationStatus).toHaveBeenCalled();
+			expect(mockGetRegistrationStatus).toHaveBeenCalledTimes(1);
 		});
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6753279 and 4078c0e.

📒 Files selected for processing (2)
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
  • apps/meteor/tests/end-to-end/api/cloud.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
🧠 Learnings (10)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/end-to-end/api/cloud.ts
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/cloud.ts (1)
packages/core-services/src/index.ts (1)
  • api (55-55)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
apps/meteor/tests/end-to-end/api/cloud.ts (1)

182-226: LGTM! Test suite follows established patterns.

The test suite structure, setup/teardown hooks, and test cases align well with the existing cloud endpoint tests in this file. The permission-based authorization testing appropriately covers the authentication and authorization scenarios for the updated endpoint.

apps/meteor/client/hooks/useRegistrationStatus.spec.ts (1)

1-5: Imports and setup look appropriate for a hook test.

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

Approving on behalf of frontend!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/client/hooks/useRegistrationStatus.spec.ts (1)

19-19: Consider using toBe(false) for consistency.

Line 19 uses toBeFalsy() while lines 42, 43, 65, and 66 use explicit toBe(true) or toBe(false). Since isRegistered is always a boolean, using toBe(false) would be more explicit and consistent with the rest of the test suite.

♻️ Proposed fix
-		expect(result.current.isRegistered).toBeFalsy();
+		expect(result.current.isRegistered).toBe(false);
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4078c0e and 0282b05.

📒 Files selected for processing (1)
  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
🧠 Learnings (11)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/client/hooks/useRegistrationStatus.spec.ts
🧬 Code graph analysis (1)
apps/meteor/client/hooks/useRegistrationStatus.spec.ts (2)
apps/meteor/client/hooks/useRegistrationStatus.ts (1)
  • useRegistrationStatus (11-31)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
apps/meteor/client/hooks/useRegistrationStatus.spec.ts (1)

6-67: Excellent test coverage for the permission-based visibility feature.

The three test cases comprehensively validate the PR objectives:

  • Users without manage-cloud permission receive error state and hidden registration status
  • Users with permission receive accurate registration status

The test structure is clear, isolated, and correctly uses waitFor for async assertions.

@ggazzo ggazzo merged commit 79f656f into develop Jan 15, 2026
65 of 67 checks passed
@ggazzo ggazzo deleted the fix/workspace-registration-status branch January 15, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants