Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Dec 4, 2025

Proposed changes (including videos or screenshots)

Issue(s)

VGA-73
VGA-74

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • Added call history API endpoints to list a user’s calls and retrieve detailed call info (metadata, participants, duration, states); returns 404 for not found.
  • Tests

    • Added end-to-end tests covering listing, info retrieval, access control, and error cases.
  • Chores

    • Test-data initialization now seeds sample call history to support API tests.
  • Refactor

    • Public typing and model interfaces extended with call-history and media-call types and lookup helpers.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 4, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

⚠️ No Changeset found

Latest commit: 20cb54c

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
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

Adds v1 REST endpoints for call history (list and info), new CallHistory model query helpers, test-data seeding during initialization, end-to-end tests for the endpoints, and typing/schema updates to include IMediaCall and CallHistoryItem.

Changes

Cohort / File(s) Summary
API Registration
apps/meteor/app/api/server/index.ts
Registers the new v1 call-history module so endpoints are loaded before OpenAPI generation.
Call History API Endpoints
apps/meteor/app/api/server/v1/call-history.ts
Adds call-history.list (paginated, user-scoped list) and call-history.info (lookup by historyId or callId) endpoints, validators, endpoint types, response validations, and declaration merging into global Endpoints.
Model Interface Typings
packages/model-typings/src/models/ICallHistoryModel.ts
Replaces type alias with ICallHistoryModel interface and declares findOneByIdAndUid and findOneByCallIdAndUid methods.
Model Implementation
packages/models/src/models/CallHistory.ts
Implements findOneByIdAndUid and findOneByCallIdAndUid helpers (adds FindOptions import) delegating to findOne.
Schema Exports
packages/core-typings/src/Ajv.ts
Extends exported AJV schemas tuple to include IMediaCall and CallHistoryItem.
Test Data & Init
apps/meteor/server/startup/callHistoryTestData.ts,
apps/meteor/server/startup/initialData.js
Adds addCallHistoryTestData(uid, extraUid) to seed sample CallHistory and MediaCalls entries and invokes it during test-data initialization.
End-to-End Tests
apps/meteor/tests/end-to-end/api/call-history.ts
New E2E test suite covering listing, info lookups (by historyId and by callId), access control, and 404/error cases.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant API as API Server (v1/call-history)
  participant Model as CallHistory Model
  participant DB as MongoDB / MediaCalls

  Client->>API: GET /v1/call-history.list (auth, query)
  API->>Model: query with uid + pagination filters
  Model->>DB: find documents (CallHistory) & count
  DB-->>Model: return items + count
  Model-->>API: items, count, offset, total
  API-->>Client: 200 { items, count, offset, total }

  Client->>API: GET /v1/call-history.info (auth, historyId|callId)
  alt historyId provided
    API->>Model: findOneByIdAndUid(historyId, uid)
  else callId provided
    API->>Model: findOneByCallIdAndUid(callId, uid)
  end
  Model->>DB: findOne matching query
  DB-->>Model: item or null
  alt item is media-call and has callId
    API->>DB: fetch MediaCalls by callId
    DB-->>API: IMediaCall (or null)
  end
  API-->>Client: 200 { item, call? } or 404
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus on:
    • Validation schemas and union handling for historyId vs callId in the endpoints.
    • Access-control enforcement: ensure model helpers and endpoints restrict by uid correctly.
    • Seeded test data shapes vs model expectations (timestamps, directions, state values).
    • Typings change in Ajv and model-typings for backward compatibility.

Possibly related PRs

Suggested reviewers

  • tassoevan
  • ricardogarim
  • KevLehman

Poem

🐇 I hopped through logs and traced each ring,
Four tiny records, ready for the spring.
Endpoints now listen, tests dance in the night,
A rabbit counts calls under soft moonlight—
Hooray for history caught just right! 📞✨

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 title accurately describes the main change: adding API endpoints for retrieving call history data, which is the primary focus of this pull request.
Linked Issues check ✅ Passed All code changes align with linked issues: VGA-73 endpoint lists history items filtered by user ID, and VGA-74 endpoint fetches single history items by call ID with proper authentication and error handling.
Out of Scope Changes check ✅ Passed All changes are scoped to call history API implementation: endpoint definitions, validators, type updates, model methods, test data, and E2E tests directly support the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 chore/call-history-endpoints

📜 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 1476252 and c61f771.

📒 Files selected for processing (1)
  • packages/models/src/models/CallHistory.ts (2 hunks)
🧰 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/models/src/models/CallHistory.ts
🧬 Code graph analysis (1)
packages/models/src/models/CallHistory.ts (1)
packages/core-typings/src/ICallHistoryItem.ts (1)
  • CallHistoryItem (51-51)
🔇 Additional comments (3)
packages/models/src/models/CallHistory.ts (3)

3-3: LGTM!

The FindOptions import is correctly added to support the type signatures of the new query methods.


16-22: LGTM! Authorization-aware query helper.

The method correctly filters by both _id and uid, ensuring users can only retrieve their own call history items. The implementation is clean and type-safe.


24-30: LGTM! Efficiently indexed query helper.

The method correctly filters by both callId and uid for authorization, and benefits from the existing unique index { uid: 1, callId: 1 } on line 13 for optimal query performance.


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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 360MiB 349MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB +1.6KiB
queue-worker-service 132MiB 132MiB +400B
ddp-streamer-service 126MiB 126MiB +972B
account-service 113MiB 113MiB +1.6KiB
stream-hub-service 111MiB 111MiB +1.5KiB
authorization-service 111MiB 111MiB +1.2KiB
presence-service 111MiB 111MiB -331B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/15 22:28", "11/16 01:28", "11/17 23:50", "11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 13:34", "12/09 13:53 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "queue-worker-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "rocketchat" [0.36, 0.36, 0.35, 0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.35]
  line "stream-hub-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
Loading

Statistics (last 16 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.2GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 1.2GiB
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37702
  • Baseline: develop
  • Timestamp: 2025-12-09 13:53:54 UTC
  • Historical data points: 16

Updated: Tue, 09 Dec 2025 13:53:54 GMT

@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review December 8, 2025 14:27
@pierre-lehnen-rc pierre-lehnen-rc requested review from a team as code owners December 8, 2025 14:27
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

🧹 Nitpick comments (2)
apps/meteor/tests/end-to-end/api/call-history.ts (1)

15-20: Consolidate duplicate before hooks.

Biome correctly flags duplicate before hooks. Consolidate into a single hook for cleaner test setup.

-	before((done) => getCredentials(done));
-
-	before(async () => {
+	before(async function (done) {
+		getCredentials(done);
+	});
+
+	before(async () => {
 		user2 = await createUser();
 		userCredentials = await login(user2.username, password);
 	});

Alternatively, if both need to remain separate due to async handling, consider using beforeEach for the second or restructuring to avoid the linter warning.

apps/meteor/app/api/server/v1/call-history.ts (1)

167-169: Redundant validation check.

The oneOf schema validation in isCallHistoryInfoProps already ensures exactly one of historyId or callId is provided. This manual check is redundant but harmless as a defensive measure.

If you prefer to remove the redundancy:

 	async function action() {
-		if (!this.queryParams.historyId && !this.queryParams.callId) {
-			return API.v1.failure();
-		}
-
 		const item = await (this.queryParams.historyId
📜 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 48953d2 and 10f12bf.

📒 Files selected for processing (8)
  • apps/meteor/app/api/server/index.ts (1 hunks)
  • apps/meteor/app/api/server/v1/call-history.ts (1 hunks)
  • apps/meteor/server/startup/callHistoryTestData.ts (1 hunks)
  • apps/meteor/server/startup/initialData.js (2 hunks)
  • apps/meteor/tests/end-to-end/api/call-history.ts (1 hunks)
  • packages/core-typings/src/Ajv.ts (1 hunks)
  • packages/model-typings/src/models/ICallHistoryModel.ts (1 hunks)
  • packages/models/src/models/CallHistory.ts (2 hunks)
🧰 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/server/startup/initialData.js
  • apps/meteor/server/startup/callHistoryTestData.ts
  • packages/model-typings/src/models/ICallHistoryModel.ts
  • apps/meteor/tests/end-to-end/api/call-history.ts
  • apps/meteor/app/api/server/index.ts
  • apps/meteor/app/api/server/v1/call-history.ts
  • packages/models/src/models/CallHistory.ts
  • packages/core-typings/src/Ajv.ts
🧠 Learnings (11)
📚 Learning: 2025-11-05T21:04:35.787Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 37357
File: ee/packages/federation-matrix/src/setup.ts:103-120
Timestamp: 2025-11-05T21:04:35.787Z
Learning: In Rocket.Chat's federation-matrix setup (ee/packages/federation-matrix/src/setup.ts and apps/meteor/ee/server/startup/federation.ts), configureFederationMatrixSettings does not need to be called before setupFederationMatrix. The SDK's init() establishes infrastructure (database, event handlers, APIs) first, and the configuration can be applied later via settings watchers before actual federation events are processed. The config only matters when events actually occur, at which point all infrastructure is already configured.

Applied to files:

  • apps/meteor/server/startup/initialData.js
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • apps/meteor/server/startup/initialData.js
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.

Applied to files:

  • apps/meteor/server/startup/callHistoryTestData.ts
  • apps/meteor/tests/end-to-end/api/call-history.ts
  • apps/meteor/app/api/server/index.ts
  • apps/meteor/app/api/server/v1/call-history.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 : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/server/startup/callHistoryTestData.ts
  • apps/meteor/tests/end-to-end/api/call-history.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 : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/server/startup/callHistoryTestData.ts
  • apps/meteor/tests/end-to-end/api/call-history.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 : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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:

  • apps/meteor/tests/end-to-end/api/call-history.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 `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.ts
🧬 Code graph analysis (4)
apps/meteor/server/startup/initialData.js (1)
apps/meteor/server/startup/callHistoryTestData.ts (1)
  • addCallHistoryTestData (3-197)
apps/meteor/server/startup/callHistoryTestData.ts (1)
packages/models/src/index.ts (2)
  • CallHistory (149-149)
  • MediaCalls (186-186)
packages/model-typings/src/models/ICallHistoryModel.ts (1)
packages/core-typings/src/ICallHistoryItem.ts (1)
  • CallHistoryItem (51-51)
apps/meteor/tests/end-to-end/api/call-history.ts (3)
packages/core-typings/src/IUser.ts (1)
  • IUser (186-256)
apps/meteor/tests/data/api-data.ts (3)
  • getCredentials (68-83)
  • request (10-10)
  • credentials (39-42)
apps/meteor/tests/data/users.helper.ts (1)
  • createUser (45-78)
🪛 Biome (2.1.2)
apps/meteor/server/startup/initialData.js

[error] 5-6: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 6-7: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)

apps/meteor/tests/end-to-end/api/call-history.ts

[error] 17-20: Disallow duplicate setup and teardown hooks.

Disallow before duplicacy inside the describe function.

(lint/suspicious/noDuplicateTestHooks)

⏰ 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: 📦 Build Packages
  • GitHub Check: CodeQL-Build
🔇 Additional comments (9)
packages/core-typings/src/Ajv.ts (1)

3-15: LGTM!

The schema expansion correctly includes IMediaCall and CallHistoryItem types, aligning with the new call history endpoints that return these types in their responses.

apps/meteor/app/api/server/index.ts (1)

12-12: LGTM!

The import is correctly placed in alphabetical order and registered before OpenAPI generation.

apps/meteor/server/startup/initialData.js (1)

255-258: LGTM!

Test data seeding is correctly gated behind TEST_MODE and follows the proper order by awaiting addUserToDefaultChannels before creating call history data. The static analysis hints about import declarations are false positives in the Meteor context.

apps/meteor/server/startup/callHistoryTestData.ts (1)

3-197: LGTM!

The test data setup is well-structured with:

  • Proper cleanup before insertion ensuring idempotency
  • Comprehensive coverage of scenarios (internal/external calls, inbound/outbound directions)
  • Correct cross-linking between CallHistory and MediaCalls via callId
packages/model-typings/src/models/ICallHistoryModel.ts (1)

6-18: LGTM!

The interface correctly defines the new query methods with proper type safety using indexed access types (CallHistoryItem['_id'], etc.) and aligns with the implementation in CallHistory.ts.

apps/meteor/tests/end-to-end/api/call-history.ts (1)

24-236: Test coverage is comprehensive.

The test suite effectively covers:

  • Listing history entries with field validation
  • Access control verification (user isolation)
  • Info retrieval by both historyId and callId
  • Error handling for invalid and cross-user access attempts
packages/models/src/models/CallHistory.ts (1)

16-30: LGTM!

The implementations are clean and correctly delegate to findOne with compound filters. The existing indexes ({ uid: 1, callId: 1 } and { uid: 1, ts: -1 }) adequately support these queries.

apps/meteor/app/api/server/v1/call-history.ts (2)

34-97: LGTM!

The list endpoint correctly implements pagination, filters by the authenticated user's ID for access control, and returns the expected response shape.


132-191: LGTM!

The info endpoint correctly:

  • Supports lookup by either historyId or callId
  • Enforces user-scoped access control via findOneByIdAndUid/findOneByCallIdAndUid
  • Returns 404 when item is not found or belongs to another user
  • Enriches response with associated MediaCall data when applicable

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

♻️ Duplicate comments (1)
apps/meteor/tests/end-to-end/api/call-history.ts (1)

83-83: Fix typo in test description.

"nost" should be "not".

-		it('should not list history entries from other users', async () => {
+		it('should not list history entries from other users', async () => {
🧹 Nitpick comments (1)
apps/meteor/tests/end-to-end/api/call-history.ts (1)

39-79: Consider using typed interfaces instead of any for better type safety.

The test uses any for item objects throughout. While functional, using proper types from @rocket.chat/core-typings would provide better type safety and IDE support.

Example refactor:

+import type { ICallHistoryItem } from '@rocket.chat/core-typings';

-const historyIds = res.body.items.map((item: any) => item._id);
+const historyIds = res.body.items.map((item: ICallHistoryItem) => item._id);

-const internalItem1 = res.body.items.find((item: any) => item._id === 'rocketchat.internal.history.test');
+const internalItem1 = res.body.items.find((item: ICallHistoryItem) => item._id === 'rocketchat.internal.history.test');
📜 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 10f12bf and f793db9.

📒 Files selected for processing (1)
  • apps/meteor/tests/end-to-end/api/call-history.ts (1 hunks)
🧰 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/call-history.ts
🧠 Learnings (13)
📚 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 : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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:

  • apps/meteor/tests/end-to-end/api/call-history.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 `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.ts
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.ts
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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:

  • apps/meteor/tests/end-to-end/api/call-history.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 : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/call-history.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:

  • apps/meteor/tests/end-to-end/api/call-history.ts
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/call-history.ts (3)
packages/core-typings/src/IUser.ts (1)
  • IUser (186-256)
apps/meteor/tests/data/api-data.ts (3)
  • getCredentials (68-83)
  • request (10-10)
  • credentials (39-42)
apps/meteor/tests/data/users.helper.ts (1)
  • createUser (45-78)
🪛 Biome (2.1.2)
apps/meteor/tests/end-to-end/api/call-history.ts

[error] 17-20: Disallow duplicate setup and teardown hooks.

Disallow before duplicacy inside the describe function.

(lint/suspicious/noDuplicateTestHooks)

⏰ 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
🔇 Additional comments (3)
apps/meteor/tests/end-to-end/api/call-history.ts (3)

1-10: LGTM!

Imports are well-organized and include all necessary types and utilities for the test suite.


11-23: LGTM!

Test setup correctly creates a secondary user for access-control validation and properly cleans up in the after hook. Multiple before hooks are valid in Mocha and run sequentially.

Note: The static analysis warning about duplicate hooks is a false positive.


100-234: LGTM!

The test suite for /call-history.info is comprehensive with excellent coverage of:

  • Positive scenarios (retrieve by historyId and callId)
  • Error handling (404 for invalid IDs)
  • Access control (cross-user access properly returns 404)

All critical fields are validated for both the history item and associated call objects.

tassoevan
tassoevan previously approved these changes Dec 8, 2025
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Dec 8, 2025
@tassoevan tassoevan added this to the 7.14.0 milestone Dec 8, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 8, 2025
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.72%. Comparing base (3837d20) to head (20cb54c).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37702      +/-   ##
===========================================
- Coverage    67.80%   67.72%   -0.08%     
===========================================
  Files         3448     3449       +1     
  Lines       113918   113927       +9     
  Branches     20915    20915              
===========================================
- Hits         77239    77158      -81     
- Misses       34548    34645      +97     
+ Partials      2131     2124       -7     
Flag Coverage Δ
e2e 57.34% <ø> (+<0.01%) ⬆️
e2e-api 42.18% <100.00%> (-0.92%) ⬇️

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

♻️ Duplicate comments (1)
apps/meteor/app/api/server/v1/call-history.ts (1)

107-132: nullable: false is redundant on required string properties.

Since historyId and callId are already in the required array and typed as string, they cannot be null by default. The nullable: false annotations on lines 114 and 125 can be removed.

 const CallHistoryInfoSchema = {
 	oneOf: [
 		{
 			type: 'object',
 			properties: {
 				historyId: {
 					type: 'string',
-					nullable: false,
 				},
 			},
 			required: ['historyId'],
 			additionalProperties: false,
 		},
 		{
 			type: 'object',
 			properties: {
 				callId: {
 					type: 'string',
-					nullable: false,
 				},
 			},
 			required: ['callId'],
 			additionalProperties: false,
 		},
 	],
 };
🧹 Nitpick comments (2)
apps/meteor/app/api/server/v1/call-history.ts (2)

151-156: Inconsistent schema definition: type: 'object' alongside $ref is redundant.

The call property (lines 151-155) uses both type: 'object' and $ref, while the item property (lines 147-149) correctly uses only $ref. For consistency and clarity, remove type: 'object' since the referenced schema already defines the type.

 				call: {
-					type: 'object',
 					$ref: '#/components/schemas/IMediaCall',
 					description: 'The call information for the requested call history item.',
 					nullable: true,
 				},

172-174: Redundant validation check with unclear failure response.

The oneOf schema validation (lines 107-132) already ensures that exactly one of historyId or callId is provided. This manual check is redundant. If kept for defensive coding, API.v1.failure() should include a descriptive error message indicating what's wrong.

Either remove the redundant check (relying on schema validation) or improve the error message:

-		if (!this.queryParams.historyId && !this.queryParams.callId) {
-			return API.v1.failure();
-		}
+		if (!this.queryParams.historyId && !this.queryParams.callId) {
+			return API.v1.failure('Either historyId or callId is required');
+		}
📜 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 f793db9 and 1476252.

📒 Files selected for processing (1)
  • apps/meteor/app/api/server/v1/call-history.ts (1 hunks)
🧰 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/call-history.ts
🧠 Learnings (1)
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.

Applied to files:

  • apps/meteor/app/api/server/v1/call-history.ts
🔇 Additional comments (4)
apps/meteor/app/api/server/v1/call-history.ts (4)

1-15: LGTM!

Imports and type definitions are appropriate for the endpoint functionality.


17-34: LGTM!

The schema correctly defines optional pagination parameters with proper type constraints.


36-101: LGTM!

The endpoint correctly implements pagination, filters by the authenticated user's ID, and includes proper error response definitions. The parallel execution of cursor and count is efficient.


200-206: LGTM!

The module augmentation correctly extends the Endpoints interface to include both endpoint definitions.

@kodiakhq kodiakhq bot merged commit 9b3fa8d into develop Dec 9, 2025
88 of 90 checks passed
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