feat: publish weekly producer contract artifact - #28
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR Review🚫 Merge blocked: 1 serious issue(s) found in high-risk files ⚖️ Codex Review Arbitration🚫 block: In 🚫 Blocking IssuesThese issues must be fixed before this PR can be merged: 1. 🟠 [HIGH] Logic in
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38376f5c69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not isinstance(item, Mapping) or type(item.get("ok")) is not bool: | ||
| raise _invalid("feed_status_invalid") |
There was a problem hiding this comment.
Reject malformed feed entries before marking status complete
When source_fetch_status.json is malformed or truncated but its counters still match, this loop accepts each feed entry as long as it has an ok boolean; for example feeds: [{"ok": true}] is treated as complete=True even though the RSS fetcher writes feed identity, URL, item count, and error fields for every feed. Since this producer is the fail-closed validation boundary for the weekly artifact, accepting status entries without the expected per-feed shape can publish a manifest from a corrupt status file instead of failing closed.
Useful? React with 👍 / 👎.
| --watchlist "${WATCHLIST_PATH}" \ | ||
| --events data/output/rss_source_pipeline/source_events.csv \ | ||
| --output data/output/rss_source_pipeline/source_tracker.csv | ||
| - name: Build weekly contract artifact |
There was a problem hiding this comment.
Keep partial RSS runs from blocking live output publication
In this workflow the fetch step still uses --continue-on-feed-error, so a single RSS outage produces usable CSVs plus a nonzero failed_feed_count; however this new weekly artifact step runs before the existing live-output commit/upload path, and the producer exits on incomplete feed status. In scheduled runs where one feed fails, the job now stops here and skips publishing the ordinary RSS outputs that were previously refreshed from the healthy feeds, so the weekly artifact failure should be isolated or moved after the existing publication path if partial RSS runs should remain available.
Useful? React with 👍 / 👎.
| data/output/rss_source_pipeline/source_items.csv \ | ||
| data/output/rss_source_pipeline/source_events.csv \ | ||
| data/output/rss_source_pipeline/source_tracker.csv \ | ||
| data/output/rss_source_pipeline/source_fetch_status.json |
There was a problem hiding this comment.
Filter weekly artifacts to the declared period
The manifest records a weekly period_start/as_of, but the files passed here are the unfiltered RSS pipeline outputs; the preceding fetch/extract/build commands do not take period bounds, so source_items.csv, source_events.csv, and source_tracker.csv can include anything in the latest N feed items, or current items when manually backfilling an older week. That makes the uploaded political-event-weekly-v1 artifact claim a completed week while hashing rows outside that week, which can corrupt downstream weekly experiments.
Useful? React with 👍 / 👎.
| artifacts.append(WeeklySourceArtifact(key, _sha256(path), _row_count(path))) | ||
| status_key, status_file = _relative_input(feed_status_path, base) | ||
| if status_key not in seen or status_file is None: | ||
| raise _invalid("feed_status_missing") | ||
| status = _feed_status(status_file) |
There was a problem hiding this comment.
Compare fetched item count with source_items rows
If source_items.csv is truncated or paired with a source_fetch_status.json from a different run, the fetcher’s top-level item_count is the available cross-check, but after computing row counts this code only validates feed success counters and still marks the status complete. The artifact can therefore contain the SHA and row count of a partial items CSV while advertising complete feed status, so the producer should fail when source_items.csv row_count disagrees with the status item_count.
Useful? React with 👍 / 👎.
Co-Authored-By: Codex <noreply@openai.com>
|
PERMANENT_FREEZE/CLOSE_RESLICE per control-plane stop rule. Evidence preserved; no further code action. |
Scope
Producer/artifact boundary only, based on the merged
political_event_weekly.v1and weekly manifest contracts.weekly_manifest.json.period_start/as_of, pins actions to immutable SHAs, and uploads exactly one weekly manifest with 30-day retention.Validation
python3 -m pytest -q: 78 passedpython3 -m compileall -q src tests scripts: passedactionlint .github/workflows/*.yml: passedgit diff --check: passedruff: unavailable in local environmentSource-of-truth: merged
political_event_weekly.v1contract anddocs/weekly_producer_artifact_contract.md.Review mode: preflight then one concentrated review, no merge in this task.