Add same-run weekly period-lock acquisition preflight - #30
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR Review🚫 Merge blocked: 2 serious issue(s) found in high-risk files ⚖️ Codex Review Arbitration🚫 block: Both current findings remain valid against the cumulative diff. In 🚫 Blocking IssuesThese issues must be fixed before this PR can be merged: 1. 🟠 [HIGH] Security in
|
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6227d65bcf
ℹ️ 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 serialize_period_lock(lock) != payloads["period_lock.json"] or lock.source_run_id != expected_run_id or lock.source_attempt != 1: | ||
| raise ValueError("period_lock_run_mismatch") |
There was a problem hiding this comment.
Verify the full period lock payload
In the attempt-2 verification path, this check only proves that period_lock.json is canonical and has the expected run id/attempt. A bundle can replace it with a different valid weekly period or different snapshot/provenance fields and update bundle_manifest.json with the new digest; the fixed snapshot is checked independently, so verify_bundle still accepts a non-original lock. Since this preflight is meant to perform an exact readback of the original lock, compare the parsed lock to the expected fixture payload (or bind the snapshot fields from the lock) before returning.
Useful? React with 👍 / 👎.
| files = manifest["files"] | ||
| if not isinstance(files, list) or {item.get("name") for item in files if isinstance(item, dict)} != {"input_snapshot.json", "period_lock.json"}: | ||
| raise ValueError("period_lock_manifest_files_invalid") |
There was a problem hiding this comment.
Reject duplicate manifest file entries
When files contains duplicate objects for an expected member name, this set comparison still passes as long as both expected names appear at least once, and the loop below accepts duplicate entries whose digests match. That means a tampered manifest with repeated input_snapshot.json or period_lock.json entries is treated as valid even though the preflight contract says duplicated bundle metadata must fail closed; require exactly two entries with unique names before checking their digests.
Useful? React with 👍 / 👎.
| name: ${{ env.ARTIFACT_NAME }} | ||
| path: ${{ runner.temp }}/pert-period-lock/downloaded | ||
| run-id: ${{ github.run_id }} | ||
| github-token: ${{ github.token }} |
There was a problem hiding this comment.
Fail when duplicate run artifacts exist
When a rerun leaves more than one artifact with this same run-scoped name, this name-only download-artifact lookup does not prove uniqueness: the v4 artifact client uses the public name-filtered run API for github-token/run-id downloads and returns the newest match when multiple artifacts share the name. That silently accepts the duplicate/replacement case the preflight doc says must fail closed; query the run artifacts and require exactly one matching artifact (or download by a previously recorded artifact id) before verifying the bundle.
Useful? React with 👍 / 👎.
|
PERMANENT_FREEZE/HUMAN_REQUIRED after the single allowed closure. Review fingerprint 2e1c0a6672f5f3c21882 repeated. Preserving branch, commits, comments, checks, and workflow evidence; no further code action. Current blockers: actions:read executes checked-out ref, verification lacks exact full lock/snapshot binding, and dispatch ref is not bound to expected reviewed SHA. |
Scope
Isolated, test-only PR-1A for
pert.weekly.period_lock_acquisition.v1. This does not modify the RSS/source production pipeline, producer fetch behavior, QAR, Pages, or any production credentials.Contract
pert-weekly-period-lock-<github.run_id>.period_lock.json,input_snapshot.json, andbundle_manifest.json; the manifest binds run id, source attempt1, artifact name, and member SHA-256 values.github.run_attempt == 2), downloads by the samegithub.run_id, and verifies canonical bytes, exact member set, lock/snapshot identity, attempt/run binding, artifact name, and hashes. It never rebuilds or overwrites attempt-1 evidence.contents:read,actions:read, andartifact-metadata:write; no contents write, secrets, or OIDC.Validation
python3 -m pytest -q: 94 passeduv sync --locked --extra test && uv run --locked pytest -q: 94 passedpython3 -m compileall -q src scripts tests: passedactionlint .github/workflows/pert_weekly_period_lock_acquisition.yml: passedgit diff --check: passedruff: unavailable in the environmentAcceptance gate
After PR checks are green and the PR head remains
6227d65bcfaa75618b405506b21beb24549253b2, run this isolated workflow once naturally for attempt 1. Only if attempt 1 succeeds, manually rerun this same workflow exactly once to obtain attempt-2 artifact download/readback evidence. Do not rerun RSS, production, CI, review, or gate workflows.