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

Remove code paths only used in non-experimental mode #3728

Merged
merged 5 commits into from
May 29, 2024

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented May 27, 2024

Remove code paths only used in non-experimental mode

@emontnemery
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented May 27, 2024

Walkthrough

Walkthrough

The changes involve the removal of the experimental flag and related conditional logic throughout the hacs custom component. This includes updates to configuration handling, diagnostics, frontend setup, repository management, and tests. The goal is to simplify the codebase by treating previously experimental features as standard, thus removing the need for experimental checks.

Changes

Files/Modules Change Summary
.gitignore, custom_components/hacs/__init__.py Removed hacs_frontend_experimental references, renamed to hacs_frontend. Updated platform handling logic to be unconditional.
custom_components/hacs/base.py Removed experimental flag and related logic from HacsConfiguration class and its methods.
custom_components/hacs/diagnostics.py Removed experimental option from diagnostics.
custom_components/hacs/frontend.py Streamlined frontend registration, removed themes endpoint setup.
custom_components/hacs/repositories/base.py Simplified content download and repository handling logic by removing experimental checks.
custom_components/hacs/repositories/integration.py Removed experimental check before creating restart_required issue.
custom_components/hacs/repositories/theme.py Removed async_setup_frontend_endpoint_themes call.
custom_components/hacs/system_health.py Removed experimental check, unconditionally fetched "HACS Data".
custom_components/hacs/utils/configuration_schema.py Removed EXPERIMENTAL constant.
custom_components/hacs/utils/data.py Simplified data loading and error handling by removing experimental checks.
custom_components/hacs/websocket/__init__.py Set experimental key in hacs_info function to always True.
custom_components/hacs/websocket/repositories.py Refined condition for including repositories by checking repo.data.last_fetched directly.
.github/pre-commit-config.yaml Removed --skip=custom_components/hacs/utils/default.repositories argument.
scripts/data/generate_category_data.py Added new imports, removed experimental attribute initialization, added GitHub API interaction method.
tests/conftest.py Removed experimental field from configuration and options dictionaries.
tests/hacsbase/test_configuration.py Replaced assertions for experimental with hasattr to confirm its absence.
tests/integration/test_integration_setup.py Removed experimental argument from create_config_entry function calls.
tests/snapshots/... Removed experimental configuration option from various JSON snapshot files.

Sequence Diagram(s) (Beta)

The changes are too varied and wide-ranging to be effectively represented in sequence diagrams. The modifications mainly involve removing conditional checks and simplifying existing logic, rather than introducing new features or control flows.


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits Files that changed from the base of the PR and between 031fed2 and 64334e8.
Files selected for processing (57)
  • .github/pre-commit-config.yaml (1 hunks)
  • .gitignore (1 hunks)
  • custom_components/hacs/init.py (3 hunks)
  • custom_components/hacs/base.py (16 hunks)
  • custom_components/hacs/diagnostics.py (1 hunks)
  • custom_components/hacs/frontend.py (1 hunks)
  • custom_components/hacs/repositories/base.py (3 hunks)
  • custom_components/hacs/repositories/integration.py (1 hunks)
  • custom_components/hacs/repositories/theme.py (1 hunks)
  • custom_components/hacs/system_health.py (2 hunks)
  • custom_components/hacs/utils/configuration_schema.py (1 hunks)
  • custom_components/hacs/utils/data.py (4 hunks)
  • custom_components/hacs/websocket/init.py (1 hunks)
  • custom_components/hacs/websocket/repositories.py (1 hunks)
  • scripts/data/generate_category_data.py (3 hunks)
  • tests/conftest.py (2 hunks)
  • tests/hacsbase/test_configuration.py (1 hunks)
  • tests/integration/test_integration_setup.py (2 hunks)
  • tests/snapshots/diagnostics/base.json (2 hunks)
  • tests/snapshots/diagnostics/exception.json (2 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/integration-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/template-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_discard_invalid_repo_data.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_download_repository.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_remove_repository_post.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_remove_repository_pre.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json (1 hunks)
  • tests/snapshots/hacs-test-org/theme-basic/test_update_repository_websocket.json (1 hunks)
  • tests/snapshots/test_integration_setup.json (1 hunks)
Files not processed due to max files limit (3)
  • tests/snapshots/test_integration_setup_with_custom_updater.json
  • tests/test_config_flow.py
  • tests/test_data_client.py
Additional Context Used
Learnings (1)
tests/snapshots/hacs-test-org/appdaemon-basic/test_download_repository.json (1)
User: emontnemery
PR: hacs/integration#3728
File: custom_components/hacs/repositories/base.py:615-625
Timestamp: 2024-05-27T13:32:27.995Z
Learning: The PR aims to remove non-experimental mode, meaning that experimental download logic should be retained.
Additional comments not posted (56)
custom_components/hacs/utils/configuration_schema.py (1)

Line range hint 1-12: The removal of the EXPERIMENTAL constant is consistent with the PR's objective to streamline the code by removing non-experimental mode paths.

.gitignore (1)

Line range hint 1-31: The inclusion of custom_components/hacs/hacs_frontend in .gitignore is consistent with the renaming and changes in handling of the frontend directory, aligning with the PR's objectives.

tests/hacsbase/test_configuration.py (1)

Line range hint 1-49: The updates to the tests ensure that the experimental attribute is correctly ignored, aligning with the removal of this attribute from the HacsConfiguration class.

custom_components/hacs/system_health.py (1)

39-41: Updating the HACS Data URL to https://data-v2.hacs.xyz/data.json is consistent with the PR's objectives to streamline and update various components.

tests/integration/test_integration_setup.py (1)

18-18: The removal of the experimental argument from create_config_entry calls is consistent with the PR's objectives to remove non-experimental mode paths.

Also applies to: 44-44

tests/snapshots/hacs-test-org/python_script-basic/test_discard_invalid_repo_data.json (1)

56-56: Setting the dev attribute to true in the snapshot data is consistent with the PR's objectives to streamline and update various components.

tests/snapshots/hacs-test-org/template-basic/test_discard_invalid_repo_data.json (1)

56-56: The addition of the "dev" configuration setting is consistent with the PR's objectives to streamline configurations.

tests/snapshots/hacs-test-org/plugin-basic/test_discard_invalid_repo_data.json (1)

56-56: The addition of the "dev" configuration setting is consistent with the PR's objectives to streamline configurations.

tests/snapshots/hacs-test-org/theme-basic/test_discard_invalid_repo_data.json (1)

56-56: The addition of the "dev" configuration setting is consistent with the PR's objectives to streamline configurations.

tests/snapshots/hacs-test-org/integration-basic/test_discard_invalid_repo_data.json (1)

58-58: The addition of the "dev" configuration setting is consistent with the PR's objectives to streamline configurations.

tests/snapshots/hacs-test-org/appdaemon-basic/test_discard_invalid_repo_data.json (1)

62-62: The addition of the "dev" configuration setting is consistent with the PR's objectives to streamline configurations.

tests/snapshots/hacs-test-org/appdaemon-basic/test_remove_repository_post.json (1)

68-68: The addition of the "dev" configuration setting aligns with the PR's objectives to streamline configurations by removing experimental modes.

tests/snapshots/hacs-test-org/integration-basic/test_remove_repository_post.json (1)

68-68: Consistent update across snapshot files, correctly reflecting the new "dev" configuration setting.

tests/snapshots/hacs-test-org/plugin-basic/test_remove_repository_post.json (1)

68-68: Consistent update across snapshot files, correctly reflecting the new "dev" configuration setting.

tests/snapshots/hacs-test-org/python_script-basic/test_remove_repository_post.json (1)

68-68: Consistent update across snapshot files, correctly reflecting the new "dev" configuration setting.

tests/snapshots/hacs-test-org/template-basic/test_remove_repository_post.json (1)

68-68: Consistent update across snapshot files, correctly reflecting the new "dev" configuration setting.

tests/snapshots/hacs-test-org/theme-basic/test_remove_repository_post.json (1)

68-68: Consistent update across snapshot files, correctly reflecting the new "dev" configuration setting.

custom_components/hacs/frontend.py (2)

Line range hint 36-36: Check if the async_setup_frontend_endpoint_plugin method is implemented and used correctly.

Verification successful

The async_setup_frontend_endpoint_plugin method is implemented in custom_components/hacs/base.py and used in custom_components/hacs/repositories/plugin.py and custom_components/hacs/frontend.py. This confirms that the method is both implemented and utilized correctly within the codebase.

  • custom_components/hacs/base.py: Implementation of async_setup_frontend_endpoint_plugin.
  • custom_components/hacs/repositories/plugin.py: Usage of async_setup_frontend_endpoint_plugin.
  • custom_components/hacs/frontend.py: Usage of async_setup_frontend_endpoint_plugin.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation and usage of `async_setup_frontend_endpoint_plugin`.

# Test: Search for the method implementation and usage. Expect: Implementation and at least one usage in the codebase.
rg --type python $'async_setup_frontend_endpoint_plugin'

Length of output: 86



Script:

#!/bin/bash
# Description: Verify the implementation and usage of `async_setup_frontend_endpoint_plugin`.

# Test: Search for the method implementation and usage. Expect: Implementation and at least one usage in the codebase.
rg --type py $'async_setup_frontend_endpoint_plugin'

Length of output: 346


Line range hint 28-28: Confirm that the environment variable HACS_FRONTEND_DIR is set in production environments if needed.

custom_components/hacs/diagnostics.py (1)

Line range hint 14-14: Ensure that all diagnostic data fields are necessary and do not expose sensitive information.

tests/snapshots/hacs-test-org/theme-basic/test_remove_repository_pre.json (1)

78-78: Confirm that the dev configuration is intended to be true in this snapshot.

tests/snapshots/hacs-test-org/python_script-basic/test_remove_repository_pre.json (1)

78-78: Verify that the dev configuration is correctly set for this snapshot.

Verification successful

The dev configuration is correctly set to true in the snapshot file.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `dev` configuration in the snapshot.

# Test: Confirm that the `dev` setting is correct. Expect: Confirmation that this is the intended setting.
echo "Manual verification needed for 'dev' configuration in snapshot."

Length of output: 142



Script:

#!/bin/bash
# Description: Extract and display the relevant portion of the snapshot file for manual inspection.

# Extract lines around the `dev` setting in the snapshot file.
grep -C 5 '"dev": true' tests/snapshots/hacs-test-org/python_script-basic/test_remove_repository_pre.json

Length of output: 395

tests/snapshots/hacs-test-org/template-basic/test_remove_repository_pre.json (1)

78-78: Ensure the dev configuration is appropriate for this snapshot.

tests/snapshots/hacs-test-org/plugin-basic/test_remove_repository_pre.json (1)

79-79: Check that the dev configuration is set correctly in this snapshot.

tests/snapshots/test_integration_setup.json (1)

62-62: The change to set "dev" to true aligns with the PR's focus on non-experimental code paths, suggesting a shift towards development stability.

tests/snapshots/hacs-test-org/appdaemon-basic/test_remove_repository_pre.json (1)

79-79: Consistent with the broader PR goals, setting "dev" to true here supports a focus on development stability.

tests/snapshots/hacs-test-org/integration-basic/test_remove_repository_pre.json (1)

82-82: Setting "dev" to true is consistent across various test configurations, supporting the PR's focus on non-experimental, development-centric settings.

tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_websocket.json (1)

95-95: The consistent update to set "dev" to true across various components supports the PR's focus on stable, development-oriented configurations.

tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_websocket.json (1)

95-95: This change to set "dev" to true is consistent across all test configurations, supporting the PR's focus on stable, development-oriented settings.

tests/snapshots/hacs-test-org/theme-basic/test_update_repository_websocket.json (1)

96-96: Setting "dev" to true in the snapshot seems unrelated to the removal of non-experimental code paths. Please verify its relevance.

tests/snapshots/hacs-test-org/template-basic/test_update_repository_websocket.json (1)

96-96: Setting "dev" to true in the snapshot seems unrelated to the removal of non-experimental code paths. Please verify its relevance.

tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_websocket.json (1)

96-96: Setting "dev" to true in the snapshot seems unrelated to the removal of non-experimental code paths. Please verify its relevance.

custom_components/hacs/repositories/theme.py (1)

Line range hint 1-57: The changes in HacsThemeRepository align with the PR's objective to remove non-experimental code paths. Good job on cleaning up the code.

tests/snapshots/hacs-test-org/integration-basic/test_update_repository_websocket.json (1)

99-99: Setting "dev" to true in the snapshot seems unrelated to the removal of non-experimental code paths. Please verify its relevance.

custom_components/hacs/websocket/__init__.py (1)

Line range hint 1-114: The changes in the WebSocket commands align with the PR's objective to remove non-experimental code paths. The implementation is clean and well-structured.

tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json (1)

Line range hint 1-1: Ensure removal of experimental features is reflected in repository entity updates.

Verification successful

The verification confirms that the JSON snapshot file does not contain any experimental features or related configurations.

  • No occurrences of 'experimental', 'beta', 'test', or 'flag' were found in tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in repository entity updates.

# Test: Search for 'experimental' in repository entity updates. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json

Length of output: 114



Script:

#!/bin/bash
# Description: Verify that no experimental or related configurations exist in repository entity updates.

# Test: Search for 'beta', 'test', 'flag' in repository entity updates. Expect: No occurrences.
rg --type json 'beta' tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json
rg --type json 'test' tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json
rg --type json 'flag' tests/snapshots/hacs-test-org/python_script-basic/test_update_repository_entity.json

Length of output: 873

tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json (1)

Line range hint 1-1: Ensure removal of experimental features is reflected in AppDaemon script repository entity updates.

Verification successful

The verification confirms that the JSON file does not contain any experimental features or related configurations.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in AppDaemon script repository entity updates.

# Test: Search for 'experimental' in AppDaemon script repository entity updates. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json

Length of output: 110



Script:

#!/bin/bash
# Description: Verify that no experimental or related configurations exist in AppDaemon script repository entity updates.

# Test: Search for 'beta', 'test', 'flag' in AppDaemon script repository entity updates. Expect: No occurrences.
rg --type json 'beta' tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json
rg --type json 'test' tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json
rg --type json 'flag' tests/snapshots/hacs-test-org/appdaemon-basic/test_update_repository_entity.json

Length of output: 857

tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json (1)

Line range hint 1-1: Ensure removal of experimental features is reflected in theme repository entity updates.

Verification successful

The searches for 'experimental', 'beta', 'feature_flag', and 'flag' in the JSON snapshot file did not produce any output, indicating that these terms are not present in the file. This suggests that there are no remnants of experimental features or related configurations in the theme repository entity updates.

  • : The JSON snapshot file tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json does not contain any experimental features or related configurations.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in theme repository entity updates.

# Test: Search for 'experimental' in theme repository entity updates. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json

Length of output: 106



Script:

#!/bin/bash
# Description: Verify that no experimental or related configurations exist in theme repository entity updates.

# Test: Search for 'beta' in theme repository entity updates. Expect: No occurrences.
rg --type json 'beta' tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json

# Test: Search for 'feature_flag' in theme repository entity updates. Expect: No occurrences.
rg --type json 'feature_flag' tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json

# Test: Search for 'flag' in theme repository entity updates. Expect: No occurrences.
rg --type json 'flag' tests/snapshots/hacs-test-org/theme-basic/test_update_repository_entity.json

Length of output: 304

tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json (1)

Line range hint 1-1: Ensure removal of experimental features is reflected in plugin repository entity updates.

Verification successful

The verification process did not find any occurrences of terms related to experimental features in the JSON snapshot file. This suggests that the removal of experimental features has been correctly reflected.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in plugin repository entity updates.

# Test: Search for 'experimental' in plugin repository entity updates. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json

Length of output: 107



Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in plugin repository entity updates.

# Test: Search for other potential terms related to experimental features in the JSON file.
rg --type json 'beta' tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json
rg --type json 'feature_flag' tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json
rg --type json 'test_feature' tests/snapshots/hacs-test-org/plugin-basic/test_update_repository_entity.json

Length of output: 315

tests/snapshots/hacs-test-org/python_script-basic/test_download_repository.json (1)

Line range hint 1-1: Ensure removal of experimental features is reflected in Python script repository download data.

Verification successful

The search for terms related to experimental features in the JSON snapshot file did not produce any results. This indicates that there are no remnants of experimental flags or configurations in the file.

  • : The JSON snapshot file does not contain any experimental flags or related configurations.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in Python script repository download data.

# Test: Search for 'experimental' in Python script repository download data. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/hacs-test-org/python_script-basic/test_download_repository.json

Length of output: 109



Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in Python script repository download data.

# Test: Search for 'experimental' and other related terms in Python script repository download data. Expect: No occurrences.
rg --type json 'experimental|beta|test_feature|flag' tests/snapshots/hacs-test-org/python_script-basic/test_download_repository.json

Length of output: 134

tests/snapshots/hacs-test-org/appdaemon-basic/test_download_repository.json (1)

152-152: The addition of the "dev" configuration setting is appropriate and aligns with the broader changes in the system configuration.

tests/snapshots/hacs-test-org/template-basic/test_update_repository_entity.json (1)

152-152: Consistent with other configuration updates, the addition of the "dev" setting is appropriate.

tests/snapshots/hacs-test-org/theme-basic/test_download_repository.json (1)

153-153: The addition of the "dev" configuration setting is consistent and appropriate across the system configuration.

tests/snapshots/hacs-test-org/plugin-basic/test_download_repository.json (1)

153-153: The addition of the "dev" configuration setting is consistent and appropriate across the system configuration.

tests/snapshots/hacs-test-org/template-basic/test_download_repository.json (1)

154-154: The addition of the "dev" configuration setting is consistent and appropriate across the system configuration.

tests/snapshots/hacs-test-org/integration-basic/test_update_repository_entity.json (1)

156-156: The addition of the "dev" configuration setting is consistent and appropriate across the system configuration.

tests/snapshots/hacs-test-org/integration-basic/test_download_repository.json (1)

157-157: The addition of the "dev": true setting in the configuration should be verified to ensure it aligns with the intended changes in this PR, especially since the PR focuses on removing experimental paths.

Verification successful

The addition of the "dev": true setting in the configuration is consistent with the PR objectives and is used across multiple test snapshot files.

  • The "dev": true setting appears in various JSON snapshot files within the tests/snapshots directory, indicating it is a standard configuration for testing purposes.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of the "dev" configuration setting across the codebase.

# Test: Search for the "dev" configuration setting. Expect: Usage consistent with PR objectives.
rg --type json '"dev": true'

Length of output: 4049

custom_components/hacs/websocket/repositories.py (1)

73-73: The removal of the experimental check in the repository listing function aligns with the PR's objectives to simplify the code by removing non-experimental paths. Good simplification.

custom_components/hacs/__init__.py (1)

33-34: Defining a PLATFORMS constant is a good practice as it centralizes the platform definitions, making the code more maintainable and less error-prone.

custom_components/hacs/repositories/integration.py (1)

49-49: The addition of logic to create a restart-required issue if a restart is pending enhances user experience by ensuring users are informed about the need to restart to apply changes.

custom_components/hacs/utils/data.py (1)

88-88: The removal of the _async_store_experimental_content_and_repos method aligns with the PR's objectives to remove experimental paths and simplifies the data handling logic.

scripts/data/generate_category_data.py (1)

344-355: The implementation of async_github_get_hacs_default_file correctly handles cases where the GitHub API returns None. The use of json_loads and decode_content for processing the response data is appropriate.

custom_components/hacs/base.py (2)

755-755: The changes in set_active_categories method are appropriate. The warning about NetDaemon being deprecated is clear and provides useful guidance.


Line range hint 932-960: The implementation of async_handle_removed_repositories method is robust. It correctly identifies and handles removed repositories, and the use of async_create_issue to notify users is appropriate.

custom_components/hacs/repositories/base.py (2)

615-625: The retention of this experimental download logic aligns with the PR's objective to remove non-experimental code paths. This ensures that the experimental features remain functional while the non-experimental paths are cleaned up.


722-722: The handling of both uppercase and lowercase variants of 'readme' enhances compatibility and robustness in file handling across different systems. Good job maintaining comprehensive coverage for potential filename cases.


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.

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

Outside diff range comments (2)
custom_components/hacs/base.py (2)

Line range hint 782-794: Error handling improvement needed.

The method async_load_hacs_from_github lacks comprehensive error handling for different types of exceptions that might occur during the GitHub API interaction.

- except HacsException as exception:
+ except (HacsException, GitHubAPIException) as exception:

Line range hint 932-960: Enhance user notification for removed repositories.

The method async_handle_removed_repositories logs a warning and creates an issue for removed repositories. It could be enhanced by providing a direct link or action in the notification for user convenience.

- "this repository has been removed from HACS, please consider removing it."
+ "this repository has been removed from HACS. [Please consider removing it](link-to-repository)."

custom_components/hacs/repositories/base.py Outdated Show resolved Hide resolved
custom_components/hacs/repositories/base.py Show resolved Hide resolved
custom_components/hacs/base.py Show resolved Hide resolved
custom_components/hacs/base.py Show resolved Hide resolved
scripts/install/frontend Outdated Show resolved Hide resolved
@emontnemery emontnemery force-pushed the remove_non_experimental_mode branch from f4a516a to 74875df Compare May 27, 2024 17:25
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

Outside diff range comments (3)
tests/conftest.py (1)

[!TIP]
Codebase Verification

The search results indicate that there are still references to experimental features in the codebase, particularly in the test files and some utility files. This suggests that the test setup may not fully align with the removal of experimental features as intended by the PR.

  • tests/hacsbase/test_configuration.py: Contains multiple references to experimental settings.
  • custom_components/hacs/base.py: Contains logic related to experimental features.
  • custom_components/hacs/repositories/base.py: Logs experimental download attempts.
  • custom_components/hacs/utils/data.py: Contains methods for storing experimental content and repositories.

These references need to be reviewed and potentially removed or updated to ensure consistency with the PR's goal of removing experimental features.

Analysis chain

Line range hint 1-1: Ensure that the test setup aligns with the changes made in the PR, particularly the removal of experimental features.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the test setup aligns with the changes made in the PR.

# Test: Search for the usage of experimental features in the test setup. Expect: No usage of experimental features.
rg --type python $'experimental'

Length of output: 62



Script:

#!/bin/bash
# Description: Verify that the test setup aligns with the changes made in the PR.

# Test: Search for the usage of experimental features in the test setup. Expect: No usage of experimental features.
rg 'experimental' --glob '*.py'

Length of output: 1449

custom_components/hacs/base.py (2)

Line range hint 782-794: Add error handling for repository registration.

+ try:
    await self.async_register_repository(
        repository_full_name=HacsGitHubRepo.INTEGRATION,
        category=HacsCategory.INTEGRATION,
        default=True,
    )
+ except HacsException as e:
+     self.log.error("Failed to register repository: %s", e)

Line range hint 932-960: Improve the clarity of the issue creation process.

+ # Creating an issue for a removed repository
async_create_issue(
    hass=self.hass,
    domain=DOMAIN,
    issue_id=f"removed_{repository.data.id}",
    is_fixable=False,
    issue_domain=DOMAIN,
    severity=IssueSeverity.WARNING,
    translation_key="removed",
    translation_placeholders={
        "name": repository.data.full_name,
        "reason": removed.reason,
        "repositry_id": repository.data.id,  # Note the typo in 'repository_id' should be fixed
    },
)

custom_components/hacs/base.py Show resolved Hide resolved
custom_components/hacs/base.py Show resolved Hide resolved
.gitignore Outdated 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: 1

custom_components/hacs/utils/data.py 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

Outside diff range comments (1)
custom_components/hacs/websocket/__init__.py (1)

Line range hint 68-91: The function hacs_info is missing the implementation to always set the "experimental" key to True as described in the PR and AI-generated summary.

{
    "categories": hacs.common.categories,
    "country": hacs.configuration.country,
    "debug": hacs.configuration.debug,
    "dev": hacs.configuration.dev,
    "disabled_reason": hacs.system.disabled_reason,
    "has_pending_tasks": hacs.queue.has_pending_tasks,
    "lovelace_mode": hacs.core.lovelace_mode,
    "stage": hacs.stage,
    "startup": hacs.status.startup,
    "version": hacs.version,
+   "experimental": True,
}

@emontnemery emontnemery force-pushed the remove_non_experimental_mode branch from 031fed2 to 64334e8 Compare May 29, 2024 11:17
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

Outside diff range comments (2)
custom_components/hacs/frontend.py (1)

[!TIP]
Codebase Verification

The add_extra_js_url function is only used within the custom_components/hacs/frontend.py file and not elsewhere in the codebase.

  • The add_extra_js_url function appears to be unused outside of the custom_components/hacs/frontend.py file. Consider removing it if it is no longer necessary.
Analysis chain

Line range hint 14-14: Ensure that the add_extra_js_url function is still required.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if the `add_extra_js_url` function is used elsewhere in the codebase.

# Test: Search for the function usage. Expect: At least one occurrence outside this file.
rg --type python $'add_extra_js_url'

Length of output: 66



Script:

#!/bin/bash
# Description: Verify if the `add_extra_js_url` function is used elsewhere in the codebase.

# Test: Search for the function usage. Expect: At least one occurrence outside this file.
rg 'add_extra_js_url'

Length of output: 440

tests/snapshots/diagnostics/base.json (1)

[!TIP]
Codebase Verification

The diagnostic snapshot file tests/snapshots/diagnostics/base.json contains a configuration related to experimental features, specifically "show_beta": false.

  • tests/snapshots/diagnostics/base.json: Contains "show_beta": false

Please review and ensure that all experimental features and related configurations are removed as per the PR's objectives.

Analysis chain

Line range hint 1-1: Ensure removal of experimental features is reflected in diagnostic snapshots.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in diagnostic snapshots.

# Test: Search for 'experimental' in diagnostic snapshots. Expect: No occurrences.
rg --type json 'experimental' tests/snapshots/diagnostics/base.json

Length of output: 67



Script:

#!/bin/bash
# Description: Verify that no experimental flags or configurations exist in diagnostic snapshots.

# Test: Search for other potential experimental configurations or flags in diagnostic snapshots.
# This includes terms like 'beta', 'feature_flag', 'test_mode', etc.
rg --type json 'beta|feature_flag|test_mode' tests/snapshots/diagnostics/base.json

Length of output: 120

@ludeeus ludeeus merged commit 883e0ce into hacs:main May 29, 2024
23 checks passed
@hacs-bot hacs-bot bot added this to the next milestone May 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants