fix: wire --config-dir CLI flag to Config initialization#2121
fix: wire --config-dir CLI flag to Config initialization#2121themavik wants to merge 1 commit intoelementary-data:masterfrom
Conversation
Fixes elementary-data#2037 The --config-dir flag was parsed but never passed to Config(), which always used the default ~/.edr. This wires the CLI argument through so the custom config directory is actually used. - Remove premature directory creation from Config._load_configuration that ran at import time (logo/upgrade) and created ~/.edr before CLI parsing - Create config_dir in anonymous_tracking when writing user id file - Add --config-dir to debug and dbt_init commands for consistency - Use keyword args for Config() in report command for clarity
|
👋 @themavik |
📝 WalkthroughWalkthroughRemoved automatic configuration directory creation in the config loading process, with explicit directory creation now added in anonymous tracking before file operations. Logging message improved for anonymous event failures. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
elementary/tracking/anonymous_tracking.py (1)
20-33:⚠️ Potential issue | 🟠 MajorAdd
config_dirparameter todebuganddbt_initcommand handlers.Both commands are missing
config_dirsupport despite the PR objective stating it was added:
- debug (line 801):
Config(profiles_dir=profiles_dir)— noconfig_dirparameter- dbt_init (line 824):
Config()— no parameters at allFor consistency with the
monitorcommand (line 349–351), both should accept and passconfig_dirtoConfig(). Without this, anonymous tracking will resolveuser_id_pathagainst the default~/.edreven when--config-diris supplied.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@elementary/tracking/anonymous_tracking.py` around lines 20 - 33, The debug and dbt_init command handlers are not passing the user-supplied config_dir into the Config constructor so anonymous tracking still resolves user_id_path against the default; update the debug handler (where it currently calls Config(profiles_dir=profiles_dir)) to accept a config_dir parameter and call Config(profiles_dir=profiles_dir, config_dir=config_dir), and update the dbt_init handler (where it currently calls Config()) to accept config_dir and call Config(config_dir=config_dir) — mirror how monitor passes config_dir to Config to ensure anonymous tracking uses the supplied directory.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@elementary/tracking/anonymous_tracking.py`:
- Around line 20-33: The debug and dbt_init command handlers are not passing the
user-supplied config_dir into the Config constructor so anonymous tracking still
resolves user_id_path against the default; update the debug handler (where it
currently calls Config(profiles_dir=profiles_dir)) to accept a config_dir
parameter and call Config(profiles_dir=profiles_dir, config_dir=config_dir), and
update the dbt_init handler (where it currently calls Config()) to accept
config_dir and call Config(config_dir=config_dir) — mirror how monitor passes
config_dir to Config to ensure anonymous tracking uses the supplied directory.
Fixes #2037
The
--config-dirflag was parsed but never passed toConfig(), which always used the default~/.edr. This wires the CLI argument through so the custom config directory is actually used.Changes:
elementary/config/config.py: removed prematureos.makedirsfrom_load_configuration()elementary/tracking/anonymous_tracking.py: create config dir only when writing user ID fileelementary/monitor/cli.py: passconfig_dirargument through toConfig()Summary by CodeRabbit
Release Notes
Bug Fixes
Chores