Skip to content

feat: custom-sounds.delete endpoint#40532

Open
nazabucciarelli wants to merge 8 commits into
developfrom
feat/sounds-delete-endpoint
Open

feat: custom-sounds.delete endpoint#40532
nazabucciarelli wants to merge 8 commits into
developfrom
feat/sounds-delete-endpoint

Conversation

@nazabucciarelli
Copy link
Copy Markdown
Contributor

@nazabucciarelli nazabucciarelli commented May 14, 2026

Proposed changes (including videos or screenshots)

Note: This PR is a cleaner final draft of #39828 (closed), that was messed up with different commits.

  • Extracted the Meteor method logic to a lib file.
  • Created a new custom-sounds.delete endpoint that uses the extracted method with validation schemas for responses and payloads.
  • Implement tests for this new feature and update tests that used the old Meteor method.
  • Add deprecation notice for deleteCustomSound Meteor method.

Issue(s)

CORE-1971 Create custom-sounds.delete endpoint and deprecate its Meteor method

Steps to test or reproduce

We can test this change by accessing the custom sounds admin panel from the workspace and creating sounds to after delete them. Besides, we could test this using any API client and sending request directly to the server. We need to make sure that the user has the manage-sounds permission.

Further comments

Summary by CodeRabbit

  • New Features

    • Added an authenticated API endpoint to delete custom sounds (requires manage-sounds).
  • Refactor

    • Server-side deletion logic consolidated into a shared helper; legacy method now deprecated.
    • Client UI updated to call the new endpoint for deleting sounds.
  • Types

    • Added request validation schema/type for the delete endpoint.
  • Tests

    • Added end-to-end tests covering auth, permissions, validation, and error cases.
  • Chores

    • Changeset updated with minor version bumps documenting the new endpoint.

Review Change Stack

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 14, 2026

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

  • This PR is missing the 'stat: QA assured' label
  • This PR is targeting the wrong base branch. It should target 8.6.0, but it targets 8.5.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48e15882-a224-466a-a184-3bd838370e0c

📥 Commits

Reviewing files that changed from the base of the PR and between 1edd4a4 and 6682158.

📒 Files selected for processing (2)
  • apps/meteor/app/custom-sounds/server/lib/deleteCustomSound.ts
  • apps/meteor/app/custom-sounds/server/methods/deleteCustomSound.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/app/custom-sounds/server/methods/deleteCustomSound.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional 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/custom-sounds/server/lib/deleteCustomSound.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/custom-sounds/server/lib/deleteCustomSound.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/custom-sounds/server/lib/deleteCustomSound.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/custom-sounds/server/lib/deleteCustomSound.ts
🔇 Additional comments (1)
apps/meteor/app/custom-sounds/server/lib/deleteCustomSound.ts (1)

1-20: LGTM!


Walkthrough

Adds a POST REST endpoint custom-sounds.delete with AJV request validation, implements a shared server helper deleteCustomSound, refactors the RPC method to delegate to it, updates the admin client to call the endpoint, adds end-to-end tests, and updates the changeset.

Changes

Custom Sounds Delete API

Layer / File(s) Summary
Request Validation Schema
packages/rest-typings/src/v1/customSounds.ts
Defines CustomSoundsDelete with _id and exports isCustomSoundsDeleteProps AJV validator.
Core Deletion Logic
apps/meteor/app/custom-sounds/server/lib/deleteCustomSound.ts
Adds exported deleteCustomSound(_id) helper: validates existence, deletes file via RocketChatFileCustomSoundsInstance, removes DB record, broadcasts deletion event, returns void.
RPC Method Refactoring
apps/meteor/app/custom-sounds/server/methods/deleteCustomSound.ts
Updates imports and implementation to emit deprecation log, enforce manage-sounds permission, validate _id, and delegate deletion to shared helper.
REST API Endpoint
apps/meteor/app/api/server/v1/custom-sounds.ts
Adds POST /v1/custom-sounds.delete requiring auth and manage-sounds, validates body with isCustomSoundsDeleteProps, calls deleteCustomSound, and returns success or failure.
Client-Side Update
apps/meteor/client/views/admin/customSounds/EditSound.tsx
Replaces useMethod('deleteCustomSound') with useEndpoint('POST', '/v1/custom-sounds.delete'), updates delete handler invocation and dependencies.
Tests and Release Notes
apps/meteor/tests/end-to-end/api/custom-sounds.ts, .changeset/neat-planets-hope.md
Updates test helper to call the new endpoint and adds a test suite for /custom-sounds.delete covering unauthenticated, invalid, unauthorized, not-found, and successful deletion; changeset records package bumps.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Endpoint as POST /v1/custom-sounds.delete
  participant Validator as isCustomSoundsDeleteProps
  participant Helper as deleteCustomSound
  participant File as RocketChatFileCustomSoundsInstance
  participant DB as CustomSounds
  participant Broadcast as notify.deleteCustomSound

  Client->>Endpoint: POST {_id}
  Endpoint->>Validator: validate body
  Validator-->>Endpoint: validation result
  Endpoint->>Helper: deleteCustomSound(_id)
  Helper->>DB: fetch sound by _id
  DB-->>Helper: sound data / not found
  Helper->>File: deleteFile({_id}.{ext})
  Helper->>DB: removeById(_id)
  Helper->>Broadcast: notify.deleteCustomSound(soundData)
  Helper-->>Endpoint: complete
  Endpoint-->>Client: 200 success / API.v1.failure on error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: feature

Suggested reviewers

  • ggazzo
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: custom-sounds.delete endpoint' accurately and specifically describes the main change: adding a new HTTP endpoint for deleting custom sounds.
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.

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

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-1971: 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 and usage tips.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

🦋 Changeset detected

Latest commit: 6682158

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/rest-typings Minor
@rocket.chat/meteor Minor
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/http-router Patch
@rocket.chat/models Patch
@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-matrix Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/livechat Patch
@rocket.chat/mock-providers Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch
@rocket.chat/ui-client Major
@rocket.chat/media-calls Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/ui-avatar Major
@rocket.chat/ui-video-conf Major
@rocket.chat/ui-voip Major
@rocket.chat/ui-composer Major
@rocket.chat/core-typings Minor
@rocket.chat/apps Patch
@rocket.chat/model-typings Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker 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

@nazabucciarelli nazabucciarelli added this to the 8.5.0 milestone May 14, 2026
@alfredodelfabro alfredodelfabro removed this from the 8.5.0 milestone May 14, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.61%. Comparing base (6bcc08c) to head (6682158).
⚠️ Report is 29 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40532      +/-   ##
===========================================
- Coverage    69.65%   69.61%   -0.05%     
===========================================
  Files         3324     3328       +4     
  Lines       122657   122869     +212     
  Branches     21882    21919      +37     
===========================================
+ Hits         85439    85533      +94     
- Misses       33884    33988     +104     
- Partials      3334     3348      +14     
Flag Coverage Δ
unit 70.38% <ø> (+0.03%) ⬆️

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

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

@nazabucciarelli nazabucciarelli marked this pull request as ready for review May 14, 2026 18:26
@nazabucciarelli nazabucciarelli requested review from a team as code owners May 14, 2026 18:26
@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label May 14, 2026
@nazabucciarelli nazabucciarelli added this to the 8.5.0 milestone May 14, 2026
Comment thread apps/meteor/app/api/server/v1/custom-sounds.ts Outdated
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 7 files

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

Comment thread apps/meteor/tests/end-to-end/api/custom-sounds.ts Outdated
Copy link
Copy Markdown
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

🤖 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/end-to-end/api/custom-sounds.ts`:
- Around line 425-431: The test case description "should return a 404 (Not
Found) if attempting to delete a sound that does not exist" is inconsistent with
the asserted status expect(400); update the test so description and assertion
match—either change the it(...) title to state 400 or change .expect(400) to
.expect(404); locate the test around the call to
request.post(api('custom-sounds.delete')) and make the title and the
.expect(...) value consistent (prefer changing the title to "should return a 400
(Bad Request)..." if the API actually returns 400).
🪄 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: 4383322b-142c-4dac-a49b-481e49a7d5e8

📥 Commits

Reviewing files that changed from the base of the PR and between 780b667 and 1bc6588.

📒 Files selected for processing (1)
  • apps/meteor/tests/end-to-end/api/custom-sounds.ts
📜 Review details
🧰 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/tests/end-to-end/api/custom-sounds.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/tests/end-to-end/api/custom-sounds.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

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

Applied to files:

  • apps/meteor/tests/end-to-end/api/custom-sounds.ts
🔇 Additional comments (2)
apps/meteor/tests/end-to-end/api/custom-sounds.ts (2)

32-34: LGTM!


407-424: LGTM!

Also applies to: 437-478

Comment thread apps/meteor/tests/end-to-end/api/custom-sounds.ts Outdated
Comment thread apps/meteor/app/api/server/v1/custom-sounds.ts Outdated
Copy link
Copy Markdown
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

🤖 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/api/server/v1/custom-sounds.ts`:
- Around line 313-319: The catch currently maps all exceptions from
deleteCustomSound(_id) to a client 4xx failure; change it to only translate
expected domain errors (e.g., not-found or validation errors) into
API.v1.failure with their message, and for any other unexpected errors log them
via SystemLogger.error({ error }) and return or rethrow a 5xx response (e.g.,
API.v1.failure('Internal Server Error', 500) or rethrow the error) so
infrastructure/file-store/db failures produce a 5xx; adjust the catch to inspect
the error type/code (or instanceof specific domain error classes) before
deciding between API.v1.failure(error.message) and API.v1.failure('Internal
Server Error', 500), keeping references to deleteCustomSound,
SystemLogger.error, and API.v1.failure.
🪄 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: 47bcca2d-1e41-4483-9ff3-ad2c47eacc97

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc6588 and 1edd4a4.

📒 Files selected for processing (2)
  • apps/meteor/app/api/server/v1/custom-sounds.ts
  • apps/meteor/tests/end-to-end/api/custom-sounds.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/tests/end-to-end/api/custom-sounds.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

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

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

Files:

  • apps/meteor/app/api/server/v1/custom-sounds.ts
🧠 Learnings (5)
📚 Learning: 2026-02-23T17:53:06.802Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: During PR reviews that touch endpoint files under apps/meteor/app/api/server/v1, enforce strict scope: if a PR targets a specific endpoint (e.g., rooms.favorite), do not propose changes to unrelated endpoints (e.g., rooms.invite) unless maintainers explicitly request them. Focus feedback on the touched endpoint's behavior, API surface, and related tests; avoid broad cross-endpoint changes in the same PR unless requested.

Applied to files:

  • apps/meteor/app/api/server/v1/custom-sounds.ts
📚 Learning: 2026-02-24T19:09:01.522Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1, avoid introducing logic changes. Only perform scope-tight changes that preserve behavior; style-only cleanups (e.g., removing inline comments) may be deferred to follow-ups to keep the migration PR focused.

Applied to files:

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

Applied to files:

  • apps/meteor/app/api/server/v1/custom-sounds.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/api/server/v1/custom-sounds.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/api/server/v1/custom-sounds.ts

Comment on lines +313 to +319
try {
await deleteCustomSound(_id);

return API.v1.success({});
} catch (error: any) {
SystemLogger.error({ error });
return API.v1.failure(error instanceof Error ? error.message : 'Unknown error');
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve 5xx for unexpected delete failures.

This catch turns every exception from deleteCustomSound(_id) into a client-error response, so file-store or database failures during deletion look like request problems even when the input is valid. Please only translate expected domain errors here and rethrow/return a 5xx for unexpected failures.

🤖 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/api/server/v1/custom-sounds.ts` around lines 313 - 319, The
catch currently maps all exceptions from deleteCustomSound(_id) to a client 4xx
failure; change it to only translate expected domain errors (e.g., not-found or
validation errors) into API.v1.failure with their message, and for any other
unexpected errors log them via SystemLogger.error({ error }) and return or
rethrow a 5xx response (e.g., API.v1.failure('Internal Server Error', 500) or
rethrow the error) so infrastructure/file-store/db failures produce a 5xx;
adjust the catch to inspect the error type/code (or instanceof specific domain
error classes) before deciding between API.v1.failure(error.message) and
API.v1.failure('Internal Server Error', 500), keeping references to
deleteCustomSound, SystemLogger.error, and API.v1.failure.

Comment thread apps/meteor/app/custom-sounds/server/lib/deleteCustomSound.ts Outdated
Comment thread apps/meteor/app/custom-sounds/server/lib/deleteCustomSound.ts Outdated
@nazabucciarelli nazabucciarelli modified the milestones: 8.5.0, 8.6.0 May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants