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

Address coverage and issues #622

Merged
merged 10 commits into from
Aug 25, 2024
Merged

Address coverage and issues #622

merged 10 commits into from
Aug 25, 2024

Conversation

victimsnino
Copy link
Owner

@victimsnino victimsnino commented Aug 24, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced naming conventions across various classes and files for consistency and clarity.
  • Bug Fixes

    • None.
  • Refactor

    • Standardized naming of types and member variables, improving readability and maintainability.
    • Streamlined the implementation of certain functions to reduce overhead.
    • Improved memory management and encapsulation of observer behavior in specific classes.
  • Style

    • Updated all instances of variables and types to follow lowercase naming conventions where applicable.
    • Renamed thread-local variables in test cases for clarity.
  • Tests

    • Adjusted test cases to align with new method and signal names following refactoring.
    • Expanded test coverage for error handling and retry mechanisms in observables.
  • Chores

    • Minor housekeeping changes for improved code clarity without impacting functionality.

Copy link
Contributor

coderabbitai bot commented Aug 24, 2024

Walkthrough

Walkthrough

The changes encompass renaming adjustments and modifications to member variables across multiple files in the codebase. The key focus is on standardizing naming conventions, transitioning from CamelCase to lowercase with underscores for structures and types. Member variables gain the RPP_NO_UNIQUE_ADDRESS attribute for optimization. Additionally, a scoped enumeration is introduced for improved type safety, and updates are made to the usage of test_scheduler in various test files.

Changes

File(s) Change Summary
src/examples/rpp/doxygen/group_by.cpp Renamed Person struct to person.
src/examples/rpp/sfml/snake/canvas.cpp, canvas.hpp Changed parameter type from Coordinates to coordinates in get_rectangle_at.
src/examples/rpp/sfml/snake/main.cpp Renamed PresentEvent to present_event.
src/examples/rpp/sfml/snake/snake.cpp Renamed Coordinates to coordinates and modified related functions.
src/examples/rpp/sfml/snake/utils.hpp Changed Coordinates to coordinates, renamed PresentEvent to present_event.
src/examples/rppgrpc/doxygen/server_reactor.cpp Renamed Server class to server.
src/extensions/rppgrpc/rppgrpc/details/base.hpp Prefixed member variables with m_ (e.g., write_mutex to m_write_mutex).
src/rpp/rpp/defs.hpp Removed MSVC-specific handling for RPP_NO_UNIQUE_ADDRESS.
src/rpp/rpp/disposables/callback_disposable.hpp Added RPP_NO_UNIQUE_ADDRESS to m_fn member variable.
src/rpp/rpp/disposables/details/container.hpp Changed loop variable to use const auto& for safety.
src/rpp/rpp/observables/connectable_observable.hpp Added RPP_NO_UNIQUE_ADDRESS to m_original_observable.
src/rpp/rpp/observers/dynamic_observer.hpp Added RPP_NO_UNIQUE_ADDRESS to m_observer.
src/rpp/rpp/operators/concat.hpp Changed ConcatStage from enum to scoped enum class.
src/rpp/rpp/operators/delay.hpp Added RPP_NO_UNIQUE_ADDRESS to Observer and Worker member variables.
src/rpp/rpp/operators/timeout.hpp Added RPP_NO_UNIQUE_ADDRESS to observer and m_fallback member variables.
src/rpp/rpp/operators/window.hpp Streamlined population of m_subject_data.
src/rpp/rpp/operators/with_latest_from.hpp Prefixed member variables with m_ for clarity.
src/tests/rpp/test_debounce.cpp, test_scheduler.cpp, test_from_signal.cpp, copy_count_tracker.hpp, rpp_trompeloil.hpp Updated method and variable names for consistency and clarity.
src/tests/rpp/test_delay.cpp, test_interval.cpp, test_retry.cpp, test_timeout.cpp, test_timer.cpp Explicitly qualified test_scheduler references for clarity.

🐰 In fields of green so bright and fair,
With names anew, we dance with flair,
From Person to person we hop with glee,
In code we find harmony, can't you see?
With m_ for members, we follow the trend,
Celebrating clarity, our coding friend! 🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7e811fb and 118d17f.

Files selected for processing (30)
  • src/examples/rpp/doxygen/group_by.cpp (1 hunks)
  • src/examples/rpp/sfml/snake/canvas.cpp (1 hunks)
  • src/examples/rpp/sfml/snake/canvas.hpp (1 hunks)
  • src/examples/rpp/sfml/snake/main.cpp (2 hunks)
  • src/examples/rpp/sfml/snake/snake.cpp (3 hunks)
  • src/examples/rpp/sfml/snake/utils.hpp (1 hunks)
  • src/examples/rppgrpc/doxygen/server_reactor.cpp (1 hunks)
  • src/extensions/rppgrpc/rppgrpc/details/base.hpp (4 hunks)
  • src/rpp/rpp/defs.hpp (1 hunks)
  • src/rpp/rpp/disposables/callback_disposable.hpp (1 hunks)
  • src/rpp/rpp/disposables/details/container.hpp (1 hunks)
  • src/rpp/rpp/observables/connectable_observable.hpp (1 hunks)
  • src/rpp/rpp/observers/dynamic_observer.hpp (1 hunks)
  • src/rpp/rpp/observers/mock_observer.hpp (3 hunks)
  • src/rpp/rpp/operators/concat.hpp (1 hunks)
  • src/rpp/rpp/operators/delay.hpp (1 hunks)
  • src/rpp/rpp/operators/timeout.hpp (2 hunks)
  • src/rpp/rpp/operators/window.hpp (1 hunks)
  • src/rpp/rpp/operators/with_latest_from.hpp (2 hunks)
  • src/rpp/rpp/schedulers/computational.hpp (1 hunks)
  • src/rpp/rpp/schedulers/current_thread.hpp (1 hunks)
  • src/rpp/rpp/schedulers/details/queue.hpp (1 hunks)
  • src/rpp/rpp/schedulers/test_scheduler.hpp (1 hunks)
  • src/rpp/rpp/schedulers/thread_pool.hpp (2 hunks)
  • src/rpp/rpp/utils/utils.hpp (4 hunks)
  • src/tests/rpp/test_debounce.cpp (2 hunks)
  • src/tests/rpp/test_scheduler.cpp (2 hunks)
  • src/tests/rppqt/test_from_signal.cpp (4 hunks)
  • src/tests/utils/copy_count_tracker.hpp (2 hunks)
  • src/tests/utils/rpp_trompeloil.hpp (1 hunks)
Files skipped from review due to trivial changes (19)
  • src/examples/rpp/doxygen/group_by.cpp
  • src/examples/rpp/sfml/snake/main.cpp
  • src/examples/rpp/sfml/snake/snake.cpp
  • src/extensions/rppgrpc/rppgrpc/details/base.hpp
  • src/rpp/rpp/defs.hpp
  • src/rpp/rpp/disposables/details/container.hpp
  • src/rpp/rpp/observables/connectable_observable.hpp
  • src/rpp/rpp/observers/mock_observer.hpp
  • src/rpp/rpp/operators/window.hpp
  • src/rpp/rpp/operators/with_latest_from.hpp
  • src/rpp/rpp/schedulers/computational.hpp
  • src/rpp/rpp/schedulers/current_thread.hpp
  • src/rpp/rpp/schedulers/details/queue.hpp
  • src/rpp/rpp/schedulers/thread_pool.hpp
  • src/rpp/rpp/utils/utils.hpp
  • src/tests/rpp/test_scheduler.cpp
  • src/tests/rppqt/test_from_signal.cpp
  • src/tests/utils/copy_count_tracker.hpp
  • src/tests/utils/rpp_trompeloil.hpp
Additional comments not posted (31)
src/examples/rpp/sfml/snake/canvas.hpp (1)

7-7: Verify the consistency of type name change.

Ensure that the type name change from Coordinates to coordinates is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

Type name change is consistent across the codebase.

The type name change from Coordinates to coordinates has been consistently applied across the codebase, with no occurrences of the old type name found.

  • Files with coordinates:
    • src/examples/rpp/sfml/snake/utils.hpp
    • src/examples/rpp/sfml/snake/snake.cpp
    • src/examples/rpp/sfml/snake/canvas.cpp
    • src/examples/rpp/sfml/snake/canvas.hpp
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of type name change from `Coordinates` to `coordinates`.

# Test: Search for the old type name. Expect: No occurrences of `Coordinates`.
rg --type cpp --type h $'Coordinates'

# Test: Search for the new type name. Expect: Occurrences of `coordinates`.
rg --type cpp --type h $'coordinates'

Length of output: 1966

src/examples/rpp/sfml/snake/canvas.cpp (2)

Line range hint 9-16: LGTM!

The implementation of the function remains unchanged and appears to be correct.


9-9: Verify the consistency of type name change.

Ensure that the type name change from Coordinates to coordinates is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

Type name change verified successfully.

The type name change from Coordinates to coordinates has been consistently applied across the codebase. No occurrences of the old type name were found, confirming the successful update.

  • Instances of coordinates found in relevant files, ensuring consistency.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of type name change from `Coordinates` to `coordinates`.

# Test: Search for the old type name. Expect: No occurrences of `Coordinates`.
rg --type cpp --type h $'Coordinates'

# Test: Search for the new type name. Expect: Occurrences of `coordinates`.
rg --type cpp --type h $'coordinates'

Length of output: 1966

src/examples/rpp/sfml/snake/utils.hpp (7)

19-20: LGTM!

The operator overloads for equality and inequality appear to be correct.


37-38: LGTM!

The function implementation appears to be correct and consistent with the changes in naming conventions.


14-20: Verify the consistency of structure name change.

Ensure that the structure name change from Coordinates to coordinates is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

Structure name change is consistent.

The structure name change from Coordinates to coordinates has been applied consistently across the codebase, as no occurrences of the old name were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of structure name change from `Coordinates` to `coordinates`.

# Test: Search for the old structure name. Expect: No occurrences of `Coordinates`.
rg --type cpp --type h $'struct Coordinates'

# Test: Search for the new structure name. Expect: Occurrences of `coordinates`.
rg --type cpp --type h $'struct coordinates'

Length of output: 148


23-23: Verify the consistency of type alias change.

Ensure that the type alias change from Coordinates to coordinates is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

Type alias change is consistent across the codebase.

The type alias change from Coordinates to coordinates has been applied consistently throughout the codebase, with no remaining instances of the old alias.

  • The new alias using Direction = coordinates; is correctly implemented in src/examples/rpp/sfml/snake/utils.hpp.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of type alias change from `Coordinates` to `coordinates`.

# Test: Search for the old type alias. Expect: No occurrences of `Coordinates`.
rg --type cpp --type h $'using Direction = Coordinates'

# Test: Search for the new type alias. Expect: Occurrences of `coordinates`.
rg --type cpp --type h $'using Direction = coordinates'

Length of output: 182


33-33: Verify the consistency of type alias change.

Ensure that the type alias change from PresentEvent to present_event is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

Type alias change is consistent across the codebase.

The type alias change from PresentEvent to present_event is consistently applied, with no occurrences of the old alias found. The new alias is correctly used in the expected location.

  • src/examples/rpp/sfml/snake/utils.hpp: using CustomEvent = std::variant<present_event, sf::Event>;
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of type alias change from `PresentEvent` to `present_event`.

# Test: Search for the old type alias. Expect: No occurrences of `PresentEvent`.
rg --type cpp --type h $'using CustomEvent = std::variant<PresentEvent, sf::Event>'

# Test: Search for the new type alias. Expect: Occurrences of `present_event`.
rg --type cpp --type h $'using CustomEvent = std::variant<present_event, sf::Event>'

Length of output: 268


28-28: Verify the consistency of structure name change.

Ensure that the structure name change from PresentEvent to present_event is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:


24-24: Verify the consistency of type alias change.

Ensure that the type alias change from Coordinates to coordinates is consistent across the codebase to avoid any discrepancies.

Run the following script to verify the consistency:

Verification successful

The type alias change is consistent across the codebase.

The change from Coordinates to coordinates has been applied consistently throughout the codebase, and the coordinates structure is defined and used correctly in the relevant files.

  • The coordinates structure is defined in src/examples/rpp/sfml/snake/utils.hpp.
  • The coordinates structure is used in canvas.cpp, snake.cpp, and canvas.hpp.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of type alias change from `Coordinates` to `coordinates`.

# Test: Search for the old type alias. Expect: No occurrences of `Coordinates`.
rg --type cpp --type h $'using SnakeBody = std::vector<Coordinates>'

# Test: Search for the new type alias. Expect: Occurrences of `coordinates`.
rg --type cpp --type h $'using SnakeBody = std::vector<coordinates>'

Length of output: 221


Script:

#!/bin/bash
# Description: Verify the definition and usage of `coordinates` across the codebase.

# Search for the definition of `coordinates`.
rg --type cpp --type h 'coordinates'

# Search for the usage of `coordinates` in other contexts.
rg --type cpp --type h '\bcoordinates\b'

Length of output: 3865

src/rpp/rpp/disposables/callback_disposable.hpp (1)

43-43: LGTM! The RPP_NO_UNIQUE_ADDRESS attribute optimizes memory usage.

The addition of the RPP_NO_UNIQUE_ADDRESS attribute is a good optimization for small objects.

src/examples/rppgrpc/doxygen/server_reactor.cpp (1)

12-12: LGTM! But verify the class references in the codebase.

The renaming of the class Server to server is approved.

However, ensure that all references to the class Server are updated to server in the codebase.

Run the following script to verify the class references:

Verification successful

Class references updated successfully.

The renaming of the class from Server to server has been applied consistently across the codebase. No references to the old class name Server were found.

  • All occurrences of the class server are correctly updated.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the class `Server` are updated to `server`.

# Test: Search for the class references. Expect: Only occurrences of the new class name.
rg --type cpp -A 5 $'class server'

Length of output: 2686

src/rpp/rpp/schedulers/test_scheduler.hpp (10)

15-15: Encapsulation of test_scheduler class within rpp::schedulers namespace.

The encapsulation of the test_scheduler class within the rpp::schedulers namespace improves organization and clarity.


19-19: Final class declaration for test_scheduler.

Declaring the test_scheduler class as final is a good practice to prevent further inheritance.


22-22: Addition of inline keyword to s_current_time.

The addition of the inline keyword to the s_current_time member promotes better linkage across translation units.


24-24: Reordering of worker_strategy class declaration.

Reordering the worker_strategy class declaration after the test_scheduler class maintains public access and improves logical grouping.


26-26: Reordering of state struct declaration.

Reordering the state struct declaration after the worker_strategy class reflects a clearer hierarchy and relationship between these components.


30-38: Improvement in schedule method.

The schedule method now ensures that it checks for disposal status before proceeding with scheduling tasks.


40-60: Refinement of drain method.

The drain method has been refined to enhance its logic, particularly in how it handles the queue and time points, ensuring that it only processes items when appropriate.


65-70: Base dispose implementation and member variables in state struct.

The base_dispose_impl method and member variables in the state struct are well-defined and maintain consistency.


72-99: Enhancements in worker_strategy class.

The worker_strategy class has been enhanced to include a check for the locked state before scheduling, ensuring that disposed states are handled correctly. This change enhances the robustness of the scheduling mechanism.


101-121: Overall improvements in test_scheduler class.

The overall improvements in the test_scheduler class, including method implementations and member variables, enhance the encapsulation, readability, and maintainability of the code while preserving the original functionality.

src/rpp/rpp/observers/dynamic_observer.hpp (1)

87-87: LGTM! The RPP_NO_UNIQUE_ADDRESS attribute optimizes memory layout.

Adding the RPP_NO_UNIQUE_ADDRESS attribute can optimize memory usage by allowing the compiler to place the member variable more efficiently.

src/tests/rpp/test_debounce.cpp (3)

25-25: LGTM! Explicitly referencing test_scheduler from rpp::schedulers enhances clarity.

This change ensures that the correct type is utilized and improves the readability of the code.


26-26: LGTM! Explicitly referencing s_current_time from rpp::schedulers::test_scheduler ensures consistency.

This change reduces potential ambiguity about which s_current_time is being referenced and improves the maintainability of the code.


126-126: LGTM! Explicitly using rpp::schedulers::test_scheduler improves readability.

This change ensures that the correct type is utilized and enhances the readability of the code.

src/rpp/rpp/operators/concat.hpp (1)

Line range hint 28-32: LGTM! Changing ConcatStage to a scoped enumeration enhances type safety.

This change prevents name clashes by requiring the scope to be specified when accessing the enumeration values. The underlying type remains uint8_t, ensuring that the memory footprint is unchanged.

src/rpp/rpp/operators/delay.hpp (2)

55-55: LGTM! Verify the impact of RPP_NO_UNIQUE_ADDRESS on observer.

The change optimizes memory usage by allowing the compiler to eliminate the storage of the member if it is the only member in the struct.

Ensure that this change does not introduce any unexpected behavior in the codebase.

Run the following script to verify the usage of observer:


56-56: LGTM! Verify the impact of RPP_NO_UNIQUE_ADDRESS on worker.

The change optimizes memory usage by allowing the compiler to eliminate the storage of the member if it is the only member in the struct.

Ensure that this change does not introduce any unexpected behavior in the codebase.

Run the following script to verify the usage of worker:

Verification successful

No issues found with RPP_NO_UNIQUE_ADDRESS usage on worker.

The change optimizes memory usage without introducing any unexpected behavior in the codebase. The extensive use of worker in tests and scheduler implementations does not reveal any problems related to this change.

  • The worker is used in various contexts, including scheduling tasks and managing disposables, without any issues.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `worker` in the codebase.

# Test: Search for the usage of `worker`. Expect: No unexpected behavior.
rg --type cpp -A 5 $'worker'

Length of output: 89634

src/rpp/rpp/operators/timeout.hpp (2)

28-28: LGTM! Verify the impact of RPP_NO_UNIQUE_ADDRESS on observer.

The change optimizes memory usage by allowing the compiler to eliminate the storage of the member if it is the only member in the struct.

Ensure that this change does not introduce any unexpected behavior in the codebase.

Run the following script to verify the usage of observer:


48-48: LGTM! Verify the impact of RPP_NO_UNIQUE_ADDRESS on m_fallback.

The change optimizes memory usage by allowing the compiler to eliminate the storage of the member if it is the only member in the struct.

Ensure that this change does not introduce any unexpected behavior in the codebase.

Run the following script to verify the usage of m_fallback:

Verification successful

Change Verified: RPP_NO_UNIQUE_ADDRESS on m_fallback is safe.

The RPP_NO_UNIQUE_ADDRESS attribute optimizes memory usage without affecting the logic of the code. The usage of m_fallback in the constructor and getter method confirms its functionality remains intact.

  • The attribute is applied to m_fallback in src/rpp/rpp/operators/timeout.hpp.
  • m_fallback is used in the constructor and a getter method, ensuring its role in the class is preserved.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `m_fallback` in the codebase.

# Test: Search for the usage of `m_fallback`. Expect: No unexpected behavior.
rg --type cpp -A 5 $'m_fallback'

Length of output: 1348

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 118d17f and 983bab8.

Files selected for processing (9)
  • src/rpp/rpp/operators/window.hpp (2 hunks)
  • src/rpp/rpp/operators/with_latest_from.hpp (1 hunks)
  • src/tests/rpp/test_delay.cpp (5 hunks)
  • src/tests/rpp/test_interval.cpp (2 hunks)
  • src/tests/rpp/test_retry.cpp (3 hunks)
  • src/tests/rpp/test_scheduler.cpp (3 hunks)
  • src/tests/rpp/test_throttle.cpp (2 hunks)
  • src/tests/rpp/test_timeout.cpp (2 hunks)
  • src/tests/rpp/test_timer.cpp (2 hunks)
Files skipped from review due to trivial changes (5)
  • src/rpp/rpp/operators/with_latest_from.hpp
  • src/tests/rpp/test_delay.cpp
  • src/tests/rpp/test_throttle.cpp
  • src/tests/rpp/test_timeout.cpp
  • src/tests/rpp/test_timer.cpp
Files skipped from review as they are similar to previous changes (2)
  • src/rpp/rpp/operators/window.hpp
  • src/tests/rpp/test_scheduler.cpp
Additional comments not posted (5)
src/tests/rpp/test_interval.cpp (2)

28-28: LGTM! Namespace update for test_scheduler improves clarity.

The change to use the fully qualified name rpp::schedulers::test_scheduler ensures that the correct namespace is specified, enhancing clarity and preventing ambiguity.


35-35: LGTM! Namespace update for worker_strategy::now() improves clarity.

The change to use the fully qualified name rpp::schedulers::test_scheduler::worker_strategy::now() ensures that the correct namespace is specified, enhancing clarity and preventing ambiguity.

src/tests/rpp/test_retry.cpp (3)

14-17: LGTM! New includes for multi-threading tests.

The added includes for rpp/operators/subscribe_on.hpp and rpp/schedulers/new_thread.hpp are necessary for the new test cases that involve multi-threading with the retry operator.


63-71: LGTM! New test case for multi-threading with retry operator.

The added test case verifies the behavior of the retry operator when invoked from another thread, ensuring that it handles multi-threading scenarios correctly.


137-152: LGTM! New test case for exception handling with retry operator.

The added test case verifies the behavior of the retry operator when the observable throws an exception, ensuring that it handles exceptions correctly.

Copy link
Contributor

github-actions bot commented Aug 24, 2024

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 300.17 ns 2.16 ns 2.16 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 298.54 ns 2.16 ns 2.16 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 683.83 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1035.37 ns 3.43 ns 3.70 ns 0.93
concat_as_source of just(1 immediate) create + subscribe 2180.40 ns 123.34 ns 105.08 ns 1.17
defer from array of 1 - defer + create + subscribe + immediate 724.49 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2143.04 ns 59.23 ns 59.33 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3019.81 ns 32.40 ns 32.40 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 30948.97 ns 28839.78 ns 28073.41 ns 1.03
from array of 1000 - create + as_blocking + subscribe + new_thread 39125.18 ns 51192.71 ns 50189.17 ns 1.02
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3414.91 ns 135.85 ns 126.09 ns 1.08

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1085.06 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 830.57 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 979.49 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 870.90 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1230.11 ns 0.62 ns 0.62 ns 1.00
immediate_just(1,2)+last()+subscribe 899.65 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1091.78 ns 17.29 ns 17.60 ns 0.98
immediate_just(1,2,3)+element_at(1)+subscribe 834.58 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 263.86 ns 2.16 ns 2.16 ns 1.00
current_thread scheduler create worker + schedule 364.64 ns 5.56 ns 5.86 ns 0.95
current_thread scheduler create worker + schedule + recursive schedule 811.69 ns 56.52 ns 56.54 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 845.12 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 880.64 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2372.30 ns 162.33 ns 159.52 ns 1.02
immediate_just+buffer(2)+subscribe 1535.66 ns 13.59 ns 13.58 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2355.29 ns 1108.84 ns 1028.32 ns 1.08

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 829.23 ns - - 0.00
immediate_just+take_while(true)+subscribe 847.14 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2030.08 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3413.50 ns 175.97 ns 179.31 ns 0.98
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3651.41 ns 171.04 ns 185.48 ns 0.92
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 134.75 ns 132.96 ns 1.01
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3517.78 ns 928.90 ns 997.81 ns 0.93
immediate_just(1) + zip(immediate_just(2)) + subscribe 2110.56 ns 204.03 ns 206.75 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.58 ns 30.86 ns 14.72 ns 2.10
subscribe 100 observers to publish_subject 200040.17 ns 14905.36 ns 15319.15 ns 0.97
100 on_next to 100 observers to publish_subject 32463.64 ns 17139.90 ns 18842.10 ns 0.91

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1424.35 ns 12.97 ns 12.65 ns 1.03
basic sample with immediate scheduler 1383.93 ns 5.55 ns 5.55 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 937.75 ns 0.31 ns 0.31 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2042.20 ns 1024.94 ns 996.08 ns 1.03
create(on_error())+retry(1)+subscribe 584.75 ns 117.05 ns 111.07 ns 1.05

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 980.20 ns 3.93 ns 5.40 ns 0.73
Subscribe empty callbacks to empty observable via pipe operator 977.58 ns 3.93 ns 4.62 ns 0.85

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1934.07 ns 0.23 ns 0.32 ns 0.73
from array of 1 - create + subscribe + current_thread 2442.50 ns 34.24 ns 39.03 ns 0.88
concat_as_source of just(1 immediate) create + subscribe 5407.46 ns 335.65 ns 420.96 ns 0.80
defer from array of 1 - defer + create + subscribe + immediate 1975.92 ns 0.23 ns 0.28 ns 0.85
interval - interval + take(3) + subscribe + immediate 4944.91 ns 113.89 ns 133.53 ns 0.85
interval - interval + take(3) + subscribe + current_thread 6029.44 ns 98.14 ns 110.64 ns 0.89
from array of 1 - create + as_blocking + subscribe + new_thread 81797.17 ns 80619.58 ns 134078.29 ns 0.60
from array of 1000 - create + as_blocking + subscribe + new_thread 85318.77 ns 84408.00 ns 151241.57 ns 0.56
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 8156.84 ns 380.68 ns 448.26 ns 0.85

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 2725.59 ns 0.22 ns 0.29 ns 0.76
immediate_just+filter(true)+subscribe 2024.33 ns 0.22 ns 0.28 ns 0.79
immediate_just(1,2)+skip(1)+subscribe 2621.91 ns 0.22 ns 0.29 ns 0.77
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1988.13 ns 0.45 ns 0.60 ns 0.75
immediate_just(1,2)+first()+subscribe 3023.43 ns 0.22 ns 0.27 ns 0.82
immediate_just(1,2)+last()+subscribe 2288.00 ns 0.22 ns 0.33 ns 0.67
immediate_just+take_last(1)+subscribe 2872.18 ns 0.22 ns 0.28 ns 0.81
immediate_just(1,2,3)+element_at(1)+subscribe 2120.41 ns 0.23 ns 0.28 ns 0.81

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 860.79 ns 4.14 ns 4.85 ns 0.85
current_thread scheduler create worker + schedule 1200.19 ns 39.89 ns 42.73 ns 0.93
current_thread scheduler create worker + schedule + recursive schedule 2008.95 ns 207.14 ns 242.41 ns 0.85

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2024.53 ns 4.23 ns 5.17 ns 0.82
immediate_just+scan(10, std::plus)+subscribe 2237.26 ns 0.45 ns 0.62 ns 0.72
immediate_just+flat_map(immediate_just(v*2))+subscribe 5074.79 ns 387.47 ns 517.27 ns 0.75
immediate_just+buffer(2)+subscribe 2386.73 ns 63.04 ns 81.41 ns 0.77
immediate_just+window(2)+subscribe + subscsribe inner 5086.12 ns 2300.69 ns 3319.91 ns 0.69

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2021.47 ns - - 0.00
immediate_just+take_while(true)+subscribe 2029.79 ns 0.22 ns 0.34 ns 0.65

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4826.18 ns 4.78 ns 6.16 ns 0.78

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 7418.18 ns 440.99 ns 528.61 ns 0.83
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 8017.82 ns 441.61 ns 516.77 ns 0.85
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 439.40 ns 605.83 ns 0.73
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 7608.75 ns 1816.48 ns 2994.50 ns 0.61
immediate_just(1) + zip(immediate_just(2)) + subscribe 4886.53 ns 804.89 ns 1137.75 ns 0.71

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 71.91 ns 45.73 ns 60.47 ns 0.76
subscribe 100 observers to publish_subject 330138.00 ns 38284.90 ns 51052.45 ns 0.75
100 on_next to 100 observers to publish_subject 51363.39 ns 17467.51 ns 22372.85 ns 0.78

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 2772.72 ns 79.54 ns 85.42 ns 0.93
basic sample with immediate scheduler 2758.38 ns 18.73 ns 21.80 ns 0.86

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2329.59 ns 0.23 ns 0.33 ns 0.69

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 6326.77 ns 4001.06 ns 4848.54 ns 0.83
create(on_error())+retry(1)+subscribe 1689.12 ns 292.17 ns 362.58 ns 0.81

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 268.30 ns 0.88 ns 1.54 ns 0.57
Subscribe empty callbacks to empty observable via pipe operator 271.23 ns 0.88 ns 1.54 ns 0.57

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 563.13 ns 0.32 ns 0.34 ns 0.92
from array of 1 - create + subscribe + current_thread 790.72 ns 4.01 ns 4.32 ns 0.93
concat_as_source of just(1 immediate) create + subscribe 2328.27 ns 135.82 ns 134.92 ns 1.01
defer from array of 1 - defer + create + subscribe + immediate 795.37 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2206.65 ns 58.31 ns 58.31 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3140.17 ns 30.88 ns 30.86 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 28495.16 ns 28182.72 ns 28005.07 ns 1.01
from array of 1000 - create + as_blocking + subscribe + new_thread 39316.23 ns 36401.56 ns 36459.93 ns 1.00
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3683.85 ns 159.42 ns 156.82 ns 1.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1177.55 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 835.12 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1078.33 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 868.78 ns 0.62 ns 0.62 ns 1.00
immediate_just(1,2)+first()+subscribe 1375.55 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 1008.43 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1170.61 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 855.06 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 278.99 ns 0.88 ns 1.54 ns 0.57
current_thread scheduler create worker + schedule 388.84 ns 4.02 ns 4.79 ns 0.84
current_thread scheduler create worker + schedule + recursive schedule 854.23 ns 56.92 ns 55.85 ns 1.02

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 840.25 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 969.25 ns 0.32 ns 0.31 ns 1.05
immediate_just+flat_map(immediate_just(v*2))+subscribe 2245.07 ns 137.39 ns 144.46 ns 0.95
immediate_just+buffer(2)+subscribe 1525.92 ns 13.92 ns 13.88 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2416.46 ns 928.56 ns 936.43 ns 0.99

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 836.17 ns - - 0.00
immediate_just+take_while(true)+subscribe 841.04 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1972.23 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3255.10 ns 160.77 ns 159.69 ns 1.01
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3706.10 ns 146.61 ns 145.90 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 143.04 ns 144.26 ns 0.99
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3386.34 ns 856.44 ns 845.49 ns 1.01
immediate_just(1) + zip(immediate_just(2)) + subscribe 2227.60 ns 201.74 ns 200.63 ns 1.01

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 52.24 ns 17.67 ns 17.65 ns 1.00
subscribe 100 observers to publish_subject 204017.80 ns 15917.10 ns 16378.32 ns 0.97
100 on_next to 100 observers to publish_subject 37887.46 ns 17931.81 ns 21234.39 ns 0.84

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1311.18 ns 11.42 ns 11.72 ns 0.97
basic sample with immediate scheduler 1281.44 ns 5.86 ns 6.17 ns 0.95

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1002.25 ns 0.31 ns 0.31 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2172.29 ns 1258.12 ns 1215.57 ns 1.04
create(on_error())+retry(1)+subscribe 643.59 ns 146.47 ns 145.97 ns 1.00

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 561.76 ns 4.94 ns 4.69 ns 1.05
Subscribe empty callbacks to empty observable via pipe operator 577.12 ns 4.87 ns 4.79 ns 1.02

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1166.27 ns 9.70 ns 4.62 ns 2.10
from array of 1 - create + subscribe + current_thread 1435.10 ns 17.59 ns 15.51 ns 1.13
concat_as_source of just(1 immediate) create + subscribe 3692.23 ns 192.64 ns 172.56 ns 1.12
defer from array of 1 - defer + create + subscribe + immediate 1185.96 ns 9.41 ns 4.94 ns 1.91
interval - interval + take(3) + subscribe + immediate 3381.19 ns 144.87 ns 133.24 ns 1.09
interval - interval + take(3) + subscribe + current_thread 3409.06 ns 65.48 ns 54.57 ns 1.20
from array of 1 - create + as_blocking + subscribe + new_thread 122830.00 ns 118400.00 ns 109020.00 ns 1.09
from array of 1000 - create + as_blocking + subscribe + new_thread 130533.33 ns 133262.50 ns 126250.00 ns 1.06
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5317.59 ns 211.57 ns 206.73 ns 1.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1826.35 ns 24.97 ns 12.87 ns 1.94
immediate_just+filter(true)+subscribe 1315.63 ns 24.06 ns 12.37 ns 1.95
immediate_just(1,2)+skip(1)+subscribe 1737.63 ns 23.44 ns 13.13 ns 1.78
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1593.61 ns 26.26 ns 15.94 ns 1.65
immediate_just(1,2)+first()+subscribe 2345.01 ns 23.74 ns 12.94 ns 1.83
immediate_just(1,2)+last()+subscribe 1801.11 ns 24.69 ns 13.80 ns 1.79
immediate_just+take_last(1)+subscribe 2001.12 ns 69.32 ns 58.99 ns 1.18
immediate_just(1,2,3)+element_at(1)+subscribe 1337.51 ns 26.54 ns 13.78 ns 1.93

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 472.54 ns 5.87 ns 6.17 ns 0.95
current_thread scheduler create worker + schedule 644.22 ns 13.82 ns 14.07 ns 0.98
current_thread scheduler create worker + schedule + recursive schedule 1087.14 ns 103.03 ns 104.67 ns 0.98

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1305.53 ns 24.35 ns 12.34 ns 1.97
immediate_just+scan(10, std::plus)+subscribe 1403.79 ns 26.51 ns 21.58 ns 1.23
immediate_just+flat_map(immediate_just(v*2))+subscribe 3870.48 ns 204.19 ns 203.81 ns 1.00
immediate_just+buffer(2)+subscribe 2304.71 ns 68.64 ns 58.38 ns 1.18
immediate_just+window(2)+subscribe + subscsribe inner 4015.03 ns 1283.84 ns 1322.69 ns 0.97

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1312.44 ns 23.14 ns 11.46 ns 2.02
immediate_just+take_while(true)+subscribe 1323.33 ns 24.06 ns 12.37 ns 1.94

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 3443.63 ns 11.10 ns 7.40 ns 1.50

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5326.56 ns 220.27 ns 225.94 ns 0.97
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5444.98 ns 226.72 ns 214.63 ns 1.06
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 200.87 ns 193.76 ns 1.04
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5423.11 ns 922.00 ns 942.66 ns 0.98
immediate_just(1) + zip(immediate_just(2)) + subscribe 3539.82 ns 515.05 ns 519.55 ns 0.99

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 37.39 ns 20.36 ns 19.79 ns 1.03
subscribe 100 observers to publish_subject 304275.00 ns 26852.63 ns 27657.14 ns 0.97
100 on_next to 100 observers to publish_subject 51755.00 ns 32683.87 ns 38686.21 ns 0.84

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1875.04 ns 101.93 ns 58.62 ns 1.74
basic sample with immediate scheduler 1886.75 ns 72.49 ns 36.72 ns 1.97

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1449.08 ns 24.66 ns 19.97 ns 1.23

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2146.01 ns 357.03 ns 341.28 ns 1.05
create(on_error())+retry(1)+subscribe 1476.48 ns 146.83 ns 144.20 ns 1.02

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 6 lines in your changes missing coverage. Please review.

Project coverage is 95.62%. Comparing base (7e811fb) to head (7ef850a).
Report is 1 commits behind head on v2.

Files Patch % Lines
src/extensions/rppgrpc/rppgrpc/details/base.hpp 80.00% 3 Missing ⚠️
src/rpp/rpp/schedulers/computational.hpp 0.00% 2 Missing ⚠️
src/rpp/rpp/operators/on_error_resume_next.hpp 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #622      +/-   ##
==========================================
+ Coverage   94.87%   95.62%   +0.74%     
==========================================
  Files          98       98              
  Lines        1894     1897       +3     
==========================================
+ Hits         1797     1814      +17     
+ Misses         97       83      -14     

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

@victimsnino victimsnino marked this pull request as ready for review August 24, 2024 20:08
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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 983bab8 and 1955f1f.

Files selected for processing (6)
  • src/rpp/rpp/operators/on_error_resume_next.hpp (1 hunks)
  • src/rpp/rpp/operators/retry_when.hpp (1 hunks)
  • src/tests/rpp/test_debounce.cpp (2 hunks)
  • src/tests/rpp/test_reduce.cpp (2 hunks)
  • src/tests/rpp/test_retry_when.cpp (1 hunks)
  • src/tests/rpp/test_timeout.cpp (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/tests/rpp/test_debounce.cpp
  • src/tests/rpp/test_timeout.cpp
Additional comments not posted (5)
src/tests/rpp/test_reduce.cpp (2)

16-17: Approved: Addition of new headers for test cases.

The inclusion of rpp/sources/empty.hpp and rpp/sources/error.hpp is justified as they are used in the new test sections for handling empty and error scenarios.


74-96: Well-structured test cases for error and completion scenarios.

The test case "reduce forwards callbacks" is well-organized into two sections testing the reduce operator's response to error and empty sources. The use of rpp::source::error and rpp::source::empty along with the reduce operator is correctly implemented. The checks for received values and counts of error and completion callbacks are appropriate and validate the expected behavior effectively.

src/rpp/rpp/operators/on_error_resume_next.hpp (2)

20-30: Approved: Introduction of on_error_resume_next_disposable structure.

The new structure on_error_resume_next_disposable is well-designed to encapsulate the observer and manage its lifecycle effectively. The use of RPP_NO_UNIQUE_ADDRESS is appropriate for optimizing the memory layout. The structure's inheritance from rpp::composite_disposable and its constructor implementation are correctly set up to handle the observer's lifecycle.


60-113: Significant improvements in observer strategy with new state management.

The modifications to on_error_resume_next_observer_strategy introduce a shared pointer for state management, enhancing memory safety and lifecycle management. The new init_state method is well-implemented, ensuring proper initialization of the observer's state. Changes to the on_error and on_completed methods correctly utilize the new state structure, simplifying error handling and ensuring proper disposal of resources.

src/rpp/rpp/operators/retry_when.hpp (1)

101-101: Streamlined error handling in on_error method.

The modification to directly subscribe to the observable in the on_error method simplifies the control flow and eliminates unnecessary intermediate storage. This change is a positive improvement, enhancing clarity and potentially reducing overhead.

src/tests/rpp/test_retry_when.cpp Show resolved Hide resolved
src/tests/rpp/test_retry_when.cpp Show resolved Hide resolved
src/tests/rpp/test_retry_when.cpp Show resolved Hide resolved
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1955f1f and a5b6e44.

Files selected for processing (3)
  • src/extensions/rppqt/rppqt/schedulers/main_thread.hpp (1 hunks)
  • src/tests/rpp/test_scheduler.cpp (4 hunks)
  • src/tests/rppqt/test_main_thread_scheduler.cpp (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/tests/rpp/test_scheduler.cpp
Additional comments not posted (3)
src/extensions/rppqt/rppqt/schedulers/main_thread.hpp (1)

47-47: Ensure robustness in duration handling.

The modification to use std::max for enforcing a minimum duration is a good practice, especially in GUI applications where timing is critical. This change helps prevent tasks from executing prematurely which can be crucial for maintaining the expected behavior of the application.

src/tests/rppqt/test_main_thread_scheduler.cpp (2)

74-96: Refactor recursive scheduling into a reusable lambda function.

The introduction of test_recursive_scheduling lambda function is a significant improvement in terms of code reusability and clarity. This change allows for easier modifications and testing of recursive scheduling scenarios with different durations. It also helps in maintaining consistency across tests.


111-120: Add test case for scenarios with no QApplication.

Adding a test case to handle scenarios where no QApplication is active is crucial for ensuring the robustness of the scheduler. This test verifies that the scheduler behaves correctly by capturing an error when QApplication is not initialized, which is a critical aspect of error handling in Qt-based applications.

@victimsnino
Copy link
Owner Author

@coderabbitai full review

@victimsnino
Copy link
Owner Author

@coderabbitai summary

Copy link
Contributor

coderabbitai bot commented Aug 24, 2024

Actions performed

Full review triggered.

Copy link
Contributor

coderabbitai bot commented Aug 24, 2024

Actions performed

Summary regeneration triggered.

Copy link
Contributor

coderabbitai bot commented Aug 24, 2024

@victimsnino:

Full Review

  1. Naming Conventions:

    • The PR introduces consistent renaming of types and member variables across the codebase. For example, Coordinates is renamed to coordinates, and PresentEvent to present_event. This enhances code readability and aligns with common C++ naming conventions.
    • Member variables are prefixed with m_, improving clarity and distinguishing them from local variables.
  2. Memory Optimization:

    • The introduction of the RPP_NO_UNIQUE_ADDRESS attribute to certain member variables, such as m_fn, optimizes memory usage. This is a C++20 feature that allows for more efficient memory handling, especially for small objects.
  3. Test Coverage:

    • The PR significantly expands test coverage, adding new test cases for various operators like debounce, retry, and timeout. These tests ensure that the changes do not introduce regressions and that the operators behave as expected under different scenarios, including error handling and multi-threaded contexts.
    • The tests are well-structured, with clear sections that verify specific behaviors, such as forwarding errors, handling race conditions, and satisfying disposable contracts.
  4. Code Quality:

    • The code changes maintain high quality, with a focus on improving readability and maintainability. The refactoring of test cases into reusable functions, such as in test_main_thread_scheduler.cpp, is a good practice that reduces redundancy and improves code clarity.
    • The removal of unnecessary optional handling in the retry_when operator simplifies the control flow, making the code more straightforward and easier to maintain.
  5. TODO Comments:

    • There are a few TODO comments in the codebase, particularly in the cmake/conan_provider.cmake file. These comments indicate areas that may need further attention or improvement in the future.

Summary of Changes

  • Type Renaming:

    • Various types and structs have been renamed to follow a consistent lowercase naming convention, such as Coordinates to coordinates and PresentEvent to present_event.
  • Memory Optimization:

    • The RPP_NO_UNIQUE_ADDRESS attribute has been added to certain member variables to optimize memory usage.
  • Test Enhancements:

    • New test cases have been added to cover edge cases and ensure correct behavior of operators like debounce, retry, and timeout.
  • Code Refactoring:

    • Test cases have been refactored to improve reusability and maintainability, such as the introduction of reusable lambda functions in test_main_thread_scheduler.cpp.

Overall, the PR demonstrates a strong focus on improving code quality, consistency, and test coverage, ensuring that the ReactivePlusPlus project remains robust and maintainable.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Gather information about the codebase to perform a full review and generate a summary.

# Search for all function definitions in the codebase.
ast-grep --lang cpp --pattern 'function $_($_) { $$$ }'

# Search for all class definitions in the codebase.
ast-grep --lang cpp --pattern 'class $_ { $$$ }'

# Search for all struct definitions in the codebase.
ast-grep --lang cpp --pattern 'struct $_ { $$$ }'

# Search for all member variable declarations in the codebase.
ast-grep --lang cpp --pattern '$_ $_;'

# Search for all test cases in the codebase.
rg --glob '!node_modules' --glob '!dist' --glob '!build' -A 5 'TEST_CASE'

# Search for any TODO comments in the codebase.
rg 'TODO'

Length of output: 84276

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a5b6e44 and 8372abc.

Files selected for processing (3)
  • src/rpp/rpp/operators/reduce.hpp (1 hunks)
  • src/tests/rpp/test_reduce.cpp (2 hunks)
  • src/tests/rpp/test_scheduler.cpp (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/tests/rpp/test_reduce.cpp
  • src/tests/rpp/test_scheduler.cpp

src/rpp/rpp/operators/reduce.hpp Show resolved Hide resolved
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8372abc and 7ef850a.

Files selected for processing (1)
  • src/tests/rpp/test_scheduler.cpp (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/tests/rpp/test_scheduler.cpp

Copy link

@victimsnino victimsnino merged commit 97d7110 into v2 Aug 25, 2024
36 of 37 checks passed
@victimsnino victimsnino deleted the address_coverage_and_issues branch August 25, 2024 19:42
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