Review syntax after model without typo whitelist
myfileagent-python-ci/pipeline/head This commit looks good
Final project review (live) / review (push) Successful in 53s

This commit is contained in:
Codex Agent
2026-11-28 22:26:14 +00:00
parent 1d20412bd6
commit 0bffbdf4bd
19 changed files with 222 additions and 261 deletions
+15 -4
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
"""Build a short versioned LaTeX PDF from an exact verified review bundle."""
import argparse
import ast
import difflib
import hashlib
import json
from pathlib import Path
@@ -47,9 +49,18 @@ def main():
review = json.loads(files["review.json"])
source_path = ROOT / ("demo/demo.py" if args.mode == "live" else "ci/fixtures/demo_broken.txt")
source = source_path.read_bytes()
if source != b'print("hello"\n' or files["reviewed.py"] != b'print("hello")\n':
raise ValueError("Demo PDF requires the exact one-character syntax repair")
if review["status"] != "corrected" or "+print(\"hello\")" not in review["diff"]:
try:
ast.parse(source.decode())
except SyntaxError:
pass
else:
raise ValueError("Demo PDF requires a syntax-invalid committed source")
if ast.dump(ast.parse(files["reviewed.py"].decode()), include_attributes=False) != ast.dump(
ast.parse('print("hello")'), include_attributes=False):
raise ValueError("Demo PDF requires a reviewed hello program without extra code")
actual_diff = "".join(difflib.unified_diff(source.decode().splitlines(keepends=True),
files["reviewed.py"].decode().splitlines(keepends=True), fromfile="original.py", tofile="reviewed.py"))
if review["status"] != "corrected" or review["diff"] != actual_diff:
raise ValueError("Review does not show the permitted correction")
if review.get("input_sha256") and review["input_sha256"] != digest(source):
raise ValueError("Review input hash differs from committed demo source")
@@ -99,7 +110,7 @@ def main():
if not 1 <= len(reader.pages) <= 3:
raise ValueError("Demo PDF must be one to three pages")
extracted = "\n".join(page.extract_text() or "" for page in reader.pages)
for value in (args.release_version, args.sha, review["model_id"], "print(\"hello\")"):
for value in (args.release_version, args.sha, review["model_id"], files["reviewed.py"].decode().strip()):
if str(value) not in extracted:
raise ValueError("Demo PDF omitted visible evidence: " + str(value))
shutil.copy2(pdf, output / "main.pdf")