feat: classification banners for ABAC rooms - #41307
Conversation
🦋 Changeset detectedLatest commit: 1455f76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds administrator-configured ABAC classification banner settings, JSON Schema validation, a processing engine for room attributes, and a room UI component that renders colored banners above the header. ChangesABAC classification banners
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Admin
participant ABACSettings
participant SettingsRegistry
participant Room
participant ClassificationBanner
participant BannerEngine
participant RoomLayout
Admin->>ABACSettings: save banner enablement and JSON configuration
ABACSettings->>SettingsRegistry: register setting schema
SettingsRegistry-->>ABACSettings: compiled validator available
Room->>ClassificationBanner: render current room
ClassificationBanner->>ABACSettings: read banner settings
ClassificationBanner->>BannerEngine: parse configuration and build payload
BannerEngine-->>ClassificationBanner: text, segments, and colors
ClassificationBanner->>RoomLayout: provide banner content
RoomLayout-->>Room: display banner above room header
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #41307 +/- ##
===========================================
+ Coverage 68.58% 68.77% +0.18%
===========================================
Files 4134 4155 +21
Lines 160802 159673 -1129
Branches 29244 28098 -1146
===========================================
- Hits 110294 109813 -481
+ Misses 45403 44676 -727
- Partials 5105 5184 +79
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
7e85d24 to
7ce3e7f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts (1)
1-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove implementation comments from the banner engine.
apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts#L1-L8: remove thereadableTextColordocumentation block.apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts#L16-L22: remove theshadedocumentation block.apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts#L51-L52: replace the ranking explanation with self-documenting names.As per coding guidelines, “Avoid code comments in the implementation.”
🤖 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/client/views/room/ClassificationBanner/lib/colors.ts` around lines 1 - 8, Remove the readableTextColor and shade documentation blocks in apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts at lines 1-8 and 16-22. In apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts at lines 51-52, replace the ranking explanation comment with self-documenting variable or function names; make no other implementation changes.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.
Inline comments:
In `@apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts`:
- Around line 9-13: Update readableTextColor to select between '`#1F2329`' and
'`#FFFFFF`' by calculating each candidate’s WCAG contrast ratio against the parsed
background luminance, then return the candidate with the higher ratio. Remove
the fixed luminance > 0.55 decision while preserving the existing hex parsing
and luminance calculation.
In `@apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts`:
- Around line 12-18: Update parseClassificationBannersConfig to validate the
JSON result against the v1 ClassificationBannersConfig schema before returning
it, rather than relying on the TypeScript cast. Return null for malformed
structures, including {}, arrays, and other schema-invalid objects, while
preserving null for invalid JSON.
---
Nitpick comments:
In `@apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts`:
- Around line 1-8: Remove the readableTextColor and shade documentation blocks
in apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts at lines 1-8
and 16-22. In apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts
at lines 51-52, replace the ranking explanation comment with self-documenting
variable or function names; make no other implementation changes.
🪄 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: 726dd09d-be6d-4f24-a53e-4616c1045e9b
📒 Files selected for processing (14)
.changeset/abac-classification-banners.mdapps/meteor/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsxapps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsxapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/client/views/room/Room.tsxapps/meteor/client/views/room/layout/RoomLayout.tsxapps/meteor/ee/server/settings/abac.tsee/packages/abac/docs/classification-banners.schema.jsonpackages/i18n/src/locales/en.i18n.json
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
🧰 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/views/admin/ABAC/ABACSettingTab/SettingsPage.tsxapps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/ee/server/settings/abac.tsapps/meteor/client/views/room/Room.tsxapps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsxapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.tsapps/meteor/client/views/room/layout/RoomLayout.tsx
**/*.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.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.ts
🧠 Learnings (9)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsxapps/meteor/client/views/room/Room.tsxapps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsxapps/meteor/client/views/room/layout/RoomLayout.tsx
📚 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/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsxapps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/ee/server/settings/abac.tsapps/meteor/client/views/room/Room.tsxapps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsxapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.tsapps/meteor/client/views/room/layout/RoomLayout.tsx
📚 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/abac-classification-banners.md
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.
Applied to files:
apps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.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/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/ee/server/settings/abac.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.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/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/ee/server/settings/abac.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.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/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.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/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.ts
🔇 Additional comments (14)
apps/meteor/ee/server/settings/abac.ts (1)
53-70: LGTM!apps/meteor/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsx (1)
35-41: LGTM!packages/i18n/src/locales/en.i18n.json (1)
40-44: LGTM!.changeset/abac-classification-banners.md (1)
1-5: LGTM!apps/meteor/client/views/room/ClassificationBanner/lib/types.ts (1)
1-53: LGTM!ee/packages/abac/docs/classification-banners.schema.json (1)
1-93: LGTM!apps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.ts (1)
1-79: LGTM!apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts (1)
23-26: LGTM!apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts (1)
1-10: LGTM!Also applies to: 20-50, 53-94
apps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.ts (1)
1-205: LGTM!apps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsx (1)
11-77: LGTM!apps/meteor/client/views/room/ClassificationBanner/index.ts (1)
1-1: LGTM!apps/meteor/client/views/room/Room.tsx (1)
10-10: LGTM!Also applies to: 58-58
apps/meteor/client/views/room/layout/RoomLayout.tsx (1)
12-12: LGTM!Also applies to: 38-38, 62-62
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
ce49a3f to
7ea9bd7
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/meteor/server/lib/settingValidationRules.ts (1)
65-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLog schema validation errors for better observability.
When JSON schema validation fails, the
ajverror details are discarded, and a genericSettingValidationErroris thrown upstream. Loggingvalidate.errorsand any JSON parsing exceptions will make it much easier for administrators or developers to diagnose exactly why a configuration payload was rejected.💡 Proposed refactor to log errors
try { - return !!validate(JSON.parse(value)); - } catch { + const parsed = JSON.parse(value); + const isValid = validate(parsed); + if (!isValid) { + logger.warn({ msg: 'JSON schema validation failed', settingId: setting._id, errors: validate.errors }); + } + return !!isValid; + } catch (err) { + logger.warn({ msg: 'Failed to parse JSON for schema validation', settingId: setting._id, err }); return 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/server/lib/settingValidationRules.ts` around lines 65 - 69, Update the JSON schema validation flow around validate and JSON.parse to log diagnostic details before returning false: record validate.errors when AJV validation fails and capture the parsing exception when JSON parsing throws. Use the existing application logging mechanism and preserve the current boolean return 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 `@apps/meteor/tests/e2e/abac-classification-banner.spec.ts`:
- Around line 74-77: In apps/meteor/tests/e2e/abac-classification-banner.spec.ts
lines 74-77, update the admin user mutation to use $push on abacAttributes,
appending only the test-specific { key: attrKey, values: ['TS', 'U'] } entry. In
the cleanup at lines 86-89, replace $unset with $pull on abacAttributes filtered
by key: attrKey, so cleanup removes only this test’s attribute.
- Line 117: Replace the data-qa-based locator in the classification banner
assertion with an appropriate semantic Playwright locator, using the banner’s
accessible role or visible text while preserving the expectation that it is
absent.
---
Nitpick comments:
In `@apps/meteor/server/lib/settingValidationRules.ts`:
- Around line 65-69: Update the JSON schema validation flow around validate and
JSON.parse to log diagnostic details before returning false: record
validate.errors when AJV validation fails and capture the parsing exception when
JSON parsing throws. Use the existing application logging mechanism and preserve
the current boolean return 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: 0d81a475-e24a-4e4e-bd37-2720121bf815
📒 Files selected for processing (9)
apps/meteor/ee/server/settings/abac.tsapps/meteor/server/lib/settingValidationRules.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/settings/functions/settingSchemas.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tspackages/i18n/src/locales/en.i18n.json
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/meteor/ee/server/settings/abac.ts
- packages/i18n/src/locales/en.i18n.json
📜 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 (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/server/settings/functions/settingSchemas.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/lib/settingValidationRules.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.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.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 inapps/meteor/tests/e2e/directory
Avoid usingpage.locator()in Playwright tests - always prefer semantic locators such aspage.getByRole(),page.getByLabel(),page.getByText(), orpage.getByTitle()
Usetest.beforeAll()andtest.afterAll()for setup/teardown in Playwright tests
Usetest.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
Useexpectmatchers for assertions (toEqual,toContain,toBeTruthy,toHaveLength, etc.) instead ofassertstatements in Playwright tests
Usepage.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/abac-classification-banner.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/abac-classification-banner.spec.ts
🧠 Learnings (6)
📚 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/settings/functions/settingSchemas.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/lib/settingValidationRules.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/settings/functions/settingSchemas.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/lib/settingValidationRules.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/settings/functions/settingSchemas.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/lib/settingValidationRules.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/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.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/settingValidationRules.spec.tsapps/meteor/tests/e2e/abac-classification-banner.spec.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.
Applied to files:
apps/meteor/tests/e2e/abac-classification-banner.spec.ts
🔇 Additional comments (5)
apps/meteor/server/settings/functions/settingSchemas.ts (1)
6-10: LGTM!apps/meteor/server/settings/SettingsRegistry.ts (1)
107-115: LGTM!apps/meteor/tests/unit/server/lib/settingValidationRules.spec.ts (1)
152-196: LGTM!apps/meteor/tests/unit/server/settings/functions/settings.tests.ts (1)
87-108: LGTM!apps/meteor/tests/end-to-end/api/abac.ts (1)
4539-4616: LGTM!
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…the classification banner
…ema on save JSON code settings may now declare a schema add-option: kept in memory (never persisted), pre-compiled at registration, and enforced for every save path by validateSettingRules — empty means unconfigured and always passes. The banners config setting declares the published schema, so unparsable or non-conforming documents are rejected with ABAC_Classification_Banners_Config_Invalid.
15360f1 to
0ec0412
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@apps/meteor/server/lib/settingValidationRules.ts`:
- Around line 50-55: Remove the JSDoc comment immediately above the
validatesSchema function while leaving the function implementation unchanged.
🪄 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: 6bf0dcb1-92ff-485e-8a9b-ebe36ac46ba2
📒 Files selected for processing (21)
.changeset/abac-classification-banners.mdapps/meteor/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsxapps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsxapps/meteor/client/views/room/ClassificationBanner/index.tsapps/meteor/client/views/room/ClassificationBanner/lib/colors.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/engine.tsapps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.tsapps/meteor/client/views/room/ClassificationBanner/lib/types.tsapps/meteor/client/views/room/Room.tsxapps/meteor/client/views/room/layout/RoomLayout.tsxapps/meteor/ee/server/settings/abac.tsapps/meteor/server/lib/settingValidationRules.tsapps/meteor/server/settings/SettingsRegistry.tsapps/meteor/server/settings/functions/settingSchemas.tsapps/meteor/tests/e2e/abac-classification-banner.spec.tsapps/meteor/tests/end-to-end/api/abac.tsapps/meteor/tests/unit/server/lib/settingValidationRules.spec.tsapps/meteor/tests/unit/server/settings/functions/settings.tests.tsee/packages/abac/docs/classification-banners.schema.jsonpackages/i18n/src/locales/en.i18n.json
🚧 Files skipped from review as they are similar to previous changes (19)
- apps/meteor/client/views/admin/ABAC/ABACSettingTab/SettingsPage.tsx
- apps/meteor/client/views/room/ClassificationBanner/lib/colors.ts
- apps/meteor/client/views/room/ClassificationBanner/lib/types.ts
- apps/meteor/server/settings/functions/settingSchemas.ts
- .changeset/abac-classification-banners.md
- apps/meteor/client/views/room/Room.tsx
- apps/meteor/tests/unit/server/settings/functions/settings.tests.ts
- apps/meteor/server/settings/SettingsRegistry.ts
- ee/packages/abac/docs/classification-banners.schema.json
- apps/meteor/client/views/room/ClassificationBanner/lib/engine.spec.ts
- apps/meteor/tests/end-to-end/api/abac.ts
- apps/meteor/client/views/room/ClassificationBanner/lib/engine.ts
- packages/i18n/src/locales/en.i18n.json
- apps/meteor/client/views/room/ClassificationBanner/lib/schema.spec.ts
- apps/meteor/client/views/room/ClassificationBanner/ClassificationBanner.tsx
- apps/meteor/tests/unit/server/lib/settingValidationRules.spec.ts
- apps/meteor/client/views/room/ClassificationBanner/index.ts
- apps/meteor/ee/server/settings/abac.ts
- apps/meteor/tests/e2e/abac-classification-banner.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 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/room/layout/RoomLayout.tsxapps/meteor/server/lib/settingValidationRules.ts
🧠 Learnings (4)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/room/layout/RoomLayout.tsx
📚 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/client/views/room/layout/RoomLayout.tsxapps/meteor/server/lib/settingValidationRules.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/server/lib/settingValidationRules.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/settingValidationRules.ts
🔇 Additional comments (2)
apps/meteor/client/views/room/layout/RoomLayout.tsx (1)
12-12: LGTM!Also applies to: 38-38, 62-62
apps/meteor/server/lib/settingValidationRules.ts (1)
138-148: LGTM!
- pick the banner ink by comparing WCAG contrast ratios instead of a fixed luminance threshold, so mid-range backgrounds like #999999 and the TS orange get the more legible color - index the segment React key since duplicate attribute ids are not rejected server-side - scope the Playwright admin attribute seeding with $push/$pull so parallel specs cannot clobber each other, and locate the banner by role instead of data-qa-id - trim the validatesSchema JSDoc down to its one non-obvious line
4e0ba18 to
219f6fa
Compare
219f6fa to
ba380a8
Compare
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Proposed changes (including videos or screenshots)
Adds classification banners to ABAC-managed rooms (EE,
abacmodule): a colored strip rendered above the room header displaying US-Government-style classification markings (classification level, need-to-know compartments, releasability, etc.), driven by a JSON configuration.How it works
ABAC_Classification_Banners_Enabled(boolean toggle, public)ABAC_Classification_Banners_Config(type: code,application/json, multiline, public) — a v1 JSON document describing attributes, value→label/color mappings and banner options. JSON syntax is validated on save via the existingcode-setting pipeline; JSON-Schema/cross-field enforcement lands separately (see Further comments).client/views/room/ClassificationBanner/lib/): segment assembly (array order, delimiters, label prefixes, alphabetical sorting, group-collapse threshold), color resolution (values ranked most restrictive first — index 0 = highest, matching Virtru HIERARCHY convention;highest/attributecolor modes), WCAG relative-luminance foreground, and a fallback banner when the room has no covered values. 19 unit tests, 100% statement coverage.ClassificationBannercomponent mounted via a newclassificationBannerslot inRoomLayout, above the header. Renders only for ABAC-managed rooms, gated by theabaclicense module (+ABAC_Enabled) and the enable toggle. The config is a public setting synced to clients, so the banner is computed client-side and updates live on config or room-attribute changes, no reload or server restart. Three styles supported:classic,segmented,edge.ee/packages/abac/docs/classification-banners.schema.json($id: https://rocket.chat/schemas/classification-banners/v1.json). The full reference documentation (semantics, cross-field rules, example) lives in the builder's Docs modal.Example: a room with
classification: [topsecret]andneedtoknow: [ops, int]rendersTOP SECRET // NTK-INT/OPSon the Top Secret orange with computed-contrast text.Issue(s)
Steps to test or reproduce
abacmodule: Admin → ABAC → Settings, enable ABAC and, under the Classification banners accordion, enable the toggle and paste a config (use the builder — its Docs modal and "Load example" provide a reference configuration).classification: topsecret) via Admin → ABAC → Rooms.groupThresholdand the segment collapses to itsmultipleLabel.Further comments
drivesColor, unique ids/sources,multipleLabelwithgroupThreshold,bannerLabelwithshowLabel) is intentionally out of scope — a separate settings-validation effort will cover it. Until then the engine parses defensively (malformed config → no banner) and the builder lints the rules warn-only.classification-banners.md.https://rocketchat.atlassian.net/browse/ABAC3-32
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Documentation
Validation & Quality