Skip to content

fix(ui-kit): Fix type guard mismatches for InputBlock and ActionsBlock#39416

Open
shrijatewari wants to merge 3 commits intoRocketChat:developfrom
shrijatewari:fix/ui-kit-type-guards
Open

fix(ui-kit): Fix type guard mismatches for InputBlock and ActionsBlock#39416
shrijatewari wants to merge 3 commits intoRocketChat:developfrom
shrijatewari:fix/ui-kit-type-guards

Conversation

@shrijatewari
Copy link
Copy Markdown

@shrijatewari shrijatewari commented Mar 6, 2026

[Description of the PR here:
Fixes type guard mismatches in isInputBlockElement and isActionsBlockElement that were causing valid UIKit block elements to be incorrectly rejected at runtime.

Changes I made

  • ✅ Added 7 missing element types to isInputBlockElement:
    • MULTI_CHANNELS_SELECT
    • MULTI_CONVERSATIONS_SELECT
    • MULTI_USERS_SELECT
    • CHECKBOX
    • RADIO_BUTTON
    • TIME_PICKER
    • TOGGLE_SWITCH
  • Added 6 missing element types to isActionsBlockElement:
    • CHANNELS_SELECT
    • CONVERSATIONS_SELECT
    • MULTI_CHANNELS_SELECT
    • MULTI_CONVERSATIONS_SELECT
    • MULTI_USERS_SELECT
    • USERS_SELECT
  • Added comprehensive unit tests for both type guards

Problem

The InputBlock and ActionsBlock types include element types that were not being checked by their respective type guards (isInputBlockElement and isActionsBlockElement). This caused SurfaceRenderer.renderInputBlockElement() and SurfaceRenderer.renderActionsBlockElement() to incorrectly reject valid elements at runtime.

Testing

  • ✅ All tests pass (4/4)
  • ✅ 100% code coverage
  • ✅ TypeScript type checking passes
  • ✅ No linter errors

Impact of this:
This fixes a bug where valid UIKit elements (like MultiChannelsSelectElement, CheckboxElement, RadioButtonElement, etc.) were being incorrectly rejected, preventing them from being rendered in InputBlocks and ActionsBlocks.

Related
This addresses the type guard inconsistencies identified in the UIKit and Fuselage codebase review.

Summary by CodeRabbit

  • New Features

    • Extended support for additional block element types (selects, multi-selects, users/channels/conversations selects, checkboxes, radio, timepicker, toggles) as action and input elements.
  • Tests

    • Added comprehensive unit tests covering the updated block element type validations.
  • Chores

    • Temporarily disabled an engines-related plugin in the build config and clarified the HTML template used by the build.
](https://github.com//pull/39416)

@shrijatewari shrijatewari requested review from a team as code owners March 6, 2026 15:19
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 6, 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 missing the required milestone or project

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 6, 2026

🦋 Changeset detected

Latest commit: c3b9f2c

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

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 6, 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: 7cd37a1f-17ee-4922-996f-142433fc1056

📥 Commits

Reviewing files that changed from the base of the PR and between de957b0 and c3b9f2c.

📒 Files selected for processing (7)
  • .changeset/fix-ui-kit-type-guards.md
  • .yarnrc.yml
  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-ui-kit-type-guards.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/ui-kit/src/blocks/isInputBlockElement.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • .yarnrc.yml
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
📜 Recent review details
🧰 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:

  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39304
File: packages/ui-contexts/src/ActionManagerContext.ts:26-26
Timestamp: 2026-03-04T14:16:49.202Z
Learning: In `packages/ui-contexts/src/ActionManagerContext.ts` (TypeScript, RocketChat/Rocket.Chat), the `disposeView` method in `IActionManager` uses an intentionally explicit union `UiKit.ModalView['id'] | UiKit.BannerView['viewId'] | UiKit.ContextualBarView['id']` to document which view types are accepted, even though all constituents resolve to the same primitive. The inline `// eslint-disable-next-line typescript-eslint/no-duplicate-type-constituents` comment is intentional and should not be flagged or removed.
📚 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:

  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.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:

  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
🔇 Additional comments (2)
packages/livechat/webpack.config.ts (1)

136-141: LGTM!

The template addition is valid. With HtmlWebpackPlugin's default inject: true behavior, script and style tags for the configured chunks will be automatically injected into the generated HTML without requiring explicit injection tokens in the EJS template.

packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts (1)

1-46: LGTM - Comprehensive test coverage for the type guard.

The test suite correctly validates all 16 valid ActionsBlock element types against the implementation and verifies that 5 invalid types return false. The valid types array properly aligns with both the ActionsBlock type definition and the isActionsBlockElement implementation.


Walkthrough

Disabled the Yarn engines plugin and added an HTML template to webpack config. Extended two UI-kit type-guard functions to recognize additional BlockElementType variants and added unit tests covering valid and invalid element classifications.

Changes

Cohort / File(s) Summary
Configuration & Build
/.yarnrc.yml, packages/livechat/webpack.config.ts
Removed/disabled the engines plugin entry in Yarn config (commented out) and added template: _('./src/index.ejs') to HtmlWebpackPlugin options.
Block Element Validation Implementation
packages/ui-kit/src/blocks/isActionsBlockElement.ts, packages/ui-kit/src/blocks/isInputBlockElement.ts
Extended both type guards to include additional BlockElementType variants: channel/conversation/user selects (single and multi), checkboxes, radio buttons, time picker, and toggle switch.
Block Element Validation Tests
packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts, packages/ui-kit/src/blocks/isInputBlockElement.spec.ts, .changeset/fix-ui-kit-type-guards.md
Added unit tests validating true/false classifications for expanded element sets and added a changeset entry for a patch release addressing the type-guard fixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: bug, area: ui-kit

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the PR: fixing type guard mismatches in InputBlock and ActionsBlock elements within the ui-kit package.
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.

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

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".yarnrc.yml">

<violation number="1" location=".yarnrc.yml:11">
P2: Commenting out the Yarn engines plugin disables enforcement of the repo’s declared Node/Yarn engine requirements, allowing installs on unsupported runtimes.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

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

Comment thread .yarnrc.yml
Comment on lines +11 to +14
# Temporarily disabled engines plugin for development
# plugins:
# - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
# spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 6, 2026

Choose a reason for hiding this comment

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

P2: Commenting out the Yarn engines plugin disables enforcement of the repo’s declared Node/Yarn engine requirements, allowing installs on unsupported runtimes.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .yarnrc.yml, line 11:

<comment>Commenting out the Yarn engines plugin disables enforcement of the repo’s declared Node/Yarn engine requirements, allowing installs on unsupported runtimes.</comment>

<file context>
@@ -8,8 +8,9 @@ enableImmutableInstalls: false
-plugins:
-  - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
-    spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
+# Temporarily disabled engines plugin for development
+# plugins:
+#   - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
</file context>
Suggested change
# Temporarily disabled engines plugin for development
# plugins:
# - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
# spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
Fix with Cubic

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 the current code and only fix it if needed.

Inline comments:
In @.yarnrc.yml:
- Around line 11-14: The commented-out "plugins" block in .yarnrc.yml (the lines
referencing .yarn/plugins/@yarnpkg/plugin-engines.cjs and its spec URL) is a
temporary local workaround that disables Node.js version validation and must not
be merged to develop; revert the change by restoring the plugins block
(uncomment the .yarnrc.yml plugin entries) so the engines plugin remains enabled
for the team, or if this must stay local move the comment into a local-only
config (or document the reason and add a flag to prevent merging) and add a
short PR note explaining why any deviation is intentionally local-only.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e42ffa8a-2b89-43b8-ad98-bb09e1d78ff8

📥 Commits

Reviewing files that changed from the base of the PR and between 79c712b and de957b0.

📒 Files selected for processing (6)
  • .yarnrc.yml
  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.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). (1)
  • GitHub Check: cubic · AI code reviewer
🧰 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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
🧠 Learnings (9)
📓 Common learnings
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39304
File: packages/ui-contexts/src/ActionManagerContext.ts:26-26
Timestamp: 2026-03-04T14:16:49.202Z
Learning: In `packages/ui-contexts/src/ActionManagerContext.ts` (TypeScript, RocketChat/Rocket.Chat), the `disposeView` method in `IActionManager` uses an intentionally explicit union `UiKit.ModalView['id'] | UiKit.BannerView['viewId'] | UiKit.ContextualBarView['id']` to document which view types are accepted, even though all constituents resolve to the same primitive. The inline `// eslint-disable-next-line typescript-eslint/no-duplicate-type-constituents` comment is intentional and should not be flagged or removed.
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.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 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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.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:

  • packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
  • packages/livechat/webpack.config.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.spec.ts
  • packages/ui-kit/src/blocks/isInputBlockElement.ts
📚 Learning: 2026-03-04T14:16:49.202Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39304
File: packages/ui-contexts/src/ActionManagerContext.ts:26-26
Timestamp: 2026-03-04T14:16:49.202Z
Learning: In `packages/ui-contexts/src/ActionManagerContext.ts` (TypeScript, RocketChat/Rocket.Chat), the `disposeView` method in `IActionManager` uses an intentionally explicit union `UiKit.ModalView['id'] | UiKit.BannerView['viewId'] | UiKit.ContextualBarView['id']` to document which view types are accepted, even though all constituents resolve to the same primitive. The inline `// eslint-disable-next-line typescript-eslint/no-duplicate-type-constituents` comment is intentional and should not be flagged or removed.

Applied to files:

  • packages/ui-kit/src/blocks/isActionsBlockElement.ts
🔇 Additional comments (5)
packages/livechat/webpack.config.ts (1)

136-141: LGTM!

The template addition works correctly. HtmlWebpackPlugin's default inject: true behavior will automatically inject the bundled scripts (before </body>) and styles (in <head>) into the template, so explicit injection tags in index.ejs are not required.

packages/ui-kit/src/blocks/isInputBlockElement.ts (1)

5-25: Runtime guard now matches the declared input-element union.

Nice fix. The added cases line up with packages/ui-kit/src/blocks/layout/InputBlock.ts, so valid input elements should no longer be rejected at render time.

packages/ui-kit/src/blocks/isInputBlockElement.spec.ts (1)

5-46: Coverage looks solid for the expanded input guard.

The spec hits both sides of the predicate and includes every newly accepted input type, so this should keep the runtime fix well protected.

packages/ui-kit/src/blocks/isActionsBlockElement.ts (1)

5-26: Actions-block guard is now consistent with the layout type.

This now matches the allowed element union in packages/ui-kit/src/blocks/layout/ActionsBlock.ts, so the added select variants should pass the runtime check correctly.

packages/ui-kit/src/blocks/isActionsBlockElement.spec.ts (1)

5-46: Good regression coverage for the actions guard.

The table of valid and invalid types cleanly exercises the broadened switch, which should make future mismatches easier to catch.

Comment thread .yarnrc.yml
- Temporarily disable engines plugin in .yarnrc.yml for Node version compatibility
- Add template path to livechat webpack config for proper index.html generation

Made-with: Cursor
- Add 7 missing element types to isInputBlockElement:
  MULTI_CHANNELS_SELECT, MULTI_CONVERSATIONS_SELECT, MULTI_USERS_SELECT,
  CHECKBOX, RADIO_BUTTON, TIME_PICKER, TOGGLE_SWITCH
- Add 6 missing element types to isActionsBlockElement:
  CHANNELS_SELECT, CONVERSATIONS_SELECT, MULTI_CHANNELS_SELECT,
  MULTI_CONVERSATIONS_SELECT, MULTI_USERS_SELECT, USERS_SELECT
- Add comprehensive unit tests for both type guards

Fixes runtime type checking failures where valid InputBlock and ActionsBlock
elements were incorrectly rejected by SurfaceRenderer methods.

Made-with: Cursor
@shrijatewari shrijatewari force-pushed the fix/ui-kit-type-guards branch from 505d06a to c3b9f2c Compare March 9, 2026 18:16
@shrijatewari shrijatewari changed the title Fix/UI kit type guards fix(ui-kit): Fix type guard mismatches for InputBlock and ActionsBlock Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants