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(services): move registry to node-core #1945

Merged
merged 3 commits into from
Aug 21, 2024
Merged

feat(services): move registry to node-core #1945

merged 3 commits into from
Aug 21, 2024

Conversation

itsdevbear
Copy link
Contributor

@itsdevbear itsdevbear commented Aug 21, 2024

Summary by CodeRabbit

  • New Features

    • Reorganized service management structure by relocating the service package to enhance modularity.
    • Introduced new dependencies to support updated functionalities and testing capabilities.
  • Bug Fixes

    • Removed obsolete dependencies to streamline the module's functionality and improve maintainability.
  • Refactor

    • Updated import paths and dependencies across multiple files for better clarity and structure in service interactions.
  • Documentation

    • Adjusted comments and documentation related to dependency management for improved understanding.

@itsdevbear itsdevbear requested a review from ocnc as a code owner August 21, 2024 18:01
Copy link
Contributor

coderabbitai bot commented Aug 21, 2024

Walkthrough

The recent changes reflect a significant restructuring of the service management within the beacon-kit project. Services have been reorganized from the runtime module to the node-core module, specifically into a services registry context. This refactor enhances modularity and clarity, likely improving maintainability and altering how services are registered and managed throughout the application.

Changes

Files Change Summary
.mockery.yaml Updated service path from runtime/pkg/service to node-core/pkg/services/registry.
mod/node-core/go.mod Added github.com/stretchr/objx v0.5.2 as an indirect dependency; removed comment for github.com/stretchr/testify v1.9.0.
mod/node-core/pkg/builder/builder.go Added import for node-core/pkg/services/registry; removed import for runtime/pkg/service.
mod/node-core/pkg/components/interfaces.go Added import for node-core/pkg/services/registry; removed import for runtime/pkg/service.
mod/node-core/pkg/components/service_registry.go Updated import from runtime/pkg/service to node-core/pkg/services/registry.
mod/node-core/pkg/node/node.go Added import for node-core/pkg/services/registry; removed import for runtime/pkg/service.
mod/node-core/pkg/services/registry/mocks/registry_option.mock.go Updated import from runtime/pkg/service to node-core/pkg/services/registry.
mod/node-core/pkg/services/registry/registry_test.go Changed import path for service and mocks to reflect the new registry service under node-core.
mod/runtime/go.mod Removed dependency on mod/log, added github.com/stretchr/testify, and removed github.com/stretchr/objx.

Sequence Diagram(s)

sequenceDiagram
    participant A as Client
    participant B as Node Core
    participant C as Service Registry

    A->>B: Request Service
    B->>C: Register Service
    C-->>B: Confirm Registration
    B-->>A: Service Response
Loading

Poem

🐇 In the meadow where services play,
The rabbit hops with cheer today!
From runtime's hold, they now take flight,
To node-core’s realm, oh what a sight!
With registry paths now shining bright,
Hooray for change, our code’s delight! 🌼


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

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 21.59%. Comparing base (d8f1bf2) to head (4e49096).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1945      +/-   ##
==========================================
+ Coverage   21.38%   21.59%   +0.20%     
==========================================
  Files         345      352       +7     
  Lines       15861    15967     +106     
  Branches        0       21      +21     
==========================================
+ Hits         3392     3448      +56     
- Misses      12354    12403      +49     
- Partials      115      116       +1     
Files Coverage Δ
mod/node-core/pkg/builder/builder.go 0.00% <ø> (ø)
mod/node-core/pkg/components/service_registry.go 0.00% <ø> (ø)
mod/node-core/pkg/node/node.go 0.00% <ø> (ø)
mod/node-core/pkg/services/registry/options.go 55.55% <ø> (ø)
mod/node-core/pkg/services/registry/registry.go 65.38% <ø> (ø)

... and 7 files with indirect coverage changes

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

Commits

Files that changed from the base of the PR and between d8f1bf2 and 4e49096.

Files ignored due to path filters (1)
  • mod/runtime/go.sum is excluded by !**/*.sum
Files selected for processing (10)
  • .mockery.yaml (1 hunks)
  • mod/node-core/go.mod (2 hunks)
  • mod/node-core/pkg/builder/builder.go (1 hunks)
  • mod/node-core/pkg/components/interfaces.go (1 hunks)
  • mod/node-core/pkg/components/service_registry.go (1 hunks)
  • mod/node-core/pkg/node/node.go (1 hunks)
  • mod/node-core/pkg/services/registry/mocks/registry_option.mock.go (1 hunks)
  • mod/node-core/pkg/services/registry/registry_test.go (1 hunks)
  • mod/node-core/pkg/types/node.go (1 hunks)
  • mod/runtime/go.mod (3 hunks)
Additional comments not posted (11)
mod/node-core/pkg/types/node.go (1)

26-26: LGTM! Verify the new import path.

The import path change is consistent with the PR objective.

Ensure that the new import path github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry is correct and accessible.

Run the following script to verify the existence of the new import path:

Verification successful

Import Path Verified: The new import path is correct and accessible.

The directory mod/node-core/pkg/services/registry exists, confirming that the import path is valid.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the new import path.

# Test: Search for the directory. Expect: The directory should exist.
fd --type d 'registry' | grep 'mod/node-core/pkg/services/registry'

Length of output: 102

mod/node-core/pkg/node/node.go (1)

26-26: LGTM! Verify the new import path.

The import path change is consistent with the PR objective.

Ensure that the new import path github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry is correct and accessible.

Run the following script to verify the existence of the new import path:

Verification successful

Import Path Verified
The new import path github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry is correct and accessible as the directory exists in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the new import path.

# Test: Search for the directory. Expect: The directory should exist.
fd --type d 'registry' | grep 'mod/node-core/pkg/services/registry'

Length of output: 102

mod/node-core/pkg/services/registry/mocks/registry_option.mock.go (1)

6-6: LGTM! Verify the new import path.

The import path change is consistent with the PR objective.

Ensure that the new import path github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry is correct and accessible.

Run the following script to verify the existence of the new import path:

Verification successful

Import Path Verified Successfully

The new import path github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry is correct and accessible. The directory exists as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the new import path.

# Test: Search for the directory. Expect: The directory should exist.
fd --type d 'registry' | grep 'mod/node-core/pkg/services/registry'

Length of output: 102

.mockery.yaml (1)

41-41: Path change is correct.

The package path has been updated to reflect the new structure. The configuration options remain unchanged, ensuring consistent behavior.

mod/node-core/pkg/services/registry/registry_test.go (1)

30-31: Import path changes are correct.

The import paths have been updated to reflect the new registry service context, ensuring that the tests align with the updated structure.

mod/node-core/pkg/builder/builder.go (1)

33-33: Import statement change is correct.

The import statement has been updated to use the new registry service, aligning with the refactoring objectives.

mod/node-core/pkg/components/service_registry.go (1)

34-34: Import path updated for service package.

The import path for the service package has been updated to github.com/berachain/beacon-kit/mod/node-core/pkg/services/registry. This change aligns with the PR's objective to move the registry to node-core, enhancing modularity and maintainability.

mod/runtime/go.mod (1)

142-142: Dependency on github.com/stretchr/testify added.

The addition of github.com/stretchr/testify as an indirect dependency enhances the module's testing capabilities. This change suggests a focus on improving testing practices.

mod/node-core/go.mod (2)

72-72: Dependency on github.com/stretchr/objx added.

The addition of github.com/stretchr/objx as an indirect dependency suggests new functionality or features that rely on this library.


217-217: Formatting change for github.com/stretchr/testify.

The comment indicating github.com/stretchr/testify as an indirect dependency has been removed. This change does not affect functionality but reflects a documentation adjustment.

mod/node-core/pkg/components/interfaces.go (1)

30-30: Verify the usage of the new service registry import.

Ensure that the functionalities from the newly added service import are correctly utilized in the codebase.

Run the following script to verify the usage of the new import:

Verification successful

The new service registry import is correctly utilized.

The service.Registry is actively used across multiple files, indicating that the refactoring to use the new service registry is implemented correctly. No further issues were found.

  • Usage confirmed in:
    • mod/node-core/pkg/node/node.go
    • mod/node-core/pkg/builder/builder.go
    • and other related files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new service registry import.

# Test: Search for the usage of the new service import. Expect: At least one usage.
rg --type go 'service\.' -A 5

Length of output: 31411

@itsdevbear itsdevbear merged commit 08bbb9c into main Aug 21, 2024
16 checks passed
@itsdevbear itsdevbear deleted the move-service branch August 21, 2024 18:27
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.

1 participant