fix: change log path to user home and force uvx refresh in install scripts - #443
Conversation
Summary of ChangesHello @julienld, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical reliability issues by preventing 'Read-only file system' errors during logging and ensuring that installation processes consistently retrieve the most current package versions. These changes enhance the robustness of the application in diverse deployment environments and improve the user experience by avoiding common installation and runtime failures. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses two distinct issues: ensuring the usage logger can write to a file in restricted environments, and forcing a refresh of the ha-mcp package during installation to prevent using stale cached versions. The changes are well-implemented. The log path is now defaulted to the user's home directory, which is a much safer default. The installation scripts for both macOS and Windows are correctly updated to include the --refresh flag. A new unit test is also added to verify the new default log path, which is great. I have one suggestion to make the new test assertion more precise.
| assert str(logger.log_file_path).startswith(str(Path.home())) | ||
| assert ".ha-mcp" in str(logger.log_file_path) |
There was a problem hiding this comment.
The assertions here are a bit loose. Using startswith and in could potentially pass for incorrect paths. A direct equality check against the expected Path object would be more precise and robust. This ensures the path is exactly what's expected, including all components.
| assert str(logger.log_file_path).startswith(str(Path.home())) | |
| assert ".ha-mcp" in str(logger.log_file_path) | |
| expected_path = Path.home() / ".ha-mcp" / "logs" / "mcp_usage.jsonl" | |
| assert logger.log_file_path == expected_path |
…ripts (homeassistant-ai#443) * fix: change default log path to user home dir to avoid read-only errors * fix: force uvx refresh in install scripts to ensure latest version
Description
Fixes issues where users encounter 'Read-only file system' errors because the default log path was relative to the current working directory, which can be read-only in restricted environments like uvx caches.
Also updates installation scripts to force 'uvx' to refresh the package version, ensuring users are not stuck on stale cached versions.
Changes
UsageLoggerto~/.ha-mcp/logs/mcp_usage.jsonl--refreshflag touvxcommands inscripts/install-macos.shandscripts/install-windows.ps1Related Issues