Skip to content

Add direct stale-fallback coverage for news updater main flow#157

Merged
dai merged 2 commits into
automation/data-updatesfrom
copilot/task-12391-1168180630-5623fce5-2bb5-400f-b2e0-1fa3880618e3
Jul 10, 2026
Merged

Add direct stale-fallback coverage for news updater main flow#157
dai merged 2 commits into
automation/data-updatesfrom
copilot/task-12391-1168180630-5623fce5-2bb5-400f-b2e0-1fa3880618e3

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The news updater’s stale-output fallback was only covered indirectly. This change adds direct main()-level coverage for the branch that decides whether an all-source failure should preserve the existing news.json or fail the run.

  • What changed

    • Added direct tests for scripts/update_news_feed.py::main()
    • Covered the success path where:
      • all news sources fail
      • --allow-stale-on-failure is enabled
      • an existing output file is present
      • the command returns 0 without rewriting the file
    • Covered the failure path where:
      • all news sources fail
      • --allow-stale-on-failure is enabled
      • no existing output file is present
      • the command returns 1
  • Why this matters

    • Locks in the CLI behavior the workflow depends on
    • Prevents regressions where stale fallback silently stops working even though lower-level helpers still pass
  • Test shape

    with (
        mock.patch.object(MODULE, "parse_args", return_value=args),
        mock.patch.object(MODULE, "build_payload", return_value=payload),
    ):
        result = MODULE.main()
  • Scope

    • Test-only change in scripts/update_news_feed_test.py
    • No production logic changes

Copilot AI assigned Copilot and dai Jul 10, 2026
@dai dai marked this pull request as ready for review July 10, 2026 13:03
@dai dai merged commit 9467e22 into automation/data-updates Jul 10, 2026
2 checks passed
@dai dai deleted the copilot/task-12391-1168180630-5623fce5-2bb5-400f-b2e0-1fa3880618e3 branch July 10, 2026 13:04
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