Skip to content

Isolate RSS failures from briefing runs - #13

Merged
IceCodeNew merged 1 commit into
masterfrom
fix/rss
Jul 14, 2026
Merged

Isolate RSS failures from briefing runs#13
IceCodeNew merged 1 commit into
masterfrom
fix/rss

Conversation

@IceCodeNew

@IceCodeNew IceCodeNew commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep briefing runs alive when individual RSS feeds exhaust retries
  • track per-feed consecutive failures and emit one operational alert per failure cycle
  • mark alerts delivered only after the operational notification succeeds, allowing failed deliveries to retry
  • alert immediately on non-RSS task failures and reset the alert cycle after a successful run
  • document the new RSS failure threshold in the environment template and reliability design

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.py 100%)
  • .venv/bin/ruff check --no-cache weather_briefing/service.py weather_briefing/state.py tests/test_service.py tests/test_state.py
  • prek run --all-files
  • git diff --check

Summary by CodeRabbit

  • Reliability

    • RSS retrieval failures no longer stop briefing generation after retries; available weather and RSS data continue to be used.
    • RSS failures and stale sources now trigger separate, deduplicated operational alerts.
    • Unconfigured RSS is treated as disabled, not as an error.
    • Weather, configuration, or delivery failures receive clearer operational notifications with retry handling.
  • Configuration

    • Replaced TASK_FAILURE_THRESHOLD with RSS_FAILURE_THRESHOLD, defaulting to 3.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6b674bf3-d0e5-4c47-9f3d-b8c7b56862d6

📥 Commits

Reviewing files that changed from the base of the PR and between 1a7666b and 43c59a9.

📒 Files selected for processing (10)
  • docs/design.md
  • docs/requirements.md
  • env.example
  • tests/test_cli.py
  • tests/test_config.py
  • tests/test_service.py
  • tests/test_state.py
  • weather_briefing/config.py
  • weather_briefing/service.py
  • weather_briefing/state.py
🚧 Files skipped from review as they are similar to previous changes (7)
  • weather_briefing/config.py
  • tests/test_config.py
  • tests/test_state.py
  • env.example
  • docs/requirements.md
  • weather_briefing/service.py
  • tests/test_service.py

📝 Walkthrough

Walkthrough

RSS 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.

Changes

Failure alert handling

Layer / File(s) Summary
Failure semantics and configuration
docs/design.md, docs/requirements.md, env.example, weather_briefing/config.py, tests/test_config.py, tests/test_cli.py
Defines separate RSS and task failure rules and replaces TASK_FAILURE_THRESHOLD with RSS_FAILURE_THRESHOLD.
Persistent failure alert state
weather_briefing/state.py, tests/test_state.py
Adds SQLite tracking and lifecycle methods for task alerts and per-source RSS failures, including suppression and recovery resets.
Service failure and alert flow
weather_briefing/service.py, tests/test_service.py
Tolerates individual RSS failures, preserves cancellation handling, and publishes deduplicated task and RSS health alerts with delivery-failure 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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: RSS failures are separated from briefing/task execution failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rss

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.21%. Comparing base (9dfbe76) to head (43c59a9).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_THRESHOLD to RSS_FAILURE_THRESHOLD and 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.

Comment thread weather_briefing/service.py Outdated
Comment thread weather_briefing/state.py
Comment thread tests/test_config.py
Comment thread tests/test_service.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread weather_briefing/service.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread weather_briefing/service.py Outdated
@IceCodeNew

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9dfbe76 and 1a7666b.

📒 Files selected for processing (10)
  • docs/design.md
  • docs/requirements.md
  • env.example
  • tests/test_cli.py
  • tests/test_config.py
  • tests/test_service.py
  • tests/test_state.py
  • weather_briefing/config.py
  • weather_briefing/service.py
  • weather_briefing/state.py

Comment thread docs/design.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread weather_briefing/state.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@IceCodeNew

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@IceCodeNew
IceCodeNew merged commit deaeae6 into master Jul 14, 2026
22 checks passed
@IceCodeNew
IceCodeNew deleted the fix/rss branch July 14, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants