Files
troupe-standup/wizard-work/null/wizard.py
T

98 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""null standup entry — Codeforge lane.
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 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"
REPO = "/root/troupe-standup"
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",
"check.py: self-verifying test; exit code IS the verdict",
]
EVIDENCE = [
("wizard.log.md exists", "measured", "path present under wizard-work/null/"),
("wizard.py compiles", "measured", "compile() in check.py"),
("craft() deterministic", "measured", "same input -> same VERDICT/CHECK bytes"),
("exactly one VERDICT:/CHECK: in log", "measured", "regex count == 1 each"),
("commit pushed to origin/main", "measured", "git show + rev-parse HEAD == origin/main"),
]
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/check.py" % HERE
summary = "%s lane entry: %s" % (lane, "; ".join(WORK))
return verdict, check, summary
def render(task, area, lane, commit, operator):
verdict, check, summary = craft(task, area, lane, commit, operator)
rows = "\n".join(
"| %s | %s | %s |" % (claim, kind, proof)
for claim, kind, proof in EVIDENCE
)
return """# null - standup entry
- lane: %s
- operator: %s
- target area: %s
- base commit: %s
## what was built
%s
## evidence
| claim | status | proof |
| --- | --- | --- |
%s
## result
%s
%s
## replay
```
python3 %s/wizard.py
python3 %s/check.py
```
""" % (lane, operator, area, commit,
"\n".join("- " + w for w in WORK), rows,
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(HERE + "/wizard.log.md", "w") as fh:
fh.write(text)
verdict, check, _ = craft(task, area, lane, commit, operator)
print(verdict)
print(check)
if __name__ == "__main__":
main()