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

feature(config plugin): deprecate env prefix #1929

Merged
merged 6 commits into from
Jun 6, 2024

Conversation

rustatian
Copy link
Member

@rustatian rustatian commented Jun 3, 2024

Reason for This PR

ref: #1610

Description of Changes

  • Deprecate automatic env prefix as confusing and non-documented.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Summary by CodeRabbit

  • Refactor

    • Simplified initialization logic by removing redundant constants and configuration settings from various components.
  • Tests

    • Removed outdated test function TestNewClient_SuccessfullyConnectedEnv and refactored related logic.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian added the C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc.. label Jun 3, 2024
@rustatian rustatian requested a review from wolfy-j June 3, 2024 10:52
@rustatian rustatian self-assigned this Jun 3, 2024
rustatian added 2 commits June 3, 2024 12:53
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Copy link
Contributor

coderabbitai bot commented Jun 3, 2024

Important

Review skipped

Review was skipped due to path filters

Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes streamline the configuration process by removing redundant constants and related logic across multiple files. Specifically, the rrPrefix and prefix constants, along with their usage in environment variable settings, have been eliminated from the internal/cli/serve/command.go, internal/rpc/client.go, and lib/roadrunner.go files. Additionally, a test function in internal/rpc/client_test.go has been removed, reflecting the refactoring of the client initialization logic.

Changes

Files Change Summary
internal/cli/serve/command.go Removed rrPrefix constant and its usage in the NewCommand function.
internal/rpc/client.go Removed prefix constant and related configuration settings in the NewClient function.
lib/roadrunner.go Removed rrPrefix constant and its usage in the NewRR function.
internal/rpc/client_test.go Removed TestNewClient_SuccessfullyConnectedEnv function and refactored related logic.

Poem

In code's vast and winding lane,
Constants gone, no more remain,
Prefixes stripped, configurations clear,
Simplified paths now appear.
Testing flows, refactored bright,
Roadrunner's code, a sleeker sight.
🌟✨


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

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
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 223bf79 and 97d25a0.

Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum
Files selected for processing (3)
  • internal/cli/serve/command.go (2 hunks)
  • internal/rpc/client.go (2 hunks)
  • lib/roadrunner.go (2 hunks)
Additional comments not posted (6)
lib/roadrunner.go (2)

14-14: Removal of rrPrefix constant aligns with PR objectives.


Line range hint 25-25: Ensure that the removal of the Prefix field does not affect other dependencies.

Verification successful

The verification process indicates that the Prefix field from configImpl.Plugin is not used elsewhere in the codebase. The searches for the Plugin struct, references to configImpl.Plugin, and .Prefix field accesses did not produce any results, suggesting no dependencies on the Prefix field.

  • No occurrences of the Prefix field were found in the codebase.
  • No references to configImpl.Plugin fields were found.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no other parts of the codebase rely on the `Prefix` field from `configImpl.Plugin`.

# Test: Search for the `Prefix` field usage in the codebase. Expect: No occurrences outside of this file.
rg --type go $'Prefix'

Length of output: 21



Script:

#!/bin/bash
# Description: Verify that no other parts of the codebase rely on the `Prefix` field from `configImpl.Plugin`.

# Step 1: Locate the definition of `configImpl.Plugin` to understand its structure.
ast-grep --lang go --pattern $'struct Plugin {
  $$$
}' > plugin_struct.txt

# Step 2: Search for references to `configImpl.Plugin` fields to ensure no indirect dependencies on `Prefix`.
rg --type go 'configImpl.Plugin' > plugin_references.txt

# Step 3: Check for any field accesses within the `configImpl.Plugin` struct.
rg --type go '\.Prefix' > prefix_field_references.txt

Length of output: 460



Script:

#!/bin/bash
# Description: Verify that no other parts of the codebase rely on the `Prefix` field from `configImpl.Plugin`.

# Step 1: Locate the definition of `configImpl.Plugin` to understand its structure.
ast-grep --lang go --pattern $'type Plugin struct {
  $$$
}' > plugin_struct.txt

# Step 2: Search for references to `configImpl.Plugin` fields to ensure no indirect dependencies on `Prefix`.
rg --type go 'configImpl.Plugin' > plugin_references.txt

# Step 3: Check for any field accesses within the `configImpl.Plugin` struct.
rg --type go '\.Prefix' > prefix_field_references.txt

Length of output: 120

internal/cli/serve/command.go (2)

Line range hint 14-14: Removal of rrPrefix constant aligns with PR objectives.


Line range hint 25-25: Ensure that the removal of the Prefix field does not affect other dependencies.

Verification successful

The inspection of the lines around the occurrences of configImpl.Plugin in both lib/roadrunner.go and internal/cli/serve/command.go confirms that the Prefix field is not referenced. Therefore, the removal of the Prefix field does not affect other dependencies.

  • lib/roadrunner.go:

    cfg := &configImpl.Plugin{
        Path:    cfgFile,
        Timeout: containerCfg.GracePeriod,
        Flags:   override,
        Version: getRRVersion(),
    }
  • internal/cli/serve/command.go:

    cfg := &configImpl.Plugin{
        Path:                 *cfgFile,
        Timeout:              containerCfg.GracePeriod,
        Flags:                *override,
        Version:              meta.Version(),
        ExperimentalFeatures: *experimental,
    }

No references to Prefix were found in these contexts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no other parts of the codebase rely on the `Prefix` field from `configImpl.Plugin`.

# Test: Search for the `Prefix` field usage in the codebase. Expect: No occurrences outside of this file.
rg --type go $'Prefix'

Length of output: 21



Script:

#!/bin/bash
# Locate the definition of `Prefix` in the codebase.
ast-grep --lang go --pattern 'struct $_ { $$$ Prefix $_ $$$ }'

# Search for the usage of `configImpl.Plugin` to check for indirect references to `Prefix`.
rg --type go 'configImpl.Plugin'

Length of output: 203



Script:

#!/bin/bash
# Inspect the lines around the occurrences of `configImpl.Plugin` in `lib/roadrunner.go`.
rg --type go -C 5 'configImpl.Plugin' lib/roadrunner.go

# Inspect the lines around the occurrences of `configImpl.Plugin` in `internal/cli/serve/command.go`.
rg --type go -C 5 'configImpl.Plugin' internal/cli/serve/command.go

Length of output: 695

internal/rpc/client.go (2)

Line range hint 14-14: Removal of prefix constant aligns with PR objectives.


25-25: Ensure that the removal of the prefix constant does not affect other dependencies.

Verification successful

The search results indicate that the prefix constant is not used outside of the internal/rpc/client.go file. The occurrences of the word "prefix" in internal/meta/meta.go and internal/meta/meta_test.go are unrelated to the prefix constant in question.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no other parts of the codebase rely on the `prefix` constant.

# Test: Search for the `prefix` constant usage in the codebase. Expect: No occurrences outside of this file.
rg --type go $'prefix'

Length of output: 149

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 97d25a0 and 0aef553.

Files ignored due to path filters (1)
  • go.mod is excluded by !**/*.mod
Files selected for processing (1)
  • internal/rpc/client_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • internal/rpc/client_test.go

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian merged commit 1c1abb4 into master Jun 6, 2024
12 checks passed
@rustatian rustatian deleted the feature/config-deprecate-prefix branch June 6, 2024 12:58
@rustatian rustatian mentioned this pull request Jun 6, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc..
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

1 participant