Skip to content

feat: validate password policy length on settings save - #41173

Merged
dionisio-bot[bot] merged 8 commits into
developfrom
fix/password-policy-length-validation
Jul 18, 2026
Merged

feat: validate password policy length on settings save#41173
dionisio-bot[bot] merged 8 commits into
developfrom
fix/password-policy-length-validation

Conversation

@ricardogarim

@ricardogarim ricardogarim commented Jul 3, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Admins could save a password policy with an enabled maximum length (>= 1) smaller than the minimum length (e.g. min=12, max=8), making it impossible to create any valid password.

The server now rejects that configuration on every settings write path (REST and the deprecated methods), and the admin sees an error toast.

  • Setting specs accept a declarative validation field (SettingValidationRule[]): a mongo-style query, an optional appliesWhen gate, and an i18n errorKey. Queries can reference other settings via { $setting: '<id>' }, so cross-setting constraints are expressible — and future ones are just data on the spec.
  • Values resolve batch-first: changing one value, the other, or both in the same group save validates against what is being saved, never a stale cached value. -1 (disabled) always passes.
  • On rejection the i18n key is returned as the REST error (with errorType: 'error-setting-validation-failed') or as the Meteor.Error reason on the methods — the existing client error handling translates it, so no client changes.
  • Pre-existing validation is untouched (saveSettingsBulk has no diff): no request that succeeded before fails now, except the invalid pair. Broken rule declarations fail open (logged). TODO(next major) marks where the per-path validations should be unified.

Issue(s)

CORE-2081

Steps to test or reproduce

  1. Go to Admin > Settings > Accounts > Password Policy.
  2. Set a minimum greater than an enabled maximum (one field, the other, or both in the same save) and hit Save changes → rejected with an error toast, nothing persisted.
  3. Set maximum to -1 → any minimum saves normally.
  4. Via API: POST /api/v1/settings/Accounts_Password_Policy_MaxLength with { "value": 4 } (while min=12) → 400, errorType: "error-setting-validation-failed".

Further comments

Other settings that could adopt this validation in the future

Candidates mapped while designing this — none implemented here, but each was verified against its registration and runtime consumer (exact ids, defaults, gating toggles, and what 0/negative values actually do):

Conditional rules (appliesWhen a feature toggle):

Setting Proposed rule
Accounts_Password_Policy_ForbidRepeatingCharactersCount ≥ 1 when ForbidRepeatingCharacters is on (0 makes the regex reject every password)
Accounts_Password_History_Amount ≥ 1 when Password_History_Enabled
Block_Multiple_Failed_Logins_Attempts_Until_Block_by_User / _By_Ip ≥ 1 when the corresponding block toggle is on
Block_Multiple_Failed_Logins_Time_To_Unblock_By_User_In_Minutes / _By_Ip_In_Minutes ≥ 1 when the corresponding block toggle is on
Accounts_TwoFactorAuthentication_Max_Invalid_Email_Code_Attempts ≥ 1 when 2FA by email is on
Accounts_TwoFactorAuthentication_By_Email_Code_Expiration > 0 when 2FA by email is on
Accounts_TwoFactorAuthentication_MaxDelta / _RememberFor ≥ 0 when 2FA is on

Magic-value rules (like -1 here):

  • FileUpload_MaxFileSize-1 (unlimited) or ≥ 1 (the guard is > -1, so 0 blocks every upload)
  • Livechat_max_queue_wait_time-1 (unlimited) or ≥ 1 (0 also disables at runtime today; the rule would canonicalize -1)
  • Livechat_maximum_chats_per_agent — confirm 0 = unlimited
  • Message_AllowEditing_BlockEditInMinutes / Message_AllowDeleting_BlockDeleteInMinutes0 disables blocking, so 0 or ≥ 1

Cross-field pairs: a repo-wide scan found no other min/max pair — the password policy lengths are currently the only settings needing a $setting cross-reference.

Plain static bounds — expressible today as a degenerate { value: { $gte: N } } rule (also localizes the error), or, more leanly, by unlocking minValue/maxValue on int settings (typings currently permit them only on range; checkSettingValueBounds already enforces them at runtime but with a hardcoded English message):

Setting Proposed bound
DirectMesssage_maxUsers ≥ 2 (a DM needs at least two people)
RetentionPolicy_MaxAge_Channels / _DMs / _Groups ≥ 1 (days)
Accounts_AvatarSize ≥ 1 (pixels)
Message_MaxAllowedSize ≥ 1
Notifications_Max_Room_Members ≥ 0
Accounts_Default_User_Preferences_idleTimeLimit ≥ 0 (seconds)
LDAP_Search_Size_Limit ≥ 0
DDP/API rate-limiter *_Requests_Allowed / *_Interval_Time ≥ 1 (batch)

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added settings value validation when saving, including JSON-defined rules, cross-setting checks, and conditional “applies when” logic.
    • Added reusable validation-rule builders for bounded integer/disabled numeric constraints.
  • Bug Fixes
    • Rejects invalid password policy configurations where max length is smaller than min length, returning consistent validation errors for both single and bulk updates.
    • Improved API error handling for validation failures.
  • Tests
    • Added unit tests covering rule evaluation, parsing/shape tolerance, and missing-reference behavior.
    • Updated password policy end-to-end coverage to preserve/restore prior configuration.
  • Documentation
    • Added English i18n messages for password policy validation errors.

@dionisio-bot

dionisio-bot Bot commented Jul 3, 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 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1f9850b

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

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/core-typings Patch
@rocket.chat/meteor Patch
@rocket.chat/rest-typings Patch

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

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

@coderabbitai

coderabbitai Bot commented Jul 3, 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

This PR adds declarative setting validation, wires it into single and bulk save paths plus settings API handlers, and applies cross-field password policy rules for min/max length with new types, messages, tests, and a changeset.

Changes

Centralized settings validation

Layer / File(s) Summary
Validation types and defaults
packages/core-typings/src/ISetting.ts, apps/meteor/app/settings/server/functions/getSettingDefaults.ts, packages/i18n/src/locales/en.i18n.json
Adds SettingValidationRule, allows validation on settings, stringifies validation in defaults, and adds password policy validation message keys.
Rule evaluation and batch validation
apps/meteor/server/settings/lib/validationRuleBuilders.ts, apps/meteor/app/lib/server/lib/settingValidationRules.ts, apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
Adds reusable validation-rule builders, parses and evaluates validation rules with $setting references and appliesWhen, validates batches, and covers the behavior with unit tests.
Save path validation wiring
apps/meteor/app/lib/server/methods/saveSetting.ts, apps/meteor/app/lib/server/methods/saveSettings.ts, apps/meteor/server/api/v1/settings.ts, apps/meteor/app/lib/server/functions/saveSettingsBulk.ts
Runs validation before saving single or bulk settings and in API update handlers, then maps validation failures to Meteor.Error or API.v1.failure with error-setting-validation-failed.
Password policy rules and tests
apps/meteor/server/settings/accounts.ts, apps/meteor/tests/end-to-end/api/users.ts, .changeset/empty-garlics-reply.md
Adds min/max password length validation rules, updates end-to-end password policy setup and assertions, and documents the patch release.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SaveMethod as saveSetting/saveSettings/settings API
  participant Validator as validateSettingRules
  participant SettingsStore as Settings storage

  Client->>SaveMethod: submit setting change(s)
  SaveMethod->>Validator: validate incoming values
  alt validation fails
    Validator-->>SaveMethod: throw Error(rule.errorKey)
    SaveMethod-->>Client: Meteor.Error/API.v1.failure error-setting-validation-failed
  else validation passes
    SaveMethod->>SettingsStore: persist setting value(s)
  end
Loading

Possibly related PRs

  • RocketChat/Rocket.Chat#40724: Touches apps/meteor/app/lib/server/methods/saveSettings.ts, which this PR also changes to add validation before persistence.

Suggested labels: type: bug

Suggested reviewers: tassoevan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enforcing password policy length validation when saving settings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2081: 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.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jul 3, 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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
apps/meteor/app/lib/server/functions/saveSettingsBulk.ts (1)

68-95: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Collapse duplicate setting IDs before validation and update. validateSettings() resolves cross-field rules against the first matching _id, but this path still updates every entry in params. With duplicate IDs, one value can be validated against another and the final stored value becomes order-dependent.

🤖 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/app/lib/server/functions/saveSettingsBulk.ts` around lines 68 -
95, Collapse duplicate setting IDs before running validateSettings() and before
building the update promises in saveSettingsBulk so each _id is processed once
with a deterministic value. Ensure the deduped params are what
updateAuditedByUser, Settings.updateValueById, Settings.findOneById, and
notifyOnSettingChangedById operate on, so repeated entries cannot make
validation or the final stored setting order-dependent.
🧹 Nitpick comments (6)
packages/core-typings/src/ISetting.ts (1)

34-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider reusing EnableQuery for the query field type.

enableQuery/displayQuery on the same interface use the named EnableQuery type, while SettingValidationRule.query is typed as a loose Record<string, unknown>. Aligning it with EnableQuery (or a shared query type) would improve type safety and consistency across similar query-filter fields.

🤖 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 `@packages/core-typings/src/ISetting.ts` around lines 34 - 39, The
SettingValidationRule.query field is using a loose Record<string, unknown> while
similar query-filter fields on the same area use the named EnableQuery type.
Update the SettingValidationRule definition in ISetting to reuse EnableQuery (or
a shared query type) for query so the interface stays consistent and more
type-safe.
apps/meteor/app/lib/server/lib/settingValidationRules.ts (2)

10-14: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comments in implementation code violate the coding guideline.

Several explanatory comments are added to this implementation file (JSDoc block, inline comments on matches, resolveObject, conditions, unknownReferences, conditionHolds).

As per coding guidelines, **/*.{ts,tsx,js}: "Avoid code comments in the implementation."

Also applies to: 22-26, 44-44, 51-52, 59-59

🤖 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/app/lib/server/lib/settingValidationRules.ts` around lines 10 -
14, The implementation file contains multiple explanatory comments that violate
the no-comments guideline. Remove the JSDoc block and the inline comments around
the relevant logic in settingValidationRules.ts, including the sections tied to
matches, resolveObject, conditions, unknownReferences, and conditionHolds, while
keeping the existing behavior unchanged.

Source: Coding guidelines


44-49: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

appliesWhen condition values are not resolved for $setting references, unlike rule.query.

resolveObject/resolveNode (lines 27-42) resolve { $setting: id } nodes anywhere inside rule.query, and any such reference gets tracked in references for the "unknown setting" safety check. However, conditionHolds (line 60-61) uses condition.value verbatim — if a future rule author puts a $setting reference inside appliesWhen[].value, it will be treated as a literal object instead of being resolved, and won't be captured by the unknown-reference safety net either. No currently-declared rule (per the mirrored fixtures in validateSettings.spec.ts) exercises this path, so it's not an active bug, but it's an inconsistency in the resolution contract that could silently misbehave for future rules.

Also applies to: 60-61

🤖 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/app/lib/server/lib/settingValidationRules.ts` around lines 44 -
49, The appliesWhen condition handling in settingValidationRules is inconsistent
with rule.query resolution because condition.value is used raw, so $setting
references inside appliesWhen can be left unresolved and skipped by the
unknown-reference check. Update the condition processing in
validateSettings/conditionHolds to run appliesWhen values through the same
resolveObject/resolveNode path used for rule.query, and make sure any resolved
references are added to references so the safety net covers them too.
apps/meteor/app/lib/server/lib/validateSettings.ts (1)

10-14: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comments in implementation code violate the coding guideline.

This file also has explanatory comments (module-level doc comment, and inline comments on getValueOf, "validate the value against its type", "evaluate the setting's declared cross-field / domain rules").

As per coding guidelines, **/*.{ts,tsx,js}: "Avoid code comments in the implementation."

Also applies to: 53-53, 64-64, 67-67

🤖 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/app/lib/server/lib/validateSettings.ts` around lines 10 - 14,
Remove the implementation comments from validateSettings.ts, including the
module-level explanatory note near SETTING_VALIDATION_ERROR and the inline
comments around getValueOf and the validation flow. Keep the logic in
getValueOf, validateSettings, and any related helpers unchanged, but rely on
clear naming and structure instead of code comments to explain the type/bounds
checks and declared-rule validation.

Source: Coding guidelines

apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts (1)

70-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Missing test: unknown reference via appliesWhen._id (not just via $setting in query).

Only the $setting-in-query path is tested for the "unknown reference" safety net. Consider adding a case where appliesWhen._id itself points to a non-existent setting, to lock in that this path is also treated as passing/logged.

🤖 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/app/lib/server/lib/settingValidationRules.spec.ts`
around lines 70 - 76, The unknown-reference coverage in
evaluateSettingValidationRule is incomplete because it only verifies the
$setting-in-query path. Add a unit test in settingValidationRules.spec.ts that
exercises a rule with appliesWhen._id pointing to a missing setting, and assert
it still passes while systemLoggerErrorMock is called and the logged references
include that missing setting; use evaluateSettingValidationRule, getterFor, and
systemLoggerErrorMock to match the existing test style.
apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts (1)

74-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

No coverage for boolean, roomPick, multiSelect, range, timespan, or code/JSON validators.

Only the int type validator and bounds delegation are exercised. Given validateJson has the error-contract issue flagged in validateSettings.ts, a direct test asserting the thrown error's shape would have caught it.

🤖 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/app/lib/server/lib/validateSettings.spec.ts` around
lines 74 - 89, Add unit coverage in validateSettings.spec.ts for the other
validator paths in validateSettings, especially boolean, roomPick, multiSelect,
range, timespan, and code/JSON, so the suite exercises each type-specific
validator rather than only the int path. Also add a direct assertion around
validateJson’s thrown error shape in validateSettings to lock down the error
contract, using the existing validateSettings and validateJson symbols to locate
the affected logic.
🤖 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/app/lib/server/lib/validateSettings.ts`:
- Around line 28-38: The JSON validation in validateJson currently throws a
generic Meteor.Error message that does not follow the settings error contract
used by the other validators. Update the catch path in validateJson to throw the
standard error-invalid-setting-value error with a clear reason and include {
method: 'saveSettings' }, keeping the behavior aligned with the rest of
validateSettings and isSettingCode-based validation.

---

Outside diff comments:
In `@apps/meteor/app/lib/server/functions/saveSettingsBulk.ts`:
- Around line 68-95: Collapse duplicate setting IDs before running
validateSettings() and before building the update promises in saveSettingsBulk
so each _id is processed once with a deterministic value. Ensure the deduped
params are what updateAuditedByUser, Settings.updateValueById,
Settings.findOneById, and notifyOnSettingChangedById operate on, so repeated
entries cannot make validation or the final stored setting order-dependent.

---

Nitpick comments:
In `@apps/meteor/app/lib/server/lib/settingValidationRules.ts`:
- Around line 10-14: The implementation file contains multiple explanatory
comments that violate the no-comments guideline. Remove the JSDoc block and the
inline comments around the relevant logic in settingValidationRules.ts,
including the sections tied to matches, resolveObject, conditions,
unknownReferences, and conditionHolds, while keeping the existing behavior
unchanged.
- Around line 44-49: The appliesWhen condition handling in
settingValidationRules is inconsistent with rule.query resolution because
condition.value is used raw, so $setting references inside appliesWhen can be
left unresolved and skipped by the unknown-reference check. Update the condition
processing in validateSettings/conditionHolds to run appliesWhen values through
the same resolveObject/resolveNode path used for rule.query, and make sure any
resolved references are added to references so the safety net covers them too.

In `@apps/meteor/app/lib/server/lib/validateSettings.ts`:
- Around line 10-14: Remove the implementation comments from
validateSettings.ts, including the module-level explanatory note near
SETTING_VALIDATION_ERROR and the inline comments around getValueOf and the
validation flow. Keep the logic in getValueOf, validateSettings, and any related
helpers unchanged, but rely on clear naming and structure instead of code
comments to explain the type/bounds checks and declared-rule validation.

In `@apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts`:
- Around line 70-76: The unknown-reference coverage in
evaluateSettingValidationRule is incomplete because it only verifies the
$setting-in-query path. Add a unit test in settingValidationRules.spec.ts that
exercises a rule with appliesWhen._id pointing to a missing setting, and assert
it still passes while systemLoggerErrorMock is called and the logged references
include that missing setting; use evaluateSettingValidationRule, getterFor, and
systemLoggerErrorMock to match the existing test style.

In `@apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts`:
- Around line 74-89: Add unit coverage in validateSettings.spec.ts for the other
validator paths in validateSettings, especially boolean, roomPick, multiSelect,
range, timespan, and code/JSON, so the suite exercises each type-specific
validator rather than only the int path. Also add a direct assertion around
validateJson’s thrown error shape in validateSettings to lock down the error
contract, using the existing validateSettings and validateJson symbols to locate
the affected logic.

In `@packages/core-typings/src/ISetting.ts`:
- Around line 34-39: The SettingValidationRule.query field is using a loose
Record<string, unknown> while similar query-filter fields on the same area use
the named EnableQuery type. Update the SettingValidationRule definition in
ISetting to reuse EnableQuery (or a shared query type) for query so the
interface stays consistent and more type-safe.
🪄 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: 2de970ad-88c6-4dac-b395-d6a0b2281046

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc4964 and 393882d.

📒 Files selected for processing (10)
  • apps/meteor/app/lib/server/functions/saveSettingsBulk.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/lib/validateSettings.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
  • packages/core-typings/src/ISetting.ts
  • packages/i18n/src/locales/en.i18n.json
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • 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/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
  • apps/meteor/app/lib/server/lib/validateSettings.ts
  • apps/meteor/app/lib/server/functions/saveSettingsBulk.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/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.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/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
  • apps/meteor/app/lib/server/lib/validateSettings.ts
  • apps/meteor/app/lib/server/functions/saveSettingsBulk.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/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
  • apps/meteor/app/lib/server/lib/validateSettings.ts
  • apps/meteor/app/lib/server/functions/saveSettingsBulk.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/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
  • apps/meteor/app/lib/server/lib/validateSettings.ts
  • apps/meteor/app/lib/server/functions/saveSettingsBulk.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/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.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/app/lib/server/lib/settingValidationRules.spec.ts
  • apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts
🔇 Additional comments (10)
packages/core-typings/src/ISetting.ts (1)

40-102: LGTM!

packages/i18n/src/locales/en.i18n.json (1)

395-400: LGTM!

apps/meteor/app/lib/server/functions/saveSettingsBulk.ts (1)

2-13: LGTM!

Also applies to: 47-58

apps/meteor/app/lib/server/methods/saveSetting.ts (1)

4-14: LGTM!

Also applies to: 58-58

apps/meteor/server/api/v1/settings.ts (1)

31-31: LGTM!

Also applies to: 385-385

apps/meteor/server/settings/accounts.ts (1)

829-855: LGTM!

apps/meteor/app/lib/server/lib/settingValidationRules.ts (1)

1-67: LGTM! The $setting resolution, appliesWhen gating, and unknown-reference safety fallback are logically sound — verified by manually tracing every test case in the accompanying spec file and the password-policy fixtures in validateSettings.spec.ts.

apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts (1)

1-77: LGTM! Good coverage of the resolution, gating, and unknown-reference logging paths; traced each assertion against evaluateSettingValidationRule and all pass as expected.

apps/meteor/app/lib/server/lib/validateSettings.ts (1)

52-78: LGTM! Batch-first value resolution, per-type validation, and rule evaluation wiring are correct — traced against the validateSettings.spec.ts fixtures including the batch-override and disabled-bound edge cases.

apps/meteor/tests/unit/app/lib/server/lib/validateSettings.spec.ts (1)

60-199: LGTM! Strong coverage of batch-first resolution, disabled-bound (-1) semantics, and cross-field password-policy rules; manually traced several scenarios (raising min above stored max, lowering max below stored min, disabled bound skip) and all match the implementation.

Comment thread apps/meteor/app/lib/server/lib/validateSettings.ts Outdated
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.04167% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.49%. Comparing base (cff23f9) to head (1f9850b).
⚠️ Report is 12 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41173      +/-   ##
===========================================
+ Coverage    68.48%   68.49%   +0.01%     
===========================================
  Files         4092     4116      +24     
  Lines       158216   159777    +1561     
  Branches     28678    29007     +329     
===========================================
+ Hits        108351   109444    +1093     
- Misses       44827    45281     +454     
- Partials      5038     5052      +14     
Flag Coverage Δ
e2e 58.94% <ø> (-0.34%) ⬇️
e2e-api 45.38% <62.79%> (-0.13%) ⬇️
unit 70.47% <87.87%> (+0.13%) ⬆️

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.

@ricardogarim
ricardogarim force-pushed the fix/password-policy-length-validation branch from 393882d to ff7cc36 Compare July 6, 2026 02:14

@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: 1

🧹 Nitpick comments (8)
apps/meteor/app/lib/server/methods/saveSettings.ts (1)

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

Comment added to implementation.

As per coding guidelines, **/*.{ts,tsx,js} files should "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/app/lib/server/methods/saveSettings.ts` at line 41, The
implementation in saveSettings should remove the inline code comment inside the
server method, since the guideline for ts/tsx/js files is to avoid comments in
implementation. Delete the comment near the Meteor.Error rethrow logic and keep
the behavior in the surrounding code unchanged.

Source: Coding guidelines

apps/meteor/app/lib/server/methods/saveSetting.ts (2)

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

Comment added to implementation.

As per coding guidelines, **/*.{ts,tsx,js} files should "Avoid code comments in the implementation." The inline comment explaining the rethrow can be dropped since the code is self-explanatory (Meteor.Error with a descriptive error key).

🤖 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/app/lib/server/methods/saveSetting.ts` at line 76, The inline
implementation comment in saveSetting should be removed because the surrounding
Meteor.Error rethrow is already self-explanatory. Update the saveSetting method
in saveSetting.ts by deleting the comment near the rethrow logic and keep the
existing error-handling behavior unchanged.

Source: Coding guidelines


73-78: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Validation wiring looks correct; consider extracting the duplicated error-conversion logic.

The try/catch that converts a thrown validation Error into Meteor.Error('error-setting-validation-failed', ...) is identical to the block added in saveSettings.ts (Lines 38-43). Extracting a small shared helper (e.g. validateSettingRulesOrThrow in settingValidationRules.ts) would remove this duplication across both Meteor methods.

♻️ Suggested helper
+export const validateSettingRulesOrThrow = (changes: { _id: ISetting['_id']; value: ISetting['value'] }[]): void => {
+	try {
+		validateSettingRules(changes);
+	} catch (error) {
+		throw new Meteor.Error('error-setting-validation-failed', error instanceof Error ? error.message : String(error));
+	}
+};
🤖 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/app/lib/server/methods/saveSetting.ts` around lines 73 - 78, The
error-conversion block in saveSetting duplicates the same try/catch logic used
in saveSettings, so factor it into a shared helper instead of repeating it. Move
the validation-and-rethrow behavior into a reusable function such as
validateSettingRulesOrThrow in settingValidationRules.ts, then call that helper
from both saveSetting and saveSettings so both methods keep the same
Meteor.Error('error-setting-validation-failed', ...) behavior through a single
implementation.
apps/meteor/server/api/v1/settings.ts (1)

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

Comments added to implementation.

As per coding guidelines, **/*.{ts,tsx,js} files should "Avoid code comments in the implementation." Several new comments (the two TODO(next major) notes and the two "message is the i18n key" explanations) were added across these blocks.

Also applies to: 387-387, 429-429, 433-433

🤖 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/api/v1/settings.ts` at line 381, The implementation in
settings.ts contains new in-code comments that violate the no-comments
guideline. Remove the two TODO(next major) notes and the two “message is the
i18n key” explanation comments, keeping the logic in the affected validation
blocks unchanged; use the nearby validation/translation code paths to ensure the
behavior remains the same without inline commentary.

Source: Coding guidelines

apps/meteor/tests/end-to-end/api/users.ts (1)

3638-3639: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comment added to implementation.

As per coding guidelines, **/*.{ts,tsx,js} files should "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/tests/end-to-end/api/users.ts` around lines 3638 - 3639, Remove
the implementation comment in the test setup around the
Accounts_Password_Policy_MinLength update, since the coding guidelines for this
TypeScript file disallow code comments in implementation. Keep the behavior in
the same test block unchanged and just delete the explanatory comment near
updateSetting.

Source: Coding guidelines

apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts (3)

122-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider consolidating the duplicate assertion into one test.

Lines 122-129 and 131-145 both assert the same scenario (min > max fails with the min-side message) — one via chai's substring throw matcher, the other via manual try/catch for exact message equality. Could merge into a single test asserting the exact message.

🤖 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/app/lib/server/lib/settingValidationRules.spec.ts`
around lines 122 - 145, The two tests around validateSettingRules are
duplicating the same failure scenario, so consolidate them into one spec. Keep a
single test in settingValidationRules.spec.ts that exercises the min/max invalid
batch and asserts the exact error message for
Accounts_Password_Policy_MinLength_Invalid, using validateSettingRules directly
instead of both a throw matcher and a manual try/catch.

84-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Manually mirrored validation rules risk silent drift from production.

This block duplicates the Accounts_Password_Policy_MinLength/MaxLength validation arrays from server/settings/accounts.ts by hand (per the comment on line 84). If the production rules change, this file won't fail to compile or flag the mismatch — it'll just keep testing stale rules. Consider importing the real validation arrays (or the settings module itself) so the tests stay in sync with production automatically.

🤖 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/app/lib/server/lib/settingValidationRules.spec.ts`
around lines 84 - 107, The test fixture is manually duplicating the password
policy validation rules, which can drift from the production source without any
signal. Update the `validationBySettingId` setup in
`settingValidationRules.spec.ts` to import and reuse the वास्तविक validation
arrays from `server/settings/accounts.ts` (or the module exporting them) instead
of mirroring `Accounts_Password_Policy_MinLength` and
`Accounts_Password_Policy_MaxLength` by hand, so the spec stays aligned
automatically.

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

Code comments present in a .ts test file.

As per coding guidelines, **/*.{ts,tsx,js} files should avoid code comments in the implementation. This file has several explanatory comments; note the guideline is framed around Playwright tests specifically, and this is a Mocha/chai unit test, so applicability may be limited.

Also applies to: 49-50, 69-71, 205-206, 223-223

🤖 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/app/lib/server/lib/settingValidationRules.spec.ts` at
line 9, Remove the explanatory inline comments from
settingValidationRules.spec.ts and keep the test self-explanatory through the
surrounding describe/it names and assertions instead. Update the affected test
blocks in settingValidationRules.spec.ts so the notes about
createPredicateFromFilter and isRecord being pure, as well as the other listed
explanatory comments, are no longer present while preserving the test behavior.

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/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts`:
- Around line 204-225: The two tests are not actually proving the behaviors in
their names. In the spec for validateSettingRules, update the “policy is
disabled” case so it targets a setting pair that is validated by
validationBySettingId and demonstrates the rule still runs regardless of
Accounts_Password_Policy_Enabled, and update the “ignores value types” case so
it uses a setting that does have validation rules rather than Some_Int_Setting.
Keep the assertions aligned with the actual rule logic so the tests fail if
those behaviors regress.

---

Nitpick comments:
In `@apps/meteor/app/lib/server/methods/saveSetting.ts`:
- Line 76: The inline implementation comment in saveSetting should be removed
because the surrounding Meteor.Error rethrow is already self-explanatory. Update
the saveSetting method in saveSetting.ts by deleting the comment near the
rethrow logic and keep the existing error-handling behavior unchanged.
- Around line 73-78: The error-conversion block in saveSetting duplicates the
same try/catch logic used in saveSettings, so factor it into a shared helper
instead of repeating it. Move the validation-and-rethrow behavior into a
reusable function such as validateSettingRulesOrThrow in
settingValidationRules.ts, then call that helper from both saveSetting and
saveSettings so both methods keep the same
Meteor.Error('error-setting-validation-failed', ...) behavior through a single
implementation.

In `@apps/meteor/app/lib/server/methods/saveSettings.ts`:
- Line 41: The implementation in saveSettings should remove the inline code
comment inside the server method, since the guideline for ts/tsx/js files is to
avoid comments in implementation. Delete the comment near the Meteor.Error
rethrow logic and keep the behavior in the surrounding code unchanged.

In `@apps/meteor/server/api/v1/settings.ts`:
- Line 381: The implementation in settings.ts contains new in-code comments that
violate the no-comments guideline. Remove the two TODO(next major) notes and the
two “message is the i18n key” explanation comments, keeping the logic in the
affected validation blocks unchanged; use the nearby validation/translation code
paths to ensure the behavior remains the same without inline commentary.

In `@apps/meteor/tests/end-to-end/api/users.ts`:
- Around line 3638-3639: Remove the implementation comment in the test setup
around the Accounts_Password_Policy_MinLength update, since the coding
guidelines for this TypeScript file disallow code comments in implementation.
Keep the behavior in the same test block unchanged and just delete the
explanatory comment near updateSetting.

In `@apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts`:
- Around line 122-145: The two tests around validateSettingRules are duplicating
the same failure scenario, so consolidate them into one spec. Keep a single test
in settingValidationRules.spec.ts that exercises the min/max invalid batch and
asserts the exact error message for Accounts_Password_Policy_MinLength_Invalid,
using validateSettingRules directly instead of both a throw matcher and a manual
try/catch.
- Around line 84-107: The test fixture is manually duplicating the password
policy validation rules, which can drift from the production source without any
signal. Update the `validationBySettingId` setup in
`settingValidationRules.spec.ts` to import and reuse the वास्तविक validation
arrays from `server/settings/accounts.ts` (or the module exporting them) instead
of mirroring `Accounts_Password_Policy_MinLength` and
`Accounts_Password_Policy_MaxLength` by hand, so the spec stays aligned
automatically.
- Line 9: Remove the explanatory inline comments from
settingValidationRules.spec.ts and keep the test self-explanatory through the
surrounding describe/it names and assertions instead. Update the affected test
blocks in settingValidationRules.spec.ts so the notes about
createPredicateFromFilter and isRecord being pure, as well as the other listed
explanatory comments, are no longer present while preserving the test 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: 92f93f03-fcb7-4606-9505-503ff4da1627

📥 Commits

Reviewing files that changed from the base of the PR and between 393882d and ff7cc36.

📒 Files selected for processing (9)
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/app/lib/server/methods/saveSettings.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • packages/core-typings/src/ISetting.ts
  • packages/i18n/src/locales/en.i18n.json
✅ Files skipped from review due to trivial changes (1)
  • packages/i18n/src/locales/en.i18n.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/meteor/server/settings/accounts.ts
  • packages/core-typings/src/ISetting.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 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/app/lib/server/methods/saveSettings.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
**/*.spec.ts

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

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

Files:

  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.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/app/lib/server/methods/saveSettings.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.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 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/app/lib/server/methods/saveSettings.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.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/app/lib/server/methods/saveSettings.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.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:

  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.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/app/lib/server/lib/settingValidationRules.spec.ts
🔇 Additional comments (11)
apps/meteor/app/lib/server/lib/settingValidationRules.ts (3)

1-9: LGTM!


16-67: LGTM!


69-91: LGTM!

apps/meteor/app/lib/server/methods/saveSettings.ts (1)

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

Duplicate error-conversion logic.

Same pattern as saveSetting.ts (Lines 73-78). See the consolidated refactor suggestion there — extracting a shared helper would avoid maintaining this conversion in two (soon four, counting settings.ts) places.

apps/meteor/server/api/v1/settings.ts (4)

384-390: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate error-conversion logic (REST variant).

Same try { validateSettingRules(...) } catch { return API.v1.failure(...) } pattern is repeated twice in this file and mirrors the Meteor-method variant in saveSetting.ts/saveSettings.ts. Consider a shared helper (e.g., returning a discriminated result) reused across both REST handlers and the two Meteor methods.

Also applies to: 429-436


381-390: 📐 Maintainability & Code Quality

Dual validation paths run for the same value; consider tracking consolidation.

checkSettingValueBounds(setting, bodyParams.value) (unwrapped, throws Meteor.Error('error-invalid-setting-value', ...)) still runs immediately before the new validateSettingRules check. This is already flagged by the existing TODO(next major) comment, so it's an acknowledged transitional state rather than a new defect, but note that a numeric-bounds failure will surface a different error shape (thrown Meteor.Error, not API.v1.failure) than a validateSettingRules failure on the same request.


327-327: LGTM!


32-32: 🎯 Functional Correctness

checkSettingValueBounds is still imported and used. The summary is outdated; apps/meteor/server/api/v1/settings.ts still imports checkSettingValueBounds and calls it at line 382.

			> Likely an incorrect or invalid review comment.
apps/meteor/tests/end-to-end/api/users.ts (1)

3596-3609: 🎯 Functional Correctness

No change needed: Accounts_Password_Policy_MinLength is already lowered to 1 in the block and never raised again, so restoring Accounts_Password_Policy_MaxLength first in after() does not violate the min/max constraint.

			> Likely an incorrect or invalid review comment.
apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts (2)

1-83: LGTM!

Also applies to: 109-203, 215-221, 226-227


12-15: 🎯 Functional Correctness

Proxyquire stubs match the imports
The stub keys align with settingValidationRules.ts’s import specifiers, so this test setup is correct.

Comment thread apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts Outdated
@ricardogarim
ricardogarim force-pushed the fix/password-policy-length-validation branch from ff7cc36 to 1a506c3 Compare July 6, 2026 12:30
@ricardogarim ricardogarim added this to the 8.7.0 milestone Jul 6, 2026
@ricardogarim
ricardogarim force-pushed the fix/password-policy-length-validation branch 2 times, most recently from 61dd515 to 2c2f0a9 Compare July 6, 2026 16:21
@ricardogarim ricardogarim reopened this Jul 6, 2026
@ricardogarim
ricardogarim marked this pull request as ready for review July 7, 2026 12:20
@ricardogarim
ricardogarim requested review from a team as code owners July 7, 2026 12:20
@coderabbitai coderabbitai Bot added type: bug and removed type: feature Pull requests that introduces new feature labels Jul 7, 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 (3)
packages/core-typings/src/ISetting.ts (1)

34-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider exporting SettingValidation.

SettingValidationRule is exported but the union alias SettingValidation (line 40) is not, even though it's the type used on the public validation field of ISettingBase. Other modules (e.g. getSettingDefaults.ts) reference options.validation structurally rather than importing this alias directly, but exporting it would make the contract more discoverable/reusable.

♻️ Proposed fix
-type SettingValidation = SettingValidationRule[] | string;
+export type SettingValidation = SettingValidationRule[] | string;
🤖 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 `@packages/core-typings/src/ISetting.ts` around lines 34 - 41, Export the
`SettingValidation` union from `ISetting.ts` so the public `validation` contract
on `ISettingBase` is discoverable and reusable alongside
`SettingValidationRule`. Update the type declaration near
`SettingValidationRule` and keep the existing shape (`SettingValidationRule[] |
string`) unchanged; this lets other modules like `getSettingDefaults` refer to
the shared alias instead of relying on structural typing.
apps/meteor/app/lib/server/lib/settingValidationRules.ts (2)

35-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Code comments present despite the "avoid code comments" guideline.

This file has explanatory inline comments (the docstring at Lines 35-39 and single-line comments at Lines 47, 51-52, 82-83, 94-95). As per coding guidelines, **/*.{ts,tsx,js} files should avoid code comments in the implementation. Given the non-trivial recursive resolution logic here, these comments genuinely aid readability, but per the stated guideline they should be reconsidered/removed if strict compliance is required.

Also applies to: 47-52, 82-95

🤖 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/app/lib/server/lib/settingValidationRules.ts` around lines 35 -
39, Remove the implementation comments in settingValidationRules.ts to comply
with the “avoid code comments” guideline, including the top docstring and the
inline comments around the recursive validation flow. Keep the behavior in the
same functions and symbols (such as the validation rule evaluator and its helper
logic) unchanged, and if any explanation is still needed, prefer clearer naming
or refactoring over comments.

Source: Coding guidelines


8-9: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Strengthen isValidationRuleArray shape validation.

The guard only checks that 'query' and 'errorKey' keys exist on each parsed element, not that query is actually an object or that errorKey is a string. A malformed rule like { query: "oops", errorKey: 42 } will pass this check and flow into evaluateSettingValidationRule, where resolveObject/Object.entries on a non-object query (e.g. a string) silently produces a bogus filter instead of failing open with a logged error, which is the stated intent for broken rule declarations.

♻️ Proposed fix
-const isValidationRuleArray = (value: unknown): value is SettingValidationRule[] =>
-	Array.isArray(value) && value.every((rule) => isRecord(rule) && 'query' in rule && 'errorKey' in rule);
+const isValidationRuleArray = (value: unknown): value is SettingValidationRule[] =>
+	Array.isArray(value) &&
+	value.every((rule) => isRecord(rule) && isRecord(rule.query) && typeof rule.errorKey === 'string');

Also applies to: 24-27

🤖 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/app/lib/server/lib/settingValidationRules.ts` around lines 8 - 9,
Strengthen the `isValidationRuleArray` type guard so it validates the actual
shape of each `SettingValidationRule`, not just the presence of keys. Update the
check in `settingValidationRules.ts` to require that each item is a record with
`query` being a non-null object and `errorKey` being a string before it can
pass. This should align with how `evaluateSettingValidationRule` and
`resolveObject` expect to consume `query`, preventing malformed rules from
slipping through and producing bogus filters.
🤖 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/app/lib/server/lib/settingValidationRules.ts`:
- Around line 35-39: Remove the implementation comments in
settingValidationRules.ts to comply with the “avoid code comments” guideline,
including the top docstring and the inline comments around the recursive
validation flow. Keep the behavior in the same functions and symbols (such as
the validation rule evaluator and its helper logic) unchanged, and if any
explanation is still needed, prefer clearer naming or refactoring over comments.
- Around line 8-9: Strengthen the `isValidationRuleArray` type guard so it
validates the actual shape of each `SettingValidationRule`, not just the
presence of keys. Update the check in `settingValidationRules.ts` to require
that each item is a record with `query` being a non-null object and `errorKey`
being a string before it can pass. This should align with how
`evaluateSettingValidationRule` and `resolveObject` expect to consume `query`,
preventing malformed rules from slipping through and producing bogus filters.

In `@packages/core-typings/src/ISetting.ts`:
- Around line 34-41: Export the `SettingValidation` union from `ISetting.ts` so
the public `validation` contract on `ISettingBase` is discoverable and reusable
alongside `SettingValidationRule`. Update the type declaration near
`SettingValidationRule` and keep the existing shape (`SettingValidationRule[] |
string`) unchanged; this lets other modules like `getSettingDefaults` refer to
the shared alias instead of relying on structural typing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: edb8b728-fd55-41f1-b331-ea608651a350

📥 Commits

Reviewing files that changed from the base of the PR and between ff7cc36 and 2c2f0a9.

📒 Files selected for processing (11)
  • .changeset/empty-garlics-reply.md
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/app/lib/server/methods/saveSettings.ts
  • apps/meteor/app/settings/server/functions/getSettingDefaults.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
  • packages/core-typings/src/ISetting.ts
  • packages/i18n/src/locales/en.i18n.json
✅ Files skipped from review due to trivial changes (2)
  • .changeset/empty-garlics-reply.md
  • packages/i18n/src/locales/en.i18n.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • apps/meteor/app/lib/server/methods/saveSetting.ts
  • apps/meteor/tests/end-to-end/api/users.ts
  • apps/meteor/app/lib/server/methods/saveSettings.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
⚠️ CI failures not shown inline (2)

GitHub Actions: CI / 19_📦 Track Image Sizes.txt: feat: validate password policy length on settings save

Conclusion: failure

View job details

##[group]Run current_total=$(jq -r '.total' current-sizes.json)
 �[36;1mcurrent_total=$(jq -r '.total' current-sizes.json)�[0m
 �[36;1m�[0m
 �[36;1mif [[ ! -f baseline-sizes.json ]]; then�[0m
 �[36;1m  echo "No baseline available"�[0m
 �[36;1m  echo "size-diff=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "size-diff-percent=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "comment-triggered=false" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m  cat > report.md << 'EOF'�[0m
 �[36;1m# 📦 Docker Image Size Report�[0m
 �[36;1m�[0m
 �[36;1m**Status:** First measurement - no baseline for comparison�[0m
 �[36;1m�[0m
 �[36;1m**Total Size:** $(numfmt --to=iec-i --suffix=B $current_total)�[0m
 �[36;1mEOF�[0m
 �[36;1m  exit 0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mbaseline_total=$(jq -r '.total' baseline-sizes.json)�[0m
 �[36;1mdiff=$((current_total - baseline_total))�[0m
 �[36;1m�[0m
 �[36;1mif [[ $baseline_total -gt 0 ]]; then�[0m
 �[36;1m  percent=$(awk "BEGIN {printf \"%.2f\", ($diff / $baseline_total) * 100}")�[0m
 �[36;1melse�[0m
 �[36;1m  percent=0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "size-diff=$diff" >> $GITHUB_OUTPUT�[0m
 �[36;1mecho "size-diff-percent=$percent" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m# Only comment when size is bigger than baseline; optionally require per-image thresholds�[0m
 �[36;1mTHRESHOLDS="$SIZE_THRESHOLDS"�[0m
 �[36;1mFAIL_THRESHOLDS="$FAIL_THRESHOLDS"�[0m
 �[36;1mcomment_triggered=false�[0m
 �[36;1mfail_triggered=false�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  if [[ -z "$THRESHOLDS" ]] || [[ "$THRESHOLDS" == "{}" ]]; then�[0m
 �[36;1m    comment_triggered=true�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mcolor="gray"�[0m
 �[36;1mif (( $(awk "BEGIN {print ($percent > 0.01)}") )); then�[0m
 �[36;1m  color="red"�[0m
 �[36;1melif (( $(awk "BEGIN {print ($percent < -0.01)}") )); then�[0m
 �[36;1m  color="green"�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Generate report�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  emoji=...

GitHub Actions: CI / 33_🔨 Test Unit _ Unit Tests.txt: feat: validate password policy length on settings save

Conclusion: failure

View job details

et=rs0&directConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   ENTERPRISE_LICENSE: MK+bpK5NveUuNlWGaQXGoy+8b74Luet82M3ZGcBB8b5P9Y+m67NEtpW64dc1d5lEWi6d0nFjCjtCMneVD7bKxodz/Cml8URKEo5P7cQb/9wmeT0MzAhYNaRFZlIGkZ3ITF59pDV2u4HZuosEDJikVRwnaJ5ZoU/pOsHSPUPhTyGNIqLeKynODtUpfwDdIKEmHxpf2yVkKjgRiIJmbWjM6A4k+MNNYXWVXHzye7GggqWVg/ZcT7nKU1CCadpLhTJiIrgrrPzil1G5DQ4xnLs3Q2tu2dILSDiW5OYw/ywu2yCMicTjMq4MLL5SXDQJj6WoJzZ54HosbvsDzOXvsdC9gI1CjhPL2uRuvC8XLrzn3vL2UgXnifzD1VrLTtdZ+aSADveqtlzYlRWtqoUFBbNw8o+YVHdhbZGR0beMoAyRbHi5EMpxpad3L+NyztUIT/Uh/IjQ/C2SQZ6jB0GKPBOPxFLN56FNhTGrffLFR++TVoBu0Iquc7kajWkNit3bVbZvbx+oFcVW2PcjQ/+i2jpJjbgtUFUKrTKxGMAXTWoDzIQQ35zNzGAy268IM4Ymp5JmsVEnBOEUkbF9yx6fzkO6xZhpsHf0muklnW0kA+Tlore/TUrBWh1/RwWlQeZlxM5NyWoRM5onQmr/k/4BmObtL1Hpmbk8oMG29z89xtE9y/4=
   NODE_VERSION: 22.22.3
   DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
 ##[endgroup]
 ##[group]Run missing_deps=""
 �[36;1mmissing_deps=""�[0m
 �[36;1m�[0m
 �[36;1m# Check for always-required commands�[0m
 �[36;1mfor cmd in bash git curl; do�[0m
 �[36;1m  if ! command -v "$cmd" >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps $cmd"�[0m
 �[36;1m  fi�[0m
 �[36;1mdone�[0m
 �[36;1m�[0m
 �[36;1m# Check for gpg only if validation is not being skipped�[0m
 �[36;1mif [ "$INPUT_SKIP_VALIDATION" != "true" ]; then�[0m
 �[36;1m  if ! command -v gpg >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps gpg"�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Report missing required dependencies�[0m
 �[36;1mif [ -n "$missing_deps" ]; then�[0m
 �[36;1m  echo "Error: The following required dependencies are missing:$missing_deps"�[0m
 �[36;1m  echo "Please install these dependencies before using this action."�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "All require...
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

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

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

Files:

  • apps/meteor/app/settings/server/functions/getSettingDefaults.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
🧠 Learnings (3)
📚 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/app/settings/server/functions/getSettingDefaults.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/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/app/settings/server/functions/getSettingDefaults.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/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/app/settings/server/functions/getSettingDefaults.ts
  • packages/core-typings/src/ISetting.ts
  • apps/meteor/app/lib/server/lib/settingValidationRules.ts
🔇 Additional comments (4)
packages/core-typings/src/ISetting.ts (1)

76-76: LGTM!

apps/meteor/app/settings/server/functions/getSettingDefaults.ts (1)

29-29: LGTM! Consistent with the existing enableQuery/displayQuery stringification pattern.

apps/meteor/app/lib/server/lib/settingValidationRules.ts (2)

93-115: LGTM! Batch-first value resolution and fail-open handling of missing settings look correct.


40-91: 🎯 Functional Correctness

No issue: createPredicateFromFilter accepts this document shape, and undefined values are already handled as expected.

			> 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 11 files

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

Re-trigger cubic

Comment thread apps/meteor/app/lib/server/lib/settingValidationRules.ts Outdated
Comment thread apps/meteor/server/api/v1/settings.ts Outdated

@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 5 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/app/lib/server/lib/settingValidationRules.ts Outdated

@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 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts Outdated
@ricardogarim
ricardogarim force-pushed the fix/password-policy-length-validation branch 2 times, most recently from 2352fd2 to 528f8d2 Compare July 10, 2026 13:54
Comment thread apps/meteor/server/api/v1/settings.ts Outdated
Comment thread apps/meteor/server/meteor-methods/settings/saveSetting.ts Outdated
Comment thread apps/meteor/server/api/v1/settings.ts Outdated
Comment thread apps/meteor/server/meteor-methods/settings/saveSetting.ts Outdated
Comment thread apps/meteor/server/meteor-methods/settings/saveSettings.ts Outdated
Comment thread apps/meteor/app/lib/server/lib/settingValidationRules.ts Outdated
Comment thread apps/meteor/app/lib/server/lib/settingValidationRules.ts Outdated
@ricardogarim
ricardogarim requested a review from KevLehman July 10, 2026 16:39
Comment thread apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts Outdated
Comment thread apps/meteor/tests/unit/app/lib/server/lib/settingValidationRules.spec.ts Outdated
KevLehman
KevLehman previously approved these changes Jul 13, 2026
@ricardogarim
ricardogarim requested a review from KevLehman July 14, 2026 16:34
KevLehman
KevLehman previously approved these changes Jul 14, 2026
@ricardogarim
ricardogarim force-pushed the fix/password-policy-length-validation branch from 72b413e to d9000ab Compare July 16, 2026 13:41
Comment thread apps/meteor/tests/unit/server/lib/settingValidationRules.spec.ts
@ricardogarim ricardogarim 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
@ricardogarim ricardogarim removed this from the 8.7.0 milestone 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
@ricardogarim ricardogarim added this to the 8.7.0 milestone 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
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks 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 1bf84cb Jul 18, 2026
84 of 86 checks passed
@dionisio-bot
dionisio-bot Bot deleted the fix/password-policy-length-validation branch July 18, 2026 03:39
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: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants