Isolate RSS failures from briefing runs - #13
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughRSS failures are now optional, per-source, and independently alertable. Task failures are limited to weather, LLM, and configuration errors. SQLite tracks separate alert lifecycles, while configuration, service logic, documentation, and tests adopt the new semantics. ChangesFailure alert handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant BriefingService
participant WeatherProviders
participant RSSSources
participant SQLiteStateStore
participant OpsDelivery
BriefingService->>WeatherProviders: acquire weather context
BriefingService->>RSSSources: fetch RSS sources
RSSSources-->>BriefingService: results and per-source failures
BriefingService->>SQLiteStateStore: record failure state
BriefingService->>OpsDelivery: publish required alert
OpsDelivery-->>BriefingService: delivery result
BriefingService->>SQLiteStateStore: mark delivered alert
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13 +/- ##
==========================================
+ Coverage 99.17% 99.21% +0.04%
==========================================
Files 34 34
Lines 3862 4073 +211
Branches 232 241 +9
==========================================
+ Hits 3830 4041 +211
Misses 21 21
Partials 11 11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adjusts briefing execution semantics so optional RSS failures don’t abort a briefing run, while still producing operational alerts for sustained RSS failures and immediate alerts for non-RSS task failures.
Changes:
- Make RSS fetching fault-tolerant (
asyncio.gather(..., return_exceptions=True)) and track per-feed consecutive failures. - Add state tracking + alert gating for RSS failure cycles (alert once per cycle, reset on recovery).
- Rename configuration from
TASK_FAILURE_THRESHOLDtoRSS_FAILURE_THRESHOLDand update docs/tests accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| weather_briefing/state.py | Adds rss_failure_tracker table and state APIs for per-feed RSS failure counting and alert gating. |
| weather_briefing/service.py | Isolates RSS fetch failures from run failure, and emits threshold-based RSS alerts plus first-failure task alerts. |
| weather_briefing/config.py | Replaces task failure threshold setting with RSS failure threshold env/config. |
| tests/test_state.py | Adds coverage for RSS failure alert marking no-op behavior on empty input. |
| tests/test_service.py | Updates failure-alert semantics tests and adds RSS failure isolation + retry coverage. |
| tests/test_config.py | Updates operational setting tests for renamed environment variables. |
| tests/test_cli.py | Updates fake settings to use rss_failure_threshold. |
| env.example | Documents RSS_FAILURE_THRESHOLD. |
| docs/requirements.md | Updates reliability requirements to reflect isolated RSS failure behavior and alert semantics. |
| docs/design.md | Expands design documentation for RSS failure/alert and task-failure alert behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@docs/design.md`:
- Around line 96-100: 更新“任务失败”的触发条件,明确将辅助上下文源获取失败纳入其中,特别是 BriefingService._run()
调用 HTTPContextSource.fetch() 时因 HTTP 错误抛出 SourceFetchError
的路径;保留现有任务终止、运维提醒及计数规则不变。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6e55efda-5006-4a36-8d84-b36311d6c3aa
📒 Files selected for processing (10)
docs/design.mddocs/requirements.mdenv.exampletests/test_cli.pytests/test_config.pytests/test_service.pytests/test_state.pyweather_briefing/config.pyweather_briefing/service.pyweather_briefing/state.py
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Why
Weather providers are the primary data source, while RSS feeds are optional context. A failed feed should degrade the available context and raise an operational alert without preventing an otherwise valid briefing.
Impact
RSS failures are isolated per feed. Successful feeds and weather API context continue through the normal briefing flow, and operators receive threshold-based RSS alerts independently from task-failure alerts. A transient operational delivery failure no longer suppresses later RSS alert attempts.
Validation
.venv/bin/pytest --cov=weather_briefing --cov-branch(311 passed; 99.7066% total coverage;state.py100%).venv/bin/ruff check --no-cache weather_briefing/service.py weather_briefing/state.py tests/test_service.py tests/test_state.pyprek run --all-filesgit diff --checkSummary by CodeRabbit
Reliability
Configuration
TASK_FAILURE_THRESHOLDwithRSS_FAILURE_THRESHOLD, defaulting to 3.