Skip to content

chore: remove duplicate TelemetryMap and TelemetryEvents types in core services (#39994)#39995

Open
ryaverma wants to merge 1 commit intoRocketChat:developfrom
ryaverma:chore/remove-duplicate-telemetry-types-39994
Open

chore: remove duplicate TelemetryMap and TelemetryEvents types in core services (#39994)#39995
ryaverma wants to merge 1 commit intoRocketChat:developfrom
ryaverma:chore/remove-duplicate-telemetry-types-39994

Conversation

@ryaverma
Copy link
Copy Markdown

@ryaverma ryaverma commented Mar 31, 2026

Proposed changes (including videos or screenshots)

In packages/rest-typings/src/index.ts, I added export of TelemetryMap and TelemetryEvents from the statistics module so they are accessible from the package root. In packages/core-services/src/types/ITelemetryEvent.ts, I removed duplicate type definitions and local helper types, replaced with an import from @rocket.chat/rest-typings.

Issue(s)

Closes #39994

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Chores
    • Consolidated telemetry type definitions across packages to improve code organization and maintainability.

@ryaverma ryaverma requested review from a team as code owners March 31, 2026 05:14
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 31, 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 31, 2026

⚠️ No Changeset found

Latest commit: 2fe7a4b

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 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: 21dd213b-004d-4dd9-bd1a-c2797b660cf3

📥 Commits

Reviewing files that changed from the base of the PR and between 4235cd9 and 2fe7a4b.

📒 Files selected for processing (2)
  • packages/core-services/src/types/ITelemetryEvent.ts
  • packages/rest-typings/src/index.ts
📜 Recent 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:

  • packages/rest-typings/src/index.ts
  • packages/core-services/src/types/ITelemetryEvent.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:42.118Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs, removing endpoint types and validators from `rocket.chat/rest-typings` (e.g., `UserRegisterParamsPOST`, `/v1/users.register` entry) is the *required* migration pattern per RocketChat/Rocket.Chat-Open-API#150 Rule 7 ("No More rest-typings or Manual Typings"). The endpoint type is re-exposed via a module augmentation `.d.ts` file in the consuming package (e.g., `packages/web-ui-registration/src/users-register.d.ts`). This is NOT a breaking change — the correct changeset bump for `rocket.chat/rest-typings` in this scenario is `minor`, not `major`. Do not flag this as a breaking change during OpenAPI migration reviews.
📚 Learning: 2026-03-20T13:52:29.575Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/api/server/v1/stats.ts:98-117
Timestamp: 2026-03-20T13:52:29.575Z
Learning: In `apps/meteor/app/api/server/v1/stats.ts`, the `statistics.telemetry` POST endpoint intentionally has no `body` AJV schema in its route options. The proper request body shape (a `params` array of telemetry event objects) has not been formally defined yet, so body validation is deferred to a follow-up. Do not flag the missing body schema for this endpoint during OpenAPI migration reviews.

Applied to files:

  • packages/rest-typings/src/index.ts
  • packages/core-services/src/types/ITelemetryEvent.ts
📚 Learning: 2026-03-16T21:50:42.118Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:42.118Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs, removing endpoint types and validators from `rocket.chat/rest-typings` (e.g., `UserRegisterParamsPOST`, `/v1/users.register` entry) is the *required* migration pattern per RocketChat/Rocket.Chat-Open-API#150 Rule 7 ("No More rest-typings or Manual Typings"). The endpoint type is re-exposed via a module augmentation `.d.ts` file in the consuming package (e.g., `packages/web-ui-registration/src/users-register.d.ts`). This is NOT a breaking change — the correct changeset bump for `rocket.chat/rest-typings` in this scenario is `minor`, not `major`. Do not flag this as a breaking change during OpenAPI migration reviews.

Applied to files:

  • packages/rest-typings/src/index.ts
  • packages/core-services/src/types/ITelemetryEvent.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/rest-typings/src/index.ts
  • packages/core-services/src/types/ITelemetryEvent.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/rest-typings/src/index.ts
  • packages/core-services/src/types/ITelemetryEvent.ts
📚 Learning: 2026-03-15T14:31:28.969Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39647
File: apps/meteor/app/api/server/v1/users.ts:710-757
Timestamp: 2026-03-15T14:31:28.969Z
Learning: In RocketChat/Rocket.Chat, the `UserCreateParamsPOST` type in `apps/meteor/app/api/server/v1/users.ts` (migrated from `packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts`) intentionally has `fields: string` (non-optional) and `settings?: IUserSettings` without a corresponding AJV schema entry. This is a pre-existing divergence carried over verbatim from the original rest-typings source (PR `#39647`). Do not flag this type/schema misalignment during the OpenAPI migration review — it is tracked as a separate follow-up fix.

Applied to files:

  • packages/core-services/src/types/ITelemetryEvent.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • packages/core-services/src/types/ITelemetryEvent.ts
🔇 Additional comments (2)
packages/rest-typings/src/index.ts (1)

42-42: LGTM - correctly exports types from the package root.

The export makes TelemetryMap and TelemetryEvents accessible from @rocket.chat/rest-typings, enabling other packages to import them without reaching into internal paths.

Minor observation: this export type is placed among import type statements, while other exports are grouped at the bottom (lines 206+). Consider moving it to the export section for consistency, though not required.

packages/core-services/src/types/ITelemetryEvent.ts (1)

1-8: LGTM - successfully consolidates duplicate type definitions.

The refactoring:

  • Imports TelemetryMap and TelemetryEvents from the canonical source in @rocket.chat/rest-typings
  • Re-exports them to maintain backward compatibility for consumers of this package
  • Keeps the ITelemetryEvent interface unchanged

The type shapes in rest-typings/src/v1/statistics.ts match the removed local definitions (slashCommandsStats: { command: string }, updateCounter: { settingsId: string }), so this is a safe refactor with no breaking changes.


Walkthrough

This change consolidates duplicate type definitions by removing TelemetryMap and TelemetryEvents from the core-services package and importing them from rest-typings instead, establishing a single source of truth across packages.

Changes

Cohort / File(s) Summary
Type Deduplication
packages/core-services/src/types/ITelemetryEvent.ts, packages/rest-typings/src/index.ts
Removed duplicate TelemetryMap and TelemetryEvents type definitions from core-services and consolidated them in rest-typings. Core-services now imports and re-exports these types from rest-typings, eliminating duplication.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 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 PR title accurately reflects the main change: removing duplicate TelemetryMap and TelemetryEvents types from core services and importing them from rest-typings.
Linked Issues check ✅ Passed The PR fully addresses the linked issue #39994 by exporting types from rest-typings and removing duplicate definitions from ITelemetryEvent.ts.
Out of Scope Changes check ✅ Passed All changes are directly related to removing duplicate type definitions and are within the scope of the linked issue.
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.

No issues found across 2 files

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.

chore: remove duplicate TelemetryMap and TelemetryEvents types in core services

1 participant