- source bundle: a /docs directory with QUICK.md (Quick Reference plus a where-to-read table), language/*.md, diagnostics/errors.md and the AIR bundle only under air/; built from docs/agent/source-bundle.txt (> output files, @manifest includes) by zig build agent-reference - Quick Reference examples are checked: every aji block must be an excerpt of a conformance program in tests/conformance/source/quickref (zig build test fails otherwise); QR fixes found by the check (mut d = data, region not auto-borrowed, statement/borrow blocks that could not verify, io_error match) - frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006 - aji lower --stats: mechanical_air_eliminated_raw and _normalized (each byte-string materialization counted as one constant; spec 15 §11) - harness: profile aji_source (doc_groups), per-file and per-group docs metrics on distinctive lines, profile columns (tool calls, lowered AIR raw/normalized, docs files read, IR-form and type-mismatch counts), dev-echo aji_source variant, scripted run and test, source token report - plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block deferred
41 lines
1.9 KiB
Python
Executable File
41 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Dev evaluator for dev-echo (public because the task is dev-set; real
|
|
evaluators live in the private benchmark repository and sandbox the code
|
|
they run).
|
|
|
|
usage: evaluator.py WORKSPACE LANGUAGE TASK_DIR -> JSON verdict on stdout
|
|
"""
|
|
import json, os, subprocess, sys
|
|
|
|
ws, lang = sys.argv[1], sys.argv[2]
|
|
REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
|
|
AJI = os.path.join(REPO, "zig-out", "bin", "aji")
|
|
cases = ["", "hello", "x" * 64, "line one\nline two\n"]
|
|
gates = {}
|
|
|
|
def build():
|
|
if lang == "rust":
|
|
return subprocess.run(["cargo", "build", "-q", "--offline"], cwd=ws, capture_output=True).returncode == 0
|
|
if lang == "zig":
|
|
return subprocess.run(["zig", "build-exe", "main.zig"], cwd=ws, capture_output=True).returncode == 0
|
|
src = "main.aji" if lang == "aji_source" else "main.air"
|
|
return subprocess.run([AJI, "check", src], cwd=ws, capture_output=True).returncode == 0
|
|
|
|
def run(inp):
|
|
if lang in ("aji_air", "aji_source"):
|
|
# `in` is a keyword in .aji, so the source entry point names it `input`.
|
|
argv = ["--grant", "in=io.read", "main.air"] if lang == "aji_air" else ["--grant", "input=io.read", "main.aji"]
|
|
p = subprocess.run([AJI, "run", argv[0], argv[1], "--grant", "out=io.write", "--stdin", inp, argv[2]], cwd=ws, capture_output=True, text=True, timeout=60)
|
|
try:
|
|
rec = json.loads(p.stdout)
|
|
except json.JSONDecodeError:
|
|
return None
|
|
return rec.get("stdout") if rec.get("status") == "returned" else None
|
|
exe = "./target/debug/echo" if lang == "rust" else "./main"
|
|
p = subprocess.run([exe], cwd=ws, input=inp, capture_output=True, text=True, timeout=60)
|
|
return p.stdout if p.returncode == 0 else None
|
|
|
|
gates["builds"] = build()
|
|
gates["functional"] = gates["builds"] and all(run(c) == c for c in cases)
|
|
print(json.dumps({"accepted": all(gates.values()), "gates": gates}))
|