Skip to content

chore(api): add default type parameter to forbidden() method#39815

Merged
ggazzo merged 1 commit intodevelopfrom
fix/api-forbidden-default-type
Mar 23, 2026
Merged

chore(api): add default type parameter to forbidden() method#39815
ggazzo merged 1 commit intodevelopfrom
fix/api-forbidden-default-type

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Mar 23, 2026

forbidden(msg?: T) inferred T as unknown when called without args, making ForbiddenResult incompatible with TypedAction return types. Adding a default T=string fixes the inference.

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Task: ARCH-2080

Summary by CodeRabbit

  • Refactor
    • Improved type inference for API error handling method.

forbidden<T>(msg?: T) inferred T as unknown when called without args,
making ForbiddenResult<unknown> incompatible with TypedAction return
types. Adding a default T=string fixes the inference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 23, 2026

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 8.4.0, but it targets 8.3.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 23, 2026

⚠️ No Changeset found

Latest commit: 9c544b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@ggazzo ggazzo added this to the 8.4.0 milestone Mar 23, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 23, 2026

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: 804093ad-b29d-4178-8e7b-f6dcc9787270

📥 Commits

Reviewing files that changed from the base of the PR and between f0e401b and 9c544b9.

📒 Files selected for processing (1)
  • apps/meteor/app/api/server/ApiClass.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). (5)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 📦 Meteor Build (coverage)
🧰 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/ApiClass.ts
🧠 Learnings (2)
📚 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/ApiClass.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/ApiClass.ts
🔇 Additional comments (1)
apps/meteor/app/api/server/ApiClass.ts (1)

376-376: Default generic parameter is the right fix for inference.

T = string prevents forbidden() from defaulting to unknown and keeps ForbiddenResult<T> compatible with typed action return expectations, with no runtime behavior change.


Walkthrough

The forbidden method in APIClass now includes a default generic type parameter of string, improving type inference when callers omit explicit type arguments. Runtime behavior remains unchanged.

Changes

Cohort / File(s) Summary
Type Parameter Default
apps/meteor/app/api/server/ApiClass.ts
Added default generic type parameter T = string to the forbidden() method signature for improved type inference when called without arguments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

type: chore

🚥 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 and specifically summarizes the main change: adding a default type parameter to the forbidden() method.
Linked Issues check ✅ Passed The code change directly addresses the linked issue ARCH-2080 objective by adding T = string as the default generic parameter to the forbidden() method.
Out of Scope Changes check ✅ Passed The pull request only modifies the forbidden() method signature to add a default type parameter, which aligns entirely with the linked issue ARCH-2080 objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

@ggazzo
Copy link
Copy Markdown
Member Author

ggazzo commented Mar 23, 2026

/jira ARCH-1464

@ggazzo ggazzo marked this pull request as ready for review March 23, 2026 13:29
@ggazzo ggazzo requested a review from a team as a code owner March 23, 2026 13:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.57%. Comparing base (82adf3a) to head (9c544b9).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39815      +/-   ##
===========================================
+ Coverage    70.48%   70.57%   +0.09%     
===========================================
  Files         3247     3256       +9     
  Lines       115374   115778     +404     
  Branches     21020    21035      +15     
===========================================
+ Hits         81323    81712     +389     
- Misses       31987    32006      +19     
+ Partials      2064     2060       -4     
Flag Coverage Δ
e2e 60.42% <ø> (+0.01%) ⬆️
e2e-api 48.14% <ø> (-0.04%) ⬇️
unit 71.11% <ø> (+0.12%) ⬆️

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.

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.

No issues found across 1 file

@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Mar 23, 2026
@ggazzo ggazzo merged commit 9e3eb78 into develop Mar 23, 2026
45 of 46 checks passed
@ggazzo ggazzo deleted the fix/api-forbidden-default-type branch March 23, 2026 14:02
cloudblimp pushed a commit to cloudblimp/Rocket.Chat that referenced this pull request Mar 24, 2026
…hat#39815)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ggazzo added a commit that referenced this pull request Mar 25, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ggazzo added a commit that referenced this pull request Mar 25, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants