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

deprecate!:backend client #295

Merged
merged 3 commits into from
Nov 19, 2024
Merged

deprecate!:backend client #295

merged 3 commits into from
Nov 19, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Nov 18, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced logic for managing settings, including improved file handling and checks for device pairing status.
  • Bug Fixes

    • Streamlined event handling for uploading and downloading settings to ensure proper functionality.
  • Refactor

    • Simplified settings management within the OVOSSkill class by removing unnecessary components and parameters.
    • Removed dependency on ovos-backend-client, indicating a shift in project requirements.
    • Updated initialization processes across various components to eliminate settings-related complexities.
  • Tests

    • Removed tests related to the settings manager initialization, reflecting changes in settings management focus.
    • Deleted the unimplemented TestSettings class to clean up the test suite.

Copy link

coderabbitai bot commented Nov 18, 2024

Walkthrough

The changes involve significant modifications to the SkillSettingsManager class and the OVOSSkill class within the ovos_workshop module. The SkillSettingsManager has been updated to improve its handling of settings, including file management and pairing status checks. In contrast, the OVOSSkill class has undergone a simplification by removing the settings manager and related methods, indicating a shift towards local settings management. Corresponding unit tests have also been adjusted to reflect these changes, with some tests removed to align with the new structure.

Changes

File Change Summary
ovos_workshop/settings.py - Modified SkillSettingsManager: updated constructor, methods _download, stop, load_meta, save_meta, upload, upload_meta, download, and event handlers.
- Method signatures updated for multiple methods.
ovos_workshop/skills/ovos.py - Removed enable_settings_manager parameter from __init__.
- Removed _upload_settings and _init_settings_manager methods, simplifying settings management.
test/unittests/skills/test_base.py - Removed assertions related to the settings manager from TestOVOSSkill.
test/unittests/skills/test_ovos.py - Removed test_settings_manager_init method from TestOVOSSkill.
test/unittests/test_settings.py - Completely removed TestSettings class, which was unimplemented.
requirements/requirements.txt - Removed dependency on ovos-backend-client.
ovos_workshop/app.py - Removed lang, settings, and enable_settings_manager parameters from __init__.
test/unittests/test_abstract_app.py - Removed settings and settings_obj attributes from TestApp, along with related tests.

Possibly related PRs

  • feat:skilljson and homescreen #283: The changes in the OVOSSkill class related to homescreen integration and skill metadata management are relevant to the modifications in the SkillSettingsManager class, as both involve enhancements to how skills interact with settings and metadata, particularly in the context of user interaction and application management.

Suggested labels

feature

Poem

In the burrow deep, where settings play,
A rabbit hops, with changes at bay.
The manager's gone, but fear not, dear friend,
For local settings now smoothly blend.
With files in order, and pairing in check,
Hooray for the tweaks, what the heck! 🐰✨


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.

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.57%. Comparing base (7c02206) to head (193df9e).
Report is 139 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #295      +/-   ##
==========================================
- Coverage   53.41%   51.57%   -1.84%     
==========================================
  Files          37       36       -1     
  Lines        4362     4178     -184     
==========================================
- Hits         2330     2155     -175     
+ Misses       2032     2023       -9     

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


🚨 Try these New Features:

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
test/unittests/test_abstract_app.py (3)

Line range hint 12-14: Fix critical typo in __init__ method name

There's a typo in the method name __int__ which should be __init__. This prevents proper initialization of the Application class and could lead to unexpected behavior in tests.

Apply this fix:

- def __int__(self, *args, **kwargs):
+ def __init__(self, *args, **kwargs):

Line range hint 67-68: Address TODO comments in test methods

These test methods are marked as TODO but appear to be testing important functionality:

  • test_get_language_dir: Language directory handling
  • test_clear_intents: Intent management

Having these tests implemented would improve test coverage and ensure proper functionality.

Would you like me to help implement these test methods or create GitHub issues to track them?

Also applies to: 71-72


Line range hint 29-46: Improve robustness of settings path test cleanup

While the test includes cleanup of temporary files, it could be more robust by using a try-finally block to ensure cleanup even if assertions fail.

Consider refactoring the test like this:

 def test_settings_path(self):
     self.assertIn("/apps/", self.app.settings_path)
 
     # Test settings path conflicts
     test_app = OVOSAbstractApplication(skill_id="test", bus=self.bus)
     test_skill = OVOSSkill(skill_id="test", bus=self.bus)
-
-    # Test app vs skill base directories
-    self.assertIn("/apps/", test_app.settings_path)
-    self.assertIn("/skills/", test_skill.settings_path)
-
-    # Test settings changes
-    test_skill.settings['is_skill'] = True
-    test_app.settings['is_skill'] = False
-    self.assertTrue(test_skill.settings['is_skill'])
-    self.assertFalse(test_app.settings['is_skill'])
-
-    # Cleanup test files
-    remove(test_app.settings_path)
-    remove(test_skill.settings_path)
+    try:
+        # Test app vs skill base directories
+        self.assertIn("/apps/", test_app.settings_path)
+        self.assertIn("/skills/", test_skill.settings_path)
+
+        # Test settings changes
+        test_skill.settings['is_skill'] = True
+        test_app.settings['is_skill'] = False
+        self.assertTrue(test_skill.settings['is_skill'])
+        self.assertFalse(test_app.settings['is_skill'])
+    finally:
+        # Cleanup test files
+        for path in [test_app.settings_path, test_skill.settings_path]:
+            try:
+                remove(path)
+            except FileNotFoundError:
+                pass
ovos_workshop/app.py (2)

17-24: Update docstring to reflect parameter changes

The docstring needs to be updated to remove references to the removed parameters.

Apply this diff to update the documentation:

        """
        Create an Application. An application is essentially a skill, but
        designed such that it may be run without an intent service.
        @param skill_id: Unique ID for this application
        @param bus: MessageBusClient to bind to application
        @param resources_dir: optional root resource directory (else defaults to
            application `root_dir`
+       @param gui: GUIInterface to bind (if `None`, one is created)
+       @param kwargs: Additional keyword arguments passed to OVOSSkill
        """

Line range hint 16-35: Architectural changes align with backend client deprecation

The removal of settings management from the constructor aligns with the broader goal of deprecating the backend client. The changes simplify the application initialization while maintaining core functionality.

Consider documenting these architectural changes in the project's documentation to help users migrate their applications.

Would you like me to help create migration documentation or examples for updating existing applications?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bdaee47 and 193df9e.

📒 Files selected for processing (3)
  • ovos_workshop/app.py (1 hunks)
  • test/unittests/skills/test_base.py (0 hunks)
  • test/unittests/test_abstract_app.py (1 hunks)
💤 Files with no reviewable changes (1)
  • test/unittests/skills/test_base.py
🔇 Additional comments (2)
test/unittests/test_abstract_app.py (1)

24-24: LGTM: Simplified application initialization

The removal of settings-related parameters aligns with the broader initiative to simplify settings management across the codebase.

ovos_workshop/app.py (1)

16-16: ⚠️ Potential issue

Breaking change: Parameters removed from constructor

The removal of lang, settings, and enable_settings_manager parameters is a breaking change that could affect existing applications.

Let's verify the impact on existing applications:

@JarbasAl JarbasAl merged commit 3c026c2 into dev Nov 19, 2024
9 of 10 checks passed
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