Skip to content

feat: no egress for offline licenses - #41148

Merged
dionisio-bot[bot] merged 10 commits into
developfrom
feat/offline-license-no-egress
Jul 18, 2026
Merged

feat: no egress for offline licenses#41148
dionisio-bot[bot] merged 10 commits into
developfrom
feat/offline-license-no-egress

Conversation

@cardoso

@cardoso cardoso commented Jul 2, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Issue(s)

CORE-2370

Steps to test or reproduce

Further comments

This was extensively tested locally with network monitoring for more than 24h.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added offline-license mode to suppress outbound Cloud/marketplace activity, push gateway/native sends, telemetry/usage reporting, and default Gravatar/avatar suggestions.
    • Interactive cloud registration/login flows now fail fast with an offline-license error.
    • Cron/scheduled processing is deferred until after the license is applied so offline mode takes effect immediately.
  • Bug Fixes
    • Cloud sync/update, marketplace fetches, version checks, OAuth completion, and logout now avoid network calls while offline.
    • Marketplace/REST errors now surface the offline-license message instead of a generic connectivity failure.
  • Documentation
    • Added a proposal for stronger type-level offline enforcement.
  • Tests
    • Added unit tests covering offline license detection and offline marketplace/cloud flows.

@dionisio-bot

dionisio-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2685a1c

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

This PR includes changesets to release 4 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/license Minor
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor

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

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR adds offline-license detection, blocks outbound cloud and external-service activity, suppresses related scheduled jobs, logs offline activation, and defers cron startup until after license application.

Changes

Offline license enforcement

Layer / File(s) Summary
Offline license state and lifecycle
ee/packages/license/src/*, apps/meteor/ee/server/lib/license/startup.ts, .changeset/*, docs/proposals/*
The license manager and mocked builder support offline state, lifecycle tests cover it, startup logs detection, and documentation describes enforcement.
Cloud connectivity guards
apps/meteor/server/lib/cloud/*, apps/meteor/ee/server/apps/marketplace/*, apps/meteor/ee/server/apps/communication/rest.ts, apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts, apps/meteor/lib/errors/*, apps/meteor/tests/unit/server/{ee/apps/marketplace,lib/cloud}/*
Interactive cloud flows, token retrieval, synchronization, version checks, marketplace requests, logout revocation, and cloud announcements are blocked or short-circuited under offline licensing, with typed marketplace errors preserved.
Outbound integration suppression
apps/meteor/server/lib/notifications/push/*, apps/meteor/server/lib/statistics/*, apps/meteor/server/lib/users/*
Push delivery, usage reporting, Gravatar suggestions, and default Gravatar fetching are suppressed for offline licenses.
Scheduled job startup ordering
apps/meteor/ee/server/apps/*, apps/meteor/server/main.ts, apps/meteor/server/startup/index.ts
Marketplace cron tasks return early offline, and cron startup moves after Rocket.Chat initialization and license application.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ServerStartup
  participant LicenseManager
  participant CronJobs
  participant RocketChatCloud
  ServerStartup->>LicenseManager: apply and validate license
  LicenseManager-->>ServerStartup: offline state available
  ServerStartup->>CronJobs: start after license validation
  CronJobs->>LicenseManager: hasOfflineLicense()
  alt offline license
    CronJobs-->>CronJobs: skip outbound task
  else standard license
    CronJobs->>RocketChatCloud: run scheduled cloud request
    RocketChatCloud-->>CronJobs: response
  end
Loading

Possibly related PRs

Suggested labels: type: feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: blocking outbound egress for offline licenses.
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.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2370: Request failed with status code 401

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.

@cardoso cardoso added this to the 8.7.0 milestone Jul 2, 2026
@cardoso
cardoso force-pushed the feat/offline-license-no-egress branch from abf138a to 33a5964 Compare July 2, 2026 17:31
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.16981% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.52%. Comparing base (65a366e) to head (2685a1c).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41148      +/-   ##
===========================================
- Coverage    68.56%   68.52%   -0.04%     
===========================================
  Files         4124     4126       +2     
  Lines       160128   160228     +100     
  Branches     29166    29150      -16     
===========================================
+ Hits        109788   109795       +7     
- Misses       45240    45318      +78     
- Partials      5100     5115      +15     
Flag Coverage Δ
e2e 58.96% <ø> (-0.06%) ⬇️
e2e-api 45.31% <11.62%> (-0.34%) ⬇️
unit 70.47% <78.26%> (-0.03%) ⬇️

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.

@cardoso
cardoso force-pushed the feat/offline-license-no-egress branch 11 times, most recently from 61581aa to 27fdb55 Compare July 7, 2026 16:12
@cardoso
cardoso force-pushed the feat/offline-license-no-egress branch from 4e2091d to 592d95d Compare July 15, 2026 12:14
@cardoso
cardoso marked this pull request as ready for review July 15, 2026 13:02
@cardoso
cardoso requested review from a team as code owners July 15, 2026 13:02
@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jul 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/meteor/ee/server/lib/license/startup.ts (1)

23-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the inline implementation comment.

The logging behavior is correct, but Line 24 adds a code comment inside the TypeScript implementation. Please remove it to follow the repository guidance; the SystemLogger.startup call is self-explanatory.

As per coding guidelines, TypeScript/JavaScript implementations should avoid code comments.

🤖 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 `@apps/meteor/ee/server/lib/license/startup.ts` around lines 23 - 27, Remove
the inline comment above the SystemLogger.startup call in the !logged branch,
leaving the existing logging behavior and message unchanged.

Source: Coding guidelines

apps/meteor/server/lib/cloud/offlineLicense.ts (1)

5-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the implementation comments or relocate this contract.

The added JSDoc blocks conflict with the repository guideline to avoid code comments in TypeScript/JavaScript implementation files. Keep the guard behavior, but move the offline-egress contract to external developer documentation if it must be retained.

Also applies to: 17-20

🤖 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 `@apps/meteor/server/lib/cloud/offlineLicense.ts` around lines 5 - 12, Remove
the added JSDoc implementation comments around the offline-license guard in
offlineLicense.ts while preserving the guard behavior unchanged. If the
offline-egress contract must remain documented, relocate it to the appropriate
external developer documentation instead of keeping it in the TypeScript
implementation file.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@apps/meteor/ee/server/lib/license/startup.ts`:
- Around line 23-27: Remove the inline comment above the SystemLogger.startup
call in the !logged branch, leaving the existing logging behavior and message
unchanged.

In `@apps/meteor/server/lib/cloud/offlineLicense.ts`:
- Around line 5-12: Remove the added JSDoc implementation comments around the
offline-license guard in offlineLicense.ts while preserving the guard behavior
unchanged. If the offline-egress contract must remain documented, relocate it to
the appropriate external developer documentation instead of keeping it in the
TypeScript implementation file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e3c8e07-71f0-4897-be5a-d5551119d2a7

📥 Commits

Reviewing files that changed from the base of the PR and between 71d4d82 and 5434bd1.

📒 Files selected for processing (31)
  • .changeset/offline-license-no-egress.md
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/startup/index.ts
  • docs/proposals/offline-license-capability-enforcement.md
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • ee/packages/license/src/license.spec.ts
  • ee/packages/license/src/license.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
🧰 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/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • ee/packages/license/src/license.spec.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • ee/packages/license/src/license.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/server/startup/index.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:

  • ee/packages/license/src/license.spec.ts
🧠 Learnings (7)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • ee/packages/license/src/license.spec.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • ee/packages/license/src/license.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/server/startup/index.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • ee/packages/license/src/license.spec.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • ee/packages/license/src/license.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/server/startup/index.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • ee/packages/license/src/license.spec.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • ee/packages/license/src/license.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/server/startup/index.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/offline-license-no-egress.md
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.

Applied to files:

  • ee/packages/license/src/license.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • ee/packages/license/src/license.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • ee/packages/license/src/license.spec.ts
🪛 LanguageTool
docs/proposals/offline-license-capability-enforcement.md

[style] ~14-~14: You have already used ‘right’ in nearby sentences. Consider using an alternative word to let your writing stand out and sound more polished.
Context: ... right entitlement, or to happen at the right time. ## Proposed Solution Make every...

(REP_RIGHT)


[style] ~65-~65: To elevate your writing, try using an alternative expression here.
Context: ...mory; proofs are free to acquire, which matters for the per-attempt rule below. - **The...

(MATTERS_RELEVANT)


[style] ~112-~112: To strengthen your wording, consider replacing the phrasal verb “leave out”.
Context: ...; both were considered and deliberately left out in favor of a types-only approach.

(OMIT_EXCLUDE)

🔇 Additional comments (30)
ee/packages/license/src/license.ts (1)

456-458: LGTM!

ee/packages/license/src/MockedLicenseBuilder.ts (1)

175-178: LGTM!

ee/packages/license/src/license.spec.ts (1)

501-537: LGTM!

apps/meteor/ee/server/lib/license/startup.ts (1)

147-148: LGTM!

.changeset/offline-license-no-egress.md (1)

1-6: LGTM!

docs/proposals/offline-license-capability-enforcement.md (1)

1-112: LGTM!

apps/meteor/ee/server/apps/appRequestsCron.ts (1)

2-2: LGTM!

Also applies to: 12-15

apps/meteor/ee/server/apps/cron.ts (1)

4-4: LGTM!

Also applies to: 79-82

apps/meteor/server/main.ts (1)

14-14: LGTM!

Also applies to: 31-36

apps/meteor/server/startup/index.ts (1)

20-22: LGTM!

apps/meteor/lib/errors/CloudOfflineLicenseError.ts (1)

1-5: LGTM!

apps/meteor/server/lib/cloud/connectWorkspace.ts (1)

4-4: LGTM!

Also applies to: 51-51

apps/meteor/server/lib/cloud/getConfirmationPoll.ts (1)

4-4: LGTM!

Also applies to: 9-9

apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts (1)

6-6: LGTM!

Also applies to: 11-12

apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts (1)

6-6: LGTM!

Also applies to: 10-13

apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts (1)

5-5: LGTM!

Also applies to: 9-10

apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts (1)

7-13: LGTM!

apps/meteor/server/lib/cloud/startRegisterWorkspace.ts (1)

5-5: LGTM!

Also applies to: 14-15

apps/meteor/server/lib/cloud/syncWorkspace/index.ts (1)

4-4: LGTM!

Also applies to: 16-21

apps/meteor/server/lib/cloud/userLogout.ts (1)

4-4: LGTM!

Also applies to: 13-13

apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts (1)

1-5: LGTM!

Also applies to: 46-51

apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts (1)

19-19: LGTM!

Also applies to: 259-260

apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts (1)

8-8: LGTM!

Also applies to: 105-113

apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts (1)

30-33: LGTM!

apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts (1)

35-38: LGTM!

apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts (1)

144-147: LGTM!

apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts (1)

47-50: LGTM!

apps/meteor/server/lib/statistics/functions/sendUsageReport.ts (1)

44-77: LGTM!

apps/meteor/server/lib/users/saveUser/saveNewUser.ts (1)

74-76: LGTM!

apps/meteor/server/lib/notifications/push/push.ts (1)

405-411: 🎯 Functional Correctness

No issue: gateways is only populated on the gateway-backed path, and that path leaves apn/gcm unset, so the offline-license guard does not skip configured native providers.

			> Likely an incorrect or invalid review comment.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 31 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/server/main.ts Outdated
Comment thread .changeset/offline-license-no-egress.md Outdated
Comment thread apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts Outdated
Comment thread docs/proposals/offline-license-capability-enforcement.md
Comment thread apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
Comment thread apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts Outdated
Comment thread apps/meteor/ee/server/lib/license/startup.ts Outdated
Comment thread apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts

@hacktron-app hacktron-app 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.

1 issue found across 1 file

Severity Count
MEDIUM 1

View full scan results

Comment thread apps/meteor/server/lib/cloud/userLogout.ts Outdated
@cardoso
cardoso force-pushed the feat/offline-license-no-egress branch from 5434bd1 to 271b65d Compare July 15, 2026 14:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/meteor/ee/server/apps/communication/rest.ts (1)

100-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consistently handle CloudOfflineLicenseError across all marketplace endpoints.

While handleError correctly formats CloudOfflineLicenseError to suppress error logs and return a clean failure reason, several other routes in this file that invoke marketplace requests (e.g., app install POST, app update POST, /bundles/:id/apps, /app-request, /:id/sync, and buildExternalUrl) do not use this helper for CloudOfflineLicenseError.

Consider routing expected offline-license rejections through handleError in these remaining endpoints as well. This will ensure that if an admin triggers them via the API while offline, the system returns a consistent, well-formed client message rather than generating unexpected 500 errors and spamming the logs with system errors.

(Note: For the app install POST route starting at line 269, the error is wrapped in a Promise.all .catch, so you may need to unwrap it by checking if err.cause instanceof CloudOfflineLicenseError.)

🤖 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 `@apps/meteor/ee/server/apps/communication/rest.ts` around lines 100 - 106, The
remaining marketplace endpoints should consistently route
CloudOfflineLicenseError through handleError instead of treating it as an
unexpected system failure. Update the app install and update POST handlers,
/bundles/:id/apps, /app-request, /:id/sync, and buildExternalUrl error paths to
invoke handleError; in the app install Promise.all catch, also detect err.cause
instanceof CloudOfflineLicenseError. Preserve the existing clean failure
response and suppressed logging behavior.
🤖 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 `@docs/proposals/offline-license-capability-enforcement.md`:
- Around line 85-89: Update the cloudFetch dispatch path and license-transition
coordination so validation and opening the serverFetch connection occur under an
atomic dispatch gate or equivalent blocking/cancellation mechanism, preventing
license changes from enabling egress after validation. Add a race test covering
a transition to offline between validation and dispatch, and verify the request
is not sent.
- Around line 112-114: Close the raw network-import bypass by enforcing that
server code uses the proof-checking cloudFetch boundary instead of importing
serverFetch directly. Add an appropriate no-restricted-imports rule or CI
validation, exempting the designated cloudClient.ts implementation (or otherwise
centralize the permitted network primitive), and ensure new code cannot bypass
offline-license revalidation.

---

Nitpick comments:
In `@apps/meteor/ee/server/apps/communication/rest.ts`:
- Around line 100-106: The remaining marketplace endpoints should consistently
route CloudOfflineLicenseError through handleError instead of treating it as an
unexpected system failure. Update the app install and update POST handlers,
/bundles/:id/apps, /app-request, /:id/sync, and buildExternalUrl error paths to
invoke handleError; in the app install Promise.all catch, also detect err.cause
instanceof CloudOfflineLicenseError. Preserve the existing clean failure
response and suppressed logging behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb989fa1-c1ae-477c-a6df-9c9a3de17340

📥 Commits

Reviewing files that changed from the base of the PR and between 5434bd1 and 271b65d.

📒 Files selected for processing (36)
  • .changeset/offline-license-no-egress.md
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/ee/server/apps/communication/rest.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/startup/index.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • docs/proposals/offline-license-capability-enforcement.md
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • ee/packages/license/src/license.spec.ts
  • ee/packages/license/src/license.ts
🚧 Files skipped from review as they are similar to previous changes (29)
  • apps/meteor/server/lib/cloud/connectWorkspace.ts
  • apps/meteor/server/lib/cloud/finishOAuthAuthorization.ts
  • ee/packages/license/src/license.spec.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts
  • apps/meteor/lib/errors/CloudOfflineLicenseError.ts
  • apps/meteor/server/lib/cloud/offlineLicense.ts
  • ee/packages/license/src/MockedLicenseBuilder.ts
  • apps/meteor/server/main.ts
  • apps/meteor/ee/server/apps/appRequestsCron.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/server/lib/cloud/startRegisterWorkspace.ts
  • apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts
  • apps/meteor/server/lib/cloud/syncWorkspace/index.ts
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/server/lib/statistics/functions/sendUsageReport.ts
  • apps/meteor/ee/server/apps/cron.ts
  • apps/meteor/server/lib/cloud/registerPreIntentWorkspaceWizard.ts
  • apps/meteor/ee/server/lib/license/startup.ts
  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/lib/cloud/getOAuthAuthorizationUrl.ts
  • .changeset/offline-license-no-egress.md
  • apps/meteor/server/lib/cloud/supportedVersionsToken/supportedVersionsToken.ts
  • apps/meteor/ee/server/apps/marketplace/MarketplaceAPIClient.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessToken.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/users/getAvatarSuggestionForUser.ts
  • apps/meteor/server/lib/cloud/getWorkspaceAccessTokenWithScope.ts
  • ee/packages/license/src/license.ts
  • apps/meteor/server/lib/cloud/version-check/functions/checkVersionUpdate.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
🧰 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/ee/server/apps/marketplace/fetchMarketplaceCategories.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts
  • apps/meteor/ee/server/apps/communication/rest.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/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts
  • apps/meteor/ee/server/apps/communication/rest.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts
  • apps/meteor/ee/server/apps/communication/rest.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts
  • apps/meteor/server/lib/cloud/getConfirmationPoll.ts
  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
  • apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts
  • apps/meteor/ee/server/apps/communication/rest.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts
  • apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts
🪛 LanguageTool
docs/proposals/offline-license-capability-enforcement.md

[style] ~14-~14: You have already used ‘right’ in nearby sentences. Consider using an alternative word to let your writing stand out and sound more polished.
Context: ... right entitlement, or to happen at the right time. ## Proposed Solution Make every...

(REP_RIGHT)


[style] ~65-~65: To elevate your writing, try using an alternative expression here.
Context: ...mory; proofs are free to acquire, which matters for the per-attempt rule below. - **The...

(MATTERS_RELEVANT)


[style] ~114-~114: To strengthen your wording, consider replacing the phrasal verb “leave out”.
Context: ...; both were considered and deliberately left out in favor of a types-only approach.

(OMIT_EXCLUDE)

🔇 Additional comments (6)
docs/proposals/offline-license-capability-enforcement.md (1)

57-59: 🔒 Security & Privacy

Fail closed while license state is unavailable.

proveCloudEgress() grants permission whenever hasOfflineLicense() is false. If that method also returns false before license information is loaded or applied, startup calls can obtain egress permission during the exact window this proposal identifies. Define and test an explicit fail-closed initialization state, or verify that hasOfflineLicense() cannot return false before licensing is resolved.

apps/meteor/server/lib/cloud/getConfirmationPoll.ts (1)

4-10: LGTM!

apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts (1)

7-7: LGTM!

Also applies to: 161-166

apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts (1)

7-7: LGTM!

Also applies to: 45-50

apps/meteor/tests/unit/server/ee/apps/marketplace/MarketplaceAPIClient.spec.ts (1)

1-57: LGTM!

apps/meteor/tests/unit/server/lib/cloud/registerPreIntentWorkspaceWizard.spec.ts (1)

1-64: LGTM!

Comment thread docs/proposals/offline-license-capability-enforcement.md
Comment thread docs/proposals/offline-license-capability-enforcement.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts (1)

63-72: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a test case for a missing userId.

Consider adding a test case to cover the new scenario where userId is empty or not provided, ensuring it correctly returns an empty string without invoking external calls.

➕ Proposed test case
 	it('should do nothing when the workspace is not registered', async () => {
 		retrieveRegistrationStatusStub.resolves({ workspaceRegistered: false });
 
 		const result = await userLogout('user-id');
 
 		expect(result).to.equal('');
 		expect(fetchStub.called).to.be.false;
 		expect(userLoggedOutStub.called).to.be.false;
 	});
+
+	it('should do nothing when the userId is empty', async () => {
+		retrieveRegistrationStatusStub.resolves({ workspaceRegistered: true });
+
+		const result = await userLogout('');
+
+		expect(result).to.equal('');
+		expect(fetchStub.called).to.be.false;
+		expect(userLoggedOutStub.called).to.be.false;
+	});
 });
🤖 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 `@apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts` around lines 63 -
72, Add a unit test alongside the existing userLogout tests covering an empty or
omitted userId. Assert that userLogout returns an empty string and that
fetchStub, retrieveRegistrationStatusStub, and userLoggedOutStub are not called.
apps/meteor/server/lib/cloud/userLogout.ts (1)

21-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove code comments in the implementation.

As per coding guidelines, code comments in the implementation should be avoided.

♻️ Proposed refactor
-	// Offline (air-gapped) licenses forbid the outbound token-revocation call, but
-	// the local cloud credentials must still be destroyed on logout.
 	if (hasOfflineLicense()) {
 		return userLoggedOut(userId);
 	}
🤖 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 `@apps/meteor/server/lib/cloud/userLogout.ts` around lines 21 - 26, Remove the
explanatory comment immediately above the hasOfflineLicense() branch in
userLogout.ts, preserving the existing offline-license behavior that returns
userLoggedOut(userId).

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@apps/meteor/server/lib/cloud/userLogout.ts`:
- Around line 21-26: Remove the explanatory comment immediately above the
hasOfflineLicense() branch in userLogout.ts, preserving the existing
offline-license behavior that returns userLoggedOut(userId).

In `@apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts`:
- Around line 63-72: Add a unit test alongside the existing userLogout tests
covering an empty or omitted userId. Assert that userLogout returns an empty
string and that fetchStub, retrieveRegistrationStatusStub, and userLoggedOutStub
are not called.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: feece5cf-6851-4c2e-b6eb-4e41284a4064

📥 Commits

Reviewing files that changed from the base of the PR and between 271b65d and b87c238.

📒 Files selected for processing (2)
  • apps/meteor/server/lib/cloud/userLogout.ts
  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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/unit/server/lib/cloud/userLogout.spec.ts
  • apps/meteor/server/lib/cloud/userLogout.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/unit/server/lib/cloud/userLogout.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/tests/unit/server/lib/cloud/userLogout.spec.ts
  • apps/meteor/server/lib/cloud/userLogout.ts
🔇 Additional comments (1)
apps/meteor/server/lib/cloud/userLogout.ts (1)

13-19: LGTM!

Comment thread apps/meteor/ee/server/apps/cron.ts
Comment thread apps/meteor/ee/server/lib/license/startup.ts Outdated
Comment thread apps/meteor/server/lib/cloud/offlineLicense.ts Outdated
Comment thread apps/meteor/server/main.ts Outdated
@cardoso
cardoso force-pushed the feat/offline-license-no-egress branch from 835c0ff to 2685a1c Compare July 17, 2026 12:01
@KevLehman
KevLehman requested a review from d-gubert July 17, 2026 13:41
@cardoso cardoso removed the stat: QA assured Means it has been tested and approved by a company insider label Jul 17, 2026
@dionisio-bot dionisio-bot Bot removed the stat: ready to merge PR tested and approved waiting for merge label Jul 17, 2026
@cardoso cardoso added the stat: QA assured Means it has been tested and approved by a company insider label Jul 17, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 17, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 17, 2026
@KevLehman
KevLehman removed this pull request from the merge queue due to a manual request Jul 17, 2026
@KevLehman KevLehman added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jul 17, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 17, 2026
Merged via the queue into develop with commit 74d6cac Jul 18, 2026
84 of 86 checks passed
@dionisio-bot
dionisio-bot Bot deleted the feat/offline-license-no-egress branch July 18, 2026 05:11
This was referenced Jul 20, 2026
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 type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants