Present completion research as web document
This commit is contained in:
+53
-5
@@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import hashlib
|
||||
import json
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
@@ -21,12 +22,19 @@ REQUIRED_FILES = (
|
||||
"data/summary.json",
|
||||
"research/memory/findings.md",
|
||||
"research/memory/evidence-ledger.md",
|
||||
"research/completion-verification/findings.md",
|
||||
"research/completion-verification/evidence-ledger.md",
|
||||
"research/evaluation/k1412-agent-evaluation-v1.md",
|
||||
"data/evaluation/k1412-agent-eval-task-contracts-v1.json",
|
||||
"tools/evaluation/score_agent_runs.py",
|
||||
"evaluation-site/index.html",
|
||||
"evaluation-site/evaluation-v1.html",
|
||||
"evaluation-site/assets/styles.css",
|
||||
"evaluation-site/assets/app.js",
|
||||
"evaluation-site/assets/research.css",
|
||||
"evaluation-site/assets/research.js",
|
||||
"evaluation-site/assets/evidence-data.js",
|
||||
"evaluation-site/build_research_data.py",
|
||||
"evaluation-site/Dockerfile",
|
||||
"evaluation-site/nginx.conf",
|
||||
"web/app.py",
|
||||
@@ -96,7 +104,10 @@ def check_research_data() -> dict[str, int]:
|
||||
|
||||
|
||||
def check_python_syntax() -> int:
|
||||
paths = sorted((ROOT / "tools").rglob("*.py")) + [ROOT / "web" / "app.py"]
|
||||
paths = sorted((ROOT / "tools").rglob("*.py")) + [
|
||||
ROOT / "web" / "app.py",
|
||||
ROOT / "evaluation-site" / "build_research_data.py",
|
||||
]
|
||||
for path in paths:
|
||||
ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
|
||||
return len(paths)
|
||||
@@ -143,16 +154,52 @@ def check_evaluation_contract() -> int:
|
||||
return len(tasks)
|
||||
|
||||
|
||||
def check_evaluation_site() -> None:
|
||||
def check_evaluation_site() -> int:
|
||||
html = (ROOT / "evaluation-site/index.html").read_text(encoding="utf-8")
|
||||
archived_html = (ROOT / "evaluation-site/evaluation-v1.html").read_text(encoding="utf-8")
|
||||
javascript = (ROOT / "evaluation-site/assets/app.js").read_text(encoding="utf-8")
|
||||
research_javascript = (ROOT / "evaluation-site/assets/research.js").read_text(encoding="utf-8")
|
||||
evidence_javascript = (ROOT / "evaluation-site/assets/evidence-data.js").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
ledger = (ROOT / "research/completion-verification/evidence-ledger.md").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
dockerfile = (ROOT / "evaluation-site/Dockerfile").read_text(encoding="utf-8")
|
||||
nginx = (ROOT / "evaluation-site/nginx.conf").read_text(encoding="utf-8")
|
||||
require("不是真实跑分" in html, "evaluation simulation must keep its evidence boundary visible")
|
||||
require("尚未运行真实模型对比" in html, "evaluation report overstates current evidence")
|
||||
require("Agent 到底凭什么说" in html, "completion research document is missing")
|
||||
require("自有跑分" in html and ">0<" in html, "research page overstates benchmark evidence")
|
||||
require("completion certificate" in html.lower(), "research synthesis boundary is missing")
|
||||
require(
|
||||
"不是真实跑分" in archived_html,
|
||||
"archived evaluation simulation must keep its evidence boundary visible",
|
||||
)
|
||||
require(
|
||||
"尚未运行真实模型对比" in archived_html,
|
||||
"archived evaluation report overstates current evidence",
|
||||
)
|
||||
require("const TASKS" in javascript, "evaluation task browser is missing")
|
||||
require("K1412_EVIDENCE" in research_javascript, "research evidence browser is missing")
|
||||
|
||||
prefix = "window.K1412_EVIDENCE="
|
||||
require(evidence_javascript.startswith("/* Generated") and prefix in evidence_javascript, "bad evidence data")
|
||||
payload_text = evidence_javascript.split(prefix, 1)[1].strip()
|
||||
require(payload_text.endswith(";"), "bad evidence data terminator")
|
||||
payload = json.loads(payload_text[:-1])
|
||||
counts = payload.get("counts") or {}
|
||||
records = payload.get("records") or []
|
||||
require(counts.get("pool") == len(records) == 40, "completion evidence pool count mismatch")
|
||||
require(counts.get("audited") == 37, "completion audited count mismatch")
|
||||
require(counts.get("core") == 26, "completion core count mismatch")
|
||||
require(
|
||||
payload.get("source_sha256") == hashlib.sha256(ledger.encode("utf-8")).hexdigest(),
|
||||
"completion evidence browser data is stale",
|
||||
)
|
||||
|
||||
require("install -d -m 0755" in dockerfile, "static asset directory must remain traversable")
|
||||
require("evaluation-v1.html" in dockerfile, "archived evaluation page is not packaged")
|
||||
require('location = /health' in nginx, "evaluation site health endpoint is missing")
|
||||
return int(counts["audited"])
|
||||
|
||||
|
||||
def main() -> int:
|
||||
@@ -163,7 +210,7 @@ def main() -> int:
|
||||
check_ollama_contract()
|
||||
check_experiment_state()
|
||||
evaluation_tasks = check_evaluation_contract()
|
||||
check_evaluation_site()
|
||||
completion_evidence = check_evaluation_site()
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
@@ -171,6 +218,7 @@ def main() -> int:
|
||||
"collections": collections,
|
||||
"research": research,
|
||||
"evaluation_tasks": evaluation_tasks,
|
||||
"completion_evidence": completion_evidence,
|
||||
"evaluation_site": True,
|
||||
"python_files_checked": python_files,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user