feat: add Singapore NEA nowcast capability - #74
Conversation
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #74 +/- ##
========================================
Coverage 99.77% 99.77%
========================================
Files 43 45 +2
Lines 7918 8123 +205
Branches 441 456 +15
========================================
+ Hits 7900 8105 +205
Misses 13 13
Partials 5 5 ☔ View full report in Codecov by Harness. |
e803dfd to
18cbfb6
Compare
81f0061 to
58653bf
Compare
|
/agentic_review |
Code Review by Qodo
Context used✅ Compliance rules (platform):
37 rules 1. NEA used outside Singapore
|
58653bf to
12937fc
Compare
|
/agentic_review |
12937fc to
0966f7a
Compare
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 0966f7a |
a971ca5 to
08a8aa2
Compare
0966f7a to
5d07391
Compare
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 5d07391 |
fc42786 to
667144d
Compare
667144d to
32194ec
Compare
|
/agentic_review |
PR Summary by QodoAdd Singapore NEA two-hour nowcast as best-effort weather supplement
AI Description
Diagram
High-Level Assessment
Files changed (16)
|
| @@ -467,9 +474,14 @@ def _weather_context_provider( | |||
| location: ResolvedLocation, | |||
| ) -> CapabilityProviderSet: | |||
| names = weather_providers_for(location, settings.weather_providers) | |||
There was a problem hiding this comment.
1. Nea used outside singapore 🐞 Bug ≡ Correctness
When WEATHER_PROVIDERS explicitly includes nea-sg, weather_providers_for() returns it for every location and _weather_context_provider() builds it as a supplement (or even as the primary when it's the only provider) without checking location.country_code. Since NEASingaporeNowcastProvider.fetch() ignores the requested latitude/longitude, non-SG briefings can receive Singapore nowcast context, producing misleading summaries.
Agent Prompt
### Issue description
`nea-sg` is Singapore-only, but the current provider selection logic applies it to *any* location whenever it appears in explicit `WEATHER_PROVIDERS`. The NEA adapter also ignores the input coordinates, so calling it for non-SG locations returns Singapore nowcast and pollutes the context.
### Issue Context
- Explicit `WEATHER_PROVIDERS` applies globally across all configured locations.
- `_weather_context_provider()` partitions `nea-sg` into supplements purely by provider name, not by `location.country_code`.
- `NEASingaporeNowcastProvider.fetch()` does not use `latitude`/`longitude`, so it cannot self-correct without an explicit guard.
### Fix Focus Areas
- weather_briefing/cli.py[476-532]
- weather_briefing/config.py[224-236]
- weather_briefing/regional_weather.py[42-77]
### Implementation guidance
Pick one (or combine for defense-in-depth):
1) **Selection-time guard (recommended):** In `_weather_context_provider()` (or in `weather_providers_for()`), drop `nea-sg` unless `location.country_code == "SG"`. If that removal would leave no providers (e.g. explicit `WEATHER_PROVIDERS=("nea-sg",)` on a non-SG location), raise a clear `ValueError/ConfigurationError`.
2) **Provider-level guard:** In `NEASingaporeNowcastProvider.fetch()`, validate the coordinates are within a Singapore bounding box and raise `RegionalWeatherProviderError` when outside; this prevents accidental misuse even if selection logic regresses.
Add/adjust tests to cover multi-location behavior with explicit `WEATHER_PROVIDERS=open-meteo,nea-sg` to ensure non-SG locations do not call NEA.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 32194ec |
What changed
Add Singapore NEA's two-hour forecast as a supplementary regional capability provider. The adapter supports optional API-key authentication, normalizes timestamps, validates response shapes, and preserves the fixed English source language.
Open-Meteo remains the primary weather provider; NEA supplements it with local nowcast detail.
Validation
Stacked on
codex/pr3-location-language.