refactor(pm): add catalog config support and rename init_project_root#2673
Conversation
- Add `[catalog]` and `[catalogs.*]` sections to Config struct via serde - Add `Config::catalogs()` method to build merged catalogs map - Add `get_catalogs()` accessor in user_config (used by upcoming catalog protocol) - Rename `update_cwd_to_root` to `init_project_root` for clarity - Add unit tests for catalog parsing (default, named, empty, coexistence) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 primarily focuses on enhancing the project's configuration management system and improving code clarity. It introduces robust support for defining package catalogs through TOML configuration files, which is a foundational step for an upcoming catalog protocol feature. Concurrently, a key function responsible for initializing the project root has been renamed to better reflect its purpose, making the codebase more intuitive and maintainable. Highlights
Changelog
Activity
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
The pull request successfully refactors the update_cwd_to_root function to init_project_root, improving clarity and providing better documentation. It also introduces comprehensive support for catalog configurations, including default and named catalogs, with appropriate serde deserialization attributes and a new accessor method. While these changes contribute positively to the codebase, the implementation introduces significant security risks in the configuration management logic. Specifically, there is a potential for local project settings to pollute the global configuration file and a process-wide cache that leads to cross-directory configuration leaks. These vulnerabilities should be addressed by separating global and local configuration states and ensuring that the cache is directory-aware or avoided for merged configurations.
Summary
[catalog]and[catalogs.*]TOML sections toConfigstruct via serde deserializationConfig::catalogs()method andget_catalogs()accessor inuser_configupdate_cwd_to_root→init_project_rootfor clarityPrerequisite for the catalog protocol feature (
feat/pm-catalog-protocol).Test plan
cargo test -p utoo-pm -- util::config_file— 5 tests passcargo clippy -p utoo-pm --all-targets -- -D warnings --no-deps— clean🤖 Generated with Claude Code