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

refactor!: Strongly typed enum for ConstrainedStep::Type and capital initial letter #4013

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

andiwand
Copy link
Contributor

@andiwand andiwand commented Jan 9, 2025

Followup from #3986

  • Strongly typed enum ConstrainedStep::Type
  • capital initial letter for Type instances

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactoring

    • Updated ConstrainedStep enumeration values to use PascalCase (e.g., navigatorNavigator)
    • Standardized references to ConstrainedStep types across multiple files
  • Type Safety

    • Improved type safety by using scoped enumeration
    • Explicit type references in method calls (e.g., ConstrainedStep::Type::Navigator)
  • Code Consistency

    • Consistent updates across propagation, navigation, and testing components
    • No changes to underlying logic or functionality

@andiwand andiwand added this to the next milestone Jan 9, 2025
Copy link

coderabbitai bot commented Jan 9, 2025

Walkthrough

Refactoring of the ConstrainedStep enumeration across multiple files in the Acts library, this pull request introduces. Transitioning from a flat enumeration to a scoped enumeration (enum class), it does. Lowercase to uppercase, enumerators are renamed, and method calls updated to use the new ConstrainedStep::Type:: prefix. Type safety enhanced, it is, while the fundamental logic of the propagation and navigation systems remains unchanged.

Changes

File Path Change Summary
Core/include/Acts/Propagator/ConstrainedStep.hpp Converted enum Type to enum class Type with capitalized enumerators
Core/include/Acts/Navigation/DetectorNavigator.hpp, Core/include/Acts/Propagator/DirectNavigator.hpp, Core/include/Acts/Propagator/Navigator.hpp, Core/include/Acts/Propagator/Propagator.ipp, Core/include/Acts/Propagator/StandardAborters.hpp, Core/include/Acts/Propagator/TryAllNavigator.hpp, Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp Updated method calls to use ConstrainedStep::Type::Navigator/Actor/User
Core/include/Acts/Propagator/detail/SteppingHelper.hpp, Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp Updated references to ConstrainedStep::actor to ConstrainedStep::Type::Actor
Multiple Test Files Consistently updated test cases to reflect new enumeration syntax

Possibly related PRs

Suggested Labels

automerge, Changes Performance

Suggested Reviewers

  • paulgessinger

Poem

Refactor, we must, with great care,
Enums now scoped, a breath of fresh air! 🌬️
Navigator leads with a capital grace,
In the code's embrace, find its rightful place. ✨
Type safety shines, a Jedi's delight,
In the realm of coding, all feels just right! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 302bcaa and 9e0c42e.

📒 Files selected for processing (17)
  • Core/include/Acts/Navigation/DetectorNavigator.hpp (2 hunks)
  • Core/include/Acts/Propagator/ConstrainedStep.hpp (5 hunks)
  • Core/include/Acts/Propagator/DirectNavigator.hpp (3 hunks)
  • Core/include/Acts/Propagator/Navigator.hpp (16 hunks)
  • Core/include/Acts/Propagator/Propagator.ipp (1 hunks)
  • Core/include/Acts/Propagator/StandardAborters.hpp (2 hunks)
  • Core/include/Acts/Propagator/TryAllNavigator.hpp (8 hunks)
  • Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp (1 hunks)
  • Examples/Io/Root/src/RootPropagationStepsWriter.cpp (1 hunks)
  • Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp (1 hunks)
  • Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp (3 hunks)
  • Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp (2 hunks)
  • Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp (3 hunks)
  • Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp (4 hunks)
  • Tests/UnitTests/Core/Propagator/PropagatorTests.cpp (1 hunks)
  • Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp (3 hunks)
  • Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (17)
  • Core/include/Acts/Propagator/DirectNavigator.hpp
  • Core/include/Acts/Propagator/Navigator.hpp
  • Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp
  • Tests/UnitTests/Core/Propagator/PropagatorTests.cpp
  • Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp
  • Core/include/Acts/Propagator/StandardAborters.hpp
  • Core/include/Acts/Navigation/DetectorNavigator.hpp
  • Examples/Io/Root/src/RootPropagationStepsWriter.cpp
  • Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
  • Core/include/Acts/Propagator/Propagator.ipp
  • Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp
  • Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp
  • Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp
  • Core/include/Acts/Propagator/TryAllNavigator.hpp
  • Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp
  • Core/include/Acts/Propagator/ConstrainedStep.hpp
  • Tests/UnitTests/Core/Propagator/ConstrainedStepTests.cpp
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: merge-sentinel

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.

@andiwand andiwand changed the title refactor!: Strongly typed enum for ConstrainedStep::Type and capital initial letter refactor!: Capital initial letter for ConstrainedStep::Type Jan 9, 2025
@github-actions github-actions bot added Component - Core Affects the Core module Component - Fatras Affects the Fatras module Component - Examples Affects the Examples module Track Finding labels Jan 9, 2025
@andiwand andiwand changed the title refactor!: Capital initial letter for ConstrainedStep::Type refactor!: Strongly typed enum for ConstrainedStep::Type and capital initial letter Jan 9, 2025
@andiwand andiwand changed the title refactor!: Strongly typed enum for ConstrainedStep::Type and capital initial letter refactor!: Strongly typed enum for ConstrainedStep::Type and capital initial letter Jan 9, 2025
Copy link

@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

🧹 Nitpick comments (1)
Core/include/Acts/Propagator/ConstrainedStep.hpp (1)

65-68: Documentation improvements needed, I sense.

Parameter renaming from value to v, more concise it makes the code. Yet, in documentation comments, the old parameter name value remains. Update these, we must.

Apply these changes, you should:

-  /// @param value is the new accuracy value
+  /// @param v is the new accuracy value
-  /// @param value is the new user value
+  /// @param v is the new user value
-  /// @param value is the new value to be updated
+  /// @param v is the new value to be updated

Also applies to: 74-78, 114-121

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 711b7c5 and 7cc6348.

📒 Files selected for processing (1)
  • Core/include/Acts/Propagator/ConstrainedStep.hpp (7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: merge-sentinel
  • GitHub Check: macos
🔇 Additional comments (2)
Core/include/Acts/Propagator/ConstrainedStep.hpp (2)

162-163: Clean and elegant, this helper function is!

Private helper value_, encapsulation it brings. Safe enum conversion through toUnderlying, wisdom it shows. Maintainable and clear, the code becomes.


50-51: Wise choice, the path to type safety is! Hmmmm.

Strong with the Force, this change to enum class Type is. Type safety it brings, and proper naming conventions it follows. The using enum Type directive, elegant solution it provides, yes.

Verify the impact of enum class conversion, we must:

✅ Verification successful

Safe and sound, this change is! Hmmmm.

Through the Force, seen the truth I have. Properly scoped, all enum values are. No disturbance in the code, there is. Type safety achieved without breaking changes, it has. Strong with the Force, this implementation is!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential implicit conversions that might break
rg "ConstrainedStep::(navigator|actor|user)" --type cpp

Length of output: 57


Script:

#!/bin/bash
# Search for ConstrainedStep::Type usage
rg "ConstrainedStep::Type" --type cpp -B 1 -A 1

# Search for method calls that might use the enum
rg "\.update\(" --type cpp -g "*/Propagator/*"

# Search for the class definition to understand usage patterns
ast-grep --pattern 'class ConstrainedStep {
  $$$
}'

Length of output: 11477


Script:

#!/bin/bash
# Search for specific enum value usage patterns
rg "Type::(Navigator|Actor|User)" --type cpp -B 1 -A 1

# Check for potential comparison operations
rg "(==|!=|switch.*Type)" --type cpp -g "*/Propagator/*" -B 1 -A 1

Length of output: 1002

Copy link

github-actions bot commented Jan 9, 2025

📊: Physics performance monitoring for 9e0c42e

Full contents

physmon summary

@andiwand
Copy link
Contributor Author

Looks like using enum is triggering a compiler segfault for gcc 11.4.0 @paulgessinger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Fatras Affects the Fatras module Track Finding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants