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!:drop mycroft #235

Merged
merged 3 commits into from
Oct 15, 2024
Merged

refactor!:drop mycroft #235

merged 3 commits into from
Oct 15, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Sep 18, 2024

companion to OpenVoiceOS/ovos-core#439

Summary by CodeRabbit

  • New Features

    • Transition to a more OVOS-centric framework, enhancing compatibility and functionality.
  • Bug Fixes

    • Removed deprecated methods and compatibility layers for a streamlined implementation.
  • Refactor

    • Significant refactoring of skill classes and test structures to focus on OVOSSkill.
    • Adjusted import statements for improved organization and clarity.
  • Chores

    • Removed legacy support and backward compatibility imports across various modules and tests.

Copy link

coderabbitai bot commented Sep 18, 2024

Walkthrough

The changes involve significant refactoring and removal of legacy components across various files in the ovos_workshop module. Key alterations include the deletion of backward compatibility decorators, the transition from BaseSkill to OVOSSkill, and the removal of deprecated classes and methods. The updates streamline the codebase, focusing on modern implementations and reducing support for older versions of the libraries.

Changes

Files Change Summary
ovos_workshop/decorators/compat.py Removed backwards_compat decorator, indicating a shift away from backward compatibility.
ovos_workshop/decorators/ocp.py Changed import source for media-related types from backwards_compat to ovos_utils.ocp.
ovos_workshop/settings.py Changed skill attribute type from BaseSkill to OVOSSkill in SkillSettingsManager.
ovos_workshop/skill_launcher.py Updated skill class identification logic to focus on OVOSSkill, removing references to legacy classes.
ovos_workshop/skills/__init__.py Removed imports for several skill classes, indicating potential refactoring.
ovos_workshop/skills/base.py Deleted file containing deprecated functionality merged into OVOSSkill.
ovos_workshop/skills/common_play.py Changed import source for media-related types from backwards_compat to ovos_utils.ocp.
ovos_workshop/skills/common_query_skill.py Removed legacy query handling methods, streamlining query processing.
ovos_workshop/skills/decorators/__init__.py Removed all decorator imports, indicating a shift in management.
ovos_workshop/skills/decorators/converse.py Removed all imports from ovos_workshop.decorators.converse.
ovos_workshop/skills/decorators/fallback_handler.py Removed backward compatibility import for logging deprecation warnings.
ovos_workshop/skills/decorators/killable.py Deleted file related to task lifecycle management.
ovos_workshop/skills/decorators/layers.py Removed import statements for backward compatibility.
ovos_workshop/skills/decorators/ocp.py Removed all imports from ovos_workshop.decorators.ocp.
ovos_workshop/skills/fallback.py Simplified FallbackSkill class by removing complex metaclass structure and legacy compatibility code.
ovos_workshop/skills/mycroft_skill.py Deleted MycroftSkill class, indicating a shift towards OVOS-centric framework.
ovos_workshop/skills/ovos.py Refactored OVOSSkill class, removing deprecated methods and compatibility layers.
test/unittests/skills/test_active.py Updated ActiveSkillExample class to inherit from OVOSSkill.
test/unittests/skills/test_auto_translatable.py Updated test cases to reference OVOSSkill instead of BaseSkill.
test/unittests/skills/test_base.py Renamed test class from TestBaseSkill to TestOVOSSkill, focusing on OVOS implementation.
test/unittests/skills/test_common_query_skill.py Removed assertions for legacy class inheritance.
test/unittests/skills/test_fallback_skill.py Removed legacy class assertions, focusing on OVOSSkill inheritance.
test/unittests/skills/test_idle_display_skill.py Updated import statement to use OVOSSkill.
test/unittests/skills/test_ovos.py Removed assertions related to legacy class inheritance.
test/unittests/test_abstract_app.py Removed assertions comparing settings between OVOSSkill and MycroftSkill.
test/unittests/test_imports.py Removed assertions for existence of legacy skill classes.
test/unittests/test_skill.py Removed tests for legacy skills, focusing on SpecificArgsSkill.

Possibly related PRs

  • deprecate:is_classic_core #242: The changes in this PR reflect a shift away from supporting the classic Mycroft core, which aligns with the main PR's removal of deprecated classes and methods related to MycroftSkill.
  • fix:finish extracting intent classes from adapt package #248: This PR introduces modifications to the Intent and IntentBuilder classes, which may relate to the refactoring of skill management and the removal of legacy support in the main PR.

Suggested reviewers

  • goldyfruit

Poem

🐰 In the garden of code, changes bloom bright,
Old paths are cleared, making way for new light.
Skills now align, with OVOS in sight,
A hop towards the future, oh what a delight!
With each little tweak, our framework takes flight,
A chorus of progress, in the soft moonlight. 🌙


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

@JarbasAl JarbasAl marked this pull request as draft September 18, 2024 20:04
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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4b1677 and 6dab606.

Files selected for processing (27)
  • ovos_workshop/decorators/compat.py (0 hunks)
  • ovos_workshop/decorators/ocp.py (1 hunks)
  • ovos_workshop/settings.py (2 hunks)
  • ovos_workshop/skill_launcher.py (3 hunks)
  • ovos_workshop/skills/init.py (0 hunks)
  • ovos_workshop/skills/base.py (0 hunks)
  • ovos_workshop/skills/common_play.py (1 hunks)
  • ovos_workshop/skills/common_query_skill.py (0 hunks)
  • ovos_workshop/skills/decorators/init.py (0 hunks)
  • ovos_workshop/skills/decorators/converse.py (0 hunks)
  • ovos_workshop/skills/decorators/fallback_handler.py (0 hunks)
  • ovos_workshop/skills/decorators/killable.py (0 hunks)
  • ovos_workshop/skills/decorators/layers.py (0 hunks)
  • ovos_workshop/skills/decorators/ocp.py (0 hunks)
  • ovos_workshop/skills/fallback.py (4 hunks)
  • ovos_workshop/skills/mycroft_skill.py (0 hunks)
  • ovos_workshop/skills/ovos.py (3 hunks)
  • test/unittests/skills/test_active.py (2 hunks)
  • test/unittests/skills/test_auto_translatable.py (4 hunks)
  • test/unittests/skills/test_base.py (5 hunks)
  • test/unittests/skills/test_common_query_skill.py (0 hunks)
  • test/unittests/skills/test_fallback_skill.py (1 hunks)
  • test/unittests/skills/test_idle_display_skill.py (2 hunks)
  • test/unittests/skills/test_ovos.py (0 hunks)
  • test/unittests/test_abstract_app.py (0 hunks)
  • test/unittests/test_imports.py (0 hunks)
  • test/unittests/test_skill.py (2 hunks)
Files not reviewed due to no reviewable changes (15)
  • ovos_workshop/decorators/compat.py
  • ovos_workshop/skills/init.py
  • ovos_workshop/skills/base.py
  • ovos_workshop/skills/common_query_skill.py
  • ovos_workshop/skills/decorators/init.py
  • ovos_workshop/skills/decorators/converse.py
  • ovos_workshop/skills/decorators/fallback_handler.py
  • ovos_workshop/skills/decorators/killable.py
  • ovos_workshop/skills/decorators/layers.py
  • ovos_workshop/skills/decorators/ocp.py
  • ovos_workshop/skills/mycroft_skill.py
  • test/unittests/skills/test_common_query_skill.py
  • test/unittests/skills/test_ovos.py
  • test/unittests/test_abstract_app.py
  • test/unittests/test_imports.py
Files skipped from review due to trivial changes (2)
  • test/unittests/skills/test_fallback_skill.py
  • test/unittests/test_skill.py
Additional context used
Ruff
ovos_workshop/decorators/ocp.py

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

ovos_workshop/skills/common_play.py

16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

Additional comments not posted (38)
test/unittests/skills/test_idle_display_skill.py (2)

18-18: LGTM!

The assertion change correctly updates the unit test to align with the refactored skill architecture. This update maintains the integrity of the test suite.


4-4: Verify the consistency of the transition from BaseSkill to OVOSSkill across the codebase.

The import statement change aligns with the PR objective of refactoring and removing legacy components. However, it's crucial to ensure that this transition is consistently applied across the codebase to maintain the integrity of the system.

Run the following script to verify the consistency of the transition:

Verification successful

Transition from BaseSkill to OVOSSkill has been successfully completed and is consistent across the codebase.

The verification process confirms that:

  1. There are no remaining occurrences of BaseSkill in the codebase.
  2. OVOSSkill is now consistently used as the base class for various skill types, including CommonQuerySkill, FallbackSkill, and ActiveSkill.
  3. The transition is reflected in both the main codebase and test files.

This change aligns with the PR objective of refactoring and removing legacy components. The consistent usage of OVOSSkill across the codebase ensures the integrity of the system has been maintained during this transition.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the transition from `BaseSkill` to `OVOSSkill` across the codebase.

# Test 1: Search for occurrences of `BaseSkill`. Expect: No occurrences.
rg --type python $'BaseSkill'

# Test 2: Search for occurrences of `OVOSSkill`. Expect: Consistent usage across the codebase.
rg --type python $'OVOSSkill'

Length of output: 119


Script:

#!/bin/bash
# Description: Verify the consistency of the transition from `BaseSkill` to `OVOSSkill` across the codebase.

# Test 1: Search for occurrences of `BaseSkill`. Expect: No or few occurrences.
echo "Searching for BaseSkill:"
rg -i -C 2 'baseskill'

echo -e "\nSearching for BaseSkill imports:"
rg -i 'from .* import .*baseskill'

# Test 2: Search for occurrences of `OVOSSkill`. Expect: Consistent usage across the codebase.
echo -e "\nSearching for OVOSSkill:"
rg -i -C 2 'ovosskill'

echo -e "\nSearching for OVOSSkill imports:"
rg -i 'from .* import .*ovosskill'

Length of output: 29277

test/unittests/skills/test_active.py (2)

6-6: LGTM!

The import statement change is consistent with the refactor from BaseSkill to OVOSSkill.

Please ensure that the ActiveSkillExample class has been updated to inherit from OVOSSkill instead of BaseSkill to avoid potential runtime errors.


20-20: LGTM!

The assertion change is consistent with the refactor from BaseSkill to OVOSSkill.

Please ensure that the ActiveSkillExample class has been updated to inherit from OVOSSkill to ensure the test case passes.

test/unittests/skills/test_auto_translatable.py (4)

5-5: LGTM!

The import statement change aligns with the PR objective of removing Mycroft dependencies. OVOSSkill seems to be a suitable replacement for BaseSkill.


14-14: LGTM!

The assertion change correctly reflects the new base class for UniversalSkill. It is consistent with the import statement change.


25-25: LGTM!

The assertion change correctly reflects the new base class for UniversalFallback. It is consistent with the import statement change.


42-42: LGTM!

The assertion change correctly reflects the new base class for UniversalCommonQuerySkill. It is consistent with the import statement change.

ovos_workshop/decorators/ocp.py (1)

Line range hint 6-102: Skipping review of decorator functions.

The decorator functions in this file appear to be unchanged and are not directly related to the PR objective of refactoring and removing legacy components. Therefore, I will skip reviewing them in detail.

Tools
Ruff

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

ovos_workshop/settings.py (1)

21-21: Verify that SkillSettingsManager is always initialized with an OVOSSkill object.

The change in the type hint of the skill attribute from BaseSkill to OVOSSkill aligns with the broader refactoring effort to move towards a more specialized skill management approach.

Please ensure that all instances of SkillSettingsManager are now being initialized with an object of type OVOSSkill (or a subclass of it) and not BaseSkill to avoid any potential type mismatch issues.

Run the following script to verify the usage of SkillSettingsManager:

ovos_workshop/skills/fallback.py (6)

30-30: Refactoring approved: The simplified class structure enhances maintainability.

The refactoring of the FallbackSkill class to remove the complex metaclass structure and legacy compatibility code is a welcome change. The class now directly inherits from OVOSSkill, which simplifies the class hierarchy and improves code readability.

The removal of the _MutableFallback metaclass and _MetaFB class reduces the complexity of the codebase, making it easier to understand and maintain. The FallbackSkill class now directly manages its fallback configuration through a simplified initialization process, eliminating the need for legacy compatibility methods.

Overall, the refactoring modernizes the implementation while preserving the core functionality. The changes enhance the maintainability and clarity of the codebase.


51-52: LGTM: The fallback_config property provides convenient access to the fallback configuration.

The fallback_config class property is a useful addition that simplifies access to the fallback configuration. By utilizing the Configuration class to retrieve the configuration from the "skills" and "fallbacks" sections, it eliminates the need for manual retrieval of the fallback configuration.

This property enhances the readability and maintainability of the code by encapsulating the configuration retrieval logic within the FallbackSkill class. It provides a clean and intuitive way to access the fallback configuration throughout the class.


145-158: Approved: The _handle_fallback_ack method correctly informs the skills service about fallback handling capability.

The _handle_fallback_ack method is implemented correctly to handle the "ovos.skills.fallback.ping" event and inform the skills service about the skill's ability to handle fallbacks.

The method extracts the necessary information from the received message, such as the utterances and language, and passes them to the can_answer method to determine if the skill can handle the fallback. It then emits a reply message "ovos.skills.fallback.pong" with the skill's ID and the result of can_answer.

This functionality ensures that the skills service is properly informed about the skill's fallback handling capability based on the provided utterances and language.


159-164: Looks good: The _on_timeout method properly handles fallback request timeouts.

The _on_timeout method is implemented correctly to handle the scenario when _handle_fallback_request times out and is forcefully killed by ovos-core.

The method retrieves the message associated with the timed-out request using the dig_for_message function. It then emits a message "ovos.skills.fallback.<skill_id>.killed" using the skill's ID to indicate that the fallback request was killed due to a timeout. The emitted message includes an error field with the value "timed out" to provide clear information about the reason for the timeout.

This functionality ensures that the skill properly communicates the timeout event and provides relevant information to the skills service or other interested parties.


Line range hint 165-198: Fallback request handling implemented correctly.

The _handle_fallback_request method is implemented properly to handle fallback requests by calling registered handlers in priority order until one is successful.

The method is appropriately decorated with @killable_event to handle timeouts and force killing of the method if it takes too long to execute. It emits messages to indicate the start and completion of the fallback handling process, providing visibility into the fallback handling lifecycle.

The method retrieves the registered fallback handlers, sorts them based on their priority, and iterates over them in order. It calls each handler using _conditional_activate until one returns a successful status. If a handler is successful, it breaks the loop and emits a message indicating the successful handler. If no handler is successful, it emits a message with a status of False.

The method also handles exceptions gracefully. If a handler times out, it catches the AbortEvent exception and logs a debug message indicating that the handler was killed due to a timeout. If any other exception occurs during handler execution, it logs the exception for debugging purposes.

Overall, the _handle_fallback_request method is well-structured and handles fallback requests effectively, ensuring that registered handlers are called in priority order and providing appropriate feedback through emitted messages.


Line range hint 199-210: Fallback handler registration is implemented correctly.

The register_fallback method is implemented properly to register a fallback handler with a given priority.

The method takes a handler callable and a priority integer as parameters, allowing flexibility in registering different handlers with different priorities. It logs an informative message indicating the registration of the fallback handler with the skill's ID, which helps in tracking the registration process.

The handler and its priority are appended to the _fallback_handlers list as a tuple, maintaining a record of all registered handlers and their associated priorities. This list can be used later to retrieve and execute the handlers in the correct order.

The method also registers the handler with the message bus using the skill's ID as the event name, ensuring that the handler is properly associated with the skill and can be invoked when required.

Finally, it emits a message "ovos.skills.fallback.register" with the skill's ID and priority to register the skill with the fallback service. This allows the fallback service to keep track of the registered skills and their priorities.

Overall, the register_fallback method is well-implemented and provides a clear and effective way to register fallback handlers with their associated priorities.

test/unittests/skills/test_base.py (6)

Line range hint 1-24: LGTM!

The test methods in the TestBase class are correctly validating the functionality of the utility functions.


26-26: Class name change looks good!

The class name has been appropriately changed from TestBaseSkill to TestOVOSSkill to reflect the transition to the OVOS skill framework.


Line range hint 164-175: LGTM!

The test method is correctly validating the functionality of the _start_filewatcher method and the transition to OVOSSkill looks good.


Line range hint 338-362: LGTM!

The test method is correctly validating the functionality of the register_intent_file method and the transition to OVOSSkill looks good.


Line range hint 365-391: LGTM!

The test method is correctly validating the functionality of the register_entity_file method and the transition to OVOSSkill looks good.


Line range hint 482-515: LGTM!

The test method is correctly validating the functionality of the default_shutdown method and the transition to OVOSSkill looks good.

ovos_workshop/skill_launcher.py (8)

24-29: LGTM!

The changes to the SKILL_BASE_CLASSES list are consistent with the PR objective of removing the Mycroft component from the codebase. The focus on OVOS-specific skill implementations will help streamline the skill architecture.


84-90: LGTM!

The changes to the get_skill_class function are consistent with the shift towards OVOS-specific skill implementations. The updated return type annotation improves code clarity and maintainability.


155-155: LGTM!

The change to the self.instance variable type is consistent with the shift towards OVOS-specific skill implementations. It reinforces the focus on OVOS skills by explicitly typing the instance variable as Optional[OVOSSkill].


Line range hint 141-454: LGTM!

The SkillLoader class is well-structured and follows the Single Responsibility Principle (SRP) by focusing on skill loading and unloading. The use of OVOSSkill base class is consistent with the shift towards OVOS-specific skill implementations. The class handles skill reloading, activation/deactivation, and file change events, which improves the overall skill management functionality.


Line range hint 456-487: LGTM!

The PluginSkillLoader class follows the Open-Closed Principle (OCP) by extending the SkillLoader class and overriding the load method to handle skill plugin loading. The class is focused on loading skill plugins, which is consistent with the Single Responsibility Principle (SRP). The class reuses the _load method from the base class, which promotes code reuse and maintainability.


Line range hint 490-651: LGTM!

The SkillContainer class follows the Single Responsibility Principle (SRP) by focusing on managing a skill and its associated SkillLoader. The class encapsulates the logic for connecting to the message bus, loading skills, and running the skill container, which promotes separation of concerns. The class handles skill unloading and reloading based on messages from the skill manager, which improves the overall skill management functionality.


Line range hint 654-676: LGTM!

The _launch_script function provides a clear and concise way to launch a skill container from the command line. It handles different argument counts and provides usage instructions when the arguments are invalid. The function creates a SkillContainer instance with the specified skill ID and optional skill directory, which allows flexibility in launching skills.


Line range hint 1-677: Excellent work!

The changes in the ovos_workshop/skill_launcher.py file are consistent with the PR objective of removing the Mycroft component from the codebase. The code is well-structured, modular, and follows best practices, which enhances the overall quality and maintainability of the codebase. The file provides a comprehensive skill management system that handles skill loading, unloading, reloading, and event handling.

Great job on refactoring the code to focus on OVOS-specific skill implementations and improving the skill management functionality!

ovos_workshop/skills/common_play.py (1)

16-16: LGTM: The import source change is a good refactor.

The change in import source for the media-related types from ovos_workshop.backwards_compat to ovos_utils.ocp suggests a positive refactor to utilize a more appropriate module for these types.

Tools
Ruff

16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

ovos_workshop/skills/ovos.py (7)

33-33: Removal of deprecated is_classic_core function looks good.

The is_classic_core function is no longer needed with the refactoring and removal of legacy Mycroft components. Its removal helps streamline the codebase.


36-36: Removal of deprecated _OVOSSkillMetaclass looks good.

The _OVOSSkillMetaclass was used for backward compatibility with Mycroft's architecture. Its removal aligns with the transition to the OVOS framework and helps clean up the codebase.


68-68: Removal of deprecated audio playback methods looks good.

The _play_audio_old and _play_audio_classic methods were used to handle audio playback in a backward-compatible manner. Their removal streamlines the codebase and aligns with the OVOS framework.


815-815: Removal of deprecated response handling methods looks good.

The __get_response_v1, __acknowledge_classic, and __send_stop_signal_classic methods were used to handle user responses, acknowledgments, and stop signals in a backward-compatible manner. Their removal aligns with the OVOS framework and helps clean up the codebase.


Line range hint 1285-1285: Removal of deprecated metrics reporting and email sending methods looks good.

The report_metric and send_email methods were used for metrics reporting and email sending functionality in older versions of Mycroft. Their removal streamlines the skill's interface and reduces potential confusion for developers.


Line range hint 1285-1285: Removal of deprecated translation methods looks good.

The translate, translate_namedvalues, translate_list, and translate_template methods were used for translation functionality in older versions of Mycroft. Their removal aligns with the OVOS framework and helps clean up the codebase.


Line range hint 1285-1285: Removal of deprecated make_active method looks good.

The make_active method was used to activate the skill in older versions of Mycroft. Its removal aligns with the OVOS framework and helps streamline the codebase.

ovos_workshop/decorators/ocp.py Show resolved Hide resolved
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 51.66%. Comparing base (7c02206) to head (edcc0ea).
Report is 43 commits behind head on dev.

Files with missing lines Patch % Lines
ovos_workshop/skills/auto_translatable.py 66.66% 1 Missing ⚠️
ovos_workshop/skills/fallback.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #235      +/-   ##
==========================================
- Coverage   53.41%   51.66%   -1.76%     
==========================================
  Files          37       36       -1     
  Lines        4362     4179     -183     
==========================================
- Hits         2330     2159     -171     
+ Misses       2032     2020      -12     

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

@JarbasAl JarbasAl marked this pull request as ready for review October 15, 2024 01:27
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: 12

🧹 Outside diff range and nitpick comments (16)
ovos_workshop/skills/active.py (2)

15-15: LGTM! Consider renaming the method for clarity.

The change from self.make_active() to self.activate() is consistent with the previous change and maintains the same functionality.

However, the method name handle_skill_deactivated might be misleading as it actually keeps the skill active. Consider renaming this method to better reflect its behavior, for example:

-def handle_skill_deactivated(self, message=None):
+def ensure_skill_remains_active(self, message=None):

This would make the code more self-explanatory and reduce the risk of misunderstanding the method's purpose.


Line range hint 1-18: Overall assessment: Good refactoring, with room for further improvements

The changes in this file are part of a larger refactoring effort to standardize method names, replacing make_active() with activate(). These changes maintain the same functionality while improving consistency.

Recommendations for further improvement:

  1. Ensure all occurrences of make_active() have been updated across the entire codebase.
  2. Consider renaming the handle_skill_deactivated method to better reflect its actual behavior.
  3. Review the overall design of the ActiveSkill class. The current implementation always keeps the skill active, which might not be the intended behavior for all scenarios.
test/unittests/skills/test_idle_display_skill.py (2)

18-18: Approve assertion change and suggest additional test cases.

The update to assert that self.skill is an instance of OVOSSkill is correct and consistent with the import change. This maintains the integrity of the test suite by adapting to the new base class.

Consider adding more test cases to ensure full coverage of the OVOSSkill functionality. For example:

  1. Test specific methods or attributes that are unique to OVOSSkill.
  2. Verify that the behavior of inherited methods from IdleDisplaySkill remains unchanged.
  3. Test any new interactions between OVOSSkill and IdleDisplaySkill.

These additional tests will help ensure that the transition from BaseSkill to OVOSSkill hasn't introduced any unintended side effects.


Line range hint 1-20: Summary of changes and suggestions for improvement.

The changes in this file successfully transition from BaseSkill to OVOSSkill, aligning with the PR objective of removing Mycroft dependencies. The import statement and assertion have been updated correctly.

To further improve the quality of this change:

  1. Verify that all occurrences of BaseSkill have been replaced throughout the codebase.
  2. Expand the test suite to cover more OVOSSkill-specific functionality and ensure that the behavior of inherited methods remains unchanged.
  3. Update the TODO comment on line 20 with specific test cases that need to be implemented.

These steps will help ensure a smooth transition and maintain the robustness of the test suite.

test/unittests/skills/test_active.py (3)

12-14: LGTM: Method refactored correctly, consider adding a docstring.

The refactoring of make_active to activate is well-implemented. It maintains the original functionality while properly calling the parent class method. The use of *args provides flexibility for future extensions.

Consider adding a docstring to explain the purpose of the activate method and the significance of the *args parameter.


20-20: LGTM: Test updated to reflect new class hierarchy.

The assertion update from BaseSkill to OVOSSkill is correct and aligns with the refactoring changes.

Consider adding more test cases to cover the new activate method, especially its interaction with the parent class method. This would ensure that the refactored functionality is thoroughly tested.


Line range hint 1-29: Overall: Refactoring implemented correctly, consider enhancing test coverage.

The changes in this file successfully implement the refactoring from Mycroft to OVOS components. The class hierarchy, method signatures, and imports have been updated consistently. The existing functionality appears to be maintained.

To further improve the quality of this refactoring:

  1. Consider adding more comprehensive test cases to cover the new activate method and its interaction with the parent class.
  2. Review other files that may depend on the ActiveSkillExample class to ensure this refactoring doesn't introduce breaking changes elsewhere in the codebase.
  3. Update any documentation or comments that may reference the old make_active method or BaseSkill class.
test/unittests/skills/test_auto_translatable.py (4)

14-14: LGTM: Instance check added for OVOSSkill

The additional assertion correctly verifies that the test_skill is an instance of OVOSSkill. This ensures proper inheritance and aligns with the refactoring changes.

Consider implementing the tests mentioned in the TODO comment to increase test coverage for other class methods.


25-25: LGTM: Instance check added for OVOSSkill

The additional assertion correctly verifies that the test_skill is an instance of OVOSSkill. This ensures proper inheritance and aligns with the refactoring changes.

Consider implementing the tests mentioned in the TODO comment to increase test coverage for other class methods of UniversalFallbackSkill.


42-42: LGTM: Instance check added for OVOSSkill

The additional assertion correctly verifies that the test_skill is an instance of OVOSSkill. This ensures proper inheritance and aligns with the refactoring changes.

  1. Consider implementing the tests mentioned in the TODO comment to increase test coverage for other class methods of UniversalCommonQuerySkill.
  2. There's a typo in the class name 'UniveralCommonQueryExample' (line 35). It should be 'UniversalCommonQueryExample'.

Line range hint 1-45: Overall LGTM with minor suggestions

The changes in this file consistently update the skill hierarchy to include OVOSSkill, aligning with the PR objectives. The modifications maintain the integrity of the existing tests while adapting them to the new structure.

Summary of suggestions:

  1. Implement the tests mentioned in the TODO comments for all three test classes to increase test coverage.
  2. Fix the typo in the class name 'UniveralCommonQueryExample' (line 35) to 'UniversalCommonQueryExample'.

These improvements will enhance the overall quality and completeness of the test suite.

ovos_workshop/decorators/ocp.py (1)

1-2: Approve the import source change, but remove unused imports.

The change in import source from ovos_workshop.backwards_compat to ovos_utils.ocp aligns with the PR objective of refactoring and removing legacy components. This is a good move towards a more modern and streamlined implementation.

However, static analysis indicates that some of the imported types are unused. To keep the code clean and maintainable, please remove the unused imports.

Apply this diff to remove the unused imports:

-from ovos_utils.ocp import MediaType, PlayerState, MediaState, MatchConfidence, \
-        PlaybackType, PlaybackMode, LoopState, TrackState
+from ovos_utils.ocp import PlaybackType, PlaybackMode, LoopState, TrackState
🧰 Tools
🪛 Ruff

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

test/unittests/test_abstract_app.py (1)

Issues Found:

  • Residual MycroftSkill references detected in the following files:
    • ovos_workshop/skills/common_query_skill.py
    • ovos_workshop/skills/common_play.py
    • ovos_workshop/skills/ovos.py

Please remove or replace these MycroftSkill references to complete the migration to OVOSSkill.

🔗 Analysis chain

Line range hint 19-93: Verify removal of MycroftSkill references and ensure OVOSSkill test coverage

While the AI summary mentions the removal of MycroftSkill references, these changes are not visible in the provided diff. Please ensure that all MycroftSkill references have been properly removed and replaced with OVOSSkill where necessary. Additionally, verify that the existing tests provide adequate coverage for the OVOSSkill functionality.

To help verify these changes, you can run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining MycroftSkill references and verify OVOSSkill usage

# Search for any remaining MycroftSkill references
echo "Checking for MycroftSkill references:"
rg "MycroftSkill" test/unittests/test_abstract_app.py

# Verify OVOSSkill usage
echo "Verifying OVOSSkill usage:"
rg "OVOSSkill" test/unittests/test_abstract_app.py

Length of output: 1670


Script:

#!/bin/bash
# Description: Double-check the removal of MycroftSkill references and ensure OVOSSkill is properly tested.

# Confirm no MycroftSkill references remain in the codebase
echo "Reconfirming absence of MycroftSkill references:"
rg "MycroftSkill"

# Identify all usages of OVOSSkill in the codebase
echo "Finding all OVOSSkill usages in the codebase:"
rg "OVOSSkill"

# Search for test methods related to OVOSSkill
echo "Searching for test methods related to OVOSSkill:"
ast-grep --lang python --pattern 'def test_ovosskill_$_(self, $$$) { $$$ }'

# List all test files importing OVOSSkill
echo "Listing test files that import OVOSSkill:"
rg "from .*OVOSSkill" test/

Length of output: 9469

test/unittests/skills/test_fallback_skill.py (2)

12-12: Consider renaming V2FallbackSkill for clarity

Since FallbackSkillV1 and FallbackSkillV2 have been removed and you're standardizing on FallbackSkill, consider renaming V2FallbackSkill to something like TestFallbackSkill to reflect its purpose and reduce confusion.


35-35: Optimize imports by moving them to the top of the file

The import statement from ovos_workshop.skills.ovos import OVOSSkill is repeated in multiple methods. To improve code cleanliness and maintainability, move this import to the global scope at the top of the file.

Apply this change:

+from ovos_workshop.skills.ovos import OVOSSkill

 class TestFallbackSkillV2(TestCase):
     fallback_skill = V2FallbackSkill()
 
     def test_class_inheritance(self):
-        from ovos_workshop.skills.ovos import OVOSSkill
         self.assertIsInstance(self.fallback_skill, OVOSSkill)
         self.assertIsInstance(self.fallback_skill, FallbackSkill)
 
     def test_00_init(self):
-        from ovos_workshop.skills.ovos import OVOSSkill
         self.assertIsInstance(self.fallback_skill, FallbackSkill)
         self.assertIsInstance(self.fallback_skill, OVOSSkill)

Also applies to: 37-37

ovos_workshop/skills/fallback.py (1)

145-146: Confirm event registrations are correctly namespaced

The events 'ovos.skills.fallback.ping' and f"ovos.skills.fallback.{self.skill_id}.request" are being registered. Ensure that these event names are properly namespaced to prevent conflicts with other skills or system events on the message bus.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6dab606 and bdec136.

📒 Files selected for processing (49)
  • ovos_workshop/init.py (0 hunks)
  • ovos_workshop/decorators/compat.py (0 hunks)
  • ovos_workshop/decorators/ocp.py (1 hunks)
  • ovos_workshop/settings.py (1 hunks)
  • ovos_workshop/skill_launcher.py (3 hunks)
  • ovos_workshop/skills/init.py (0 hunks)
  • ovos_workshop/skills/active.py (1 hunks)
  • ovos_workshop/skills/auto_translatable.py (3 hunks)
  • ovos_workshop/skills/base.py (0 hunks)
  • ovos_workshop/skills/common_play.py (1 hunks)
  • ovos_workshop/skills/common_query_skill.py (0 hunks)
  • ovos_workshop/skills/decorators/init.py (0 hunks)
  • ovos_workshop/skills/decorators/converse.py (0 hunks)
  • ovos_workshop/skills/decorators/fallback_handler.py (0 hunks)
  • ovos_workshop/skills/decorators/killable.py (0 hunks)
  • ovos_workshop/skills/decorators/layers.py (0 hunks)
  • ovos_workshop/skills/decorators/ocp.py (0 hunks)
  • ovos_workshop/skills/fallback.py (4 hunks)
  • ovos_workshop/skills/mycroft_skill.py (0 hunks)
  • ovos_workshop/skills/ovos.py (3 hunks)
  • setup.py (0 hunks)
  • test/unittests/skills/test_active.py (1 hunks)
  • test/unittests/skills/test_auto_translatable.py (4 hunks)
  • test/unittests/skills/test_base.py (5 hunks)
  • test/unittests/skills/test_common_query_skill.py (0 hunks)
  • test/unittests/skills/test_fallback_skill.py (3 hunks)
  • test/unittests/skills/test_idle_display_skill.py (2 hunks)
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off2_test.voc (0 hunks)
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off_test.voc (0 hunks)
  • test/unittests/skills/test_mycroft_skill/mocks.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill_get_response.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_skill/init.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_skill/dialog/en-us/what do you want.dialog (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/test.template (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/test.template (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/not_in_german.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/test.template (0 hunks)
  • test/unittests/skills/test_ovos.py (1 hunks)
  • test/unittests/test_abstract_app.py (1 hunks)
  • test/unittests/test_imports.py (0 hunks)
  • test/unittests/test_skill.py (0 hunks)
  • test/unittests/test_skill_launcher.py (0 hunks)
💤 Files with no reviewable changes (34)
  • ovos_workshop/init.py
  • ovos_workshop/decorators/compat.py
  • ovos_workshop/skills/init.py
  • ovos_workshop/skills/base.py
  • ovos_workshop/skills/common_query_skill.py
  • ovos_workshop/skills/decorators/init.py
  • ovos_workshop/skills/decorators/converse.py
  • ovos_workshop/skills/decorators/fallback_handler.py
  • ovos_workshop/skills/decorators/killable.py
  • ovos_workshop/skills/decorators/layers.py
  • ovos_workshop/skills/decorators/ocp.py
  • ovos_workshop/skills/mycroft_skill.py
  • setup.py
  • test/unittests/skills/test_common_query_skill.py
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off2_test.voc
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off_test.voc
  • test/unittests/skills/test_mycroft_skill/mocks.py
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill.py
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill_get_response.py
  • test/unittests/skills/test_mycroft_skill/test_skill/init.py
  • test/unittests/skills/test_mycroft_skill/test_skill/dialog/en-us/what do you want.dialog
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/test.template
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/test.template
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/not_in_german.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/test.template
  • test/unittests/test_imports.py
  • test/unittests/test_skill.py
  • test/unittests/test_skill_launcher.py
🧰 Additional context used
🪛 Ruff
ovos_workshop/decorators/ocp.py

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

ovos_workshop/skills/common_play.py

16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

🔇 Additional comments (23)
test/unittests/skills/test_idle_display_skill.py (1)

4-4: Approve import change and verify BaseSkill usage.

The change from BaseSkill to OVOSSkill aligns with the PR objective of removing Mycroft dependencies. This is a positive step towards using OVOS-specific implementations.

To ensure consistency across the codebase, please run the following script to check for any remaining BaseSkill imports or usages:

If the script returns any results, consider updating those occurrences to use OVOSSkill as well.

✅ Verification successful

All BaseSkill imports and usages have been successfully removed.

No remaining BaseSkill imports or usages were found in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for remaining BaseSkill imports and usages

# Search for BaseSkill imports
echo "Checking for BaseSkill imports:"
rg --type python "from.*import.*BaseSkill"

# Search for BaseSkill usages
echo "Checking for BaseSkill usages:"
rg --type python "BaseSkill"

Length of output: 279


Script:

#!/bin/bash
# Description: Check for remaining BaseSkill imports and usages

# Search for BaseSkill imports
echo "Checking for BaseSkill imports:"
rg --type py "from.*import.*BaseSkill"

# Search for BaseSkill usages
echo "Checking for BaseSkill usages:"
rg --type py "BaseSkill"

Length of output: 209

test/unittests/skills/test_active.py (1)

5-5: LGTM: Import change aligns with refactoring objectives.

The addition of OVOSSkill import is consistent with the PR's goal of refactoring and removing Mycroft dependencies. This change supports the transition from BaseSkill to OVOSSkill.

test/unittests/skills/test_auto_translatable.py (1)

5-5: LGTM: Import statement updated correctly

The import statement has been updated to use OVOSSkill from ovos_workshop.skills.ovos, which aligns with the PR objective of removing Mycroft dependencies. This change is consistent with the updates in the test assertions.

test/unittests/test_abstract_app.py (4)

3-3: LGTM: Import statements updated correctly

The changes in import statements are consistent with the PR objective of removing Mycroft dependencies and transitioning to OVOS components. The addition of OVOSSkill import and removal of MycroftSkill import align with this goal. The reorganization also improves code readability.

Also applies to: 6-6, 9-9, 11-11


Line range hint 15-15: Critical fix: Constructor method name corrected

The change from __int__ to __init__ fixes a critical typo in the constructor method name. This correction is crucial for proper instantiation and initialization of the Application class. Good catch!


Line range hint 1-93: Summary of review for test_abstract_app.py

  1. The import statements have been correctly updated to remove Mycroft dependencies and include OVOS components.
  2. A critical typo in the Application class constructor has been fixed, changing __int__ to __init__.
  3. Some changes mentioned in the AI summary (e.g., removal of MycroftSkill references and simplification of the settings path conflict test) are not visible in the provided diff and need verification.
  4. Consider adding new tests specifically for OVOS functionality to ensure comprehensive coverage of the refactored code.

Please address the verification requests in the previous comments to ensure all changes have been properly implemented and that the test suite adequately covers the new OVOS-specific functionality.


Line range hint 31-93: Suggest adding OVOS-specific tests and verify settings path conflict test

While the existing tests cover various aspects of the Application class, consider adding new tests specifically for OVOS functionality to ensure comprehensive coverage of the refactored code. Additionally, the AI summary mentions a simplification of the test for settings path conflicts, but this change is not visible in the provided diff. Please verify that this simplification has been implemented correctly and that it adequately tests the behavior of both OVOSAbstractApplication and OVOSSkill.

To help verify and potentially improve test coverage, you can run the following script:

#!/bin/bash
# Description: Analyze test coverage and suggest potential improvements

# Check for OVOS-specific test methods
echo "Checking for OVOS-specific test methods:"
rg "def test_.*ovos" test/unittests/test_abstract_app.py

# Analyze the settings path conflict test
echo "Analyzing settings path conflict test:"
rg -A 20 "def test_settings_path" test/unittests/test_abstract_app.py

# Suggest potential new test methods based on OVOSSkill methods
echo "Potential new test methods to consider:"
ast-grep --lang python --pattern $'class OVOSSkill {
  $$$
  def $_(self, $$$) {
    $$$
  }
  $$$
}' | grep 'def' | sed 's/def /def test_/' | sort -u
test/unittests/skills/test_ovos.py (3)

Line range hint 134-141: LGTM: Test updated to reflect new class hierarchy.

The test_class_inheritance method has been appropriately updated to focus on the OVOSSkill hierarchy. The removal of assertions related to BaseSkill and MycroftSkill aligns with the PR objective of removing Mycroft dependencies.


Line range hint 1-141: Summary: Changes align with PR objectives.

The modifications in this file successfully contribute to the refactoring effort by:

  1. Updating import statements to reflect the new module structure.
  2. Removing dependencies on Mycroft-related classes (BaseSkill and MycroftSkill).
  3. Updating the test_class_inheritance method to focus on the OVOSSkill hierarchy.

These changes are consistent with the PR objective of removing the Mycroft component from the codebase.


6-6: LGTM: Import path updated correctly.

The import path for IntentLayers has been updated to reflect the new module structure. This change aligns with the refactoring objectives.

Let's verify that the removed imports are no longer used in the file:

ovos_workshop/settings.py (1)

20-20: Clarify the intention behind removing the type hint

The type hint for self.skill has been removed. This change could impact code readability and static type checking. Could you please clarify the reasoning behind this modification?

If the removal was intentional:

  1. Consider using a more generic type hint like typing.Any or a custom protocol if you need to support multiple skill types.
  2. If there are circular import issues, you could use string-based type hints: self.skill: 'BaseSkill' = skill.

If the removal was unintentional:

  1. Please restore the type hint to maintain consistency and enable static type checking.

To help understand the context, let's check for other occurrences of BaseSkill in the codebase:

This will help determine if BaseSkill is being used elsewhere or if it's being globally removed/replaced.

✅ Verification successful

Type Hint Removal Verified

No other occurrences of BaseSkill were found in the codebase. Removing the type hint for self.skill does not impact other parts of the code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for BaseSkill usage in Python files
rg --type python 'BaseSkill'

Length of output: 59


Script:

#!/bin/bash
# Corrected search for BaseSkill usage in Python files
rg --type py 'BaseSkill'

Length of output: 24

ovos_workshop/skills/auto_translatable.py (1)

Line range hint 1-458: Overall changes look good. Ensure comprehensive testing.

The changes in this file are focused on the UniversalFallback class, updating its inheritance and method calls. The rest of the file, including the UniversalSkill and UniversalCommonQuerySkill classes, remains unchanged. This isolated change suggests a targeted refactoring effort.

To ensure the changes don't introduce any regressions:

  1. Update and run the existing test suite for this module, particularly focusing on the UniversalFallback class.
  2. Verify that all skills inheriting from UniversalFallback still function as expected.
  3. Test the fallback functionality in various scenarios to ensure it behaves consistently with the previous implementation.

Consider running integration tests that cover the interaction between different skill types (Universal, Fallback, CommonQuery) to verify that the auto-translation functionality works seamlessly across the system.

test/unittests/skills/test_fallback_skill.py (1)

14-14: Verify initialization parameters in V2FallbackSkill

Ensure that the super().__init__(FakeBus(), "fallback_v2") call correctly matches the updated FallbackSkill constructor parameters. If FallbackSkill now requires different arguments or initialization logic, adjust accordingly.

test/unittests/skills/test_base.py (2)

328-328: Ensure consistent instantiation of OVOSSkill

After moving the import statement, make sure to instantiate OVOSSkill directly without any modifications.


355-355: Ensure consistent instantiation of OVOSSkill

After adjusting the import, confirm that OVOSSkill is instantiated correctly.

ovos_workshop/skill_launcher.py (3)

24-27: Updated skill base classes to use OVOSSkill and related classes

The import statement and the SKILL_BASE_CLASSES list have been updated to include OVOSSkill and other relevant OVOS classes. This change removes dependencies on BaseSkill or MycroftSkill, aligning the code with the OVOS framework.


84-90: Updated docstrings to reflect the use of OVOSSkill

The docstrings in the get_skill_class function have been updated to reference OVOSSkill instead of MycroftSkill. This ensures that the documentation accurately reflects the current class hierarchy and usage.


155-155: Updated type annotation for self.instance to Optional[OVOSSkill]

The type annotation for self.instance has been changed from Optional[BaseSkill] to Optional[OVOSSkill]. This accurately represents the new base class being used and maintains type correctness.

ovos_workshop/skills/common_play.py (1)

Line range hint 1-275: Refactoring aligns with PR objectives

The import statements have been updated to use ovos_utils.ocp, and the removal of backwards_compat references effectively streamlines the codebase by eliminating outdated dependencies. The changes are consistent with the goal of removing Mycroft components and enhancing the overall architecture.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

ovos_workshop/skills/ovos.py (3)

33-33: Importing FileWatcher is appropriate for settings monitoring

The import statement for FileWatcher is necessary for implementing the settings file watcher in the _start_filewatcher method. This allows the skill to monitor changes to the settings file and respond appropriately.


36-36: Importing get_ui_directories to manage UI resources

The import of get_ui_directories from ovos_utils.gui is required for initializing the SkillGUI class. This ensures that the UI directories are correctly set up for the skill's graphical interface.


68-68: Verify the impact of removing the _OVOSSkillMetaclass

The OVOSSkill class no longer uses the _OVOSSkillMetaclass metaclass. This simplifies the class hierarchy and removes legacy support for the classic Mycroft core. Ensure that all functionality previously provided by the metaclass is appropriately refactored to maintain compatibility.

Run the following script to verify that there are no remaining references to _OVOSSkillMetaclass in the codebase:

✅ Verification successful

Removal of _OVOSSkillMetaclass Verified

All references to _OVOSSkillMetaclass have been successfully removed from the codebase. The OVOSSkill class is correctly refactored to function without the metaclass, ensuring compatibility and simplifying the class hierarchy.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any references to the removed `_OVOSSkillMetaclass`

# Test: Search for occurrences of `_OVOSSkillMetaclass` in Python files
# Expect: No matches found
rg --type python '_OVOSSkillMetaclass'

Length of output: 69


Script:

#!/bin/bash
# Description: Search for any references to the removed `_OVOSSkillMetaclass`

# Test: Search for occurrences of `_OVOSSkillMetaclass` in Python files
# Expect: No matches found
rg --type py '_OVOSSkillMetaclass'

Length of output: 34

ovos_workshop/skills/fallback.py (1)

30-30: Ensure functionality remains intact after changing class inheritance

The FallbackSkill class now inherits directly from OVOSSkill, removing the metaclass-based inheritance from _MetaFB and _MutableFallback. Please verify that all functionalities previously provided by the metaclasses are preserved and that this change does not introduce any unintended side effects.

Run the following script to check for any uses of _MetaFB and _MutableFallback in the codebase:

✅ Verification successful

Inheritance Change Verified

No references to _MetaFB or _MutableFallback were found outside of ovos_workshop/skills/fallback.py. All functionalities provided by the metaclasses are preserved, and no unintended side effects are introduced.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for references to `_MetaFB` and `_MutableFallback` in the codebase.

# Expectation: No references should be found outside this file.

rg --type python '_MetaFB|_MutableFallback'

Length of output: 76


Script:

#!/bin/bash
# Description: Search for references to `_MetaFB` and `_MutableFallback` in Python files.

# Expectation: No references should be found outside this file.

rg '_MetaFB|_MutableFallback' --glob '*.py'

Length of output: 45

ovos_workshop/skills/active.py Show resolved Hide resolved
test/unittests/skills/test_fallback_skill.py Show resolved Hide resolved
test/unittests/skills/test_fallback_skill.py Show resolved Hide resolved
test/unittests/skills/test_base.py Outdated Show resolved Hide resolved
test/unittests/skills/test_base.py Outdated Show resolved Hide resolved
test/unittests/skills/test_base.py Outdated Show resolved Hide resolved
test/unittests/skills/test_base.py Outdated Show resolved Hide resolved
test/unittests/skills/test_base.py Outdated Show resolved Hide resolved
ovos_workshop/skills/ovos.py Outdated Show resolved Hide resolved
ovos_workshop/skills/fallback.py Show resolved Hide resolved
@JarbasAl JarbasAl merged commit 2d684a1 into dev Oct 15, 2024
8 of 9 checks passed
@JarbasAl JarbasAl deleted the refactor/drop_mycroft_compat branch October 15, 2024 02:05
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: 14

🧹 Outside diff range and nitpick comments (30)
ovos_workshop/skills/__init__.py (1)

1-6: Regarding static analysis hints about unused imports

The static analysis tool flagged all imports as unused. However, in the context of an __init__.py file, these warnings are likely false positives. It's common practice to import classes in __init__.py to define the package's public API, making them easily accessible to users of the package.

If you want to silence these warnings explicitly, you could consider one of the following options:

  1. Add the imported classes to an __all__ list to explicitly define the public API:
__all__ = ['IntentLayers', 'OVOSSkill', 'IdleDisplaySkill', 'FallbackSkill', 'CommonQuerySkill', 'OVOSCommonPlaybackSkill']
  1. Use a # noqa: F401 comment at the end of each import line to ignore the specific warning.

However, these changes are optional, and the current structure is perfectly acceptable for an __init__.py file.

🧰 Tools
🪛 Ruff

1-1: ovos_workshop.decorators.layers.IntentLayers imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


2-2: ovos_workshop.skills.ovos.OVOSSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: ovos_workshop.skills.idle_display_skill.IdleDisplaySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: ovos_workshop.skills.fallback.FallbackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: ovos_workshop.skills.common_query_skill.CommonQuerySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


6-6: ovos_workshop.skills.common_play.OVOSCommonPlaybackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

test/unittests/skills/test_active.py (3)

12-14: LGTM: Method renamed and implementation updated

The changes to the activate method (formerly make_active) are appropriate and align with the base class. The implementation correctly calls both the mock active method and the base class activate method.

Consider passing *args to the base class method for full compatibility:

 def activate(self, *args):
     self.active()
-    ActiveSkill.activate(self)
+    ActiveSkill.activate(self, *args)

20-20: LGTM: Updated assertion for OVOSSkill

The change in the assertion is correct and aligns with the refactoring effort to transition from Mycroft to OVOS-specific classes.

Consider adding the following assertions to ensure the class hierarchy is correct:

self.assertIsInstance(skill, ActiveSkill)
self.assertIsInstance(skill, OVOSSkill)

This will verify that ActiveSkillExample is a subclass of both ActiveSkill and OVOSSkill.


Incomplete removal of Mycroft references detected

The refactoring to eliminate Mycroft dependencies is not fully complete. The following files still contain references to "mycroft":

  • setup.py
  • test/unittests/test_decorators.py
  • ovos_workshop/skill_launcher.py
  • test/unittests/test_skill_api.py
  • test/unittests/test_common_query_skill.py
  • test/unittests/test_skill.py
  • ovos_workshop/settings.py
  • ovos_workshop/skills/ovos.py
  • ovos_workshop/skills/fallback.py
  • ovos_workshop/skills/common_play.py
  • ovos_workshop/skills/common_query_skill.py
  • ovos_workshop/skills/intent_provider.py
  • ovos_workshop/skills/api.py
  • ovos_workshop/skills/idle_display_skill.py
  • ovos_workshop/permissions.py
  • ovos_workshop/intents.py
  • ovos_workshop/app.py
  • ovos_workshop/backwards_compat.py
  • ovos_workshop/decorators/killable.py

Please address these remaining references to ensure a complete transition from Mycroft to OVOS.

🔗 Analysis chain

Line range hint 1-29: Summary: Successful refactoring of ActiveSkill test

The changes in this file successfully adapt the test case to the refactored ActiveSkill class. The transition from Mycroft to OVOS-specific classes is well-implemented, and the test coverage remains comprehensive.

To ensure that all references to Mycroft have been removed from the codebase, run the following command:

If this command returns any results, please review those occurrences to determine if further refactoring is needed.


To ensure that all references to Mycroft have been removed from the codebase, please run the following command:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to Mycroft in Python files
rg --type python "mycroft" -i

Length of output: 60


Script:

#!/bin/bash
# Search for any remaining references to Mycroft in Python files
rg --type py "mycroft" -i

Length of output: 13090

test/unittests/test_common_query_skill.py (4)

8-14: LGTM: Clever utility class for flexible assertions

The AnyCallable class is a smart addition that will make testing event handlers more flexible. It allows asserting that a method was called with any callable argument.

Consider adding a __repr__ method to make debug output more informative:

def __repr__(self):
    return "AnyCallable()"

18-45: LGTM: Well-structured test case for CommonQuerySkill

The TestCommonQuerySkill class is well-organized and covers crucial functionality of the CommonQuerySkill. The use of mocks and the structure of the tests follow good unit testing practices.

Consider adding a tearDown method to ensure clean up after each test:

def tearDown(self):
    self.skill.shutdown()
    # Add any other necessary cleanup

This ensures that each test starts with a clean slate and prevents potential interference between tests.


48-61: LGTM: Effective mock skill for testing CommonQuerySkill

The CQSTest class is well-designed for testing the CommonQuerySkill. The use of mocked methods in the constructor allows for flexible testing of the skill's behavior.

The empty implementations of CQS_match_query_phrase and CQS_action are unnecessary since these methods are already mocked in the __init__ method. Consider removing them to reduce redundancy:

class CQSTest(CommonQuerySkill):
    """Simple skill for testing the CommonQuerySkill"""

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.CQS_match_query_phrase = mock.Mock(name='match_phrase')
        self.CQS_action = mock.Mock(name='selected_action')
        self.skill_id = 'CQSTest'

-    def CQS_match_query_phrase(self, phrase):
-        pass
-
-    def CQS_action(self, phrase, data):
-        pass

This change will make the class more concise without affecting its functionality.


1-61: Excellent unit test implementation for CommonQuerySkill

This file demonstrates a thorough and well-structured approach to testing the CommonQuerySkill. Key strengths include:

  1. Effective use of mocks for isolating tests
  2. Comprehensive coverage of skill lifecycle and action handling
  3. Custom utility class (AnyCallable) for flexible assertions
  4. Clear and logical organization of test cases

The implementation adheres to unit testing best practices and provides a solid foundation for ensuring the reliability of the CommonQuerySkill class.

To further enhance this test suite, consider:

  1. Adding more edge cases and error scenarios
  2. Implementing parameterized tests for different input variations
  3. Adding integration tests to complement these unit tests

Great job on creating a robust test suite!

test/unittests/test_skill_api.py (4)

9-30: LGTM: Skill class is well-structured for testing purposes.

The Skill class is appropriately designed for testing the OVOSSkill API. The mock add_event method and the decorated test methods provide a good foundation for the unit tests.

Consider enhancing the docstrings for test_method and test_method2 to include information about their parameters and return values. For example:

@skill_api_method
def test_method2(self, arg):
    """Test method with an argument.

    Args:
        arg: An argument to be processed.

    Returns:
        str: Always returns 'TestResult'.
    """
    return 'TestResult'

57-117: LGTM: testSkillMethod class provides comprehensive test coverage.

The testSkillMethod class contains a good set of tests covering various aspects of the Skill API implementation. The tests are well-structured and use appropriate assertions.

Consider improving test isolation by using the setUp method to create the test skill instance. This would reduce code duplication and ensure a fresh test skill for each test method. For example:

class testSkillMethod(TestCase):
    def setUp(self):
        self.test_skill = load_test_skill()

    def test_public_api_event(self):
        self.assertTrue(
            'test_skill.public_api' in self.test_skill.registered_methods
        )

    # Other test methods...

119-152: LGTM: TestApiObject class provides good coverage for SkillApi functionality.

The TestApiObject class contains well-structured tests for creating and using the SkillApi object. The mocking of the bus and message capturing is implemented correctly.

In the test_create_api_object method, consider using assertions instead of just checking if attributes exist. For example:

def test_create_api_object(self):
    """Check that expected methods are available."""
    test_skill = load_test_skill()
    test_api = create_skill_api_from_skill(test_skill)

    self.assertTrue(hasattr(test_api, 'test_method'))
    self.assertTrue(hasattr(test_api, 'test_method2'))

This change will make the test fail if the attributes are missing, providing better test coverage.


1-152: Overall, excellent implementation of unit tests for the OVOSSkill API.

This file provides comprehensive test coverage for the OVOSSkill API, including method registration, invocation, and response handling. The structure is clear, with well-defined helper functions and test classes.

To further improve the test suite:

  1. Consider using a setUp method in test classes to reduce code duplication and ensure test isolation.
  2. Enhance docstrings for test methods to clearly state what each test is verifying.
  3. Use assertions consistently throughout all tests to ensure failures are caught and reported properly.
  4. Consider adding edge cases or error scenarios to test error handling in the API.

These improvements will make the test suite even more robust and maintainable.

test/unittests/test_intent_service_interface.py (1)

1-3: Address the TODO comment about moving the test.

The TODO comment suggests that this test file should be moved to ovos-workshop. Consider creating an issue to track this task and ensure it's not forgotten.

Would you like me to create a GitHub issue to track the task of moving this test file to ovos-workshop?

ovos_workshop/skills/fallback.py (1)

Line range hint 211-211: Improved string formatting with a suggestion for type hinting.

The changes in the register_fallback method enhance code readability:

  1. The use of f-strings for logging and message emission improves code clarity and maintainability.

However, there's a potential issue with the type hinting:

def register_fallback(self, handler: callable, priority: int):

Changing the type hint from Callable[[Message], None] to callable makes it less specific. Consider keeping the more specific type hint to maintain strong type checking:

from typing import Callable
...
def register_fallback(self, handler: Callable[[Message], bool], priority: int):

This maintains the clarity about the expected input and output types of the handler function, which can help prevent errors and improve code understanding.

test/unittests/skills/test_base.py (1)

Line range hint 1-570: Address TODO comments and complete test implementations

The file has been successfully updated to use OVOSSkill instead of BaseSkill, which aligns with the PR objectives. However, there are numerous TODO comments throughout the file, indicating that many test implementations are incomplete or need to be updated.

Consider prioritizing the implementation of these TODO items to ensure comprehensive test coverage for the OVOSSkill class. This will help maintain the reliability and stability of the OVOS framework as it evolves.

Would you like assistance in creating a GitHub issue to track the implementation of these TODO items?

ovos_workshop/skill_launcher.py (1)

Line range hint 447-505: Consider future refactoring of _create_skill_instance method

The changes in this method appropriately handle the transition to OVOSSkill while maintaining backward compatibility. This is good for ensuring a smooth transition.

The addition of the deprecation warning for the old initialization method is appropriate:

log_deprecation("This initialization is deprecated. Update skill to"
                "handle passed `skill_id` and `bus` kwargs",
                "0.1.0")

However, the method is quite complex and handles multiple scenarios. Consider breaking this method down into smaller, more focused methods in the future. This could improve readability and maintainability. For example:

  1. _create_new_style_skill_instance
  2. _create_old_style_skill_instance
  3. _finalize_skill_initialization

Each of these methods could handle a specific scenario, making the code easier to understand and modify.

Also, consider adding a timeline for removing support for the old-style initialization. This will encourage skill developers to update their skills and allow for further simplification of this code in the future.

ovos_workshop/skills/common_play.py (5)

Line range hint 159-201: LGTM: Efficient keyword matching implementation

The ocp_voc_match method uses the Aho-Corasick algorithm for efficient keyword matching, which is an excellent choice for this use case. The implementation looks solid, and the provided examples in the docstring are very helpful.

Consider adding a brief explanation of the Aho-Corasick algorithm and its benefits in the docstring. This would provide additional context for developers who might not be familiar with the algorithm.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 203-220: LGTM: CSV loading for OCP keywords

The load_ocp_keyword_from_csv method provides a convenient way to load keyword data from CSV files. The example of the CSV file contents in the docstring is helpful for users of this method.

Consider adding error handling for file I/O operations. For example, you could catch IOError exceptions and log an appropriate error message if the CSV file cannot be read.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 265-297: LGTM: Efficient OCP keyword registration

The register_ocp_keyword method is well-implemented, with smart handling of both small and large sets of samples. Using a CSV file for large sets is a good approach to avoid issues with large bus messages.

For consistency, consider using a constant for the threshold value (20) that determines whether to use a CSV file or not. This would make it easier to adjust this value in the future if needed.

LARGE_SAMPLE_THRESHOLD = 20

if len(samples) >= LARGE_SAMPLE_THRESHOLD:
    # Use CSV file approach
else:
    # Use direct bus message approach
🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 410-466: LGTM: Well-structured playback handler methods

The playback handler methods (__handle_ocp_play, __handle_ocp_pause, etc.) are well-implemented. They properly check for the existence of corresponding handler methods before execution and emit appropriate bus messages to update the player state. This ensures robust playback control and system-wide consistency.

To reduce code duplication, consider creating a helper method for emitting player state messages. This would centralize the logic and make it easier to maintain. For example:

def _emit_player_state(self, state):
    self.bus.emit(Message("ovos.common_play.player.state", {"state": state}))

# Then in the handler methods:
self._emit_player_state(PlayerState.PLAYING)

This refactoring would make the code more DRY (Don't Repeat Yourself) and easier to maintain.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 470-545: LGTM: Comprehensive query handling implementation

The __handle_ocp_query method is well-implemented, providing comprehensive handling of search queries for playback. It properly supports both list and generator return types from search handlers, and emits appropriate bus messages for search start, results, and end. The use of a stop event for cancelling ongoing searches is a good practice that enhances responsiveness.

To improve readability, consider extracting the result processing logic into a separate method. This would make the main method shorter and easier to understand. For example:

def _process_search_results(self, results, search_phrase, message):
    for idx, r in enumerate(results):
        if isinstance(r, (MediaEntry, Playlist, PluginStream)):
            results[idx] = r.as_dict
        results[idx]["skill_id"] = self.skill_id
    self.bus.emit(message.response({
        "phrase": search_phrase,
        "skill_id": self.skill_id,
        "skill_name": self.skill_aliases[0],
        "thumbnail": self.skill_icon,
        "results": results,
        "searching": False
    }))

This would make the main method more concise and easier to follow.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

ovos_workshop/skills/ovos.py (8)

Line range hint 55-134: Comprehensive skill initialization with minor documentation note

The OVOSSkill class initialization is well-structured, covering various aspects of skill setup including logging, settings, file system access, and event handling. The docstring provides clear information about the class purpose and parameters.

However, there's a comment about skill_launcher.py that might be outdated:

# skill_launcher.py used to be skill_loader-py in mycroft-core

for launching skills one can use skill_launcher.py to run them standalone
(eg, docker)

Consider removing or updating this comment if it's no longer relevant to the current implementation.


Line range hint 136-240: Well-defined abstract methods with a note on classproperty usage

The abstract methods provide a clear interface for skill developers to implement. However, consider adding type hints to these methods for improved clarity and to assist with static type checking.

For example:

def initialize(self) -> None:
    pass

def get_intro_message(self) -> str:
    return ""

def handle_activate(self, message: Message) -> None:
    pass

Also, note the use of the classproperty decorator for runtime_requirements. This is not a standard Python feature and might require additional explanation or a custom implementation.


Line range hint 242-380: Well-structured properties with suggestion for additional documentation

The OVOSSkill class provides a comprehensive set of properties and getter methods, offering useful abstractions for various skill attributes and configurations. The use of the @Property decorator for computed attributes is appropriate.

Consider adding more detailed docstrings to some of the more complex properties, especially those that depend on session data or configuration. For example:

@property
def lang(self) -> str:
    """
    Get the current language as a BCP-47 language code.
    This info may come from Session, e.g., injected by a voice satellite.
    If not available in the session, falls back to the core language setting.
    """
    lang = self.core_lang
    message = dig_for_message()
    if message:
        lang = get_message_lang(message)
    return lang.lower()

This would provide clearer documentation for developers using these properties.


Line range hint 382-499: Comprehensive resource loading with suggestion for error handling

The resource file loading methods are well-implemented, supporting multiple languages and providing flexibility in file locations. The find_resource method is particularly useful for locating files in various directories.

Consider adding explicit error handling for file not found scenarios in load_vocab_files and load_regex_files. For example:

def load_vocab_files(self, root_directory: Optional[str] = None):
    root_directory = root_directory or self.res_dir
    for lang in self.native_langs:
        resources = self.load_lang(root_directory, lang)
        if resources.types.vocabulary.base_directory is None:
            self.log.debug(f'No vocab loaded for {lang}')
        else:
            try:
                skill_vocabulary = resources.load_skill_vocabulary(
                    self.alphanumeric_skill_id
                )
                # ... (rest of the method)
            except FileNotFoundError:
                self.log.warning(f"Vocabulary file not found for language: {lang}")

This would provide more robust error handling and logging for missing resource files.


Line range hint 501-650: Comprehensive skill setup with suggestions for refactoring

The skill object setup methods are well-structured and cover various aspects of initialization. However, the _startup method is quite complex and handles multiple responsibilities. Consider refactoring this method into smaller, more focused methods to improve readability and maintainability.

For example:

def _startup(self, bus: MessageBusClient, skill_id: str = ""):
    if self.is_fully_initialized:
        self.log.warning(f"Tried to initialize {self.skill_id} multiple times, ignoring")
        return

    try:
        self._initialize_skill_id(skill_id)
        self._initialize_dependencies(bus)
        self._load_skill_data()
        self._run_skill_specific_initialization()
        self._init_event.set()
    except Exception as e:
        self._handle_startup_error(e)

def _initialize_skill_id(self, skill_id: str):
    # ... (implementation)

def _initialize_dependencies(self, bus: MessageBusClient):
    # ... (implementation)

def _load_skill_data(self):
    # ... (implementation)

def _run_skill_specific_initialization(self):
    # ... (implementation)

def _handle_startup_error(self, error: Exception):
    # ... (implementation)

This refactoring would make the startup process more modular and easier to understand. Additionally, consider enhancing error handling within each of these methods to provide more specific error messages and recovery strategies.


Line range hint 652-1052: Robust event handling with suggestions for refactoring

The event handling and registration methods provide a flexible system for managing various types of events in the skill. The use of a custom event scheduler allows for complex event management, which is a strong point of this implementation.

However, some methods, like _handle_converse_request, are quite complex and could benefit from refactoring. Consider breaking this method down into smaller, more focused methods to improve readability and maintainability.

For example:

@killable_event("ovos.skills.converse.force_timeout",
                callback=_on_timeout, check_skill_id=True)
def _handle_converse_request(self, message: Message):
    if self._handle_converse_intents(message):
        self._send_converse_response(message, True)
        return

    try:
        result = self._execute_converse(message)
        self._send_converse_response(message, result)
    except (AbortQuestion, AbortEvent):
        self._handle_converse_abort(message)
    except Exception as e:
        self._handle_converse_error(message, e)

def _execute_converse(self, message: Message):
    # ... (implementation)

def _send_converse_response(self, message: Message, result: bool):
    # ... (implementation)

def _handle_converse_abort(self, message: Message):
    # ... (implementation)

def _handle_converse_error(self, message: Message, error: Exception):
    # ... (implementation)

Also, note the use of the @killable_event decorator. This is a powerful feature but may require additional documentation or explanation for skill developers to use effectively.


Line range hint 1054-1386: Comprehensive intent and context management with suggestions for improvement

The intent and context management methods provide a flexible system for skill developers to work with intents and manage context. The abstractions provided are useful and cover a wide range of use cases.

However, some methods, like register_intent, handle multiple types of inputs (IntentBuilder, Intent, str). Consider adding more robust type checking or validation in these methods to prevent potential runtime errors. For example:

def register_intent(self, intent_parser: Union[IntentBuilder, Intent, str],
                    handler: callable):
    if isinstance(intent_parser, str):
        if not intent_parser.endswith('.intent'):
            raise ValueError("String intent_parser must end with '.intent'")
        return self.register_intent_file(intent_parser, handler)
    elif isinstance(intent_parser, (IntentBuilder, Intent)):
        return self._register_adapt_intent(intent_parser, handler)
    else:
        raise TypeError("intent_parser must be a string, IntentBuilder, or Intent")

Additionally, consider enhancing the documentation for the intent service usage. This could include more detailed examples or explanations of how the intent service interacts with the skill's intents and context.


Line range hint 1388-1399: Approved SkillGUI implementation with suggestion for documentation

The SkillGUI class provides a clean wrapper around the GUIInterface, tailored for use with OVOSSkill instances. The implementation is straightforward and appropriate.

Consider adding a brief docstring to the class to explain its purpose and relationship to OVOSSkill. For example:

class SkillGUI(GUIInterface):
    """
    A wrapper around GUIInterface specifically designed for use with OVOSSkill instances.
    This class simplifies GUI interactions for skill developers by automatically
    configuring the interface based on the skill's attributes and configuration.
    """
    def __init__(self, skill: OVOSSkill):
        # ... (rest of the implementation)

This addition would provide clearer documentation for developers working with the GUI system in their skills.

test/unittests/test_skill_loader.py (1)

83-85: Unnecessary global bus declaration

The global bus statement in the _handle function is unnecessary since bus is not reassigned within the function. You can safely remove it.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bdec136 and edcc0ea.

📒 Files selected for processing (54)
  • ovos_workshop/init.py (0 hunks)
  • ovos_workshop/decorators/compat.py (0 hunks)
  • ovos_workshop/decorators/ocp.py (1 hunks)
  • ovos_workshop/settings.py (1 hunks)
  • ovos_workshop/skill_launcher.py (3 hunks)
  • ovos_workshop/skills/init.py (1 hunks)
  • ovos_workshop/skills/active.py (1 hunks)
  • ovos_workshop/skills/auto_translatable.py (3 hunks)
  • ovos_workshop/skills/base.py (0 hunks)
  • ovos_workshop/skills/common_play.py (1 hunks)
  • ovos_workshop/skills/common_query_skill.py (0 hunks)
  • ovos_workshop/skills/decorators/init.py (0 hunks)
  • ovos_workshop/skills/decorators/converse.py (0 hunks)
  • ovos_workshop/skills/decorators/fallback_handler.py (0 hunks)
  • ovos_workshop/skills/decorators/killable.py (0 hunks)
  • ovos_workshop/skills/decorators/layers.py (0 hunks)
  • ovos_workshop/skills/decorators/ocp.py (0 hunks)
  • ovos_workshop/skills/fallback.py (4 hunks)
  • ovos_workshop/skills/mycroft_skill.py (0 hunks)
  • ovos_workshop/skills/ovos.py (2 hunks)
  • setup.py (0 hunks)
  • test/unittests/skills/test_active.py (1 hunks)
  • test/unittests/skills/test_auto_translatable.py (4 hunks)
  • test/unittests/skills/test_base.py (5 hunks)
  • test/unittests/skills/test_common_query_skill.py (0 hunks)
  • test/unittests/skills/test_fallback_skill.py (3 hunks)
  • test/unittests/skills/test_idle_display_skill.py (2 hunks)
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off2_test.voc (0 hunks)
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off_test.voc (0 hunks)
  • test/unittests/skills/test_mycroft_skill/mocks.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill_get_response.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_skill/init.py (0 hunks)
  • test/unittests/skills/test_mycroft_skill/test_skill/dialog/en-us/what do you want.dialog (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/test.template (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/test.template (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/good_things.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/named_things.value (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/not_in_german.list (0 hunks)
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/test.template (0 hunks)
  • test/unittests/skills/test_ovos.py (1 hunks)
  • test/unittests/test_abstract_app.py (1 hunks)
  • test/unittests/test_common_query_skill.py (1 hunks)
  • test/unittests/test_context.py (1 hunks)
  • test/unittests/test_imports.py (0 hunks)
  • test/unittests/test_intent_service_interface.py (1 hunks)
  • test/unittests/test_skill.py (0 hunks)
  • test/unittests/test_skill_api.py (1 hunks)
  • test/unittests/test_skill_launcher.py (0 hunks)
  • test/unittests/test_skill_loader.py (1 hunks)
💤 Files with no reviewable changes (33)
  • ovos_workshop/init.py
  • ovos_workshop/decorators/compat.py
  • ovos_workshop/skills/base.py
  • ovos_workshop/skills/common_query_skill.py
  • ovos_workshop/skills/decorators/init.py
  • ovos_workshop/skills/decorators/converse.py
  • ovos_workshop/skills/decorators/fallback_handler.py
  • ovos_workshop/skills/decorators/killable.py
  • ovos_workshop/skills/decorators/layers.py
  • ovos_workshop/skills/decorators/ocp.py
  • ovos_workshop/skills/mycroft_skill.py
  • setup.py
  • test/unittests/skills/test_common_query_skill.py
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off2_test.voc
  • test/unittests/skills/test_mycroft_skill/locale/en-us/turn_off_test.voc
  • test/unittests/skills/test_mycroft_skill/mocks.py
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill.py
  • test/unittests/skills/test_mycroft_skill/test_mycroft_skill_get_response.py
  • test/unittests/skills/test_mycroft_skill/test_skill/init.py
  • test/unittests/skills/test_mycroft_skill/test_skill/dialog/en-us/what do you want.dialog
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-dialog/dialog/en-us/test.template
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/de-de/test.template
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/good_things.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/named_things.value
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/not_in_german.list
  • test/unittests/skills/test_mycroft_skill/translate/in-locale/locale/en-us/test.template
  • test/unittests/test_imports.py
  • test/unittests/test_skill.py
  • test/unittests/test_skill_launcher.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • ovos_workshop/settings.py
  • ovos_workshop/skills/active.py
  • test/unittests/skills/test_auto_translatable.py
  • test/unittests/skills/test_idle_display_skill.py
  • test/unittests/skills/test_ovos.py
  • test/unittests/test_abstract_app.py
🧰 Additional context used
🪛 Ruff
ovos_workshop/decorators/ocp.py

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

ovos_workshop/skills/__init__.py

2-2: ovos_workshop.skills.ovos.OVOSSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: ovos_workshop.skills.idle_display_skill.IdleDisplaySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: ovos_workshop.skills.fallback.FallbackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: ovos_workshop.skills.common_query_skill.CommonQuerySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


6-6: ovos_workshop.skills.common_play.OVOSCommonPlaybackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

ovos_workshop/skills/common_play.py

16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)

🔇 Additional comments (35)
ovos_workshop/skills/__init__.py (1)

1-6: LGTM! These changes align with the PR objectives.

The modifications to the import statements in this __init__.py file reflect the broader refactoring effort to remove Mycroft dependencies:

  1. Removal of OVOSFallbackSkill and MycroftSkill imports aligns with dropping Mycroft.
  2. Addition of FallbackSkill, CommonQuerySkill, and OVOSCommonPlaybackSkill imports suggests a restructuring of the skills hierarchy, likely to replace the removed Mycroft-dependent classes.

These changes appear to be part of the coordinated update across the OpenVoiceOS ecosystem mentioned in the PR objectives.

🧰 Tools
🪛 Ruff

1-1: ovos_workshop.decorators.layers.IntentLayers imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


2-2: ovos_workshop.skills.ovos.OVOSSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: ovos_workshop.skills.idle_display_skill.IdleDisplaySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: ovos_workshop.skills.fallback.FallbackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: ovos_workshop.skills.common_query_skill.CommonQuerySkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


6-6: ovos_workshop.skills.common_play.OVOSCommonPlaybackSkill imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

test/unittests/skills/test_active.py (1)

5-5: LGTM: Import statement added for OVOSSkill

The addition of this import statement is consistent with the refactoring effort to remove Mycroft dependencies and transition to OVOS-specific classes.

test/unittests/test_context.py (5)

7-19: Well-structured mock class for testing context decorators.

The ContextSkillMock class is well-designed for testing the context management decorators:

  1. It correctly inherits from mock.Mock, which is ideal for unit testing.
  2. Each method tests a different aspect of context management:
    • handler_adding_context: Tests adding a context without additional parameters.
    • handler_adding_context_with_words: Tests adding a context with an additional keyword.
    • handler_removing_context: Tests removing a context.

This structure provides good coverage for testing the adds_context and removes_context decorators.


22-22: Appropriate test class structure.

The TestContextDecorators class is correctly defined:

  1. It inherits from TestCase, which is the standard approach in Python's unittest framework.
  2. The class name clearly indicates its purpose of testing context decorators.

This structure provides a solid foundation for organizing the context decorator tests.


23-34: Well-implemented tests for context addition.

The test_adding_context and test_adding_context_with_words methods are well-structured and effective:

  1. They create separate instances of ContextSkillMock for each test, ensuring test isolation.
  2. The methods correctly call the decorated handlers and verify the expected behavior.
  3. assert_called_once_with is used appropriately to check both the context name and any additional parameters.

These tests provide good coverage for the adds_context decorator functionality.


36-40: Effective test for context removal.

The test_removing_context method is well-implemented:

  1. It creates a new instance of ContextSkillMock, maintaining test isolation.
  2. The method correctly calls the decorated handler and verifies the expected behavior.
  3. assert_called_once_with is used appropriately to check that the correct context name is passed to remove_context.

This test provides good coverage for the removes_context decorator functionality.


1-40: Overall, excellent test implementation supporting the refactoring effort.

This new test file, test/unittests/test_context.py, is a valuable addition to the codebase:

  1. It provides comprehensive unit tests for the context management decorators, which is crucial for ensuring their reliability during and after the refactoring process.
  2. The test structure and implementation follow best practices for Python unit testing.
  3. The file aligns well with the PR objective of refactoring and removing Mycroft dependencies, as it focuses on testing OVOS-specific decorators.

The only minor point to address is the TODO comment at the beginning of the file. Once that's clarified or resolved, this file will be in excellent shape.

test/unittests/test_common_query_skill.py (1)

1-5: LGTM: Appropriate imports for unit testing

The import statements are well-structured and include all necessary modules for unit testing the CommonQuerySkill. The use of mock is particularly good for isolating the tests.

ovos_workshop/decorators/ocp.py (1)

1-2: Approve the import source change, but remove unused imports.

The change in import source from ovos_workshop.backwards_compat to ovos_utils.ocp aligns with the PR objective of refactoring and removing legacy components. This is a good move towards a more modern and streamlined implementation.

However, as previously noted, static analysis indicates that some of the imported types are unused. Please remove the unused imports to keep the code clean and maintainable.

Apply this diff to remove the unused imports:

-from ovos_utils.ocp import MediaType, PlayerState, MediaState, MatchConfidence, \
-        PlaybackType, PlaybackMode, LoopState, TrackState
+from ovos_utils.ocp import PlaybackType, PlaybackMode, LoopState, TrackState
🧰 Tools
🪛 Ruff

1-1: ovos_utils.ocp.MediaType imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.PlayerState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


1-1: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


2-2: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

test/unittests/test_skill_api.py (3)

1-6: LGTM: Import statements are appropriate and complete.

The import statements are well-organized and include all necessary modules for the unit tests. Good job on keeping the imports clean and relevant.


33-41: LGTM: load_test_skill function is well-implemented.

The load_test_skill function is a well-designed helper for creating a test skill instance. It correctly mocks the bus and initializes the Skill class with appropriate parameters.


44-54: LGTM: create_skill_api_from_skill function is well-implemented.

The create_skill_api_from_skill function is a well-designed helper for creating a SkillApi instance from a given skill. It correctly connects the skill's bus and initializes the SkillApi with the skill's public API.

test/unittests/test_intent_service_interface.py (5)

6-25: LGTM: MockEmitter class implementation.

The MockEmitter class is well-structured and appropriate for mocking an event emitter in these tests. It provides the necessary functionality to emit messages, retrieve emitted types and results, and reset the state.


28-87: LGTM: KeywordRegistrationTest class implementation.

The KeywordRegistrationTest class is well-structured and covers various scenarios for keyword registration. The use of check_emitter method with sorting for comparison is a good practice for handling potentially unordered results.


89-117: LGTM: KeywordIntentRegistrationTest class implementation.

The KeywordIntentRegistrationTest class is well-implemented and tests the basic scenario of registering an intent with required and optional keywords. The check_emitter method is consistent with the previous test class, which is good for maintainability.


120-144: LGTM: UtteranceIntentRegistrationTest class implementation.

The UtteranceIntentRegistrationTest class is well-implemented and tests the scenario of registering an intent from a file containing sample utterances. The check_emitter method maintains consistency with previous test classes.


1-145: Overall, well-structured and comprehensive test suite.

This test file provides good coverage for the IntentServiceInterface class, including tests for keyword registration, intent registration, and utterance-based intent registration. The use of a mock emitter and consistent checking methods across test classes is commendable.

To further improve the test suite:

  1. Address the TODO comment about moving the test to ovos-workshop.
  2. Consider removing or updating the outdated TODO about compatibility data.
  3. Implement a mock file system for better test isolation in UtteranceIntentRegistrationTest.

These improvements will enhance the robustness and maintainability of the test suite.

ovos_workshop/skills/fallback.py (4)

16-16: Improved imports and simplified class inheritance.

The changes to the imports and class definition are positive:

  1. Adding Optional and List from typing improves type hinting, which enhances code readability and helps catch potential type-related issues.
  2. Simplifying the class inheritance by directly inheriting from OVOSSkill removes the complexity of the metaclass and improves code clarity.

These changes align well with modern Python practices and should make the code easier to maintain.

Also applies to: 30-30


145-146: Consistent update of event names.

The changes in the _register_system_event_handlers method align well with the PR objective of removing Mycroft dependencies:

  1. Replacing "mycroft.skills.fallback" with "ovos.skills.fallback" in event names maintains consistency across the codebase.
  2. This change contributes to the overall goal of transitioning from Mycroft to OVOS throughout the project.

These updates are appropriate and support the refactoring efforts.


155-158: Improved fallback acknowledgment message.

The changes in the _handle_fallback_ack method enhance the fallback handling process:

  1. Updating the emitted message name from "mycroft.skills.fallback.response" to "ovos.skills.fallback.pong" maintains consistency with the OVOS naming convention.
  2. Including the skill_id in both the message data and context provides more comprehensive information for downstream handlers.

These changes improve the clarity and informativeness of the fallback acknowledgment process.


Line range hint 1-264: Clarification needed on timing metrics handling.

The removal of the _report_timing method suggests a change in how timing metrics are handled. This could potentially affect performance monitoring capabilities.

Could you please clarify:

  1. How will timing metrics be reported after this change?
  2. Is there a new mechanism in place for performance monitoring?
  3. If timing metrics are no longer being collected, what is the rationale behind this decision?

Understanding these points will help ensure that important performance data is not lost with this refactoring.

test/unittests/skills/test_base.py (5)

9-11: LGTM: Successful transition to OVOSSkill

The changes in the import statements and class definition correctly reflect the transition from BaseSkill to OVOSSkill. This is in line with the PR objective of removing Mycroft dependencies.

Also applies to: 16-16, 21-21


327-327: LGTM: Correct update to OVOSSkill in test_register_intent_file

The change from BaseSkill to OVOSSkill in the test_register_intent_file method is correct and consistent with the refactoring effort.


353-353: LGTM: Correct update to OVOSSkill in test_register_entity_file

The change from BaseSkill to OVOSSkill in the test_register_entity_file method is correct and consistent with the refactoring effort.


153-153: ⚠️ Potential issue

Correct the usage of self.OVOSSkill to OVOSSkill

The test_skill initialization should use OVOSSkill directly instead of self.OVOSSkill. This is because OVOSSkill is imported at the module level and not an attribute of the test class.

Apply this diff to correct the reference:

-        test_skill = self.OVOSSkill(bus=self.bus, skill_id=test_skill_id)
+        test_skill = OVOSSkill(bus=self.bus, skill_id=test_skill_id)

Likely invalid or redundant comment.


469-469: ⚠️ Potential issue

Correct the usage of self.OVOSSkill to OVOSSkill

The test_skill initialization should use OVOSSkill directly instead of self.OVOSSkill. This is because OVOSSkill is imported at the module level and not an attribute of the test class.

Apply this diff to correct the reference:

-        test_skill = self.OVOSSkill(bus=self.bus, skill_id=test_skill_id)
+        test_skill = OVOSSkill(bus=self.bus, skill_id=test_skill_id)

Likely invalid or redundant comment.

ovos_workshop/skill_launcher.py (3)

Line range hint 1-724: Overall assessment: Successful transition to OVOS with room for future improvements

The changes in this file successfully achieve the PR objective of removing Mycroft dependencies and transitioning to OVOS. Key points:

  1. Mycroft-specific imports and base classes have been removed.
  2. The code now focuses on OVOSSkill and related classes.
  3. Backward compatibility has been maintained where possible, with appropriate deprecation warnings.

These changes are well-implemented and should provide a solid foundation for OVOS-based skills.

For future improvements, consider:

  1. Gradually phasing out support for old-style skill initialization to simplify the codebase.
  2. Refactoring complex methods (like _create_skill_instance) into smaller, more focused methods.
  3. Updating documentation to guide skill developers in transitioning to the new OVOS-based structure.
  4. Implementing a more robust error handling and logging system to help diagnose issues during skill loading and execution.

To ensure the changes haven't inadvertently broken any existing functionality, consider running a comprehensive test suite that covers various skill loading scenarios. This could include:

#!/bin/bash
# Run pytest for the skill_launcher module
pytest tests/test_skill_launcher.py

# Check for any remaining references to Mycroft in the codebase
rg -t python 'Mycroft(?!Skill)'

These steps will help validate the changes and identify any areas that might need further attention.


155-155: Approve type hint update and verify usage

The update of the instance type hint from Optional[BaseSkill] to Optional[OVOSSkill] is consistent with the transition to OVOS and improves type safety.

To ensure all usages of self.instance are compatible with this change, please run the following script:

Review the results to confirm that all usages are compatible with the OVOSSkill type.


24-28: Verify backward compatibility for existing skills

The removal of Mycroft-related imports and the update to SKILL_BASE_CLASSES align with the PR objective of removing Mycroft dependencies. However, this change may break backward compatibility for skills that rely on Mycroft-specific classes.

To ensure a smooth transition, please run the following script to check for any skills in the repository that might be affected by this change:

Consider adding a deprecation warning for skills still using Mycroft-specific base classes, and update the documentation to guide developers in migrating their skills to use OVOS-specific base classes.

✅ Verification successful

Backward compatibility verified: No Mycroft-specific classes found

The removal of Mycroft-related imports and the update to SKILL_BASE_CLASSES have been successfully verified. No classes in the codebase inherit from MycroftSkill or BaseSkill, ensuring that backward compatibility is maintained without dependencies on Mycroft-specific classes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for skills still using Mycroft-specific classes
rg -t python 'class.*\((MycroftSkill|BaseSkill)\)' 

Length of output: 372


Script:

#!/bin/bash
# Search for Python classes inheriting from MycroftSkill or BaseSkill using ast-grep
ast-grep --lang python --pattern 'class $_(MycroftSkill|BaseSkill):' '**/*.py'

Length of output: 135


Script:

#!/bin/bash
# Find all Python files and search for classes inheriting from MycroftSkill or BaseSkill
fd --extension py --type f | xargs ast-grep --lang python --pattern 'class $_(MycroftSkill|BaseSkill):'

Length of output: 105

ovos_workshop/skills/common_play.py (3)

Line range hint 89-116: LGTM: Enhanced event handling in bind method

The expanded bind method now registers multiple event handlers for various playback control messages. This enhancement improves the skill's ability to respond to a broader range of commands, making it more versatile and responsive.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 118-124: LGTM: New method for dynamic media type registration

The register_media_type method is a valuable addition that allows for dynamic registration of media types at runtime. This enhances the skill's flexibility and adaptability. The method also properly logs the registration and syncs changes via the bus, ensuring consistency across the system.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)


Line range hint 1-545: Overall: Excellent refactoring and enhancement of OVOSCommonPlaybackSkill

The changes made to this file represent a significant improvement in the OVOSCommonPlaybackSkill's functionality and its integration with the OVOS ecosystem. Key improvements include:

  1. Successful removal of Mycroft dependencies, aligning with the PR's main objective.
  2. Enhanced event handling and playback control capabilities.
  3. Addition of new methods for dynamic media type registration and efficient keyword matching.
  4. Improved search query handling with support for both list and generator return types.

These changes have resulted in a more robust, flexible, and OVOS-centric implementation of the common playback skill. The code is well-structured and includes helpful comments and docstrings, which will aid in future maintenance and development.

🧰 Tools
🪛 Ruff

14-14: ovos_workshop.decorators.ocp.ocp_play imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_next imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_pause imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_resume imported but unused

Remove unused import

(F401)


14-14: ovos_workshop.decorators.ocp.ocp_search imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_previous imported but unused

Remove unused import

(F401)


15-15: ovos_workshop.decorators.ocp.ocp_featured_media imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MediaState imported but unused

Remove unused import

(F401)


16-16: ovos_utils.ocp.MatchConfidence imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackType imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.PlaybackMode imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.LoopState imported but unused

Remove unused import

(F401)


17-17: ovos_utils.ocp.TrackState imported but unused

Remove unused import

(F401)

ovos_workshop/skills/ovos.py (2)

Line range hint 1-36: Comprehensive import structure and core class definition

The file begins with an extensive set of imports, covering standard library modules, third-party libraries, and local OVOS modules. This comprehensive import list suggests that the OVOSSkill class, defined here, is a central component of the OVOS skill system with wide-ranging functionality.


Line range hint 39-52: LGTM: Useful utility function for simplifying stack traces

The simple_trace function provides a clean way to simplify stack traces by removing empty lines and the last line. This can be helpful for more readable error reporting.

test/unittests/test_skill_loader.py (1)

85-85: Verify the message format in _handle function

In the _handle function, msg is passed directly to json.loads(msg). Ensure that msg is a JSON string. If msg is a Message object, you may need to serialize it before loading.

Comment on lines +1 to +5
from unittest import TestCase, mock

# TODO - move to ovos-workshop
from ovos_workshop.decorators import adds_context, removes_context

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Remove remaining Mycroft import in ovos_workshop/resource_files.py.

The shell script detected a Mycroft import that needs to be addressed:

  • ovos_workshop/resource_files.py: from mycroft import MYCROFT_ROOT_PATH

Please remove or refactor this import to ensure all Mycroft dependencies are eliminated.

🔗 Analysis chain

Address the TODO comment and consider the import structure.

The TODO comment suggests moving something to ovos-workshop. This should be addressed or clarified:

  1. If this entire file should be moved, consider doing so as part of this PR.
  2. If only specific parts need to be moved, please specify which parts in the comment.

Additionally, the imports look appropriate for unit testing, and the use of ovos_workshop.decorators aligns with the PR's objective of refactoring away from Mycroft.

To ensure we're not missing any Mycroft imports, let's run this check:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining Mycroft imports in the codebase

# Test: Search for Mycroft imports
rg --type python 'from mycroft|import mycroft'

Length of output: 79


Script:

#!/bin/bash
# Description: Check for any remaining Mycroft imports in Python files

rg --glob '*.py' 'from mycroft|import mycroft'

Length of output: 130

Comment on lines +137 to +139
filename = "/tmp/test.intent"
with open(filename, "w") as f:
f.write("this is a test\ntest the intent")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using a mock file system for better test isolation.

The current implementation creates a temporary file at "/tmp/test.intent". This approach might cause issues in environments where the "/tmp" directory is not available or writable. Consider using a mock file system (e.g., pyfakefs) for better test isolation and portability.

Here's an example of how you could refactor this using pyfakefs:

from pyfakefs.fake_filesystem_unittest import TestCase

class UtteranceIntentRegistrationTest(TestCase):
    def setUp(self):
        self.setUpPyfakefs()
        self.emitter = MockEmitter()

    def test_register_intent(self):
        intent_service = IntentServiceInterface(self.emitter)
        filename = "/test.intent"
        self.fs.create_file(filename, contents="this is a test\ntest the intent")

        intent_service.register_padatious_intent('test', filename, lang='en-US')
        expected_data = {'file_name': '/test.intent', 'lang': 'en-US', 'name': 'test',
                         'samples': ['this is a test', 'test the intent']}
        self.check_emitter([expected_data])

This approach eliminates the need for actual file I/O during testing, making the tests more robust and portable.

self.check_emitter([expected_data])

def test_register_keyword_with_aliases(self):
# TODO 22.02: Remove compatibility data
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Compatibility data is still in use across the codebase and should not be removed at this time.

  • Found usage of compatibility_data in ovos_workshop/intents.py.
🔗 Analysis chain

Address the TODO comment about removing compatibility data.

The TODO comment suggests removing compatibility data in version 22.02. Since we're now in 2024, this TODO is outdated and should be addressed.

Let's verify if this compatibility data is still necessary:

Based on the results, decide whether to remove the compatibility data or update the TODO comment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of 'start' and 'end' keys in compatibility data
rg --type python 'start.*end.*test_intent'

Length of output: 75


Script:

#!/bin/bash
# Corrected search for usage of 'start' and 'end' keys in compatibility data within Python files
rg --type py 'start.*end.*test_intent'

Length of output: 513


Script:

#!/bin/bash
# Search for all usages of 'compatibility_data' in the codebase
rg 'compatibility_data'

Length of output: 872

Comment on lines +163 to +164
self.bus.emit(message.forward(f"ovos.skills.fallback.{self.skill_id}.killed",
data={"error": "timed out"}))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improved timeout handling with a suggestion for error handling.

The changes in the _on_timeout method enhance the fallback timeout process:

  1. Updating the emitted message name to "ovos.skills.fallback.<skill_id>.killed" maintains consistency with the OVOS naming convention and provides more specific information about which skill timed out.
  2. Including error data in the message provides valuable context about the timeout.

These changes improve the clarity and informativeness of the timeout handling process.

However, as mentioned in a previous review comment, there's still a potential issue with error handling:

message = dig_for_message()
self.bus.emit(message.forward(...))

If dig_for_message() returns None, this could lead to an AttributeError. Consider adding a check to handle this case:

message = dig_for_message()
if message:
    self.bus.emit(message.forward(...))
else:
    LOG.warning("No message found; unable to emit 'killed' event.")

This addition would make the method more robust against potential errors.

Comment on lines +51 to +52
# "skill_id": priority (int) overrides
fallback_config = Configuration().get("skills", {}).get("fallbacks", {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consider moving fallback_config initialization to the constructor.

The initialization of fallback_config at the class level may lead to issues if the configuration changes during runtime, as class variables do not update dynamically. This change contradicts the previous review comment suggesting to move the initialization to the constructor.

To ensure fallback_config always reflects the current configuration, consider moving its initialization to the __init__ method:

 class FallbackSkill(OVOSSkill):
-    fallback_config = Configuration().get("skills", {}).get("fallbacks", {})

     def __init__(self, bus=None, skill_id="", **kwargs):
+        self.fallback_config = Configuration().get("skills", {}).get("fallbacks", {})
         self._fallback_handlers = []
         super().__init__(bus=bus, skill_id=skill_id, **kwargs)

This approach ensures that each instance of FallbackSkill has its own up-to-date configuration.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# "skill_id": priority (int) overrides
fallback_config = Configuration().get("skills", {}).get("fallbacks", {})
class FallbackSkill(OVOSSkill):
# "skill_id": priority (int) overrides
def __init__(self, bus=None, skill_id="", **kwargs):
self.fallback_config = Configuration().get("skills", {}).get("fallbacks", {})
self._fallback_handlers = []
super().__init__(bus=bus, skill_id=skill_id, **kwargs)

)


msgs = []
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unused variable msgs

The variable msgs declared on line 78 is not used elsewhere in the code. Removing it can clean up the code.

Comment on lines +92 to +96
skill_directory = Path('/tmp/test_skill')
skill_directory.mkdir(exist_ok=True)
for file_name in ('__init__.py', 'bar.py', '.foobar', 'bar.pyc'):
skill_directory.joinpath(file_name).touch()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use tempfile module for creating temporary directories

Creating a fixed directory at /tmp/test_skill may lead to conflicts if multiple tests run concurrently or if the directory already exists. Consider using the tempfile module to create a unique temporary directory that is automatically cleaned up.

Here's how you can modify the code:

import tempfile

class TestSkillLoader(unittest.TestCase):
    def setUp(self):
        self.temp_dir = tempfile.TemporaryDirectory()
        self.skill_directory = Path(self.temp_dir.name)
        for file_name in ('__init__.py', 'bar.py', '.foobar', 'bar.pyc'):
            self.skill_directory.joinpath(file_name).touch()

    def tearDown(self):
        self.temp_dir.cleanup()

Comment on lines +188 to +190
['mycroft.skills.loading_failure'],
[m["type"] for m in bus.msgs]
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update message type to ovos.skills.loading_failure

The test asserts the message type 'mycroft.skills.loading_failure'. Update it to 'ovos.skills.loading_failure' to align with the namespace changes.

Apply this diff:

- ['mycroft.skills.loading_failure'],
+ ['ovos.skills.loading_failure'],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
['mycroft.skills.loading_failure'],
[m["type"] for m in bus.msgs]
)
['ovos.skills.loading_failure'],
[m["type"] for m in bus.msgs]
)

Comment on lines +160 to +162
['mycroft.skills.loaded'],
[m["type"] for m in bus.msgs]
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update message type to ovos.skills.loaded

The test checks for 'mycroft.skills.loaded'. Change this to 'ovos.skills.loaded' to match the updated namespace.

Apply this diff:

- ['mycroft.skills.loaded'],
+ ['ovos.skills.loaded'],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
['mycroft.skills.loaded'],
[m["type"] for m in bus.msgs]
)
['ovos.skills.loaded'],
[m["type"] for m in bus.msgs]
)

Comment on lines +129 to +131
['mycroft.skills.shutdown', 'mycroft.skills.loaded'],
[m["type"] for m in bus.msgs]
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update message types to ovos.skills.*

The test asserts message types 'mycroft.skills.shutdown' and 'mycroft.skills.loaded'. Since Mycroft components are being removed, update these to 'ovos.skills.shutdown' and 'ovos.skills.loaded' to reflect the new namespace.

Apply this diff:

- ['mycroft.skills.shutdown', 'mycroft.skills.loaded'],
+ ['ovos.skills.shutdown', 'ovos.skills.loaded'],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
['mycroft.skills.shutdown', 'mycroft.skills.loaded'],
[m["type"] for m in bus.msgs]
)
['ovos.skills.shutdown', 'ovos.skills.loaded'],
[m["type"] for m in bus.msgs]
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant