[10/10] refactor: thin the CLI composition root - #102
Conversation
📝 WalkthroughWalkthroughProvider construction moves from ChangesProvider composition refactor
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant composition.providers
participant llm.any_llm
participant WeatherProviders
participant DeliveryProvider
CLI->>composition.providers: request configured adapters
composition.providers->>llm.any_llm: create structured LLM provider
composition.providers->>WeatherProviders: build weather and supplement providers
composition.providers->>DeliveryProvider: build selected publisher
composition.providers-->>CLI: return composed providers
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
/agentic_review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #102 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 91 87 -4
Lines 9535 9535
Branches 563 563
=======================================
Hits 9518 9518
Misses 12 12
Partials 5 5 ☔ View full report in Codecov by Harness. |
Code Review by Qodo
1.
|
74cbbdc to
ebaca3b
Compare
66ec530 to
6deca90
Compare
ebaca3b to
eaeeb8c
Compare
6deca90 to
3c54109
Compare
eaeeb8c to
986cb4e
Compare
3c54109 to
6f2da79
Compare
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 6f2da79 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 0d32253 |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 127cb12 |
|
Code review by qodo was updated up to the latest commit 127cb12 |
PR Summary by QodoRefactor: move provider composition out of the CLI entrypoint
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
weather_briefing/composition/providers.py (1)
252-329: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRedundant builder registry vs. special-casing in
build_weather_provider.
WEATHER_PROVIDER_BUILDERSis fetched intobuilder, but that value is only invoked for the fall-through (Open-Meteo) case — QWeather/NEA/JMA are special-cased above, so the dict acts mostly as an existence check. The NEA branch (Line 267) also duplicates_build_neaverbatim. Consider either dispatching through the registry uniformly (e.g., normalizing all builders to a common signature that acceptsoutput_language/jma_office_code) or dropping the unused registry to remove the duplication.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@weather_briefing/composition/providers.py` around lines 252 - 329, Simplify provider construction in build_weather_provider by removing the redundant WEATHER_PROVIDER_BUILDERS lookup and registry, or replace the special-case branches with uniform registry dispatch. Preserve QWeather output_language handling, JMA jma_office_code validation, and the existing NEA/Open-Meteo construction behavior while eliminating the duplicated _build_nea path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@weather_briefing/composition/providers.py`:
- Around line 252-329: Simplify provider construction in build_weather_provider
by removing the redundant WEATHER_PROVIDER_BUILDERS lookup and registry, or
replace the special-case branches with uniform registry dispatch. Preserve
QWeather output_language handling, JMA jma_office_code validation, and the
existing NEA/Open-Meteo construction behavior while eliminating the duplicated
_build_nea path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 292f8cef-fc98-4dcf-b114-f2110a66806c
📒 Files selected for processing (13)
docs/design.mdtests/test_cli.pytests/test_geocoding.pyweather_briefing/cli.pyweather_briefing/composition/__init__.pyweather_briefing/composition/providers.pyweather_briefing/config/environment.pyweather_briefing/geocoding/matching.pyweather_briefing/publishers.pyweather_briefing/reference_data.pyweather_briefing/regional_weather.pyweather_briefing/render.pyweather_briefing/weather_context.py
💤 Files with no reviewable changes (5)
- weather_briefing/publishers.py
- weather_briefing/regional_weather.py
- weather_briefing/weather_context.py
- weather_briefing/reference_data.py
- weather_briefing/render.py
Summary
cli.pyto command dispatch, lifecycle, and schedulingCommits
refactor: thin the CLI composition rootdocs: document refactored package boundariesfix: migrate final reference data consumersDependency
Based on #101. Keep draft until #101 is merged into
master, then rebase and validate before review.Verification
prek run --all-filesa45bbc1Summary by CodeRabbit