Skip to content

Conversation

@dougfabris
Copy link
Member

@dougfabris dougfabris commented Sep 23, 2025

Proposed changes (including videos or screenshots)

This PR introduces the RangeSettingInput, so we can use our Slider component to handle settings, such as volumes. It improves the user experience allowing users to set a specific range of values, preventing undesirable values

image

Issue(s)

Steps to test or reproduce

Further comments

CORE-1395

Summary by CodeRabbit

  • New Features
    • Added a range slider input for numeric settings in the admin panel (min/max, hint, reset support) and exported it in the public settings UI.
    • Switched default user volume preferences (master, notification, ringer) to use the new range input with descriptive hints.
  • Bug Fixes
    • Server-side and API validation now enforce min/max bounds for numeric and range settings.
  • Documentation
    • Added Storybook examples demonstrating disabled, preset value, hint, and reset states.
  • Tests
    • Added snapshot, accessibility, and end-to-end tests (including out-of-range update checks).
  • Chores
    • Minor version bumps for external packages.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 23, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Sep 23, 2025

🦋 Changeset detected

Latest commit: 36bd4ec

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

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

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

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

Adds a slider-style RangeSettingInput and integrates a new range setting type across typings, client UI, server validation (bounds checking), defaults, settings declarations, Storybook stories, and tests; includes a changeset updating package metadata.

Changes

Cohort / File(s) Summary
New slider input component, stories & tests
apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.tsx, apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.stories.tsx, apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.spec.tsx
Adds RangeSettingInput React slider component, Storybook stories (5 variants), and snapshot + accessibility tests.
Admin settings input mapping
apps/meteor/client/views/admin/settings/Setting/MemoizedSetting.tsx
Imports RangeSettingInput and maps range to it in inputsByType.
Core typings and guards
packages/core-typings/src/ISetting.ts
Adds ISettingRange type (type: 'range', minValue, maxValue), extends ISetting union and ISettingBase.type, adds isSettingRange guard, and extends ISettingAsset.
Settings defaults augmentation
apps/meteor/app/settings/server/functions/getSettingDefaults.ts
When isSettingRange(setting) is true, augments returned setting defaults with minValue: 0 and maxValue: 100.
Server numeric validation helpers
apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts, apps/meteor/app/lib/server/methods/saveSettings.ts, apps/meteor/app/api/server/v1/settings.ts
Adds checkSettingValueBounds (enforces minValue/maxValue for numeric settings), introduces checkInteger usage in save flow, and invokes bounds check in API POST handler.
Accounts settings updates
apps/meteor/server/settings/accounts.ts
Converts three default preference settings (masterVolume, notificationsSoundVolume, voipRingerVolume) from int to range and adds i18nDescription hints.
End-to-end tests
apps/meteor/tests/end-to-end/api/settings.ts
Fixes typos and adds POST tests asserting validation fails when values are below minValue or above maxValue.
Release metadata / changeset
.changeset/new-bats-pull.md
Adds changeset noting new public RangeSettingInput and minor bumps for @rocket.chat/core-typings and @rocket.chat/meteor.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Admin
  participant UI as RangeSettingInput (client)
  participant API as Settings API / saveSettings (server)
  participant Store as Settings Store

  Admin->>UI: adjust slider / submit value
  UI->>API: POST /settings {_id, value}
  API->>API: checkInteger(value)
  API->>API: checkSettingValueBounds(setting, value)
  alt value within bounds
    API->>Store: persist setting value
    Store-->>API: success
    API->>UI: success / notify
    API->>API: audit(action, meta)
  else invalid
    API-->>UI: Meteor.Error (error-invalid-setting-value)
  end
Loading
sequenceDiagram
  autonumber
  participant Loader as Settings Loader
  participant Defaults as getSettingDefaults()
  participant Typings as isSettingRange()

  Loader->>Defaults: request defaults
  Defaults->>Typings: isSettingRange(setting)
  alt setting is 'range'
    Defaults-->>Loader: setting + { minValue: 0, maxValue: 100 }
  else
    Defaults-->>Loader: setting unchanged
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • MartinSchoeler
  • cardoso

Poem

I nudge a slider, soft and bright,
A rabbit hums through day and night.
From min to max the volumes play,
Three tiny knobs hop into sway.
I twitch my whiskers — settings sing. 🐇🎚️

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: Introduce RangeSettingInput" directly and clearly identifies the primary feature being introduced—a new React component for handling bounded numeric range settings. The title is concise, specific, and accurately reflects the main change in the changeset. While the PR also includes supporting infrastructure such as type definitions, backend validation, and integration logic, these are all subordinate to the main feature addition and do not make the title misleading or overly vague. A reviewer scanning the history would immediately understand that this PR introduces a new component called RangeSettingInput.
Linked Issues Check ✅ Passed The PR successfully implements the requirements for CORE-1395 (New slider setting component for volume settings). The changes include the creation of the RangeSettingInput component that leverages the existing Slider component to provide a bounded numeric range interface CORE-1395. Additionally, three account preference settings (masterVolume, notificationsSoundVolume, voipRingerVolume) have been converted from 'int' type to 'range' type, demonstrating practical integration with volume-related settings CORE-1395. Supporting infrastructure has been added, including type definitions (ISettingRange, isSettingRange), backend validation (checkSettingValueBounds), API integration, comprehensive tests, and Storybook stories, all fulfilling the technical requirements for the feature.
Out of Scope Changes Check ✅ Passed All substantive changes in the PR are directly scoped to implementing and integrating the RangeSettingInput feature. The component implementation, type definitions, backend validation logic, API updates, and tests are all essential to delivering the feature requirements. The only potentially tangential changes are two typo corrections in test descriptions ("succesfully" → "successfully" in the E2E test file), which are minimal code quality improvements that do not materially expand the scope of the PR. No changes present unrelated functionality or introduce logic outside the stated objectives of creating a range-based setting input component for volume and similar settings.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/slider-setting

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0f60f64 and 2ae4b3c.

📒 Files selected for processing (4)
  • apps/meteor/app/api/server/v1/settings.ts (2 hunks)
  • apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts (1 hunks)
  • apps/meteor/app/lib/server/methods/saveSettings.ts (3 hunks)
  • apps/meteor/tests/end-to-end/api/settings.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/meteor/app/api/server/v1/settings.ts
  • apps/meteor/app/lib/server/methods/saveSettings.ts
  • apps/meteor/tests/end-to-end/api/settings.ts
  • apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 99.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.66%. Comparing base (f3555bf) to head (36bd4ec).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37038      +/-   ##
===========================================
+ Coverage    67.62%   67.66%   +0.04%     
===========================================
  Files         3339     3339              
  Lines       113919   113876      -43     
  Branches     20664    20641      -23     
===========================================
+ Hits         77034    77056      +22     
+ Misses       34213    34148      -65     
  Partials      2672     2672              
Flag Coverage Δ
e2e 57.33% <0.00%> (+<0.01%) ⬆️
unit 71.62% <99.00%> (+0.01%) ⬆️

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.

@dougfabris dougfabris added this to the 7.12.0 milestone Sep 29, 2025
@dougfabris dougfabris marked this pull request as ready for review September 30, 2025 19:23
@dougfabris dougfabris requested review from a team as code owners September 30, 2025 19:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/core-typings/src/ISetting.ts (2)

27-31: Capture future needs: step and documentation

Consider adding an optional step to express non-unit increments and document that minValue ≤ maxValue and the value is integer (per server validation).

 export interface ISettingSlider extends Omit<ISettingBase, 'type'> {
   type: 'slider';
   minValue: number;
   maxValue: number;
+  /** Increment step for the slider; defaults to 1 if omitted */
+  step?: number;
 }

33-33: Union looks good; add a dedicated type guard for ergonomics

Matching existing patterns (e.g., color/code), export a helper to narrow to ISettingSlider.

Add below the other guards:

export const isSettingSlider = (setting: ISettingBase): setting is ISettingSlider => setting.type === 'slider';
apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.stories.tsx (2)

6-14: Consider adding an explicit title for stable Storybook IDs

Helps with permalinks and test runner selectors.

 export default {
   component: SliderSettingInput,
+  title: 'Admin/Settings/SliderSettingInput',
   parameters: {
     actions: {
       argTypesRegex: '^on.*',
     },
   },
   decorators: [(fn) => <Field>{fn()}</Field>],
 } satisfies Meta<typeof SliderSettingInput>;

38-42: Provide a reset handler in the story

Without an explicit handler, clicking Reset may no-op depending on auto-actions detection. Add a stub for clarity.

 export const WithResetButton = Template.bind({});
 WithResetButton.args = {
   value: 50,
   hasResetButton: true,
+  onResetButtonClick: () => {},
 };
.changeset/new-bats-pull.md (1)

2-6: Changeset targets correct packages
Only @rocket.chat/core-typings and @rocket.chat/meteor require bumps for this change. Consider updating the changeset description to mention the new ISettingSlider typings in core-typings and the server-side validation added in apps/meteor.

apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.tsx (1)

46-46: Consider bounds validation for the value prop.

The value coercion Number(value || 0) handles undefined/null cases correctly. However, there's no validation that the value falls within [minValue, maxValue]. While the Slider component likely enforces this, adding explicit bounds clamping would make the component more defensive:

-value={Number(value || 0)}
+value={Math.max(minValue, Math.min(maxValue, Number(value || 0)))}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5e821ad and 1aec9ba.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/views/admin/settings/Setting/inputs/__snapshots__/SliderSettingInput.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (8)
  • .changeset/new-bats-pull.md (1 hunks)
  • apps/meteor/app/lib/server/methods/saveSettings.ts (1 hunks)
  • apps/meteor/client/views/admin/settings/Setting/MemoizedSetting.tsx (2 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.spec.tsx (1 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.stories.tsx (1 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.tsx (1 hunks)
  • apps/meteor/server/settings/accounts.ts (1 hunks)
  • packages/core-typings/src/ISetting.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: 🚢 Build Docker Images for Testing (alpine)
🔇 Additional comments (13)
packages/core-typings/src/ISetting.ts (1)

57-58: Confirm inclusion of 'slider' in base type is intentional

Including 'slider' in ISettingBase['type'] keeps inputsByType keyed by base types working. Just ensure code that relies on min/max narrows to ISettingSlider (via the guard above) before accessing those fields.

apps/meteor/client/views/admin/settings/Setting/MemoizedSetting.tsx (2)

22-22: Import looks good


45-46: Slider bounds are forwarded correctly
minValue and maxValue from ISettingSlider are included in {...setting}, passed into MemoizedSetting as inputProps, and reach SliderSettingInput as expected.

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

92-100: Enforce slider min/max on the server
Import ISettingSlider and add a range check for slider settings:

-import type { ISetting } from '@rocket.chat/core-typings';
+import type { ISetting, ISettingSlider } from '@rocket.chat/core-typings';
@@
-                case 'timespan':
-                case 'int':
-                case 'slider':
+                case 'timespan':
+                case 'int':
+                case 'slider':
                   check(value, Number);
                   if (!Number.isInteger(value)) {
                     throw new Meteor.Error(`Invalid setting value ${value}`, 'Invalid setting value', {
                       method: 'saveSettings',
                     });
                   }
+                  if (setting?.type === 'slider') {
+                    const { minValue, maxValue } = setting as ISettingSlider;
+                    if (value < minValue || value > maxValue) {
+                      throw new Meteor.Error(
+                        `Invalid setting value ${value}`,
+                        `Value must be between ${minValue} and ${maxValue}`,
+                        { method: 'saveSettings' },
+                      );
+                    }
+                  }
                   break;

Verify that ISettingSlider in @rocket.chat/core-typings defines minValue and maxValue.

apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.tsx (3)

1-11: LGTM!

The imports and type definition are well-structured. The SliderSettingInputProps correctly extends the base SettingInputProps<number> with slider-specific properties.


13-26: LGTM!

The component signature is comprehensive with sensible defaults (minValue=0, maxValue=100) that align with the volume settings use case mentioned in the PR objectives.


41-48: Add explicit id to <Slider> or confirm its auto-generation.

The <FieldLabel htmlFor={_id}/> needs a matching id on the <Slider> for proper association. Either pass id={_id} to the Slider or verify that @rocket.chat/fuselage’s Slider auto-sets its id from data-qa-setting-id.

apps/meteor/client/views/admin/settings/Setting/inputs/SliderSettingInput.spec.tsx (3)

1-7: LGTM!

The test setup correctly uses composeStories to load stories and generate test cases. This is a standard pattern for testing Storybook components.


9-12: LGTM!

The snapshot test correctly renders each story and captures the baseElement for comprehensive snapshot coverage.


14-19: LGTM!

The accessibility test properly uses jest-axe to validate that each story has no a11y violations. This is excellent practice for ensuring the component meets accessibility standards.

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

711-727: LGTM!

The conversion of notificationsSoundVolume and voipRingerVolume settings to slider type follows the same pattern as masterVolume, with consistent minValue: 0 and maxValue: 100 constraints. This provides a uniform user experience across all volume settings.


702-709: i18n slider description keys present
The keys Master_volume_hint, Notification_volume_hint and Call_ringer_volume_hint exist in the translation files; no further action required.


702-727: No action needed: slider type is already supported.

saveSettings.ts includes a case 'slider' alongside int, validating the value as a Number and enforcing integer constraints, so server-side handling is correct.

@dougfabris dougfabris requested a review from gabriellsh October 7, 2025 17:13
@dougfabris dougfabris changed the title feat: Introduce SliderSettingInput feat: Introduce RangeSettingInput Oct 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.stories.tsx (1)

16-18: Consider adding stories for different range configurations.

The Template hardcodes minValue={0} and maxValue={100}, which limits the ability to demonstrate different range configurations or edge cases.

Consider adding stories that showcase:

  • Different ranges (e.g., 1-10, 0-1, -100-100)
  • Boundary values (value at minValue, value at maxValue)
  • Edge cases (minValue === maxValue)

Example:

export const CustomRange = Template.bind({});
CustomRange.args = {
	value: 5,
	minValue: 1,
	maxValue: 10,
};

export const AtMinValue = Template.bind({});
AtMinValue.args = {
	value: 0,
};

export const AtMaxValue = Template.bind({});
AtMaxValue.args = {
	value: 100,
};

This would improve test coverage and documentation of the component's behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1aec9ba and 4fba71e.

📒 Files selected for processing (9)
  • .changeset/new-bats-pull.md (1 hunks)
  • apps/meteor/app/lib/server/methods/saveSettings.ts (1 hunks)
  • apps/meteor/app/settings/server/functions/getSettingDefaults.ts (2 hunks)
  • apps/meteor/client/views/admin/settings/Setting/MemoizedSetting.tsx (2 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.spec.tsx (1 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.stories.tsx (1 hunks)
  • apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.tsx (1 hunks)
  • apps/meteor/server/settings/accounts.ts (1 hunks)
  • packages/core-typings/src/ISetting.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/client/views/admin/settings/Setting/MemoizedSetting.tsx
  • apps/meteor/app/lib/server/methods/saveSettings.ts
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/app/settings/server/functions/getSettingDefaults.ts (1)
packages/core-typings/src/ISetting.ts (2)
  • isSettingRange (170-170)
  • ISetting (27-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (4)
.changeset/new-bats-pull.md (1)

1-6: LGTM!

The changeset correctly documents the addition of the RangeSettingInput component and appropriately marks this as a minor version bump for the affected packages.

apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.spec.tsx (1)

1-19: LGTM!

The test suite correctly uses Storybook stories to drive both snapshot and accessibility tests. This approach ensures consistency between the stories and tests.

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

40-43: LGTM!

The addition of default minValue: 0 and maxValue: 100 for range settings provides sensible defaults. These values can be overridden by individual setting definitions, ensuring flexibility while maintaining safe defaults.

apps/meteor/client/views/admin/settings/Setting/inputs/RangeSettingInput.tsx (1)

1-54: LGTM!

The component implementation is clean and follows established patterns:

  • Properly uses Fuselage components for consistent styling
  • Handles optional hint display
  • Delegates range validation to the underlying Slider component
  • Correctly treats readonly as disabled for the slider

The use of Number(value || 0) on Line 46 safely handles null/undefined values while preserving explicit 0 values.

tassoevan
tassoevan previously approved these changes Oct 13, 2025
gabriellsh
gabriellsh previously approved these changes Oct 16, 2025
@dougfabris dougfabris added the stat: QA assured Means it has been tested and approved by a company insider label Oct 16, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 16, 2025
tassoevan
tassoevan previously approved these changes Oct 16, 2025
@dougfabris dougfabris removed stat: ready to merge PR tested and approved waiting for merge stat: QA assured Means it has been tested and approved by a company insider labels Oct 16, 2025
@dougfabris dougfabris dismissed stale reviews from tassoevan and gabriellsh via 0f60f64 October 16, 2025 19:32
tassoevan
tassoevan previously approved these changes Oct 16, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1bae81a and 0f60f64.

📒 Files selected for processing (4)
  • apps/meteor/app/api/server/v1/settings.ts (2 hunks)
  • apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts (1 hunks)
  • apps/meteor/app/lib/server/methods/saveSettings.ts (3 hunks)
  • apps/meteor/tests/end-to-end/api/settings.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior

Applied to files:

  • apps/meteor/tests/end-to-end/api/settings.ts
🧬 Code graph analysis (4)
apps/meteor/app/lib/server/methods/saveSettings.ts (2)
packages/core-typings/src/ISetting.ts (1)
  • ISetting (27-27)
apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts (1)
  • checkSettingValueBounds (8-28)
apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts (1)
packages/core-typings/src/ISetting.ts (1)
  • ISetting (27-27)
apps/meteor/tests/end-to-end/api/settings.ts (1)
apps/meteor/tests/data/api-data.ts (2)
  • request (10-10)
  • credentials (39-42)
apps/meteor/app/api/server/v1/settings.ts (1)
apps/meteor/app/lib/server/lib/checkSettingValueBonds.ts (1)
  • checkSettingValueBounds (8-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (4)
apps/meteor/app/api/server/v1/settings.ts (1)

24-24: LGTM! Proper validation gate placement.

The bounds validation is correctly positioned before the audit and update operations, ensuring that invalid values are rejected early without side effects.

Also applies to: 234-235

apps/meteor/tests/end-to-end/api/settings.ts (2)

131-131: Good catch on the typo fix.

The correction from "succesfully" to "successfully" improves clarity.

Also applies to: 157-157


171-205: Excellent test coverage for bounds validation.

The new tests thoroughly verify that:

  • Values below minValue are rejected with a 400 status and descriptive error message
  • Values above maxValue are rejected with a 400 status and descriptive error message

The error message assertions ensure the user receives clear feedback about the constraint violation.

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

38-44: Well-structured validation flow.

The addition of the checkInteger helper and the sequential validation (type → integer → bounds) provides clear, maintainable validation logic. The range case is properly integrated alongside other numeric types.

Also applies to: 102-105

@dougfabris dougfabris added the stat: QA assured Means it has been tested and approved by a company insider label Oct 16, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 16, 2025
@kodiakhq kodiakhq bot merged commit d166e2a into develop Oct 17, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the feat/slider-setting branch October 17, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants