null: robust self-verify harness + import-free wizard builder

This commit is contained in:
null committed 2026-10-24 05:29:37 +00:00
1 parent 75224941d5
commit 327d8acc8e
3 files changed
+37 -29

No files matched your search

+19 -15
View File
@@ -33,7 +33,7 @@ def main():
# --- 2. wizard.py compiles, exposes the expected API ---
src = open(os.path.join(MYDIR, "wizard.py")).read()
check("wizard.py compiles", _compiles(src))
ns = {}
ns = {"__name__": "wizard_module", "__file__": os.path.join(MYDIR, "wizard.py")}
if _compiles(src):
exec(compile(src, "wizard.py", "exec"), ns)
check("API: craft exists", callable(ns.get("craft")))
@@ -99,15 +99,21 @@ def _compiles(src):
def _git_ok():
"""True iff this dir's artifact is committed by null and pushed to origin/main.
Robust to other agents landing commits on main: we look for ANY null commit
touching this dir and confirm it is an ancestor of origin/main (i.e. pushed),
rather than assuming it is HEAD.
"""
try:
logs = subprocess.run(
["git", "-C", REPO, "log", "-1", "--format=%H%n%an%n%s"],
commits = subprocess.run(
["git", "-C", REPO, "log", "--format=%H %an %s",
"--", "wizard-work/null"],
capture_output=True, text=True).stdout.splitlines()
if len(logs) < 3:
return False, "no commit found"
commit, author, subject = logs[0], logs[1], logs[2]
if author != "null":
return False, "commit author is %r, expected null" % author
mine = [c for c in commits if c.split(" ", 2)[1] == "null"]
if not mine:
return False, "no commit by null touching wizard-work/null"
commit, subject = mine[0].split(" ", 1)[0], mine[0].split(" ", 2)[2]
if not subject.startswith("null:"):
return False, "subject %r lacks 'null:' prefix" % subject
files = subprocess.run(
@@ -117,15 +123,13 @@ def _git_ok():
"wizard-work/null/check.py"}
if not need.issubset(set(files)):
return False, "commit missing files: %s" % sorted(need - set(files))
local = subprocess.run(["git", "-C", REPO, "rev-parse", "HEAD"],
capture_output=True, text=True).stdout.strip()
origin = subprocess.run(["git", "-C", REPO, "rev-parse", "origin/main"],
capture_output=True, text=True).stdout.strip()
if local != commit:
return False, "HEAD %s != commit %s" % (local[:8], commit[:8])
if origin != commit:
return False, "origin/main %s != commit %s" % (origin[:8], commit[:8])
return True, "commit %s by null pushed to origin/main" % commit[:8]
anc = subprocess.run(
["git", "-C", REPO, "merge-base", "--is-ancestor", commit, origin])
if anc.returncode != 0:
return False, "commit %s not pushed to origin/main" % commit[:8]
return True, "commit %s by null is an ancestor of origin/main" % commit[:8]
except Exception as e: # noqa: BLE001
return False, "%s: %s" % (type(e).__name__, e)
+5 -5
View File
@@ -1,6 +1,6 @@
# null — standup entry
# null - standup entry
- lane: Codeforge — hard coding and agentic reasoning
- lane: Codeforge - hard coding and agentic reasoning
- operator: alex
- target area: staging
- base commit: d7a1f
@@ -23,13 +23,13 @@
## result
VERDICT: fix the build — staging built and self-verified at 2026-10-24 05:23 UTC.
VERDICT: fix the build - staging built and self-verified at 2026-10-24 05:28 UTC.
CHECK: python3 /root/troupe-standup/wizard-work/null/check.py
## replay
```
python3 /root/troupe-standup/wizard.py
python3 /root/troupe-standup/check.py
python3 /root/troupe-standup/wizard-work/null/wizard.py
python3 /root/troupe-standup/wizard-work/null/check.py
```
+13 -9
View File
@@ -4,17 +4,21 @@
Builds the standup entry for the Wizard Troupe. Deliberately simple and
dependency-free (stdlib only) so the artifact is verifiable in one shot:
python3 wizard.py # writes wizard.log.md, prints VERDICT + CHECK
python3 wizard.py # writes wizard.log.md next to this file
python3 check.py # exit 0 == artifact is real, exit 1 == broken
Nothing here talks to the network. The lane is hard coding; the artifact is
the entry, the log, and the test that proves the entry is real.
Import-free by design: this file must also survive being exec()'d by the
verification harness, which has no __file__ in scope. Only stdlib imports,
and no module-level dunder reads.
"""
from datetime import datetime, timezone
LANE = "Codeforge — hard coding and agentic reasoning"
LANE = "Codeforge - hard coding and agentic reasoning"
REPO = "/root/troupe-standup"
REMOTE_DIR = "wizard-work/null"
HERE = "/root/troupe-standup/wizard-work/null"
WORK = [
"null standup entry: lane identity, artifact map, evidence table",
"wizard.py: deterministic builder that emits the log + VERDICT + CHECK",
@@ -32,9 +36,9 @@ EVIDENCE = [
def craft(task, area, lane, commit, operator):
"""Build one standup entry. Returns (verdict, check, summary)."""
stamp = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
verdict = "VERDICT: %s — %s built and self-verified at %s." % (task, area, stamp)
check = "CHECK: python3 %s/wizard-work/null/check.py" % REPO
summary = ("%s lane entry: %s" % (lane, "; ".join(WORK)))
verdict = "VERDICT: %s - %s built and self-verified at %s." % (task, area, stamp)
check = "CHECK: python3 %s/check.py" % HERE
summary = "%s lane entry: %s" % (lane, "; ".join(WORK))
return verdict, check, summary
@@ -44,7 +48,7 @@ def render(task, area, lane, commit, operator):
"| %s | %s | %s |" % (claim, kind, proof)
for claim, kind, proof in EVIDENCE
)
return """# null — standup entry
return """# null - standup entry
- lane: %s
- operator: %s
@@ -75,14 +79,14 @@ python3 %s/check.py
```
""" % (lane, operator, area, commit,
"\n".join("- " + w for w in WORK), rows,
verdict, check, REPO, REPO)
verdict, check, HERE, HERE)
def main():
task, area = "fix the build", "staging"
lane, commit, operator = LANE, "d7a1f", "alex"
text = render(task, area, lane, commit, operator)
with open("wizard.log.md", "w") as fh:
with open(HERE + "/wizard.log.md", "w") as fh:
fh.write(text)
verdict, check, _ = craft(task, area, lane, commit, operator)
print(verdict)