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
+14 -10
View File
@@ -1,18 +1,22 @@
# Controlled syntax-review demo
The current live-demo input in `demo.py` is `print("hello"` with its final
closing parenthesis missing. The preceding preparation commit contained the
valid baseline `print("hello")`; the one-character edit is already committed.
The current live-demo input in `demo.py` is `print("hello` with its closing
quote and parenthesis missing. The preceding successful run used a source
with only its closing parenthesis missing. Both forms require model inference.
To repeat the live demonstration later, restore the valid baseline in a
separate preparation commit, then delete only its final closing parenthesis
in a new live commit. The Actions reviewer sends exactly `print("hello"` to the
SmolLM2 model. It preserves the committed input and writes the validated repair
to `reviewed.py` in the review bundle. Jenkins verifies that bundle, builds the
short versioned demo PDF, tests the reviewed program, and packages the release.
separate preparation commit, then introduce a small syntax error in a new live
commit. The Actions reviewer sends the committed source line to SmolLM2 without
matching it against a list of expected typos. It preserves the original and
writes the model's validated proposal to `reviewed.py` in the review bundle.
Before executing model output, the validator checks that it contains only the
demo's `print("hello")` behavior. Jenkins verifies the bundle, builds the short
versioned demo PDF, tests the reviewed program, and packages the release.
The final-project workflow runs the reviewer and pipeline unit tests. Jenkins
then has a separate `Compile and execute model-reviewed Python` stage: it
Gitea Actions checks the source SHA, runs the real model, then executes the
reviewed program and requires exactly `hello` on standard output. Jenkins
runs reviewer and pipeline unit tests after that inference, then has a separate
`Compile and execute model-reviewed Python` stage: it
compiles the verified `reviewed.py`, runs it, and requires exactly `hello` on
standard output. The original broken `demo.py` is intentionally not executed.
Legacy `pricing.py` tests belong to the older application and are not part of
+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")
+2 -2
View File
@@ -24,11 +24,11 @@
\textbf{Complete Actions-job memory:} \MemoryPeak\ bytes peak; target: \MemoryTarget\ bytes (\MemoryTargetStatus); hard ceiling: \MemoryLimit\ bytes; OOM kills: \OOMKills.
\section*{The committed input}
The source at the commit above has one missing closing parenthesis. The reviewer preserves it and writes a separate reviewed file.
The source at the commit above has a syntax error in its closing quote and/or parenthesis. The reviewer preserves it and writes a separate reviewed file.
\VerbatimInput[fontsize=\small,frame=single]{source-before.txt}
\section*{The model's recorded proposal}
These bytes came from the real model response in \texttt{review.json}. In fixture mode, this section is clearly labeled simulated. The validator accepts only the single permitted repair.
These bytes came from the real model response in \texttt{review.json}. In fixture mode, this section is clearly labeled simulated. The validator accepts only the exact permitted hello repair.
\VerbatimInput[fontsize=\small,frame=single]{raw-response.txt}
\section*{The accepted reviewed program}