Skip to content

feat: integrate political event weekly manifest - #27

Merged
Pigbibi merged 2 commits into
mainfrom
codex/pert-weekly-manifest-pr1
Jul 15, 2026
Merged

feat: integrate political event weekly manifest#27
Pigbibi merged 2 commits into
mainfrom
codex/pert-weekly-manifest-pr1

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Scope

Pure producer manifest integration for the merged political_event_weekly.v1 contract. No workflow, fetcher, artifact upload, QAR consumer, Pages, publisher, monthly, dependency, or automation changes.

Contract

  • Builds and serializes a deterministic political_event_weekly_manifest from an already validated weekly contract.
  • Parses and validates exact manifest shape; validate_weekly_manifest() compares the emitted manifest to the expected input contract.
  • Explicit period/as_of/generated_at, producer SHA, provenance, input SHA/row counts, and typed complete feed counters are preserved.
  • Invalid/partial/mismatched contracts fail before output creation.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🤖 Codex PR Review

Merge allowed: blocking findings were cleared by independent Codex arbitration

⚖️ Codex Review Arbitration

clear: The prior blocker is demonstrably fixed by the cumulative diff. In weekly_contract.py, WeeklySourceContract.__post_init__ still canonicalizes source_artifacts ordering and serialize_weekly_contract() still canonicalizes JSON/timestamps, so the old risk remained relevant unless manifest validation compared against canonical output. The new validate_weekly_manifest() no longer stops at dataclass equality: after parsed != expected, it also rejects any mapping where build_weekly_manifest(parsed) != dict(value), which catches semantically equivalent but differently shaped manifests such as reordered artifacts or alternate timestamp spellings. The new parse_weekly_manifest_bytes() goes further for wire input by reparsing with duplicate-key detection and requiring serialize_weekly_manifest(contract) == wire, proving exact canonical bytes. The added tests explicitly cover both cases (test_manifest_contract_tamper_is_rejected and test_manifest_wire_must_be_exact_canonical_bytes).

ℹ️ Other Findings

1. 🟡 [MEDIUM] Reliability in src/political_event_tracking_research/weekly_manifest.py

write_weekly_manifest() writes directly to the final path with Path.write_bytes(), which is not atomic. If the process crashes mid-write, the filesystem fills, or another component reads the file concurrently, callers can observe a truncated or partially updated JSON manifest even though this module is supposed to fail closed on invalid/partial output creation. (line 78)

Suggestion: Write to a temporary file in the same directory, flush/fsync it, and then atomically replace the destination with Path.replace()/os.replace(). That preserves the previous valid file until the new manifest is fully durable.


Review by Codex PR Review bot • PR

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit 7c4104d into main Jul 15, 2026
4 checks passed
@Pigbibi
Pigbibi deleted the codex/pert-weekly-manifest-pr1 branch July 15, 2026 07:16
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.

1 participant