Skip to content

fix(review): daily-review no-op when there are no ingest artifacts#225

Open
shaypal5 wants to merge 2 commits into
mainfrom
codex/daily-review-noop-when-no-ingest
Open

fix(review): daily-review no-op when there are no ingest artifacts#225
shaypal5 wants to merge 2 commits into
mainfrom
codex/daily-review-noop-when-no-ingest

Conversation

@shaypal5

Copy link
Copy Markdown
Member

Why

Surfaced by the UNIFY-PR-06 go-live verification dispatch. news-items-daily-review reviews the output of daily-state-run (ingest): it looks for news_items/ingest/logs/*.summary.json tagged workflow_name: daily-state-run. But:

  1. ingest runs locally / on-demand, gated on the parked Decouple scrape→classify so GitHub can drain the classification queue #213 (scrape→classify coupling) — GitHub never produces ingest artifacts, and
  2. the seeded state repo has no news_items/ingest directory at all (confirmed: top-level dirs are discover, backfill_discover, backup, monthly_report, operational, release, scrape_candidates).

So review_latest_daily_run() raised FileNotFoundError: No complete news_items/ingest artifacts found for workflow 'daily-state-run' and failed the workflow. A scheduled review job with nothing to review should not be a red run (it's noise, and would ironically spawn its own daily-ai-review ticket).

What

review_latest_daily_run() now catches that FileNotFoundError, logs No daily ingest artifacts to review (...); skipping., and returns 0 — before constructing the Anthropic or GitHub clients, so a no-op makes zero API/network calls.

The low-level latest_daily_review_artifacts() finder still raises (its contract and the test_..._raises_when_daily_artifacts_missing test are unchanged) — only the workflow entrypoint tolerates the empty case. Adds a regression test asserting the no-op returns 0 with an empty state root.

Verification

  • pytest -q tests/unit/test_daily_review.py28 passed (incl. the new no-op test and the still-raising finder test)
  • ruff format --check / ruff check / mypy — clean
  • Will re-run the news-items-daily-review dispatch after merge to confirm it goes green (no-op) against the real seeded state.

Context

Last open structural blocker from the go-live dispatch. With this, the scheduled go-live set (discover, daily-review, monthly-report, release, backup) can all run without a spurious failure; daily-review becomes useful automatically once ingest output exists in the state repo.

…acts

Surfaced by the UNIFY-PR-06 go-live dispatch: news-items-daily-review reviews
the output of daily-state-run (ingest), but ingest runs locally/on-demand
(gated on #213) and was not seeded, so the state repo has no news_items/ingest.
review_latest_daily_run() raised FileNotFoundError and failed the workflow — a
scheduled review with nothing to review should not be a red run.

Catch FileNotFoundError in review_latest_daily_run(), log, and return 0 (no
issues created, no Anthropic/GitHub calls). The low-level latest_daily_review_
artifacts() finder still raises (its contract and tests are unchanged); only the
workflow entrypoint tolerates the empty case. Adds a no-op regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 18, 2026 18:46
@shaypal5 shaypal5 added this to the Local↔CI Unification milestone Jun 18, 2026
@shaypal5 shaypal5 added bug Something isn't working ci labels Jun 18, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the news-items-daily-review workflow entrypoint to treat “no ingest artifacts exist yet” as a clean no-op (return 0) instead of failing, which prevents scheduled runs from going red when there is nothing to review.

Changes:

  • Catch FileNotFoundError from latest_daily_review_artifacts() in review_latest_daily_run() and return 0 after logging a skip message.
  • Add a unit test asserting the orchestrator returns 0 when the state root has no ingest artifacts at all.
  • Record the completed work item in .agent-plan.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/denbust/news_items/daily_review.py Makes review_latest_daily_run() tolerant of missing ingest artifacts by catching FileNotFoundError and returning 0.
tests/unit/test_daily_review.py Adds a regression test for the “no artifacts → no-op” behavior.
.agent-plan.md Marks the daily-review no-op fix as [done] in the task ledger.

Comment on lines +396 to +404
try:
artifacts = latest_daily_review_artifacts(
state_root=state_root,
workflow_name=workflow_name,
source_diagnostics_path=source_diagnostics_path,
)
except FileNotFoundError as exc:
print(f"No daily ingest artifacts to review ({exc}); skipping.")
return 0
Comment on lines +201 to +213
def test_review_latest_daily_run_is_a_noop_when_no_ingest_artifacts(
self, tmp_path: Path
) -> None:
"""With no ingest artifacts to review (ingest runs locally/on-demand),
the review is a clean no-op: it returns 0 and never reaches the Anthropic
or GitHub clients, so a scheduled run does not fail."""
created = review_latest_daily_run(
state_root=tmp_path, # empty: no news_items/ingest at all
repository="DataHackIL/tfht_enforce_idx",
anthropic_api_key="unused",
github_token="unused",
)
assert created == 0
@github-actions

This comment has been minimized.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.84%. Comparing base (be43e02) to head (d1d547e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #225   +/-   ##
=======================================
  Coverage   92.84%   92.84%           
=======================================
  Files          84       84           
  Lines       12337    12341    +4     
=======================================
+ Hits        11454    11458    +4     
  Misses        883      883           
Files with missing lines Coverage Δ
src/denbust/news_items/daily_review.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

pr-agent-context report:

This run includes unresolved review comments on PR #225.

For each unresolved review comment, recommend one of: resolve as irrelevant, accept and implement
the recommended solution, open a separate issue and resolve as out-of-scope for this PR, accept and
implement a different solution, or resolve as already treated by the code.

After I reply with my decision per item, implement the accepted actions, resolve the corresponding
PR comments, and push all of these changes in a single commit.

# Copilot Comments

## COPILOT-1
Location: src/denbust/news_items/daily_review.py:404
URL: https://github.com/DataHackIL/tfht_enforce_idx/pull/225#discussion_r3438181322
Root author: copilot-pull-request-reviewer

Comment:
    `review_latest_daily_run()` currently swallows *all* `FileNotFoundError` from `latest_daily_review_artifacts()`, which means it will also silently no-op when ingest artifacts exist but are incomplete (e.g. `.summary.json` present but companion `runs/*.json`/`logs/*.json` missing). That can hide a real regression in the ingest workflow/state production. Consider only no-op'ing when the ingest artifact root is entirely absent/empty, and re-raise otherwise so incomplete/corrupt artifacts still fail loudly.

## COPILOT-2
Location: tests/unit/test_daily_review.py:213
URL: https://github.com/DataHackIL/tfht_enforce_idx/pull/225#discussion_r3438181348
Root author: copilot-pull-request-reviewer

Comment:
    This test's docstring claims the no-op path "never reaches the Anthropic or GitHub clients", but the assertions don't currently enforce that. Adding a `monkeypatch` that makes those constructors raise would prevent future refactors from accidentally reintroducing network/client construction while still returning 0.

Run metadata:

Tool ref: v4.0.19
Tool version: 4.0.19
Trigger: commit pushed
Workflow run: 27781903531 attempt 1
Comment timestamp: 2026-06-18T18:52:38.125393+00:00
PR head commit: d1d547ebc56d83149fbd5c6eb5b165b95b22bd0b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants