Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: delete event handling plugins #2047

Open
wants to merge 5 commits into
base: feat.move-event-handling-to-core-sdk-2823-final
Choose a base branch
from

Conversation

saikumarrs
Copy link
Member

@saikumarrs saikumarrs commented Feb 18, 2025

PR Description

I've removed the existing data plane events handling plugins XhrQueue and BeaconQueue and all their references throughout the code.

The RetryQueue module is moved to the common package as now it'll be utilized in more than one packages (core and plugins).

Linear task (optional)

https://linear.app/rudderstack/issue/SDK-2823/move-dataplane-events-dispatch-functionality-to-core-sdk

Cross Browser Tests

Please confirm you have tested for the following browsers:

  • Chrome
  • Firefox
  • IE11

Sanity Suite

  • All sanity suite test cases pass locally

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Summary by CodeRabbit

  • Refactor

    • Streamlined the event queuing and retry mechanisms with simplified method signatures and improved type consistency for better maintainability.
  • Chores

    • Removed deprecated event delivery modules and outdated plugin configurations, along with cleaning up redundant build and configuration settings.
  • Tests

    • Pruned and updated test suites by disabling legacy test cases to ensure ongoing stability.
  • Bundle Improvements

    • Adjusted size limits for core modules, supporting enhanced performance and reliability.

These improvements lay a solid foundation for future enhancements without altering end-user functionality.

@saikumarrs saikumarrs self-assigned this Feb 18, 2025
@saikumarrs saikumarrs requested a review from a team as a code owner February 18, 2025 09:33
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

📝 Walkthrough

Walkthrough

This pull request restructures various import paths and method signatures across multiple modules. Notably, the retry queue and schedule modules have been refactored with updated type imports and simplified method signatures. Several files, tests, and type definitions related to the BeaconQueue and XhrQueue functionality have been removed. Changes also include adjustments to configuration, bundle size limits, and browser capability detection (removing Beacon API checks). Overall, the modifications streamline the codebase, remove deprecated plugins and types, and adjust lifecycle and testing assertions.

Changes

File(s) Change Summary
packages/analytics-js-common/__tests__/services/retryQueue/RetryQueue.test.ts,
.../Schedule.test.ts,
.../utilities/url.test.ts
Updated import paths and formatting; no functional changes.
packages/analytics-js-common/src/services/retryQueue/RetryQueue.ts,
.../Schedule.ts,
.../logMessages.ts
Refactored import paths and consolidated local type imports; updated method signatures (e.g. removed optional error parameter in requeue, changed operator in run, and fixed return type in handle).
packages/analytics-js-common/src/services/retryQueue/types.ts,
.../src/types/ApplicationState.ts,
.../types/PluginsManager.ts
Restructured type definitions, consolidated types under the retryQueue module; removed the eventsQueuePluginName property and updated union types.
packages/analytics-js-plugins/__tests__/xhrQueue/index.test.ts,
.../xhrQueue/utilities.test.ts
Deleted entire test suites for XhrQueue and its utility functions.
packages/analytics-js-plugins/rollup.config.mjs Removed entries for ./BeaconQueue and ./XhrQueue from the plugins map.
packages/analytics-js-plugins/src/beaconQueue/* (e.g. constants.ts, index.ts, logMessages.ts, types.ts, utilities.ts) Deleted BeaconQueue implementation files, including all associated methods, constants, exports, and types.
packages/analytics-js-plugins/src/xhrQueue/* (e.g. constants.ts, index.ts, logMessages.ts, types.ts, utilities.ts) Deleted XhrQueue implementation files and removed their exports, constants, utilities, and tests.
packages/analytics-js-plugins/src/deviceModeTransformation/index.ts,
.../nativeDestinationQueue/index.ts
Updated imports to utilize DoneCallback and IQueue from the analytics-js-common retryQueue types; streamlined RetryQueue instantiation.
packages/analytics-js-plugins/src/shared-chunks/common.ts Removed several utility exports (e.g. duplicate URL and JSON helpers) and added a new export for RetryQueue.
packages/analytics-js-plugins/src/types/plugins.ts,
.../utilities/retryQueue/types.ts
Removed various queue-related type definitions such as QueueItem, DoneCallback, and the IQueue interface.
packages/analytics-js/.size-limit.mjs Increased size limits for all “Core – Modern” bundle entries from ~27 KiB to 30 KiB.
packages/analytics-js/__mocks__/remotePlugins/{BeaconQueue, XhrQueue}.ts Removed mock implementations for both BeaconQueue and XhrQueue.
packages/analytics-js/__tests__/* (e.g. browser.test.ts,
components/configManager/commonUtil.test.ts,
components/core/Analytics.test.ts,
components/pluginsManager/PluginsManager.test.ts,
components/utilities/loadOptions.test.ts,
services/ErrorHandler/utils.test.ts)
Updated test cases: skipped some network and preload tests, removed tests for data plane events state handling, updated lifecycle status assertions, and removed BeaconQueue and XhrQueue from default plugin lists.
packages/analytics-js/src/components/{capabilitiesManager, configManager, pluginsManager}/* Removed Beacon API detection (hasBeacon) and associated constants; eliminated updateDataPlaneEventsStateFromLoadOptions and DataPlaneEventsTransportToPluginNameMap; removed references to BeaconQueue and XhrQueue from plugin configuration and defaults.
packages/analytics-js/src/state/slices/dataPlaneEvents.ts Removed the eventsQueuePluginName property from the state slice.
packages/analytics-js/src/types/remote-plugins.d.ts Removed module declarations for rudderAnalyticsRemotePlugins/BeaconQueue and .../XhrQueue.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant RetryQueue
    Caller->>RetryQueue: Call requeue(queueItem)
    Note right of RetryQueue: Processes queueItem using updated signature (without error parameter)
    RetryQueue-->>Caller: Returns updated queue state
Loading
sequenceDiagram
    participant Analytics
    participant PluginsManager
    Analytics->>Analytics: Initialize (configured state)
    Analytics->>PluginsManager: Load plugins
    PluginsManager-->>Analytics: Plugins loaded (status updated to readyExecuted)
    Analytics->>Analytics: Invoke lifecycle methods (onPluginsReady, onInitialized, loadDestinations, onDestinationsReady, onReady)
Loading

Suggested reviewers

  • ChryssaAliferi
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@saikumarrs saikumarrs changed the title Feat.delete event handling plugins sdk 2823 feat: delete event handling plugins Feb 18, 2025
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 61.43%. Comparing base (28fd410) to head (e1a7a12).

Files with missing lines Patch % Lines
...ics-js-plugins/src/nativeDestinationQueue/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                                 Coverage Diff                                 @@
##           feat.move-event-handling-to-core-sdk-2823-final    #2047      +/-   ##
===================================================================================
+ Coverage                                            61.41%   61.43%   +0.01%     
===================================================================================
  Files                                                  478      470       -8     
  Lines                                                16404    16193     -211     
  Branches                                              3240     3231       -9     
===================================================================================
- Hits                                                 10075     9948     -127     
+ Misses                                                5095     5011      -84     
  Partials                                              1234     1234              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Feb 18, 2025

size-limit report 📦

Name Size (Base) Size (Current) Size Limit Status
Cookies Utils - Legacy - NPM (ESM) 1.54 KB 1.54 KB (0%) 2 KB
Cookies Utils - Legacy - NPM (CJS) 1.75 KB 1.75 KB (0%) 2 KB
Cookies Utils - Legacy - NPM (UMD) 1.54 KB 1.54 KB (0%) 2 KB
Cookies Utils - Modern - NPM (ESM) 1.17 KB 1.17 KB (0%) 1.5 KB
Cookies Utils - Modern - NPM (CJS) 1.4 KB 1.4 KB (0%) 1.5 KB
Cookies Utils - Modern - NPM (UMD) 1.16 KB 1.16 KB (0%) 1.5 KB
Plugins Module Federation Mapping - Legacy - CDN 332 B 332 B (0%) 512 B
Plugins Module Federation Mapping - Modern - CDN 331 B 331 B (0%) 512 B
Plugins - Legacy - CDN 13.66 KB 13.56 KB (-0.75% ▼) 14 KB
Plugins - Modern - CDN 5.64 KB 5.66 KB (+0.46% ▲) 6 KB
Common - No bundling 17.99 KB 18.11 KB (+0.69% ▲) 18.4 KB
Load Snippet 765 B 765 B (0%) 1 KB
Core (v1.1) - NPM (ESM) 30.13 KB 30.13 KB (0%) 32 KB
Core (v1.1) - NPM (CJS) 30.33 KB 30.33 KB (0%) 32 KB
Core (v1.1) - NPM (UMD) 30.17 KB 30.17 KB (0%) 32 KB
Core (Content Script - v1.1) - NPM (ESM) 29.64 KB 29.64 KB (0%) 30.5 KB
Core (Content Script - v1.1) - NPM (CJS) 29.89 KB 29.89 KB (0%) 30.5 KB
Core (Content Script - v1.1) - NPM (UMD) 29.74 KB 29.74 KB (0%) 30.5 KB
Core (v1.1) - Legacy - CDN 31.99 KB 31.99 KB (0%) 32.5 KB
Core (v1.1) - Modern - CDN 30.06 KB 30.06 KB (0%) 32 KB
Service Worker - Legacy - NPM (ESM) 30.55 KB 30.55 KB (0%) 31 KB
Service Worker - Legacy - NPM (CJS) 30.84 KB 30.84 KB (0%) 31 KB
Service Worker - Legacy - NPM (UMD) 30.64 KB 30.64 KB (0%) 31 KB
Service Worker - Modern - NPM (ESM) 25.73 KB 25.73 KB (0%) 26 KB
Service Worker - Modern - NPM (CJS) 25.96 KB 25.96 KB (0%) 26.5 KB
Service Worker - Modern - NPM (UMD) 25.71 KB 25.71 KB (0%) 26 KB
Core - Legacy - NPM (ESM) 47.39 KB 46.17 KB (-2.57% ▼) 48 KB
Core - Legacy - NPM (CJS) 47.65 KB 46.42 KB (-2.59% ▼) 48 KB
Core - Legacy - NPM (UMD) 47.43 KB 46.13 KB (-2.76% ▼) 48 KB
Core - Legacy - CDN 47.55 KB 46.21 KB (-2.81% ▼) 47.6 KB
Core - Modern - NPM (ESM) 26.84 KB 26.66 KB (-0.69% ▼) 30 KB
Core - Modern - NPM (CJS) 27.08 KB 26.88 KB (-0.77% ▼) 30 KB
Core - Modern - NPM (UMD) 26.9 KB 26.7 KB (-0.77% ▼) 30 KB
Core - Modern - CDN 27.13 KB 26.92 KB (-0.77% ▼) 30 KB
Core (Bundled) - Legacy - NPM (ESM) 47.39 KB 46.17 KB (-2.57% ▼) 48 KB
Core (Bundled) - Legacy - NPM (CJS) 47.63 KB 46.43 KB (-2.53% ▼) 48 KB
Core (Bundled) - Legacy - NPM (UMD) 47.43 KB 46.13 KB (-2.76% ▼) 48 KB
Core (Bundled) - Modern - NPM (ESM) 38.58 KB 37.42 KB (-3.01% ▼) 39 KB
Core (Bundled) - Modern - NPM (CJS) 38.85 KB 37.68 KB (-3.02% ▼) 39 KB
Core (Bundled) - Modern - NPM (UMD) 38.62 KB 37.38 KB (-3.21% ▼) 39 KB
Core (Content Script) - Legacy - NPM (ESM) 47.33 KB 46.08 KB (-2.66% ▼) 48 KB
Core (Content Script) - Legacy - NPM (CJS) 47.6 KB 46.36 KB (-2.63% ▼) 48 KB
Core (Content Script) - Legacy - NPM (UMD) 47.37 KB 46.14 KB (-2.6% ▼) 48 KB
Core (Content Script) - Modern - NPM (ESM) 38.56 KB 37.32 KB (-3.22% ▼) 39 KB
Core (Content Script) - Modern - NPM (CJS) 38.75 KB 37.61 KB (-2.93% ▼) 39 KB
Core (Content Script) - Modern - NPM (UMD) 38.63 KB 37.33 KB (-3.37% ▼) 39 KB
All Integrations - Legacy - CDN 94.94 KB 94.94 KB (0%) 95.3 KB
All Integrations - Modern - CDN 90.5 KB 90.5 KB (0%) 91 KB

@saikumarrs saikumarrs force-pushed the feat.delete-event-handling-plugins-sdk-2823 branch from c659777 to e1a7a12 Compare February 20, 2025 06:39
Copy link
Member Author

Choose a reason for hiding this comment

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

These tests are temporarily skipped to avoid failing the test cases. Once we build the events delivery functionality in the core SDK, we'll un-skip them again.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
86.2% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

@saikumarrs
Copy link
Member Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Feb 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@ChryssaAliferi ChryssaAliferi left a comment

Choose a reason for hiding this comment

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

Looks good to my eyes 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants