Skip to content

Official Codebase of 3DCodeVerse

Python

Archive obsolete tools and retire historical harness compatibility

gaoypeng9d2a94962657
diff --git a/.gitignore b/.gitignore
index b1833095..edcfa17e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,6 @@ dist/
# Developer-only visual studies; agents use the production starter library.
/harness/examples/graphics_lab/
+
+# Retired tools retained locally for reference.
+/.local-archive/
diff --git a/eval/bench/_fixed_eval.py b/eval/bench/_fixed_eval.py
index d7279c38..511a393c 100644
--- a/eval/bench/_fixed_eval.py
+++ b/eval/bench/_fixed_eval.py
@@ -40,7 +40,7 @@ RUBRIC = "static_object_v1"
def rubric_for(spec: Spec | Track) -> str:
"""The fixed judge's rubric for a cell (or for a battery's track): the track's ``TRACK_INFO``
- row — static_object_v1 / articulated_v1 / scene_v1 / shader_v2.
+ row — static_object_v1 / articulated_v1 / scene_v2 / shader_v2.
The one place the compare bench maps a track to a rubric: ``FixedEvaluator`` defaults to
it, ``judge_for`` picks each cell's judge with it and ``_compare_report`` names it in the
diff --git a/eval/bench/judge_calib_graphics.py b/eval/bench/judge_calib_graphics.py
index a02c4083..4f5a476c 100644
--- a/eval/bench/judge_calib_graphics.py
+++ b/eval/bench/judge_calib_graphics.py
@@ -4,7 +4,7 @@ The loop the object track had (rubric → re-judge recorded rounds → compare a
person sees → revise) never ran for graphics. This script is that loop's measuring half:
python bench/judge_calib_graphics.py --corpus <corpus.json> --eye <eye.json> \
- --rubrics shader_v1,shader_v2 --model gemini:gemini-3.1-pro-preview --n 2 \
+ --rubrics shader_v2 --model gemini:gemini-3.1-pro-preview --n 2 \
--out bench/out/judge_calib_graphics
* ``corpus.json``: ``[[score, run_dir, sheet_path, generator], ...]`` — every graphics run with a
@@ -66,7 +66,7 @@ def main(argv: list[str] | None = None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
ap.add_argument("--corpus", required=True)
ap.add_argument("--eye", required=True)
- ap.add_argument("--rubrics", default="shader_v1,shader_v2")
+ ap.add_argument("--rubrics", default="shader_v2")
ap.add_argument("--model", default="gemini:gemini-3.1-pro-preview")
ap.add_argument("--n", type=int, default=2)
ap.add_argument("--workers", type=int, default=4)
diff --git a/eval/docs/EVAL.md b/eval/docs/EVAL.md
index 0d250629..2353d447 100644
--- a/eval/docs/EVAL.md
+++ b/eval/docs/EVAL.md
@@ -312,8 +312,8 @@ Notes: the earlier criteria-first schema compressed flash to 0.6–0.7 (std 0.01
on 2026-09-22), and the 0.072 round-to-round spread in the corpus is generation variance,
not the judge. Untested: temperature 0.0 (brilliana measured 0.013
vs 0.035 between 0.0 and 0.2 on 512 calls) — one more $8 battery.
-* **scene_v2 (2026-10-14): the scene judge gets stricter and detail-aware; scene_v1 is frozen
- for replays.** Part of the argon scene-tuning program (D105): the owner asked for stricter
+* **scene_v2 (2026-10-14): the scene judge gets stricter and detail-aware; scene_v1 was frozen
+ for replays at that time and is no longer distributed.** Part of the argon scene-tuning program (D105): the owner asked for stricter
connectivity / contact standards, and the scene judge was the lenient half of them — the
placement gate measured floating / sunken / interpenetration while the rubric had one −0.06
"floating or sunken" tick, no interpenetration or scale item at all, a floating cap at 0.70
diff --git a/eval/tests/test_complexity_report.py b/eval/tests/test_complexity_report.py
index 0807b4aa..74b0c008 100644
--- a/eval/tests/test_complexity_report.py
+++ b/eval/tests/test_complexity_report.py
@@ -39,9 +39,9 @@ def _write_run(root: Path, slug: str, *, index: float, overall: float, detail: f
"workspace": str(run),
"plan": StaticPlan(object_name="Chair", summary="s", overall_bbox=box, parts=[
PartPlan(name=n, role="r", description="d", bbox=box) for n in ("a", "b")]).model_dump(mode="json"),
- "status": "passed", "best_round": 0,
+ "status": "max_rounds",
"total_usage": {"cost_usd": cost},
- "extra": {"budget": {"elapsed_min": minutes}}, # a record before step timing counts its clock
+ "steps": [{"step": "generate", "wall_s": minutes * 60}],
"rounds": [{
"index": 0, "kind": "baseline", "gates": [],
"measurement": _measurement(index).model_dump(mode="json"),
@@ -93,20 +93,19 @@ def test_battery_expectations_flag_out_of_band_runs(tmp_path: Path) -> None:
def test_row_recomputes_the_vector_when_the_record_has_none(tmp_path: Path) -> None:
- """The historic corpus predates the vector: the report must fall back to the
- GLB rather than skipping the run."""
+ """A missing measurement can be recomputed from the round's own GLB."""
import trimesh
run = tmp_path / "runs" / "old"
- (run / "artifacts").mkdir(parents=True)
+ (run / "artifacts" / "r00").mkdir(parents=True)
trimesh.Scene({"Box": trimesh.creation.box(extents=(0.3, 0.3, 0.3))}).export(
- str(run / "artifacts" / "object.glb"))
+ str(run / "artifacts" / "r00" / "object.glb"))
(run / "record.json").write_text(json.dumps({
- "spec": {"track": "static_object", "language": "blender", "tags": []},
- "plan": {"parts": []}, "status": "passed", "best_round": 0,
+ "spec": {"id": "box", "prompt": "a box", "track": "static_object", "language": "blender", "tags": []},
+ "status": "max_rounds",
"total_usage": {"cost_usd": 1.0}, "rounds": [{
- "index": 0, "gates": [],
- "judgment": {"overall": 0.5, "passed": False,
+ "index": 0, "kind": "baseline", "gates": [],
+ "judgment": {"rubric": "static_object_v1", "overall": 0.5, "passed": False,
"scores": dict.fromkeys(CR.CRITERIA, 0.5), "issues": []}}]}))
row = CR.row_for(run, "old_battery")
assert row is not None and row["part_count"] == 1 and row["index"] > 0
diff --git a/eval/tests/test_scene_stats.py b/eval/tests/test_scene_stats.py
index 3207e42e..5d7a4a13 100644
--- a/eval/tests/test_scene_stats.py
+++ b/eval/tests/test_scene_stats.py
@@ -52,7 +52,7 @@ def test_the_median_score_is_read_off_the_real_Judgment_shape(tmp_path: Path) ->
def judged(name: str, overall: float) -> None:
d = tmp_path / name / "run"
d.mkdir(parents=True, exist_ok=True)
- j = Judgment(rubric="scene_v1", scores={"a": overall}, overall=overall, passed=overall > 0.5)
+ j = Judgment(rubric="scene_v2", scores={"a": overall}, overall=overall, passed=overall > 0.5)
(d / "record.json").write_text(json.dumps({
"spec": {"track": "scene", "id": name},
"plan": {"assets": []},
diff --git a/finetune/CLAUDE.md b/finetune/CLAUDE.md
index 40d8954f..b4fc4555 100644
--- a/finetune/CLAUDE.md
+++ b/finetune/CLAUDE.md
@@ -7,12 +7,12 @@ Training-data preparation and LLM fine-tuning for 3DCodeVerse. Read `README.md`
external and add a recipe plus the corresponding dataset registry entries.
- `llamafactory/` is the canonical home for this project's LF data conversion, QC, pair builders,
mix sampling, and publication scripts. It is not vendored framework code. Edit implementations there;
- the seven Python entries in `scripts/` are compatibility forwarders.
+ the six Python entries in `scripts/` are compatibility forwarders.
- Configs stay in `configs/`, environment snapshots in `env/`, and train/export/orchestration launchers
in `scripts/`. General source curation and the contributor CLI belong in `../toolkits/`.
- Evaluate generated code with `../eval/llm/`: 3DCodeBench, held-out dialect suites, and pass@N. Follow
- its protocol and decoding defaults. The old stop-DPO scripts still need adaptation to its generation
- schema; do not assume replacing a path is sufficient.
+ its protocol and decoding defaults. Historical stop-DPO generation scripts are no longer distributed; the retained recipes
+ require prepared preference datasets.
- Workstation paths remain in `env.sh`, launchers, configs, and data tools. Inspect them before running;
editing `env.sh` alone is insufficient. Current local training recipes also require external data
registries not fully represented by `data_specs/dataset_info.json`.
diff --git a/finetune/README.md b/finetune/README.md
index 3d1f72dc..b073d49b 100644
--- a/finetune/README.md
+++ b/finetune/README.md
@@ -13,7 +13,7 @@ tools; it is not a copy or fork of the LLaMA-Factory framework.
| path | what |
|---|---|
| [`llamafactory/`](llamafactory/) | canonical training-data scripts: ShareGPT conversion, quality checks, multimodal pairs, token counts, mix sampling, and Hub packaging; includes the per-source `runners/` |
-| [`scripts/`](scripts/) | training/export launchers and workstation orchestration; seven old Python data-script paths are compatibility forwarders to `llamafactory/` |
+| [`scripts/`](scripts/) | training/export launchers and workstation orchestration; six old Python data-script paths are compatibility forwarders to `llamafactory/` |
| [`configs/lf/`](configs/lf/) | current SFT and stop-DPO YAML recipes, the LoRA export template, and a DeepSpeed offload template; see its README for the current recipe list |
| `data_specs/` | recorded dataset registry and data statistics; each run must also have the registry and datasets named by its own `dataset_dir` |
| `env/requirements-{llmft,lf,vllm}.txt` | snapshots of the original data/eval, LLaMA-Factory training, and vLLM inference environments |
@@ -71,10 +71,9 @@ python -m llm.run_eval --backend vllm --model /absolute/path/to/run/merged \
See [`../eval/llm/README.md`](../eval/llm/README.md) for tool/asset setup and suite decoding defaults.
-The stop-DPO recipes are in `configs/lf/dpo_*.yaml`; their workstation orchestration remains in
-`scripts/stop_dpo_pairs.sh` and `scripts/stop_dpo_round.sh`. Those scripts still depend on the old
-generation entrypoint, output schema, and prepared training prompts. Adapting them to `eval/llm/`
-is separate work; the folder reorganization does not make that historical pipeline portable.
+The stop-DPO recipes remain in `configs/lf/dpo_*.yaml`. Their historical generation
+and workstation orchestration scripts are no longer distributed. Prepare matching
+preference data before using these training recipes.
## Released weights
diff --git a/finetune/configs/lf/README.md b/finetune/configs/lf/README.md
index fe4cbbe6..40751670 100644
--- a/finetune/configs/lf/README.md
+++ b/finetune/configs/lf/README.md
@@ -11,7 +11,7 @@ Everything else (batch 1, bf16, cosine schedule, 1 epoch for SFT) is the same ac
| `sft_9b_lora64_lr1e-4_len8k_pubimg.yaml` | the published image pairs (169k rows), local `media_dir` |
| `sft_9b_lora64_lr1e-4_len8k_pairsmix.yaml` | published image+text and text pairs |
| `sft_9b_lora64_lr1e-4_len8k_hub-remote.yaml` | text-only, streamed with `dataset_dir: REMOTE:3dcodeverse/3dcodeverse-2m` |
-| `dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml` | stop-DPO round 1 (also the template `stop_dpo_round.sh` seds) |
+| `dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml` | stop-DPO round 1 |
| `dpo_9b_lora16_lr5e-6_len2k_stop-r2.yaml` | round 2, from the round-1 model |
`export_lora_template.yaml` is the merge template used by `scripts/export_lora.sh`; `ds_z3_offload.json` is the
diff --git a/finetune/llamafactory/README.md b/finetune/llamafactory/README.md
index fa21aec2..78b2e74b 100644
--- a/finetune/llamafactory/README.md
+++ b/finetune/llamafactory/README.md
@@ -5,7 +5,7 @@ quality checks, multimodal pairs, mix sampling, and publication. It contains pro
upstream LLaMA-Factory source. General corpus curation stays in [`../../toolkits/`](../../toolkits/);
training configs, environments, and launchers stay in the parent [`finetune/`](../README.md) component.
-The seven former data scripts in `../scripts/` forward to the implementation here for CLI compatibility.
+The six former data scripts in `../scripts/` forward to the implementation here for CLI compatibility.
For new workflows, call `python llamafactory/<script>.py ...` from `finetune/`. Per-source shell drivers
live in [`runners/`](runners/).
@@ -25,13 +25,11 @@ live in [`runners/`](runners/).
| `shrink_pair_images.py` | re-encode extracted PNG renders as JPEGs at a configurable maximum size (default 448 px); source tars retain the originals |
| `audit_pairs.py` | check pair datasets for absolute/missing/non-JPEG media paths, placeholder counts across all turns, turn shape, fenced code, empty systems, and row-count/QC mismatches; exits nonzero on findings |
| `upload_pairs.py` | publish pair datasets under `<source>/<subdir>_llamafactory_{text,img,imgtext}` and optionally renders under `<source>/pair_renders/`, then update the Hub registry |
-| `drop_old_pair_trees.py` | delete superseded top-level pair trees after checking that the Hub registry no longer points into them |
| `build_md_max.py`, `sample_mix.py` | build the combined corpus and sample mixes with per-dialect token budgets and captions-per-sample caps |
| `build_refine_sft.py` | turn improved harness refinement transitions into message JSONL for SFT |
| `to_llamafactory.py` | convert message JSONL to ShareGPT JSON and registry entries |
| `build_hf_dataset.py` | package prepared corpus data, historical preference sets, held-out tests, and mix descriptions for the Hub |
| `cache_ntok.py`, `ntok_cache.py` | calculate/cache token counts for data builders |
-| `extract.py` | dialect-aware extraction from free-form model output for data QC |
| `analyze_3dcodeverse.py`, `fetch_hf_files.py` | corpus inventory and selective Hub downloads |
| `runners/` | per-source drivers for the pair-building workflows |
diff --git a/finetune/llamafactory/drop_old_pair_trees.py b/finetune/llamafactory/drop_old_pair_trees.py
deleted file mode 100644
index 7eb104d9..00000000
--- a/finetune/llamafactory/drop_old_pair_trees.py
+++ /dev/null
@@ -1,26 +0,0 @@
-"""Remove the superseded top-level pairs/ and pair_images/ once their replacements are registered.
-
-Both were mine: the pair datasets were first published into a separate top-level tree, which read as if it were
-a source of its own. They now live at <source>/<subdir>_llamafactory_{text,img,imgtext} and
-<source>/pair_renders/, and dataset_info.json points only at those, so the old tree is safe to drop.
-"""
-import os, json
-from huggingface_hub import HfApi, hf_hub_download, CommitOperationDelete
-tok = os.environ["HF_TOKEN"]; REPO = "3dcodeverse/3dcodeverse-2m"; api = HfApi(token=tok)
-agg = json.load(open(hf_hub_download(REPO, "dataset_info.json", repo_type="dataset", token=tok)))
-still = [k for k, v in agg.items() if str(v.get("folder", "")).startswith(("pairs/", "pair_images/"))]
-if still:
- raise SystemExit(f"REFUSING: {len(still)} index entries still point into the old tree")
-for d in ("pairs", "pair_images"):
- files = [e.path for e in api.list_repo_tree(REPO, repo_type="dataset", path_in_repo=d, recursive=True)
- if e.__class__.__name__.startswith("RepoFile")]
- print(f"[drop] {d}/: {len(files):,} files", flush=True)
- B = 400
- for i in range(0, len(files), B):
- api.create_commit(repo_id=REPO, repo_type="dataset",
- operations=[CommitOperationDelete(path_in_repo=f) for f in files[i:i+B]],
- commit_message=f"remove the superseded {d}/ ({i+1}-{min(i+B, len(files))} of {len(files)})")
- if (i // B) % 20 == 0:
- print(f"[drop] {min(i+B, len(files)):,}/{len(files):,}", flush=True)
- print(f"[drop] {d}/ removed", flush=True)
-print("[drop] DONE", flush=True)
diff --git a/finetune/llamafactory/extract.py b/finetune/llamafactory/extract.py
deleted file mode 100644
index 55eaa783..00000000
--- a/finetune/llamafactory/extract.py
+++ /dev/null
@@ -1,220 +0,0 @@
-"""Dialect-aware code extraction from free-form model output.
-
-Why this exists: instruct/reasoning models do not answer with bare code. A single response may contain
-a <think> block (often with *draft* code), prose, several fenced blocks (setup shell commands, a JSON
-snippet, the real program, then a "here's a variant" block), or no fence at all. Taking "the longest
-fenced block" (the old rule) picks the draft or the variant often enough to matter.
-
-extract(text, dialect) -> (code, meta)
- * strips reasoning blocks (<think>…</think>, <thinking>…</thinking>, <reasoning>…</reasoning>);
- if the model never closed the block the answer is considered truncated-in-thought and we fall back
- to mining the thought itself (meta["from_think"]=True) so we can still score something.
- * collects candidates: every fenced block (closed or trailing-unterminated), plus the whole visible
- text as a last resort.
- * scores each candidate by: dialect markers (import bpy / cq. / mainImage / THREE. / module …),
- language tag on the fence, syntax validity (ast.parse for python dialects, structural checks
- otherwise), and penalises obvious non-answers (shell commands, pip installs, json, error logs).
- * ties are broken toward the LAST high-scoring block (models put the final program last), then length.
-
-meta keys: n_blocks, chosen, score, lang, had_think, think_chars, from_think, no_fence, valid, markers.
-"""
-import ast
-import json
-import re
-
-THINK_RE = re.compile(r"<(think|thinking|reasoning)>(.*?)</\1>", re.S | re.I)
-THINK_OPEN_RE = re.compile(r"<(think|thinking|reasoning)>(.*)$", re.S | re.I)
-FENCE_RE = re.compile(r"```([A-Za-z0-9_+.#-]*)[ \t]*\r?\n(.*?)```", re.S)
-FENCE_OPEN_RE = re.compile(r"```([A-Za-z0-9_+.#-]*)[ \t]*\r?\n(.*)$", re.S)
-
-# per-dialect: fence language tags, regexes that prove the block is that dialect, and how to syntax-check
-DIALECTS = {
- "blender": {
- "langs": {"python", "py", "python3", "blender", "bpy"},
- "markers": [r"^\s*import\s+bpy\b", r"\bbpy\.(ops|data|context)\b"],
- "check": "python",
- },
- "cadquery": {
- "langs": {"python", "py", "python3", "cadquery", "cq"},
- "markers": [r"^\s*import\s+cadquery\b", r"^\s*from\s+cadquery\b", r"\bcq\.Workplane\b", r"\bcadquery\.Workplane\b"],
- "check": "python",
- },
- "openscad": {
- "langs": {"openscad", "scad"},
- "markers": [r"^\s*module\s+\w+\s*\(", r"\b(cube|cylinder|sphere|polyhedron|linear_extrude|rotate_extrude|hull|minkowski)\s*\("],
- "check": "scad",
- },
- "glsl": {
- "langs": {"glsl", "frag", "fragment", "fs", "c", "cpp"},
- "markers": [r"void\s+mainImage\s*\(", r"\bgl_FragColor\b", r"^\s*#version\b", r"\bfragColor\b"],
- "check": "glsl",
- },
- "threejs": {
- "langs": {"html", "htm", "javascript", "js", "jsx"},
- "markers": [r"<!DOCTYPE\s+html", r"<html", r"\bnew\s+THREE\.", r"\bTHREE\.[A-Z]\w+"],
- "check": "html",
- },
- # generic python (used by "auto" when nothing dialect-specific matches)
- "python": {"langs": {"python", "py", "python3"}, "markers": [r"^\s*(import|from|def|class)\s+\w"], "check": "python"},
-}
-
-# blocks that are never the answer
-NEGATIVE = [
- (re.compile(r"^\s*(pip|conda|apt|sudo|blender|python)\s+(install|-m|-b)\b", re.M), 4),
- (re.compile(r"^\s*[$#>]\s+\w"), 3), # shell prompt
- (re.compile(r"^\s*\{[\s\S]*\}\s*$"), 2), # bare JSON
- (re.compile(r"^\s*(Traceback|Error:|error:)", re.M), 3), # pasted error log
-]
-
-
-def _syntax_ok(code, kind):
- if kind == "python":
- try:
- ast.parse(code)
- return True
- except SyntaxError:
- return False
- except Exception:
- return False
- if kind == "scad":
- return code.count("{") == code.count("}") and code.count("(") == code.count(")") and bool(re.search(r"[;{]", code))
- if kind == "glsl":
- return code.count("{") == code.count("}") and "void" in code
- if kind == "html":
- return ("<" in code and ">" in code) or "THREE" in code
- return True
-
-
-def _candidates(text):
- """[(lang, code, start_index)] for every fenced block, plus a trailing unterminated one."""
- out, last_end = [], 0
- for m in FENCE_RE.finditer(text):
- out.append((m.group(1).lower(), m.group(2), m.start()))
- last_end = m.end()
- tail = text[last_end:]
- m = FENCE_OPEN_RE.search(tail)
- if m and m.group(2).strip():
- out.append((m.group(1).lower(), m.group(2), last_end + m.start()))
- return out
-
-
-def _first_code_line(text):
- """No fence anywhere: drop the prose preamble, keep from the first code-looking line on."""
- pat = re.compile(r"^\s*(import\s+\w|from\s+\w|def\s+\w|class\s+\w|#\s*!|#version|module\s+\w|void\s+\w|<!DOCTYPE|<html|const\s+\w|let\s+\w|var\s+\w|function\s+\w|\$fn\s*=)")
- lines = text.splitlines()
- for i, ln in enumerate(lines):
- if pat.match(ln):
- return "\n".join(lines[i:])
- return text
-
-
-def _score(lang, code, spec):
- s, markers = 0.0, 0
- for pat in spec["markers"]:
- if re.search(pat, code, re.M):
- markers += 1
- s += 3.0 * min(markers, 2)
- if lang in spec["langs"]:
- s += 2.0
- elif lang == "":
- s += 0.5
- valid = _syntax_ok(code, spec["check"])
- if valid:
- s += 2.0
- for pat, pen in NEGATIVE:
- if pat.search(code):
- s -= pen
- if len(code.strip()) < 40:
- s -= 2.0
- return s, valid, markers
-
-
-def extract(text, dialect="auto"):
- meta = {"n_blocks": 0, "chosen": None, "score": None, "lang": None, "had_think": False,
- "think_chars": 0, "from_think": False, "no_fence": False, "valid": False, "markers": 0,
- "dialect": dialect}
- if not text:
- return "", meta
-
- # 1) reasoning blocks
- thinks = THINK_RE.findall(text)
- visible = THINK_RE.sub("", text)
- if thinks:
- meta["had_think"] = True
- meta["think_chars"] = sum(len(t[1]) for t in thinks)
- m = THINK_OPEN_RE.search(visible)
- if m: # unterminated <think>: everything after it is thought
- meta["had_think"] = True
- meta["think_chars"] += len(m.group(2))
- visible = visible[: m.start()]
-
- def _pick(src):
- cands = _candidates(src)
- if not cands:
- return None, None
- specs = [DIALECTS[dialect]] if dialect in DIALECTS else list(DIALECTS.values())
- best = None
- for i, (lang, code, _pos) in enumerate(cands):
- sc = max((_score(lang, code, sp) for sp in specs), key=lambda x: x[0])
- key = (round(sc[0], 3), i, len(code)) # score, then LAST block, then length
- if best is None or key > best[0]:
- best = (key, i, lang, code, sc)
- return cands, best
-
- cands, best = _pick(visible)
- if best is None and visible.strip(): # no fence in the visible answer
- code = _first_code_line(visible)
- specs = [DIALECTS[dialect]] if dialect in DIALECTS else list(DIALECTS.values())
- sc = max((_score("", code, sp) for sp in specs), key=lambda x: x[0])
- meta.update(n_blocks=0, no_fence=True, chosen=-1, score=round(sc[0], 2), lang="", valid=sc[1], markers=sc[2])
- return code.strip("\n"), meta
- if best is None: # nothing visible: mine the thought
- cands, best = _pick(text)
- meta["from_think"] = True
- if best is None:
- return "", meta
-
- meta.update(n_blocks=len(cands), chosen=best[1], score=round(best[4][0], 2), lang=best[2],
- valid=best[4][1], markers=best[4][2])
- return best[3].strip("\n"), meta
-
-
-def extract_code(text, dialect="auto"):
- """Backwards-compatible single-value API (old callers import this name from generate.py)."""
- return extract(text, dialect)[0]
-
-
-def summarize(metas):
- """Aggregate extraction metadata over a run -> dict for extract_stats.json."""
- n = max(1, len(metas))
- return {
- "n": len(metas),
- "with_think": sum(m.get("had_think", False) for m in metas),
- "mean_think_chars": round(sum(m.get("think_chars", 0) for m in metas) / n, 1),
- "no_fence": sum(m.get("no_fence", False) for m in metas),
- "from_think_fallback": sum(m.get("from_think", False) for m in metas),
- "multi_block": sum((m.get("n_blocks") or 0) > 1 for m in metas),
- "mean_blocks": round(sum(m.get("n_blocks") or 0 for m in metas) / n, 2),
- "chosen_not_last": sum(m.get("chosen") is not None and m.get("n_blocks") and m["chosen"] != m["n_blocks"] - 1 for m in metas),
- "syntax_valid": sum(m.get("valid", False) for m in metas),
- "no_dialect_marker": sum((m.get("markers") or 0) == 0 for m in metas),
- "empty": sum((m.get("score") is None) for m in metas),
- }
-
-
-if __name__ == "__main__": # tiny self-test: python eval/extract.py
- T = [
- ("<think>let me draft\n```python\nimport bpy\nbpy.ops.mesh.primitive_cube_add() # draft\n```\nno, better</think>\n"
- "Here is the script:\n```python\nimport bpy\nbpy.ops.mesh.primitive_uv_sphere_add(radius=2)\n```\nThat creates a sphere.",
- "blender", "uv_sphere"),
- ("First install:\n```bash\npip install cadquery\n```\nThen:\n```python\nimport cadquery as cq\nresult = cq.Workplane('XY').box(1,2,3)\n```",
- "cadquery", "Workplane"),
- ("Sure!\nimport bpy\nbpy.ops.mesh.primitive_cone_add()\n", "blender", "cone"),
- ("```\n$fn = 64;\nmodule part(){ cube([10,10,2]); }\npart();\n```", "openscad", "module part"),
- ("```glsl\nvoid mainImage(out vec4 O, in vec2 U){ O = vec4(1.0); }\n```", "glsl", "mainImage"),
- ("<think>thinking forever without closing\n```python\nimport bpy\nbpy.ops.mesh.primitive_torus_add()\n```",
- "blender", "torus"),
- ]
- for text, d, needle in T:
- code, meta = extract(text, d)
- print(("OK " if needle in code else "FAIL"), d, json.dumps({k: meta[k] for k in ("n_blocks", "chosen", "score", "had_think", "from_think", "no_fence", "valid")}))
diff --git a/finetune/scripts/README.md b/finetune/scripts/README.md
index 77bd6dcd..f4568613 100644
--- a/finetune/scripts/README.md
+++ b/finetune/scripts/README.md
@@ -9,23 +9,16 @@ implementations live in [`../llamafactory/`](../llamafactory/); see its README f
| `train_when_free.sh <config> [need_mib] [log]` | wait for a free card and retry a training launch after a detected OOM |
| `free_gpus.sh [need_mib] [gpu_list]` | list cards with the requested free memory |
| `lf_export.sh <config>` / `export_lora.sh <run_dir> [base]` | merge a LoRA adapter into `<run_dir>/merged` |
-| `stop_dpo_pairs.sh` | build termination preference pairs (`TAG`, `BASE_MODEL` env), using the historical generator/output schema |
-| `stop_dpo_round.sh <base_model> <tag>` | historical stop-DPO orchestration: pairs → train → merge |
-| `supervisor2.sh` | process the workstation job queue in `queue.txt` |
-| `sync_repo.sh` | legacy synchronization from the original workstation's external working tree; its scripts copy excludes Python files to preserve the compatibility forwarders |
-These shell scripts retain workstation-specific paths and assumptions. The stop-DPO generation
-interface and some queue entries refer to historical scripts; inspect and adapt them before use.
-`sync_repo.sh` also predates the current directory ownership and should not be used to synchronize
-this layout without updating it.
+These launchers retain workstation-specific paths; adapt them before use.
+Historical workstation queues, synchronization and stop-DPO orchestration are no longer distributed.
-The following seven Python files are thin CLI forwarders, preserving existing command paths while
+The following six Python files are thin CLI forwarders, preserving existing command paths while
running the implementation in `../llamafactory/`:
- `audit_pairs.py`
- `build_pairs_3dcodebench.py`
- `convert_subdirs.py`
-- `drop_old_pair_trees.py`
- `shrink_pair_images.py`
- `upload_pairs.py`
- `verify_unflattened_glsl.py`
diff --git a/finetune/scripts/drop_old_pair_trees.py b/finetune/scripts/drop_old_pair_trees.py
deleted file mode 100644
index a6f32161..00000000
--- a/finetune/scripts/drop_old_pair_trees.py
+++ /dev/null
@@ -1,15 +0,0 @@
-"""Compatibility CLI; the implementation lives in finetune/llamafactory/."""
-
-import runpy
-import sys
-from pathlib import Path
-
-
-def main():
- scripts = Path(__file__).resolve().parents[1] / "llamafactory"
- sys.path.insert(0, str(scripts))
- runpy.run_path(str(scripts / Path(__file__).name), run_name="__main__")
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/queue.txt b/finetune/scripts/queue.txt
deleted file mode 100644
index e8119a05..00000000
--- a/finetune/scripts/queue.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-pubimg|bash -c 'cd /wekafs/ict/hx_624/llm-ft; GPUS=$(scripts/free_gpus.sh 60000) scripts/lf_train.sh configs/lf/sft_9b_lora64_lr1e-4_len8k_pubimg.yaml > logs/train_pubimg.log 2>&1'
-stopdpo_r2_plus|bash scripts/run_stopdpo_r2_plus.sh
-noise_profile|bash scripts/run_noise_profile.sh
diff --git a/finetune/scripts/stop_dpo_pairs.sh b/finetune/scripts/stop_dpo_pairs.sh
deleted file mode 100755
index a97305b8..00000000
--- a/finetune/scripts/stop_dpo_pairs.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-# The 9B does not fail OpenSCAD because it forgot the dialect -- greedy walks it into a repetition loop. The
-# proof: 6.0% greedy vs 44.0% sampled on the same weights (base is 46%), with 30,166 mean tokens greedy against
-# 884 in its training answers, and the longest output is 576 lines of "holder holder holder" comments with no
-# geometry at all. Sampling is a workaround; this trains the behaviour out. The model generates its own negatives
-# (its runaway greedy output) and its own positives (a sampled generation that finishes AND executes), on
-# TRAINING prompts only -- the dialect suites are held-out and must not be trained on.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-TAG=${TAG:-mmmix2}; W=data/stop_dpo_$TAG; BASE=${BASE_MODEL:-runs/lf_qwen35_9b_mmmix2/merged}
-[ -d "$BASE" ] || { echo "[stopdpo] no base model"; exit 0; }
-mkdir -p $W; cp -n data/stop_dpo/prompts.jsonl $W/prompts.jsonl 2>/dev/null || true
-STOP_TP=${STOP_TP:-1}; STOP_NSEQ=${STOP_NSEQ:-}
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[stopdpo] no GPU with 40 GB free"; exit 0; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-# greedy produces the negatives, sampling the positives -- exactly the two behaviours we want to separate
-[ -d $W/gen_greedy/. ] || python eval/generate_vllm.py --model $BASE --prompts $W/prompts.jsonl --out $W/gen_greedy \
- --tp $STOP_TP ${STOP_NSEQ:+--max_num_seqs $STOP_NSEQ} --no_think --max_new_tokens 16384 --max_model_len 20480 2>&1 | tail -1
-for i in 1 2; do
- [ -d $W/gen_s$i/. ] || python eval/generate_vllm.py --model $BASE --prompts $W/prompts.jsonl --out $W/gen_s$i \
- --tp $STOP_TP ${STOP_NSEQ:+--max_num_seqs $STOP_NSEQ} --no_think --max_new_tokens 16384 --max_model_len 20480 --temperature 0.8 --seed $((700+i)) 2>&1 | tail -1
-done
-conda activate llmft
-python - <<'PY'
-import json, os, glob, random, collections
-random.seed(5); W = "data/stop_dpo_" + os.environ.get("TAG", "mmmix2")
-prompts = {json.loads(l)["task"]: json.loads(l) for l in open(f"{W}/prompts.jsonl")}
-def load(d):
- out = {}
- p = f"{d}/gens_shard0.jsonl"
- if not os.path.exists(p): return out
- for l in open(p):
- r = json.loads(l); t = r["task"]
- cp = f"{d}/{t}/code.py"
- if not os.path.exists(cp): continue
- out[t] = {"finished": r.get("finished", True), "ntok": r.get("n_new_tokens", 0),
- "code": open(cp, encoding="utf-8", errors="replace").read().strip()}
- return out
-greedy = load(f"{W}/gen_greedy")
-samples = [load(f"{W}/gen_s{i}") for i in (1, 2)]
-pairs, why = [], collections.Counter()
-for t, g in greedy.items():
- # a negative must actually be a runaway: unfinished, or wildly longer than anything in the training data
- bad = (not g["finished"]) or g["ntok"] > 8192
- if not bad: why["greedy_was_fine"] += 1; continue
- cands = [s[t] for s in samples if t in s and s[t]["finished"] and s[t]["ntok"] <= 8192 and len(s[t]["code"]) > 60]
- if not cands: why["no_clean_sample"] += 1; continue
- good = min(cands, key=lambda c: c["ntok"])
- if good["code"] == g["code"]: why["identical"] += 1; continue
- p = prompts[t]
- pairs.append({"conversations": [{"from": "human", "value": p["messages"][1]["content"]}],
- "system": p["messages"][0]["content"],
- "chosen": {"from": "gpt", "value": good["code"]},
- "rejected": {"from": "gpt", "value": g["code"][:60000]},
- "dialect": p["dialect"]})
- why["paired"] += 1
-random.shuffle(pairs)
-tag = os.environ.get("TAG", "mmmix2")
-json.dump(pairs, open(f"data/lf/stop_dpo_pairs_{tag}.json", "w"), ensure_ascii=False)
-info = json.load(open("data/lf/dataset_info.json"))
-info[f"stop_dpo_pairs_{tag}"] = {"file_name": f"stop_dpo_pairs_{tag}.json", "ranking": True, "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system", "chosen": "chosen", "rejected": "rejected"}}
-json.dump(info, open("data/lf/dataset_info.json", "w"), indent=2)
-print("[stopdpo] pairs:", len(pairs), dict(why))
-print("[stopdpo] by dialect:", dict(collections.Counter(p["dialect"] for p in pairs)))
-PY
-echo "[stopdpo] DATA DONE"
diff --git a/finetune/scripts/stop_dpo_round.sh b/finetune/scripts/stop_dpo_round.sh
deleted file mode 100755
index 58790c51..00000000
--- a/finetune/scripts/stop_dpo_round.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-# One full stop-DPO round: sample the model, pair its runaway greedy output against its own terminating
-# sampled output, train, merge. Termination pairs transfer across models, so a round is worth running on any
-# new SFT model. Replaces run_stop_dpo{,_r2,_train}.sh and run_stopdpo_{r2_plus,transfer}.sh, which differed
-# only in which model and tag they hardcoded.
-# scripts/stop_dpo_round.sh <base_model_dir> <tag>
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-BASE=$(readlink -f "$1"); TAG=$2; RUN=runs/lf_${TAG}
-[ -d "$BASE" ] || { echo "[stopdpo] base model $BASE missing"; exit 1; }
-export TAG BASE_MODEL="$BASE"
-source /wekafs/ict/hx_624/.secrets/hf.env 2>/dev/null || true
-bash scripts/stop_dpo_pairs.sh
-PAIRS=data/lf/stop_dpo_pairs_${TAG}.json
-N=$(python3 -c "import json;print(len(json.load(open('$PAIRS'))))" 2>/dev/null || echo 0)
-echo "[stopdpo] $N pairs"
-# Round 1 removes most runaways; too few left means the behaviour is gone, and that is the result.
-[ "${N:-0}" -lt 100 ] && { echo "[stopdpo] only $N pairs left — stopping here"; exit 0; }
-CFG=configs/lf/_gen_dpo_${TAG}.yaml
-sed -e "s|^model_name_or_path:.*|model_name_or_path: $BASE|" \
- -e "s|^dataset:.*|dataset: stop_dpo_pairs_${TAG}|" \
- -e "s|^output_dir:.*|output_dir: $(pwd)/$RUN|" configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml > "$CFG"
-scripts/train_when_free.sh "$CFG" 60000 "logs/train_${TAG}.log" || exit 1
-scripts/export_lora.sh "$RUN" "$BASE" > "logs/export_${TAG}.log" 2>&1
-echo "[stopdpo] DONE -> $RUN/merged"
diff --git a/finetune/scripts/supervisor2.sh b/finetune/scripts/supervisor2.sh
deleted file mode 100644
index ce7ff1e4..00000000
--- a/finetune/scripts/supervisor2.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-# Keeps GPUs 0-3 busy: runs the pending jobs in scripts/queue.txt one at a time, restarts nothing that succeeded,
-# and reports every state change to logs/supervisor.log. One line per job: "<label>|<command>".
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-Q=scripts/queue.txt; STATE=logs/.supervisor_done
-touch $STATE
-while true; do
- PENDING=""
- while IFS='|' read -r label cmd; do
- [ -z "${label:-}" ] && continue
- case "$label" in \#*) continue;; esac
- grep -qx "$label" $STATE || { PENDING="$label|$cmd"; break; }
- done < $Q
- if [ -z "$PENDING" ]; then
- echo "[sup] $(date) queue empty — idling (add a line to $Q to continue)"
- IDLE_MIN=0
- while [ -z "$PENDING" ]; do
- sleep 300; IDLE_MIN=$((IDLE_MIN+5))
- [ $((IDLE_MIN % 30)) -eq 0 ] && echo "[sup] WARNING $(date) idle ${IDLE_MIN}m with GPUs [$(scripts/free_gpus.sh)] free"
- while IFS='|' read -r label cmd; do
- [ -z "${label:-}" ] && continue; case "$label" in \#*) continue;; esac
- grep -qx "$label" $STATE || { PENDING="$label|$cmd"; break; }
- done < $Q
- done
- fi
- label="${PENDING%%|*}"; cmd="${PENDING#*|}"
- # wait until no training/inference of mine is running and the GPUs are idle (3 confirmations)
- STABLE=0
- while [ $STABLE -lt 3 ]; do
- # count only REAL trainer/inference processes (python/torchrun): a plain `pgrep -f` also matches
- # monitoring shells whose own command line contains these strings, which deadlocks the queue
- MINE=0
- for pid in $(pgrep -u $USER -f "llamafactory-cli train|generate_multi.py|generate_vllm.py" 2>/dev/null); do
- case "$(ps -o comm= -p $pid 2>/dev/null)" in python*|torchrun*|pt_main*) MINE=$((MINE+1));; esac
- done
- F=$(scripts/free_gpus.sh); N=$(echo "$F" | awk -F, 'NF&&$1!=""{print NF}')
- if [ "$MINE" -eq 0 ] && [ "${N:-0}" -ge 2 ]; then STABLE=$((STABLE+1)); else STABLE=0; fi
- sleep 30
- done
- # the wait above can last hours; another process may have finished this job meanwhile, so re-confirm the
- # decision instead of acting on one made before the wait (this is how mm_multisuite ran a second time)
- if grep -qx "$label" $STATE; then echo "[sup] $(date) skipping $label — completed while waiting"; continue; fi
- echo "[sup] $(date) starting: $label"
- bash -c "$cmd" >> logs/sup_$label.log 2>&1
- RC=$?
- if [ $RC -eq 0 ]; then echo "[sup] $(date) OK: $label"; else echo "[sup] $(date) FAILED (rc=$RC): $label — see logs/sup_$label.log"; fi
- echo "$label" >> $STATE
-done
diff --git a/finetune/scripts/sync_repo.sh b/finetune/scripts/sync_repo.sh
deleted file mode 100755
index fc52a7eb..00000000
--- a/finetune/scripts/sync_repo.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-# One command to mirror the working tree into the GitHub repo and push:
-# scripts/sync_repo.sh "commit message" (default message if omitted)
-#
-# What is synced (code + docs only):
-# shell scripts/ configs/ eval/ env.sh -> finetune/
-# Python data tools are maintained in the repo's finetune/llamafactory/;
-# their compatibility launchers in scripts/ must not be overwritten by old copies.
-# REPORT.md -> finetune/docs/REPORT.md
-# README.md -> finetune/docs/PROJECT_README.md
-# llm_finetune_exps.md -> finetune/llm_finetune_exps.md
-# data/lf/dataset_info.json -> finetune/data_specs/dataset_info.json
-# data/md_max/report.json -> finetune/data_specs/md_max_report.json
-# pip freezes of the three envs -> finetune/env/requirements-*.txt (with --envs)
-# Never synced: data/, runs/, logs/, eval/out/, models/, secrets. Only finetune/ is ever touched.
-set -uo pipefail
-SRC=/wekafs/ict/hx_624/llm-ft
-REPO=/wekafs/ict/hx_624/repos/3dcodeverse
-DST=$REPO/finetune
-MSG=${1:-"finetune: sync scripts, configs, eval stack and docs"}
-
-[ -d "$DST" ] || { echo "repo clone missing at $REPO"; exit 1; }
-# Preserve the repo-owned entrypoints/docs and this script itself, so an older
-# external sync script cannot restore the pre-consolidation mirroring rules.
-rsync -a --delete --exclude '__pycache__' --exclude '*.pyc' --exclude '*.py' \
- --exclude '/sync_repo.sh' --exclude '/README.md' "$SRC/scripts/" "$DST/scripts/"
-# --delete on configs too: without it a config retired into configs/lf/archive/ was copied to its new
-# location but the old copy lingered in the repo forever, so a tidy-up never actually reached GitHub.
-rsync -a --delete --exclude '__pycache__' "$SRC/configs/" "$DST/configs/"
-rm -rf "$DST/eval" # superseded by 3dcodeverse_eval/; without this the old copy lingers forever
-# The evaluation stack is managed as a self-contained folder under LLaMA-Factory now; llm-ft/eval keeps the
-# working generations (out/) and is no longer what the repo mirrors.
-rsync -a --delete --exclude '__pycache__' --exclude '*.pyc' \
- /wekafs/ict/hx_624/tools/LLaMA-Factory/3dcodeverse_eval/ "$DST/3dcodeverse_eval/"
-cp "$SRC/env.sh" "$DST/env.sh"
-cp "$SRC/REPORT.md" "$DST/docs/REPORT.md"
-cp "$SRC/README.md" "$DST/docs/PROJECT_README.md" 2>/dev/null || true
-cp "$SRC/llm_finetune_exps.md" "$DST/llm_finetune_exps.md" 2>/dev/null || true
-cp "$SRC/data/lf/dataset_info.json" "$DST/data_specs/dataset_info.json" 2>/dev/null || true
-cp "$SRC/data/md_max/report.json" "$DST/data_specs/md_max_report.json" 2>/dev/null || true
-if [ "${2:-}" = "--envs" ]; then
- source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh
- for e in llmft lf vllm; do conda activate $e && pip freeze > "$DST/env/requirements-$e.txt"; done
- conda deactivate
-fi
-
-# refuse to publish anything that looks like a credential
-PAT=$(printf '%s_%s|%s_%s|%s_%s' hf '[A-Za-z0-9]{30,}' ghp '[A-Za-z0-9]{30,}' github 'pat_[A-Za-z0-9_]{20,}') # assembled at runtime so this file cannot match itself
-if grep -rIlE "$PAT" "$DST" | head -1 | grep -q .; then
- echo "ABORT: a token-like string is present under finetune/ — not committing"; exit 1
-fi
-
-cd "$REPO"
-git add -A -- finetune
-if git diff --cached --quiet; then echo "[sync] nothing changed"; exit 0; fi
-git commit -q -m "$MSG
-
-Co-Authored-By: Claude Fable 5 <[email protected]>
-Claude-Session: https://claude.ai/code/session_01EtURHD29bBnAeA3FkJNnci"
-export GIT_ASKPASS=/wekafs/ict/hx_624/.secrets/gh_askpass.sh GIT_TERMINAL_PROMPT=0
-git fetch -q origin main && git rebase -q origin/main
-git push -q origin main && echo "[sync] pushed: $(git log --oneline -1)"
diff --git a/finetune/tests/test_llamafactory_entrypoints.py b/finetune/tests/test_llamafactory_entrypoints.py
index e29acfc8..11bd96e3 100644
--- a/finetune/tests/test_llamafactory_entrypoints.py
+++ b/finetune/tests/test_llamafactory_entrypoints.py
@@ -20,7 +20,6 @@ LEGACY_SCRIPTS = (
"audit_pairs.py",
"build_pairs_3dcodebench.py",
"convert_subdirs.py",
- "drop_old_pair_trees.py",
"shrink_pair_images.py",
"upload_pairs.py",
"verify_unflattened_glsl.py",
diff --git a/harness/codeverse3d/agents/materialize.py b/harness/codeverse3d/agents/materialize.py
index be884415..c8313273 100644
--- a/harness/codeverse3d/agents/materialize.py
+++ b/harness/codeverse3d/agents/materialize.py
@@ -30,14 +30,10 @@ import logging
from codeverse3d.agents.cli_common import default_mcp_command
from codeverse3d.proc import read_json_or_none
from codeverse3d.skills.materialize import BODY_FILES
-from codeverse3d.workspace import C3D_DIR, Workspace
+from codeverse3d.workspace import Workspace
log = logging.getLogger(__name__)
-#: a run made BEFORE D107 was handed its language's cookbook here (and a "## Cookbook" section in
-#: the body files). Materialising removes it, and its presence makes a resumed run re-materialise
-#: (``needs_rematerialize``) so the agent of a later round never reads a cookbook.
-LEGACY_COOKBOOK = f"{C3D_DIR}/cookbook.md"
MCP_SERVER_NAME = "3dcode"
MCP_TOOL_TIMEOUT_MS = 600_000
#: ``.antigravityignore`` — agy's own ignore file. The agent-facing artefacts must stay readable:
@@ -166,13 +162,6 @@ def materialize_workspace(
body = _body(agent_kind, contract_md, spatial_tools, mcp_command, ws)
for name in BODY_FILES:
(ws.root / name).write_text(body)
- (ws.root / LEGACY_COOKBOOK).unlink(missing_ok=True)
# No MCP server is written into the workspace: every CLI gets 3dcode from a harness-owned
# per-session file, so an agent-planted server cannot reach the next round (audit 2026-08-27).
(ws.root / IGNORE_FILE).write_text("\n".join(IGNORE_LINES) + "\n")
-
-
-def needs_rematerialize(ws: Workspace) -> bool:
- """A workspace materialised before D107 (it still holds :data:`LEGACY_COOKBOOK`) — its body
- files carry the old "## Cookbook" section, so a resumed run writes them again."""
- return (ws.root / LEGACY_COOKBOOK).is_file()
diff --git a/harness/codeverse3d/cli/layout_cmd.py b/harness/codeverse3d/cli/layout_cmd.py
index e9de50bb..a7eb354c 100644
--- a/harness/codeverse3d/cli/layout_cmd.py
+++ b/harness/codeverse3d/cli/layout_cmd.py
@@ -83,8 +83,6 @@ def print_status(ws: Workspace, record: RunRecord | None, n_events: int) -> None
score = c.get("score")
rows[f"{c.get('label', c.get('index'))}{' *' if c.get('index') == cands.get('selected') else ''}"] = (
f"score {score if score is None else round(score, 3)} build_ok={c.get('build_ok')}")
- if pw := cands.get("pairwise"): # a record from before 2026-09-22 (in-loop pairwise)
- rows["pairwise"] = f"{pw.get('a')} vs {pw.get('b')} → {pw.get('winner')} (confidence {pw.get('confidence')})"
console.print(kv_table("candidates (best-of-N, * = selected)", rows))
if record is not None and (t := record.extra.get("texturing")):
console.print(kv_table("texturing", {
@@ -131,8 +129,8 @@ def _deliverable_table(d: RunDeliverable) -> Table:
return t
-def _legacy_deliverable_rows(ws: Workspace) -> dict[str, Any]:
- """Old layout: point at the physical artifacts instead of ``deliverable/``."""
+def _unpackaged_artifact_rows(ws: Workspace) -> dict[str, Any]:
+ """A run not yet packaged: show physical artifacts instead of ``deliverable/``."""
rows: dict[str, Any] = {}
for name in ("object.glb", "object.stl", "object.step", "robot.urdf", "object_textured.glb", "preview.gif"):
p = ws.artifacts / name
@@ -161,7 +159,7 @@ def print_deliverable(ws: Workspace, record: RunRecord) -> None:
warn(f"not packaged: {name} — {why}")
else:
console.print(kv_table("artifacts (no deliverable/ yet — `3dcode pick` packages a round)",
- _legacy_deliverable_rows(ws)))
+ _unpackaged_artifact_rows(ws)))
# --------------------------------------------------------------------------- (b) evidence
@@ -232,7 +230,7 @@ def print_cost_and_settings(ws: Workspace, record: RunRecord) -> None:
tele = load_telemetry(ws, record)
computed = False
if tele is None or tele.cost is None:
- tele = build_telemetry(ws, record, write=False) # old layout: compute, do not write
+ tele = build_telemetry(ws, record, write=False) # incomplete telemetry: compute without writing
computed = True
cost, settings = tele.cost, tele.settings
if cost is not None:
diff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.py
index cb5a99e0..6468e6da 100644
--- a/harness/codeverse3d/cli/main.py
+++ b/harness/codeverse3d/cli/main.py
@@ -607,7 +607,7 @@ def _finished_reason(ws, raised: dict) -> str:
return "" if raised else f"{detail}: raise a cap to continue it (--max-minutes / --rounds)"
if status is RunStatus.MAX_ROUNDS:
return "" if "max_rounds" in raised else f"{detail}: raise --rounds to continue it"
- finished = (RunStatus.STOPPED, RunStatus.NO_CHANGE, RunStatus.NO_REFINE_TASKS)
+ finished = (RunStatus.NO_CHANGE, RunStatus.NO_REFINE_TASKS)
return detail if status in finished else ""
diff --git a/harness/codeverse3d/contracts/common.py b/harness/codeverse3d/contracts/common.py
index 8f32aef7..f05706db 100644
--- a/harness/codeverse3d/contracts/common.py
+++ b/harness/codeverse3d/contracts/common.py
@@ -163,8 +163,7 @@ class Budget(BaseModel):
for the ledger and the run record, and never gates anything.
``extra="forbid"``: a caller still passing a retired ceiling (``max_usd``) or a typo
- must raise, not be silently swallowed. Old on-disk specs are migrated in ONE place:
- ``Spec._strip_retired_budget_keys``.
+ must raise, not be silently swallowed, including when loading a stored spec.
"""
model_config = ConfigDict(extra="forbid")
diff --git a/harness/codeverse3d/contracts/run.py b/harness/codeverse3d/contracts/run.py
index c3567676..bc854b4a 100644
--- a/harness/codeverse3d/contracts/run.py
+++ b/harness/codeverse3d/contracts/run.py
@@ -15,7 +15,7 @@ from enum import StrEnum
from pathlib import PurePosixPath
from typing import Any, Literal
-from pydantic import AliasChoices, BaseModel, ConfigDict, Field
+from pydantic import BaseModel, ConfigDict, Field
from codeverse3d.contracts.artifacts import (
BuildResult,
@@ -177,12 +177,6 @@ class RunStatus(StrEnum):
NO_REFINE_TASKS = "no_refine_tasks" # the last round left nothing to ask for
JUDGE_UNAVAILABLE = "judge_unavailable" # the last round has no verdict, even after a re-judge
FAILED = "failed"
- #: a run recorded before 2026-09-22 that ended on a judgement stop (``passed`` / ``plateau``)
- STOPPED = "stopped"
-
- @classmethod
- def _missing_(cls, value: object) -> RunStatus | None:
- return cls.STOPPED if value in ("passed", "plateau") else None
class StepTime(BaseModel):
@@ -220,9 +214,9 @@ class RoundRecord(BaseModel):
default=None, description="skills attached to this round's sessions, and which were actually read")
started_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
duration_s: float = Field(default=0.0, description="the round's clock, provider errors included")
- steps: list[StepTime] | None = Field(
- default=None, description="the round's timed steps (generate / build / gates / render / judge); "
- "None = recorded before 2026-09-22")
+ steps: list[StepTime] = Field(
+ default_factory=list, description="the round's timed steps (generate / build / gates / render / judge); "
+ "empty until timing is recorded")
notes: str = ""
@property
@@ -231,10 +225,7 @@ class RoundRecord(BaseModel):
@property
def minutes(self) -> float:
- """The round's minutes: its steps' ``wall_s - lost_s``. A round recorded before step
- timing (``steps is None``) counts its own clock, ``duration_s``."""
- if self.steps is None:
- return self.duration_s / 60.0
+ """The round's timed steps, excluding provider wait."""
return sum(s.active_s for s in self.steps) / 60.0
@@ -244,12 +235,11 @@ class RoleSettings(BaseModel):
``source`` says where the sampling knobs came from: ``run`` (stamped by the track as it
ran, ``record.extra["sampling"]``) or ``spec`` (only the model is known — a vendor CLI owns
- its knobs; the values are left empty rather than guessed). Records before 2026-09-22 say
- ``default`` (read off the call sites' signature defaults)."""
+ its knobs; the values are left empty rather than guessed)."""
role: str
model: str = ""
- backend: str = Field(default="", description="gemini | anthropic | gemini-cli | codex | … (api-agent only in records written before 2026-08-28)")
+ backend: str = Field(default="", description="gemini | anthropic | agy | claude-code | codex | …")
thinking: str = Field(default="", description="off | low | medium | high; '' = not recorded")
temperature: float | None = None
n_samples: int | None = Field(default=None, description="judge samples per verdict")
@@ -295,9 +285,7 @@ class StageCost(BaseModel):
class CostSummary(BaseModel):
"""``telemetry/cost.json``: the run's ledger rows summarised — what the run cost, where, and
- its minutes against ``max_minutes``. A summary written before 2026-09-22 also carries
- ``ledger_usd`` / ``unattributed_usd`` / ``post_run_usd`` (the record's total and the ledger
- were two numbers then) and a span as ``wall_clock_s``: unknown keys, ignored."""
+ its minutes against ``max_minutes``."""
schema_version: int = 1
total_usd: float = Field(default=0.0, description="the ledger's sum at list price = record.total_usage")
@@ -334,8 +322,7 @@ class RunDeliverable(BaseModel):
schema_version: int = 1
dir: str = "deliverable"
- round: int | None = Field(default=None, validation_alias=AliasChoices("round", "best_round"),
- description="the packaged round (manifests before 2026-09-22 call it best_round)")
+ round: int | None = Field(default=None, description="the packaged round")
commit: str = ""
code_source: str = Field(default="", description="commit | working_tree")
entry: str = Field(default="", description="run-relative entry file of the code snapshot")
@@ -349,10 +336,7 @@ class RunDeliverable(BaseModel):
class RunRecord(BaseModel):
- """One run. A record written before 2026-09-22 also names a baseline and a final score
- (``baseline_score`` / ``final_score``) and a round may carry a ``pairwise`` tie-break note:
- unknown keys, ignored — ``addons.select`` answers which round to hand over, after the run.
- Its ``best_round`` is kept (below): the only pointer to the round its ``artifacts/`` holds."""
+ """One run; selection is recorded separately after generation finishes."""
spec: Spec
plan: StaticPlan | ArticulatedPlan | ScenePlan | GraphicsPlan | None = None
@@ -367,30 +351,18 @@ class RunRecord(BaseModel):
error: str = ""
telemetry: RunTelemetry | None = Field(
default=None, description="settings snapshot + cost summary (written by finalize_record)")
- steps: list[StepTime] | None = Field(
- default=None, description="the run-level timed steps (plan, the pre-round stages, best-of-N, the part of "
- "an aborted round that ran); None = recorded before 2026-09-22")
+ steps: list[StepTime] = Field(
+ default_factory=list, description="the run-level timed steps (plan, the pre-round stages, best-of-N, the part of "
+ "an aborted round that ran)")
extra: dict[str, Any] = Field(default_factory=dict)
- best_round: int | None = Field(
- default=None, exclude_if=lambda v: v is None,
- description="LEGACY, read-only: written only by runs recorded before 2026-09-22 (pre-D80), whose "
- "finalise rebuilt that round into artifacts/ — record.deliverable.round_outputs finds "
- "the round's GLB/GIF/meshes by it. Kept so a record rewrite (flywheel caption, "
- "pick --texture) does not drop it; never set by a new run, never a pick")
@property
- def minutes(self) -> float | None:
+ def minutes(self) -> float:
"""THE minutes of a run, the one number every reader reports: the ``wall_s - lost_s``
of every step, run-level and round, so time lost to 503 / 429 / token-limit errors
does not count (owner, 2026-09-22). It is a statistic, not the budget: the
``max_minutes`` clock (``orchestrator.BudgetGuard``) counts every active second,
errors included, because it must stop a run even in a 503 storm.
- A record written before step timing (``steps is None``) counts its own clock
- instead: the budget's active minutes, ``extra["budget"]["elapsed_min"]`` (None when
- even that is missing)."""
- if self.steps is None:
- budget = self.extra.get("budget")
- elapsed = budget.get("elapsed_min") if isinstance(budget, dict) else None
- return float(elapsed) if isinstance(elapsed, (int, float)) else None
+ """
return sum(s.active_s for s in self.steps) / 60.0 + sum(r.minutes for r in self.rounds)
diff --git a/harness/codeverse3d/contracts/spec.py b/harness/codeverse3d/contracts/spec.py
index ef8edf8d..0d6e43e1 100644
--- a/harness/codeverse3d/contracts/spec.py
+++ b/harness/codeverse3d/contracts/spec.py
@@ -3,7 +3,6 @@
from __future__ import annotations
from datetime import UTC, datetime
-from typing import Any
from pydantic import BaseModel, Field, model_validator
@@ -60,20 +59,6 @@ class Spec(BaseModel):
tags: list[str] = Field(default_factory=list)
created_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
- @model_validator(mode="before")
- @classmethod
- def _strip_retired_budget_keys(cls, data: Any) -> Any:
- """THE migration point for retired spec fields — nowhere else may tolerate them.
-
- Runs recorded before 2026-08-28 carry ``budget.max_usd`` (the money ceiling
- deleted from the harness). ``Budget`` itself is ``extra="forbid"`` so live
- callers and typos raise — but a spec.json / record.json written back then must
- keep loading (resume, flywheel), so the retired key is stripped here, before
- validation."""
- if isinstance(data, dict) and isinstance(data.get("budget"), dict) and "max_usd" in data["budget"]:
- data = {**data, "budget": {k: v for k, v in data["budget"].items() if k != "max_usd"}}
- return data
-
@model_validator(mode="after")
def _language_fits_track(self) -> Spec:
allowed = TRACK_LANGUAGES[self.track]
diff --git a/harness/codeverse3d/judges/rubrics/scene_v1.yaml b/harness/codeverse3d/judges/rubrics/scene_v1.yaml
deleted file mode 100644
index cc9b7765..00000000
--- a/harness/codeverse3d/judges/rubrics/scene_v1.yaml
+++ /dev/null
@@ -1,280 +0,0 @@
-name: scene_v1
-version: 1
-track_hint: scene
-pass_threshold: 0.70
-description: >
- Rubric for a procedural 3D SCENE (a place) judged on its authored cameras plus a
- fitted overview rig, at one or more animation times, with a probe digest (console/shader
- errors, census). The scene owns its lighting, sky and fog: grade
- the picture it makes, and the place it depicts.
-
-extra_instructions: >
- Views named overview_* are HARNESS cameras fitted to the scene bounds — nobody framed
- them; use them only for layout, coverage, floating/sunken objects and scale, and never
- as evidence that a picture is badly composed, badly lit or under-dressed. Every other
- view is one of the scene's OWN authored cameras (PascalCase plan names such as
- Establishing / BridgeView) — grade composition, lighting, atmosphere and effects on
- those alone. Views at different times (t=...) show animation, but they reach you in
- different montage images: do NOT judge motion by comparing them — the harness measures
- the pixel change between the two times per camera and states it in the context; that
- measurement decides `nothing_moves` and every "it must move" acceptance item. The probe
- digest lists console/shader errors measured by the harness; treat those as facts.
- A gate finding that starts with "harness rig view" describes one of the harness's own
- cameras, not the scene: never turn it into a defect against the scene.
- Use zone and asset names from the plan digest as targets.
- A scene a person would screenshot belongs at 0.8+; a recognisable place with one
- dead zone / flat lighting / floating asset sits near 0.5; an unlit, empty or
- unreadable scene sits at 0.1-0.3.
- Craft on this track is mostly about five things, so look for each of them explicitly
- before scoring: (1) the GROUND — is it several blended materials with paths, wear and
- dressed edges, or one flat colour with a hard bbox line; (2) VEGETATION / repeated
- natural elements — several silhouettes with size and hue variation in clusters, or one
- shape stamped in a ring; (3) DEPTH — is there something in the near foreground framing
- the shot, a subject in the midground and a horizon above, or is it a small diorama alone
- on a big empty plane; (4) DRESSING — the small props (pebbles, leaves, tools, cups,
- cables, litter) that make a place look used; (5) ATMOSPHERE — fog/haze giving aerial
- perspective, coloured (sky-lit) shade, and a key light whose hue differs from the fill.
- A scene can be entirely correct against the brief and still sit at 0.5 because it fails
- all five; say so in the issues rather than inventing a fidelity complaint.
-
-criteria:
- - id: brief_fidelity
- weight: 0.18
- floor: 0.30
- title: Brief fidelity
- description: >
- Does the scene depict the place the brief describes, with every named element
- (landmarks, zones, weather, time of day, activity) present and recognisable,
- arranged as the brief implies?
- anchors:
- "1.0": Every named element is present and recognisable; setting, era, weather and time of day are unmistakable.
- "0.7": The place reads right; one named element is token or hard to find.
- "0.4": The place reads right but named elements are missing, or the time of day / weather contradicts the brief.
- "0.1": Wrong kind of place, or an unreadable world.
-
- - id: composition_and_camera
- weight: 0.14
- floor: 0.25
- title: Composition and camera
- description: >
- Do the authored cameras make readable, well-framed pictures — a focal subject,
- foreground/midground/background, horizon placed deliberately, nothing clipped by
- the near plane, no camera inside geometry, no shot that shows only sky or ground?
- anchors:
- "1.0": Every authored camera is a composed shot — a foreground element within a few metres frames the edge, the subject fills the middle distance, a horizon band sits above, and the subject is what the camera is aimed at.
- "0.7": Shots are readable and aimed at the subject, but one layer is missing (no foreground, or a bare horizon) or one shot is flat / off-centre.
- "0.5": The scene reads as a diorama photographed from outside — subject centred on a large empty plane, no foreground, nothing on the horizon.
- "0.4": One authored camera shows nothing useful (sky, ground, the inside of a wall), or the establishing shot is aimed at the bounds centre rather than the subject, or a shot is badly clipped.
- "0.1": Most shots are unusable or the camera is inside geometry.
-
- - id: lighting_atmosphere
- weight: 0.14
- floor: 0.25
- title: Lighting and atmosphere
- description: >
- Is the lighting readable and atmospheric — a consistent sun/moon direction,
- present soft shadows, sky that matches the mood, aerial perspective / fog giving
- depth, exposure neither blown nor crushed, coloured (sky-lit) shade rather than
- black?
- anchors:
- "1.0": Clear mood executed consistently; warm key against a cooler fill (or the reverse); soft accurate shadows with smooth edges; fog/haze gives visible aerial perspective with distance; shade carries sky colour.
- "0.7": Good lighting with one weakness (slightly flat shadows, slightly heavy fog, or a horizon with no atmospheric falloff).
- "0.5": Lit but airless — no haze or depth cue, key and fill share one hue so the frame is monochrome, or shadow edges are visibly stair-stepped.
- "0.4": Flat shadowless light, or noticeably under/over-exposed, or sky contradicting the light, or black (unfilled) shadows.
- "0.1": Near-black, blown white, or unlit.
-
- - id: asset_quality_detail
- weight: 0.14
- title: Asset quality and detail
- description: >
- Are the individual assets refined beyond primitives and varied — buildings with
- roofs/windows/setbacks, trees with trunk and canopy, vehicles and street
- furniture where the place calls for them — without copy-paste monotony?
- anchors:
- "1.0": Assets are crafted and varied — several silhouettes per family, per-instance size and hue variation, wear and small props everywhere; closeups hold up.
- "0.7": Assets are decent with some repetition, a few plain ones, or thin set dressing.
- "0.5": Hero assets are fine but everything around them is one repeated primitive and the place is undressed — no small props, no litter, no ground cover.
- "0.4": Mostly plain boxes / cones, or one shape stamped everywhere, or a solid object faked as a flat coloured plane.
- "0.1": Primitive blobs or an empty world.
-
- - id: spatial_coherence_scale
- weight: 0.12
- floor: 0.25
- title: Spatial coherence and scale
- description: >
- Is the layout believable as a place (streets connect, shoreline continuous,
- buildings face roads, spacing realistic), everything sits ON the ground/terrain
- (nothing floating or sunken), and relative sizes agree on what a metre is?
- anchors:
- "1.0": Layout reads as a real place; everything grounded; sizes agree.
- "0.7": Minor oddities (a slightly floating prop, a slightly large car) that do not break the read.
- "0.4": A clearly floating/sunken asset, an intersection of objects, or one glaring scale error.
- "0.1": Uniform scatter, many floating objects, or scale chaos.
-
- - id: materials_shaders_effects
- weight: 0.12
- materials: true
- title: Materials, shaders and effects
- description: >
- Do surfaces read as materials (water with specular life, glass, foliage,
- concrete) and do the planned effects (custom shaders, particles, post-processing)
- visibly exist and look intentional — not magenta, not noise, not a flat tint?
- anchors:
- "1.0": Materials convincing; every planned effect is visible and adds to the picture.
- "0.7": Materials sensible; effects present but subtle or slightly crude.
- "0.4": A planned effect is missing or broken (flat water, no particles, a black shader), or a placeholder material is visible.
- "0.1": Placeholder surfaces throughout or broken shaders dominate.
-
- - id: animation_life
- weight: 0.08
- title: Animation and life
- description: >
- Comparing frames at different times, does something move as the plan says
- (water, foliage, vehicles, lights, characters) in a plausible way, and is the
- scene alive rather than frozen?
- anchors:
- "1.0": Planned motion is visible and natural across the time samples.
- "0.7": Some planned motion visible; subtle or partial.
- "0.4": Frames are identical although motion was planned, or motion is implausible (rigid glide, clipping).
- "0.1": Nothing moves and/or motion breaks the scene.
-
- - id: technical_cleanliness
- weight: 0.08
- floor: 0.30
- title: Technical cleanliness
- description: >
- No z-fighting, no magenta/default materials, no missing faces, no visible world
- edge cliff, no console or shader errors in the probe digest.
- anchors:
- "1.0": Clean renders, zero console/shader errors.
- "0.7": A minor artefact or a single non-fatal warning.
- "0.4": Visible z-fighting / missing faces / hard world edge, or a console error.
- "0.1": Broken renders, shader failures, or the scene does not run.
-
-# Binary checklist (judge answers, code scores: penalty subtracted, cap applied).
-defects:
- - id: wrong_place
- text: The scene is a different kind of place than the brief describes (or an unreadable world).
- cap: 0.30
- - id: camera_unusable
- text: >
- One of the SCENE'S OWN authored cameras shows only sky / ground / the inside of a wall,
- or is clipped by the near plane. (Never answer this for an overview_* harness view.)
- penalty: 0.08
- cap: 0.60
- - id: unlit_or_blown
- text: >
- One of the SCENE'S OWN authored cameras is near-black, blown to white, or lit from a
- direction that contradicts the sky. (Never answer this for an overview_* harness view:
- a rig shot taken at street level under a rooftop, or from above a night scene, is dark
- because of where the harness put it.)
- penalty: 0.08
- cap: 0.60
- - id: floating_or_sunken_asset
- text: An asset clearly hovers above or sinks into the ground / terrain in an overview view.
- penalty: 0.06
- cap: 0.70
- - id: empty_zone
- text: A zone named in the plan is empty or contains only a ground plane.
- penalty: 0.06
- - id: placeholder_material
- text: Magenta / default-grey / untextured flat surfaces dominate a view.
- penalty: 0.05
- cap: 0.75
- - id: nothing_moves
- text: >
- The harness's MEASURED MOTION line says no authored camera changed between the animation
- times although motion was planned. Answer this from that measurement only — never from
- comparing tiles by eye, and never because you cannot see what moved.
- penalty: 0.05
- - id: world_edge_visible
- text: A hard world edge / terrain cliff / missing horizon is visible from an authored camera.
- penalty: 0.04
- - id: flat_ground
- text: The ground is one flat untextured colour — no material blending, no paths or worn areas, and where objects meet it the seam is a hard undressed line.
- penalty: 0.04
- - id: monotonous_vegetation
- text: A repeated natural element (trees, rocks, plants, crowd) is one shape stamped many times — no variation in silhouette, size or hue, and placed in a ring or a grid rather than clusters.
- penalty: 0.04
- - id: empty_midground
- text: An authored camera has no depth layering — nothing in the near foreground and/or nothing on the horizon, so the subject sits alone on a large empty plane.
- penalty: 0.04
- - id: undressed_scene
- text: The place has no small props or clutter (pebbles, leaves, tools, cups, cables, litter, ground cover) — it looks like a showroom of a few large objects.
- penalty: 0.03
- - id: thin_atmosphere
- text: No visible aerial perspective — distant things are as saturated and contrasty as near things, there is no haze/fog falloff, and the key and fill light share one hue.
- penalty: 0.03
-
-caps:
- - id: floating_or_sunken_asset
- when: gate
- gate: "scene_placement"
- severity: error
- kinds: [floating, sunken, unsupported]
- cap: 0.7
- note: >
- the scene_placement gate (2026-08-26) measures every placed asset's gap to what is under it;
- an ERROR there caps at 0.7, and because this id matches the checklist defect of the same
- name, a PASSED gate vetoes the VLM's "floating or sunken asset" claim (judges/caps.measured_absent)
- - id: build_error
- when: gate
- gate: "build*"
- severity: error
- cap: 0.0
- - id: shader_error
- when: gate
- gate: "*"
- severity: error
- kinds: [shader, glsl, webgl, compile]
- cap: 0.5
- - id: console_error
- when: console
- cap: 0.6
- note: runtime JS errors seen while rendering
- - id: camera_in_geometry
- when: gate
- gate: "*"
- severity: error
- kinds: [camera_in_geometry, camera_clipped, camera_inside, camera_underground, point_blank, blank_view, dead_render]
- cap: 0.5
- # scene_frames gate (codeverse3d.spatial.frame_metrics): deterministic frame quality of the
- # authored cameras — a crushed dusk, a blown sky, a one-colour frame or an establishing shot
- # that shows a tiny island of content can never score as a finished picture.
- - id: dark_frame
- when: gate
- gate: "scene_frames"
- severity: error
- kinds: [dark_frame]
- cap: 0.55
- note: mean luminance < 0.12 or > 35 % near-black pixels on an authored camera
- - id: blown_frame
- when: gate
- gate: "scene_frames"
- severity: error
- kinds: [blown_frame]
- cap: 0.6
- note: "> 20 % pure-white pixels on an authored camera"
- - id: flat_frame
- when: gate
- gate: "scene_frames"
- severity: error
- kinds: [flat_frame]
- cap: 0.65
- note: one luminance band holds > 92 % of an authored frame
- - id: content_small
- when: gate
- gate: "scene_frames"
- severity: error
- kinds: [content_small]
- cap: 0.6
- note: establishing shot covers < 20 % content (rest is sky/ground)
- - id: floating_part
- when: gate
- gate: "*"
- severity: error
- kinds: [floating, sunken, unsupported]
- cap: 0.6
- - id: missing_must_acceptance
- when: acceptance
- cap: 0.6
diff --git a/harness/codeverse3d/judges/rubrics/scene_v2.yaml b/harness/codeverse3d/judges/rubrics/scene_v2.yaml
index 3d35b5f1..d37c1feb 100644
--- a/harness/codeverse3d/judges/rubrics/scene_v2.yaml
+++ b/harness/codeverse3d/judges/rubrics/scene_v2.yaml
@@ -11,7 +11,7 @@ description: >
floating and sunken are separate measured defects, interpenetration / scale / hard-edged
particles / missing planned elements / hero placement join the checklist, the caps follow
the scene_placement gate's typed kinds, and every criterion is anchored at six levels so the
- judge uses the whole scale. scene_v1 stays frozen for replays of the rounds it scored.
+ judge uses the whole scale.
2026-10-15 (owner's rule — the harness states requirements, never templates): the craft
criteria and defects judge each place against what ITS brief implies instead of one recipe
(blended ground + paths, clustered scatter, foreground-frame / midground / horizon, fog and
diff --git a/harness/codeverse3d/judges/rubrics/shader_v1.yaml b/harness/codeverse3d/judges/rubrics/shader_v1.yaml
deleted file mode 100644
index 9a57108b..00000000
--- a/harness/codeverse3d/judges/rubrics/shader_v1.yaml
+++ /dev/null
@@ -1,188 +0,0 @@
-name: shader_v1
-version: 1
-track_hint: graphics
-pass_threshold: 0.70
-description: >
- Rubric for the GRAPHICS track: a real-time effect (Shadertoy-style fragment shader or a
- raw OpenGL program) judged on a contact sheet of frames sampled at t = 0, 1, 2.5, 4, 6 s
- plus the harness frame metrics (luminance, colourfulness, edge density, frame-to-frame
- motion, NaN detection). Grade the picture AND the motion; the metrics are facts.
-
-extra_instructions: >
- Every view is the SAME program rendered at a different time (label t=...s); there are no
- camera angles. Compare the frames to judge motion: identical frames mean the effect is
- static; wildly unrelated frames mean flicker. The frame-metrics digest (mean luminance,
- colourfulness, edge density, mean |Δ| between frames, NaN count) is measured by the
- harness — treat it as truth over your impression. Grade what the brief asked for:
- subject, mood, palette, named elements (rain, city lights, bokeh, sun, clouds ...) and
- whether the frames read as a designed effect a person would screenshot (0.8+), a
- recognisable but crude attempt (≈0.5), or a flat gradient / noise blob / black frames
- (0.1-0.3). Use the pass / key-visual names from the plan digest as targets.
-
-criteria:
- - id: brief_fidelity
- weight: 0.24
- floor: 0.30
- title: Brief fidelity
- description: >
- Does the effect depict what the brief describes — subject, named elements, setting,
- mood — so that a stranger would describe the frames the way the brief does? Every
- key visual in the plan should be recognisable.
- anchors:
- "1.0": Subject and every named element are unmistakable; mood and setting match.
- "0.7": Subject reads right; one named element is weak or hard to find.
- "0.4": Subject is recognisable only with goodwill, or a named element is missing / contradicted.
- "0.1": Unrelated abstract pattern, noise, or nothing recognisable.
-
- - id: visual_richness
- weight: 0.18
- title: Visual richness and detail
- description: >
- Is there structure at several scales — layered shapes, noise/fbm detail, particles,
- highlights, depth cues (parallax, fog, size falloff) — rather than a single flat
- gradient or one repeated primitive? Credit only what is visible.
- anchors:
- "1.0": Multiple layers and scales of detail; the image rewards a closer look.
- "0.7": Two or three distinct layers; some areas plain.
- "0.4": One dominant element on a flat background; little detail.
- "0.1": A flat gradient, a blob, or uniform noise.
-
- - id: composition
- weight: 0.12
- title: Composition and framing
- description: >
- Is the frame composed — focal area, horizon / vanishing point placed deliberately,
- balance between empty and busy regions, no important element cut off or crammed
- into a corner, aspect ratio respected (no stretched circles)?
- anchors:
- "1.0": Deliberate composition with a clear focal area and depth layering.
- "0.7": Readable composition; slightly flat or off-balance.
- "0.4": Elements stretched / off-screen / centred by accident; no focal area.
- "0.1": Unreadable arrangement.
-
- - id: motion_quality
- weight: 0.14
- floor: 0.20
- title: Motion quality
- description: >
- Across the time samples, does the effect move the way the brief / plan says
- (rain falls, clouds drift, lights pulse, camera glides) — continuous, paced,
- and plausible — neither frozen nor strobing?
- anchors:
- "1.0": Planned motion is visible, continuous and natural across all samples.
- "0.7": Motion visible but subtle, uniform or partly missing.
- "0.4": Frames nearly identical although motion was planned, or jumps/strobes between samples.
- "0.1": Static effect (all frames identical) or incoherent flicker.
-
- - id: colour_light
- weight: 0.12
- title: Colour and light
- description: >
- Is the palette intentional (harmonious, fitting the mood) with readable contrast
- and lighting — exposure neither crushed to black nor blown to white, highlights and
- shadows, glow / bloom where appropriate, no raw saturated RGB primaries unless asked?
- anchors:
- "1.0": Cohesive palette and lighting that sells the mood; good tonal range.
- "0.7": Pleasant colours; slightly flat lighting or tonal range.
- "0.4": Garish or muddy colours, heavy under/over-exposure, or banding.
- "0.1": Near-black, blown white, or random colours.
-
- - id: technical_cleanliness
- weight: 0.12
- floor: 0.30
- title: Technical cleanliness
- description: >
- No NaN / garbage pixels, no hard aliasing staircase on edges, no visible banding in
- gradients, no tiling seams, no obvious z-fighting / depth errors, no flicker, no
- frame that is solid black or white. The harness digest lists NaN counts and gate
- findings — treat those as facts.
- anchors:
- "1.0": Clean frames; no artefacts in any sample; no gate findings.
- "0.7": One minor artefact (slight aliasing / banding) in one area.
- "0.4": A clearly visible artefact (seam, banding, aliasing, a black frame) or a gate warning.
- "0.1": NaN / garbage pixels, or frames are broken.
-
- - id: originality
- weight: 0.08
- title: Originality and craft
- description: >
- Does the effect go beyond the textbook demo (plain plasma, rainbow spiral, raw
- noise) with a distinctive idea, a specific look, or an unexpected detail that fits
- the brief?
- anchors:
- "1.0": Distinctive, crafted look with a memorable idea.
- "0.7": Competent and tasteful; some familiar ingredients.
- "0.4": A stock demo with the brief's colours swapped in.
- "0.1": Generic noise / gradient with no idea.
-
-caps:
- - id: build_error
- when: gate
- gate: "build*"
- severity: error
- cap: 0.0
- note: the shader/program did not compile or render; nothing to score
- - id: lint_error
- when: gate
- gate: "lint*"
- severity: error
- cap: 0.6
- - id: nan_pixels
- when: gate
- gate: "gl_frames"
- severity: error
- kinds: [nan]
- cap: 0.0
- note: NaN/Inf pixels detected in the float readback
- - id: black_or_blown
- when: gate
- gate: "gl_frames"
- severity: error
- kinds: [black, blown]
- cap: 0.5
- - id: static_frames
- when: gate
- gate: "gl_frames"
- severity: warn
- kinds: [static]
- cap: 0.5
- note: motion was planned but frames do not change over time
- - id: flicker
- when: gate
- gate: "gl_frames"
- severity: warn
- kinds: [flicker]
- cap: 0.7
- - id: missing_must_acceptance
- when: acceptance
- cap: 0.6
-
-defects:
- - id: wrong_subject
- text: The frames do not depict the subject of the brief (an unrelated abstract pattern, or nothing recognisable).
- cap: 0.40
- - id: black_or_blown_frame
- text: At least one sampled frame is essentially solid black or blown-out white.
- penalty: 0.10
- cap: 0.50
- - id: static_effect
- text: The sampled frames are visually identical although the brief implies motion.
- penalty: 0.10
- cap: 0.50
- - id: flicker_or_strobe
- text: Consecutive samples are unrelated (hard cuts, strobing, random per-frame colours) rather than continuous motion.
- penalty: 0.08
- cap: 0.70
- - id: garbage_pixels
- text: Visible garbage — NaN speckles, blocky corruption, uninitialised regions, magenta/error colour.
- penalty: 0.10
- cap: 0.30
- - id: banding_or_aliasing
- text: Clearly visible banding in gradients or staircase aliasing on edges / thin lines.
- penalty: 0.05
- - id: stretched_aspect
- text: Circles are ellipses / the image is stretched — aspect ratio not corrected.
- penalty: 0.06
- - id: placeholder_look
- text: The effect is a textbook demo (plain plasma, uv gradient, rainbow rings) with no connection to the brief beyond colour.
- penalty: 0.10
diff --git a/harness/codeverse3d/languages/glsl_shader/__init__.py b/harness/codeverse3d/languages/glsl_shader/__init__.py
index 3f27a6e8..2bb92cd7 100644
--- a/harness/codeverse3d/languages/glsl_shader/__init__.py
+++ b/harness/codeverse3d/languages/glsl_shader/__init__.py
@@ -113,14 +113,11 @@ def _piece(text: str) -> str:
def compose(shader_src: str, common_src: str | None = None, *,
- shader_file: str = "src/shader.frag", common_file: str = "src/common.glsl",
- legacy_src: str | None = None) -> Composed:
- """Header (+ a pre-D107 run's :data:`LEGACY_RECIPES`) + common + shader (+ trailer) with a line
+ shader_file: str = "src/shader.frag", common_file: str = "src/common.glsl") -> Composed:
+ """Header + common + shader (+ trailer) with a line
map back to the agent files."""
convention = detect_convention(shader_src)
pieces: list[tuple[str, str]] = [("harness", HEADER)]
- if legacy_src and legacy_src.strip():
- pieces.append((LEGACY_RECIPES, _piece(legacy_src)))
if common_src and common_src.strip():
pieces.append((common_file, _piece(common_src)))
pieces.append((shader_file, _piece(shader_src)))
@@ -155,10 +152,6 @@ GATE = "lint:glsl_shader"
SHADER = ENTRY_FILE[Language.GLSL_SHADER]
COMMON = "src/common.glsl"
BUFFER_A = "src/buffer_a.frag"
-#: runs made BEFORE D107 had the harness seed this file and their shaders call its functions, so
-#: it is still composed (after the header, before common.glsl) when it exists — the only reason
-#: `resume` / `render` / `pick` on such a run still builds. No new run is given one.
-LEGACY_RECIPES = "src/recipes.glsl"
SAMPLERS = {"u_prev", "u_noise", "u_buffer_a", "iChannel0", "iChannel1"}
MAX_CHARS = 60_000
@@ -256,7 +249,7 @@ def lint_workspace(ws: Workspace) -> GateReport:
if p.is_file():
findings.extend(_check_file(rel, p.read_text(errors="replace"), role=role))
stray = [ws_rel(ws, p) for p in ws.src.rglob("*") if p.is_file()
- and ws_rel(ws, p) not in (SHADER, COMMON, BUFFER_A, LEGACY_RECIPES)
+ and ws_rel(ws, p) not in (SHADER, COMMON, BUFFER_A)
and p.suffix in (".frag", ".glsl", ".vert", ".py", ".js")]
for rel in stray:
findings.append(GateFinding(gate=GATE, severity=Severity.WARN, target=rel, message=f"{rel} is not part of the shader contract and is ignored",
@@ -361,11 +354,9 @@ class GlslShaderRuntime(RuntimeLayout):
shader = (ws.root / SHADER).read_text(errors="replace")
common_p = ws.root / COMMON
common = common_p.read_text(errors="replace") if common_p.is_file() else None
- legacy_p = ws.root / LEGACY_RECIPES
- legacy = legacy_p.read_text(errors="replace") if legacy_p.is_file() else None
- image = compose(shader, common, legacy_src=legacy)
+ image = compose(shader, common)
buf_p = ws.root / BUFFER_A
- buffer_a = (compose(buf_p.read_text(errors="replace"), common, shader_file=BUFFER_A, legacy_src=legacy)
+ buffer_a = (compose(buf_p.read_text(errors="replace"), common, shader_file=BUFFER_A)
if buf_p.is_file() else None)
return image, buffer_a
diff --git a/harness/codeverse3d/record/deliverable.py b/harness/codeverse3d/record/deliverable.py
index 77670c13..ad16dff8 100644
--- a/harness/codeverse3d/record/deliverable.py
+++ b/harness/codeverse3d/record/deliverable.py
@@ -142,29 +142,11 @@ def _code_tree(ws: Workspace, rnd: RoundRecord | None) -> tuple[dict[str, bytes]
def round_outputs(ws: Workspace, rnd: RoundRecord | None) -> Path | None:
- """Where the round's build outputs are: ``artifacts/rNN/``, or — a run recorded before
- rounds kept their own (2026-09-22) — ``artifacts/`` itself, but only for the round
- that run's finalise rebuilt there: the legacy ``RunRecord.best_round``, or — a record
- rewritten by a build that dropped that key — the round its old deliverable packaged."""
+ """The build outputs retained for this round; never substitute another build."""
if rnd is None:
return None
kept = ws.round_artifacts(rnd.index)
- if kept.is_dir():
- return kept
- return ws.artifacts if legacy_canonical_round(ws) == rnd.index else None
-
-
-def legacy_canonical_round(ws: Workspace) -> int | None:
- """The round a run recorded before rounds kept ``artifacts/rNN/`` rebuilt into ``artifacts/``
- (its record's ``best_round``, else its deliverable's round); None for a run that keeps its
- rounds — there ``artifacts/`` is the LAST build's, no round's by name."""
- legacy = (read_json_or_none(ws.record_path) or {}).get("best_round")
- if isinstance(legacy, int):
- return legacy
- if any(ws.artifacts.glob("r[0-9][0-9]")):
- return None
- old = load_deliverable(ws)
- return old.round if old is not None else None
+ return kept if kept.is_dir() else None
def texture_report_for(ws: Workspace, glb: Path) -> dict | None:
@@ -248,7 +230,7 @@ def build_deliverable(ws: Workspace, record: RunRecord, round_index: int | None,
on an unchanged run produces byte-identical content."""
rnd = next((r for r in record.rounds if r.index == round_index), None)
previous = load_deliverable(ws) if ws.deliverable_manifest_path.is_file() else None
- out = round_outputs(ws, rnd) # before the wipe: an old run may be found by its old manifest
+ out = round_outputs(ws, rnd)
if clean and ws.deliverable.exists():
shutil.rmtree(ws.deliverable)
ws.ensure_layout()
@@ -287,7 +269,7 @@ def deliverable_path(ws: Workspace, name: str) -> Path | None:
"""``deliverable/<name>`` when it exists, else ``artifacts/<name>``, else None.
The one resolver every consumer (export, gallery, show) uses so both layouts
- work: new runs answer from the hand-over folder, old runs from artifacts/."""
+ work: packaged runs answer from the hand-over folder, unpackaged runs from artifacts/."""
for candidate in (ws.deliverable / name, ws.artifacts / name):
if candidate.is_file():
return candidate
diff --git a/harness/codeverse3d/record/git_history.py b/harness/codeverse3d/record/git_history.py
index f954682f..d06b1a92 100644
--- a/harness/codeverse3d/record/git_history.py
+++ b/harness/codeverse3d/record/git_history.py
@@ -117,7 +117,7 @@ def diff_between(ws: Workspace, before: str, after: str, *, max_bytes: int | Non
``total_bytes`` is what git actually produced, so a capped row still records the
size it was capped from. The useful shas are the ones recorded on the rounds,
- never ``HEAD`` — a run recorded before 2026-09-22 may end on a "restore best round rNN" commit — and a
+ rather than ``HEAD``, which may contain later changes. A
sha the repository no longer holds raises rather than diffing against an empty
tree: ``git diff`` itself refuses an unknown object, so no pre-check is needed.
"""
diff --git a/harness/codeverse3d/texturing/run.py b/harness/codeverse3d/texturing/run.py
index 53eb5960..3ad6f448 100644
--- a/harness/codeverse3d/texturing/run.py
+++ b/harness/codeverse3d/texturing/run.py
@@ -123,8 +123,7 @@ def texture_supported(track: Track) -> bool:
def texture_requested(spec: Spec) -> bool:
"""True when the run asked for the derived texture pass AND the track can run one.
- ``Spec.options.texture`` is the switch; the legacy ``texture`` tag is still
- honoured because recorded specs carry it. Nothing else may turn texturing
+ ``Spec.options.texture`` is the switch. Nothing else may turn texturing
on; ``3dcode texture pass <slug>`` is an explicit user instruction that does
not go through here at all.
@@ -134,7 +133,7 @@ def texture_requested(spec: Spec) -> bool:
spurious ``texture.failed`` event — quality's advertised "+texture" was a guaranteed
no-op on half the tracks, and scene runs never reached the command that would work.
"""
- return bool(spec.options.texture or "texture" in (spec.tags or [])) and texture_supported(spec.track)
+ return bool(spec.options.texture) and texture_supported(spec.track)
def texture_pass(
diff --git a/harness/codeverse3d/tracks/graphics.py b/harness/codeverse3d/tracks/graphics.py
index 0ebb4c87..cb08c9de 100644
--- a/harness/codeverse3d/tracks/graphics.py
+++ b/harness/codeverse3d/tracks/graphics.py
@@ -31,7 +31,6 @@ from codeverse3d.contracts.run import RoundRecord
from codeverse3d.languages._gl_common import JUDGE_TIMES, METRICS_NAME, SHEET_NAME, read_metrics
from codeverse3d.orchestrator import TaskGroup
from codeverse3d.prompts import render
-from codeverse3d.record.deliverable import legacy_canonical_round
from codeverse3d.tracks.common import RunContext
from codeverse3d.tracks.generation import GenerationTask
from codeverse3d.tracks.lifecycle import MATERIALIZE, SKELETON, BaseTrack
@@ -106,13 +105,11 @@ def frames_render_set(ws: Workspace, build: BuildResult, round_index: int) -> Re
def frame_stats_text(ws: Workspace, round_index: int | None = None) -> str:
"""The frame metrics as judge / refine text: round ``round_index``'s own copy
(``renders/rNN/metrics.json``), else the canonical file, quoted only for the round it belongs
- to — the round an old run's finalise rebuilt (``legacy_canonical_round``: its best), else
- the LAST build's (no later round in the journal)."""
+ to — the LAST build's (no later round in the journal)."""
where = ws.renders_dir(round_index) if round_index is not None else None
if round_index is not None and where is not None and not (where / METRICS_NAME).is_file():
- owner = legacy_canonical_round(ws)
later = any(int(p.stem[1:]) > round_index for p in (ws.root / "rounds").glob("r[0-9][0-9].json"))
- if (owner != round_index) if owner is not None else later:
+ if later:
return "(not kept for this round: the metrics on disk are a later build's; judge motion from the frames)"
where = None
m = read_metrics(ws, where)
diff --git a/harness/codeverse3d/tracks/lifecycle.py b/harness/codeverse3d/tracks/lifecycle.py
index def1747d..cfed8fe6 100644
--- a/harness/codeverse3d/tracks/lifecycle.py
+++ b/harness/codeverse3d/tracks/lifecycle.py
@@ -21,7 +21,6 @@ from datetime import UTC, datetime
from pathlib import Path
from typing import Any
-from codeverse3d.agents.materialize import needs_rematerialize
from codeverse3d.config import Settings, get_settings
from codeverse3d.contracts.artifacts import GateReport
from codeverse3d.contracts.common import TRACK_INFO, Track
@@ -584,7 +583,7 @@ class BaseTrack:
if ctx.single_shot:
return
kind = ctx.agent_kind
- if ctx.state.materialized_for == kind and not needs_rematerialize(ctx.ws):
+ if ctx.state.materialized_for == kind:
return
self.services.materialize(ctx.ws, agent_kind=kind, contract_md=self.agent_contract_md(ctx), spatial_tools=True)
ctx.state.materialized_for = kind
@@ -869,4 +868,3 @@ class BaseTrack:
hashes = prior.get("prompt_hashes")
return (dict(extra) if isinstance(extra, dict) else {},
{str(k): str(v) for k, v in hashes.items()} if isinstance(hashes, dict) else {})
-
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index c3839c9c..b56f242c 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -452,8 +452,8 @@ image-conditioned specs.
Rubrics (pass threshold 0.70 unless named): `static_object_v1` (0.72), `articulated_v1`
(requires pose views: the `missing_pose_sheet` cap), `scene_v2` (D105: placement caps floating 0.60 / sunken 0.65 /
interpenetration 0.70 / scale 0.75 / free_exempt 0.75 measured by `scene_placement`, frame-gate caps
-dark/blown/flat/content_small, graded must-acceptance; `scene_v1` is kept frozen for replays), `asset_v1`, `reference_v1`, `shader_v2` (graphics, `gl_frames`
-caps; also the `LikenessJudge` default); `shader_v1` stays for calibration replays only.
+dark/blown/flat/content_small, graded must-acceptance), `asset_v1`, `reference_v1`, `shader_v2` (graphics, `gl_frames`
+caps; also the `LikenessJudge` default). Retired `scene_v1` and `shader_v1` are no longer distributed.
**Calibration** (`addons/calibration.py`: re-judges recorded rounds, n samples each) is why the
default judge is `gemini-3.1-pro-preview` (`Settings.default_judge`) and flash is the cheap
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
index ba98ee97..5f510845 100644
--- a/harness/docs/INTERFACES.md
+++ b/harness/docs/INTERFACES.md
@@ -733,8 +733,8 @@ post-render gates → the build's own `BuildResult.gates` (also when the build f
## texturing/ (derived asset pack; code stays truth — object.glb is never touched)
```python
from codeverse3d.texturing.run import texture_pass, texture_requested, load_report
-texture_requested(spec) -> bool # THE owner of "does this run texture?" (Spec.options.texture, or
- # the legacy "texture" tag). Asked by the CLI hand-over after the run (make/resume → addons.select.package(
+texture_requested(spec) -> bool # Uses Spec.options.texture and the supported track.
+ # Asked by the CLI hand-over after the run (make/resume → addons.select.package(
# texture=…), which textures the PICKED round — Δ 2026-09-22, finalise no longer does). No agent session can
# buy a pass: the texture_pass / texture_preview tools were deleted 2026-09-22.
texture_pass(ws, spec, plan, *, model_id, image_model=None, judge=True, judge_obj=None, judge_model_id=None, rubric=None,
@@ -857,10 +857,8 @@ prompt_hashes{contract, generate, refine, …} (Δ D107: no cookbook key), error
rubric, budget{elapsed_min, max_minutes} (the clock), aborted_rounds?, candidates? (the
rounds/candidates.json payload), texturing?, captions?}. `total_usage` is the sum of telemetry/cost.jsonl at
list price — every billed row once, aborted rounds, retried sessions and billed-but-discarded round-trips
-included; a texture pass a pick buys joins it when `select.package` re-packages the run. Δ 2026-09-22: no
-`cost_by_stage` / `rounds_summary` (written, never read), no `baseline_score` / `final_score` (old records
-carry them: ignored — `addons.select.summarise` answers), `best_round` only as a LEGACY read-only field (an old
-record's pointer to the round its `artifacts/` holds, `record.deliverable.round_outputs`; kept across a record
-rewrite, never written by a new run, absent from its JSON), and `status` is only
-the stop reason: max_rounds | budget | agent_quota | no_change | no_refine_tasks | judge_unavailable |
-failed (an old `passed` / `plateau` loads as `stopped`).
+included; a texture pass a pick buys joins it when `select.package` re-packages the run.
+Selection is stored separately; `RunRecord` carries no `best_round` field. Round outputs
+are read from `artifacts/rNN/`, and minutes come from `StepTime` rows. Historical status,
+manifest and timing migration is unsupported. A completed `status` names its stop reason:
+max_rounds | budget | agent_quota | no_change | no_refine_tasks | judge_unavailable | failed.
diff --git a/harness/docs/RUN_LAYOUT.md b/harness/docs/RUN_LAYOUT.md
index 84cced60..df36fb4a 100644
--- a/harness/docs/RUN_LAYOUT.md
+++ b/harness/docs/RUN_LAYOUT.md
@@ -166,20 +166,14 @@ produces no diff.
## `record.json`
-One additive block, `None` on older records:
+`record.telemetry` stores the settings snapshot and cost summary written at finalization.
+The hand-over is described by `deliverable/manifest.json` and `selection.json`, not by
+`record.json`. Round artifacts live in `artifacts/rNN/`.
-* `record.telemetry` — `RunTelemetry(settings, cost)` (a record written before 2026-09-22 also carries
- `environment` and `files`, which nothing read; they are ignored on load).
-
-The hand-over is described by `deliverable/manifest.json` (`RunDeliverable(round, commit,
-code_source, entry, files[path, role, bytes, sha256], total_bytes, skipped, generated_at)`) and
-`selection.json`, not by the record: since 2026-09-22 the record names no best round and
-carries no `deliverable` block. A `record.json` written before that still validates — its
-`baseline_score` / `final_score` / `deliverable` keys are ignored, its `best_round` is kept as the legacy
-read-only `RunRecord.best_round` (the round its `artifacts/` holds: `record.deliverable.round_outputs`
-finds that round's GLB / GIF / meshes by it, else by the round its old deliverable packaged), a
-`passed` / `plateau` status reads `stopped`, and a manifest that says `best_round` loads as
-`round`.
+Historical record migration is not supported: retired `passed` / `plateau` / `stopped`
+statuses, `best_round` manifest aliases, pre-step timing fallbacks and canonical-artifact
+ownership inference have been removed. Use the repository revision that wrote an old run
+if you need to read it. Existing local run data is not migrated or deleted.
## Reading a run
@@ -189,7 +183,7 @@ finds that round's GLB / GIF / meshes by it, else by the round its old deliverab
3dcode status <slug> # = show --section status: the rounds, run_state, the lock holder, events
```
-`3dcode show` works on both layouts: when a run has no `telemetry/` yet the cost
+`3dcode show` can inspect a run before finalization: when it has no `telemetry/` yet the cost
and settings block is computed on the fly (read-only) from the trajectories,
judge verdicts and events already on disk. Its STATUS section needs no `record.json`, so it
also reads a run in flight (the other three sections wait for the record).
diff --git a/harness/tests/agents/test_materialize.py b/harness/tests/agents/test_materialize.py
index f367a1d2..5f5b4b38 100644
--- a/harness/tests/agents/test_materialize.py
+++ b/harness/tests/agents/test_materialize.py
@@ -10,10 +10,8 @@ import tomllib
from codeverse3d.agents.cli_common import default_mcp_command
from codeverse3d.agents.materialize import (
- LEGACY_COOKBOOK,
codex_mcp_overrides,
materialize_workspace,
- needs_rematerialize,
)
from codeverse3d.workspace import Workspace
@@ -67,19 +65,6 @@ def test_the_body_is_rules_tools_and_contract_and_never_mentions_a_cookbook(tmp_
assert not (tmp_ws.root / ".3dcode").exists() or not any((tmp_ws.root / ".3dcode").iterdir())
-def test_a_workspace_materialised_before_d107_is_rematerialised_and_loses_its_cookbook(tmp_ws: Workspace):
- """A resumed pre-D107 run still holds ``.3dcode/cookbook.md`` and a "## Cookbook" body section:
- ``needs_rematerialize`` says so (``ensure_materialized`` then writes the body again), and
- materialising removes the file."""
- tmp_ws.spec_path.write_text(json.dumps({"id": "t", "track": "static_object", "language": "blender", "prompt": "p"}))
- legacy = tmp_ws.root / LEGACY_COOKBOOK
- legacy.parent.mkdir(parents=True, exist_ok=True)
- legacy.write_text("# Cookbook\n")
- (tmp_ws.root / "AGENTS.md").write_text("## Cookbook\ncopy its patterns exactly\n")
- assert needs_rematerialize(tmp_ws)
- _mat(tmp_ws)
- assert not legacy.exists() and not needs_rematerialize(tmp_ws)
- assert "cookbook" not in (tmp_ws.root / "AGENTS.md").read_text().lower()
def test_ignore_files_keep_agent_facing_paths_readable(tmp_ws: Workspace):
diff --git a/harness/tests/core/test_contracts.py b/harness/tests/core/test_contracts.py
index 0a14ced7..e7842d8c 100644
--- a/harness/tests/core/test_contracts.py
+++ b/harness/tests/core/test_contracts.py
@@ -100,7 +100,7 @@ def test_camera_plan_name_must_be_filename_safe():
CameraPlan(**{"name": "cam", "position": (0, 1.6, 5), "look_at": (0, 0, 0), **bad})
-def test_budget_is_strict_but_recorded_specs_migrate_the_retired_cost_key():
+def test_budget_and_recorded_specs_reject_retired_cost_keys():
with pytest.raises(ValidationError):
Budget(max_usd=1.0)
with pytest.raises(ValidationError):
@@ -109,7 +109,35 @@ def test_budget_is_strict_but_recorded_specs_migrate_the_retired_cost_key():
data = {"id": "x", "track": "static_object", "language": "blender", "prompt": "p",
"budget": {"max_rounds": 2, "max_minutes": 30.0, "max_usd": 2.5}}
- s = Spec.model_validate(data)
- assert s.budget.max_rounds == 2 and not hasattr(s.budget, "max_usd")
- assert Spec.model_validate_json(json.dumps(data)).budget.max_minutes == 30.0
- assert data["budget"]["max_usd"] == 2.5, "migration must not mutate the caller's dict"
+ with pytest.raises(ValidationError):
+ Spec.model_validate(data)
+ with pytest.raises(ValidationError):
+ Spec.model_validate_json(json.dumps(data))
+
+
[email protected]("status", ["passed", "plateau", "stopped"])
+def test_retired_run_statuses_are_rejected(status):
+ from codeverse3d.contracts.run import RunStatus
+
+ with pytest.raises(ValueError):
+ RunStatus(status)
+
+
+def test_missing_round_snapshot_does_not_borrow_canonical_artifacts(tmp_ws):
+ from codeverse3d.contracts.run import RoundRecord
+ from codeverse3d.record.deliverable import keep_round_artifacts, round_outputs
+
+ (tmp_ws.artifacts / "object.glb").write_bytes(b"current build")
+ rnd = RoundRecord(index=0, kind="baseline")
+ assert round_outputs(tmp_ws, rnd) is None
+ keep_round_artifacts(tmp_ws, 0)
+ (tmp_ws.artifacts / "object.glb").write_bytes(b"next build")
+ assert (round_outputs(tmp_ws, rnd) / "object.glb").read_bytes() == b"current build"
+
+
[email protected]("name", ["scene_v1", "shader_v1"])
+def test_retired_rubrics_are_not_available(name):
+ from codeverse3d.judges.rubrics import RubricError, load_rubric
+
+ with pytest.raises(RubricError, match="unknown rubric"):
+ load_rubric(name)
diff --git a/harness/tests/core/test_run_layout.py b/harness/tests/core/test_run_layout.py
index ed83a8b7..d08a4cf0 100644
--- a/harness/tests/core/test_run_layout.py
+++ b/harness/tests/core/test_run_layout.py
@@ -25,8 +25,8 @@ def test_create_makes_the_buckets_aliases_and_gitignore(tmp_path: Path):
ws.events_path.write_text('{"event": "run.start"}\n')
assert (ws.telemetry / "events.jsonl").read_text().strip().endswith("}")
# an atomic rewrite of the physical file must not disturb the alias
- ws.write_json(ws.state_path, {"status": "passed"})
- assert json.loads((ws.telemetry / "run_state.json").read_text())["status"] == "passed"
+ ws.write_json(ws.state_path, {"status": "max_rounds"})
+ assert json.loads((ws.telemetry / "run_state.json").read_text())["status"] == "max_rounds"
assert (ws.telemetry / "run_state.json").is_symlink()
@@ -51,16 +51,15 @@ def test_ensure_layout_never_clobbers_real_data(tmp_path: Path):
def test_record_blocks_are_additive(tmp_path: Path):
- """An old record.json (no telemetry, a deliverable block) validates; an old manifest loads."""
+ """Telemetry can be added at finalization; manifests use the current round field."""
spec = Spec(id="x", track="static_object", language="blender", prompt="a chair")
- old = {"spec": spec.model_dump(mode="json"), "workspace": str(tmp_path), "status": "passed",
- "deliverable": {"best_round": 1, "commit": "abc"}}
- rec = RunRecord.model_validate(old)
- assert rec.telemetry is None and rec.status.value == "stopped"
+ rec = RunRecord(spec=spec, workspace=str(tmp_path), status="max_rounds")
+ assert rec.telemetry is None
rec.telemetry = RunTelemetry()
again = RunRecord.model_validate_json(rec.model_dump_json())
assert again.telemetry is not None and again.telemetry.schema_version == 1
- assert RunDeliverable.model_validate({"best_round": 1, "commit": "abc"}).round == 1 # a pre-2026-09-22 manifest
+ assert RunDeliverable.model_validate({"round": 1, "commit": "abc"}).round == 1
+ assert RunDeliverable.model_validate({"best_round": 1, "commit": "abc"}).round is None
# --------------------------------------------------------------------------- relocation
diff --git a/harness/tests/flywheel_cli/conftest.py b/harness/tests/flywheel_cli/conftest.py
index f0e87c37..a1bbf662 100644
--- a/harness/tests/flywheel_cli/conftest.py
+++ b/harness/tests/flywheel_cli/conftest.py
@@ -89,7 +89,7 @@ def make_fake_run(
renders=RenderSet(views=views, contact_sheet=str(sheet)),
judgment=_judgment(sc, sc >= 0.75, ["thicken the legs", "add a back rail"]),
usage=Usage(backend="gemini", model="gemini-3.7-flash", input_tokens=1000, output_tokens=500, cost_usd=0.02),
- duration_s=12.0,
+ duration_s=12.0, steps=[StepTime(step="generate", wall_s=12.0)],
))
if with_repair:
e.write_text("import bpy\nbpy.ops.mesh.primitive_cube_add(size=\n")
diff --git a/harness/tests/flywheel_cli/test_captions.py b/harness/tests/flywheel_cli/test_captions.py
index 4ef1204f..447abe20 100644
--- a/harness/tests/flywheel_cli/test_captions.py
+++ b/harness/tests/flywheel_cli/test_captions.py
@@ -13,7 +13,6 @@ from codeverse3d.addons.dataset.captions import (
validate_captions,
)
from codeverse3d.contracts.chat import ImagePart
-from codeverse3d.record.deliverable import load_deliverable
from codeverse3d.record.record import load_record
from tests.orchestrator_tracks.fakes import FakeChatModel
@@ -100,45 +99,3 @@ def test_validate_captions(fields, language, problem):
# --------------------------------------------------------------------------- a run recorded before artifacts/rNN/
-def _old_urdf_run(tmp_path):
- """An urdf_blender run recorded before rounds kept ``artifacts/rNN/``: its finalise rebuilt
- round 1 (the ``best_round`` its record.json names) into ``artifacts/`` and packaged it."""
- from codeverse3d.addons import select
- from codeverse3d.contracts.common import Language
-
- from .conftest import make_fake_run
-
- ws, rec = make_fake_run(tmp_path / "runs", "arm", language=Language.URDF_BLENDER)
- for i in (0, 1):
- (ws.round_artifacts(i) / "object.glb").unlink()
- ws.round_artifacts(i).rmdir()
- (ws.artifacts / "preview.gif").write_bytes(b"GIF89a")
- (ws.artifacts / "meshes").mkdir()
- (ws.artifacts / "meshes" / "base.glb").write_bytes(b"glTF-base")
- ws.write_json(ws.record_path, {**json.loads(ws.record_path.read_text()), "best_round": 1})
- select.package(ws.root, 1)
- return ws, load_record(ws)
-
-
-def test_an_old_runs_caption_then_export_still_ships_its_glb_gif_and_meshes(tmp_path):
- """The caption's record rewrite once dropped the raw best_round, and with it the old run's outputs;
- a record already rewritten without ``best_round`` falls back to its packaged deliverable."""
- from codeverse3d.addons import select
- from codeverse3d.addons.dataset.export import export_one
-
- ws, rec = _old_urdf_run(tmp_path)
- urdf = dict(GOOD, instruction="Write a URDF model of a simple robot arm with a base and one hinged link.")
- caption_sample(ws, rec, "fake:fake", model=FakeChatModel([urdf]))
- assert json.loads(ws.record_path.read_text())["best_round"] == 1 # the rewrite keeps the legacy key
- handed = {f.path for f in load_deliverable(ws).files}
- assert {"deliverable/object.glb", "deliverable/preview.gif", "deliverable/meshes/base.glb"} <= handed
- sample = export_one(ws, load_record(ws), tmp_path / "ds")
- assert {"renders/object.glb", "renders/preview.gif", "meshes/base.glb"} <= set(sample.file_hashes)
-
- data = json.loads(ws.record_path.read_text())
- del data["best_round"]
- ws.write_json(ws.record_path, data)
- assert select.round_file(ws, rec.rounds[1]) == ws.artifacts / "object.glb"
- assert select.round_file(ws, rec.rounds[0]) is None
- select.package(ws.root, 1) # the rebuild wipes the old manifest: resolved before the wipe
- assert (ws.deliverable / "object.glb").is_file() and (ws.deliverable / "meshes" / "base.glb").is_file()
diff --git a/harness/tests/flywheel_cli/test_cli.py b/harness/tests/flywheel_cli/test_cli.py
index 74736258..2b6c607f 100644
--- a/harness/tests/flywheel_cli/test_cli.py
+++ b/harness/tests/flywheel_cli/test_cli.py
@@ -208,7 +208,7 @@ def test_commands_over_a_runs_dir(runs_dir: Path, tmp_path: Path, monkeypatch):
ws.record_path.write_text(json.dumps(rec))
r = runner.invoke(app, ["status", "wooden_chair_ab12cd34", "--runs-dir", str(runs_dir)])
assert r.exit_code == 0, r.output
- assert "candidates" in r.output and "c1" in r.output and "pairwise" in r.output
+ assert "candidates" in r.output and "c1" in r.output and "pairwise" not in r.output
assert "texturing" in r.output and "shipped" in r.output
@@ -246,17 +246,15 @@ def test_resume_refuses_a_finished_run_and_never_re_enters_it(made_run, stub_tra
runs, run_dir = made_run()
ws = Workspace(run_dir)
- # a run recorded before 2026-09-22 that stopped on a pass (its state names the best it kept)
- ws.state_path.write_text(json.dumps({"status": "passed", "stop_reason": "pass", "best_round": 1,
- "best_commit": "abc", "best_score": 0.7436}))
- assert RunState.load(ws).status is RunStatus.STOPPED
+ ws.state_path.write_text(json.dumps({"status": "no_refine_tasks", "stop_reason": "no_refine_tasks"}))
+ assert RunState.load(ws).status is RunStatus.NO_REFINE_TASKS
entered, specs = [], []
stub_track(lambda spec, resume, force: (entered.append((resume, force)), specs.append(spec)))
r = runner.invoke(app, ["resume", ws.root.name, "--runs-dir", str(runs)])
- assert r.exit_code == 1 and "already finished" in r.output and "stop_reason='pass'" in r.output
+ assert r.exit_code == 1 and "already finished" in r.output and "status=no_refine_tasks" in r.output
assert entered == [], "the pipeline must not be re-entered"
- assert RunState.load(ws).status is RunStatus.STOPPED, "the terminal state must survive"
+ assert RunState.load(ws).status is RunStatus.NO_REFINE_TASKS, "the terminal state must survive"
# ... and the escape hatch still works, loudly
assert runner.invoke(app, ["resume", ws.root.name, "--runs-dir", str(runs), "--force"]).exit_code == 130
assert entered == [(True, True)]
@@ -379,6 +377,10 @@ def test_texture_is_not_offered_on_tracks_that_have_no_glb(tmp_path: Path):
assert texture_supported(Track.STATIC_OBJECT) and not texture_supported(Track.SCENE)
stale = Spec.model_validate(json.loads((runs / "objq" / "spec.json").read_text()))
assert texture_requested(stale)
+ tagged = stale.model_copy(deep=True)
+ tagged.options.texture = False
+ tagged.tags = ["texture"]
+ assert not texture_requested(tagged), "tags cannot enable the texture pass"
assert not texture_requested(stale.model_copy(update={"track": Track.GRAPHICS}))
diff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.py
index ddb9bf4e..46efa280 100644
--- a/harness/tests/flywheel_cli/test_run_layout_cli.py
+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py
@@ -30,27 +30,24 @@ from .conftest import make_fake_run
runner = CliRunner()
-def strip_layout(ws: Workspace) -> Workspace:
- """Turn a freshly created workspace back into a pre-2026-08-23 run directory: no
- telemetry/ or deliverable/, no per-round builds — only the canonical one, of the best
- round its record.json names."""
+def strip_telemetry(ws: Workspace) -> Workspace:
+ """Remove optional packaging/telemetry; keep current per-round evidence."""
for name, _ in LAYOUT_ALIASES:
p = ws.root / name
if p.is_symlink():
p.unlink()
- for d in (ws.deliverable, ws.telemetry, *ws.artifacts.glob("r[0-9][0-9]")):
+ for d in (ws.deliverable, ws.telemetry):
shutil.rmtree(d, ignore_errors=True)
rec = json.loads(ws.record_path.read_text())
rec.pop("telemetry", None)
rec.pop("deliverable", None)
- rec["best_round"] = max((r for r in rec["rounds"] if r.get("judgment")), key=lambda r: r["judgment"]["overall"])["index"]
ws.record_path.write_text(json.dumps(rec, indent=2))
return ws
-def old_layout_run(tmp_path: Path, slug: str = "wooden_chair_ab12cd34") -> tuple[Workspace, RunRecord]:
+def unpackaged_run(tmp_path: Path, slug: str = "wooden_chair_ab12cd34") -> tuple[Workspace, RunRecord]:
ws, rec = make_fake_run(tmp_path / "runs", slug)
- strip_layout(ws)
+ strip_telemetry(ws)
return ws, load_record(ws)
@@ -228,8 +225,8 @@ def test_show_on_a_run_without_a_record_is_its_status(tmp_path: Path):
assert _show("stool", ws.root.parent, "--section", "cost").exit_code == 1
-def test_show_works_on_an_old_layout_run(tmp_path: Path):
- ws, _ = old_layout_run(tmp_path)
+def test_show_works_on_an_unpackaged_run(tmp_path: Path):
+ ws, _ = unpackaged_run(tmp_path)
r = _show(ws.root.name, ws.root.parent)
assert r.exit_code == 0, r.output
assert "no deliverable/ yet" in r.output and "computed on the fly" in r.output
@@ -245,7 +242,7 @@ def test_export_and_gallery_on_both_layouts(tmp_path: Path):
ws_new.write_json(ws_new.record_path, rec_new)
select.package(ws_new.root, 1)
ws_old, _ = make_fake_run(runs, "run_old")
- strip_layout(ws_old)
+ strip_telemetry(ws_old)
rep = export_samples(runs, tmp_path / "ds")
assert rep.n_exported == 2 and not rep.skipped, rep.skipped
@@ -264,7 +261,7 @@ def test_export_and_gallery_on_both_layouts(tmp_path: Path):
assert new_item.cost_by_stage and old_item.cost_by_stage == {}
new_links = {ln.label: ln.rel for ln in new_item.links}
old_links = {ln.label: ln.rel for ln in old_item.links}
- assert old_links["glb"] == "artifacts/object.glb"
+ assert old_links["glb"] == "artifacts/r01/object.glb"
assert new_links["glb"] == "deliverable/object.glb"
# a packaged run copied without its history exports from its deliverable snapshot
diff --git a/harness/tests/flywheel_cli/test_select.py b/harness/tests/flywheel_cli/test_select.py
index d7a931de..987ccec7 100644
--- a/harness/tests/flywheel_cli/test_select.py
+++ b/harness/tests/flywheel_cli/test_select.py
@@ -123,15 +123,6 @@ def test_an_unjudged_run_shows_one_fallback_round_in_every_reader(tmp_path, monk
assert asked == [0] # `3dcode judge`'s default round
-def test_an_old_record_with_best_fields_still_summarises(tmp_path):
- """A pre-2026-09-22 record (best_round / final_score / status 'passed') still loads and summarises."""
- ws, _ = make_fake_run(tmp_path / "runs")
- data = json.loads(ws.record_path.read_text())
- data.update(status="passed", best_round=0, baseline_score=0.55, final_score=0.55)
- data.setdefault("extra", {})["stop_reason"] = "pass"
- ws.record_path.write_text(json.dumps(data))
- s = select.summarise(ws.root)
- assert (s.picked_round, s.stop_reason, s.baseline_score) == (1, "pass", 0.55)
class _Pairwise:
@@ -315,15 +306,15 @@ def test_round_outputs_are_the_rounds_own_never_the_last_builds(tmp_path: Path):
assert select.round_file(ws, rec.rounds[0]) == ws.round_artifacts(0) / "object.glb"
assert select.round_file(ws, rec.rounds[0], "preview.gif") is None
assert select.round_complexity_block(ws, rec.rounds[0]) is None # never the canonical file's
- # a run recorded before rounds kept their own: the canonical build is its best_round's only
+ # Missing snapshots cannot borrow the canonical build, even with an obsolete best_round key.
for i in (0, 1):
(ws.round_artifacts(i) / "object.glb").unlink()
ws.round_artifacts(i).rmdir()
data = json.loads(ws.record_path.read_text())
ws.write_json(ws.record_path, {**data, "best_round": 1})
assert select.round_file(ws, rec.rounds[0]) is None
- assert select.round_file(ws, rec.rounds[1]) == ws.artifacts / "object.glb"
- assert select.round_complexity_block(ws, rec.rounds[1]) == {"index": 0.9}
+ assert select.round_file(ws, rec.rounds[1]) is None
+ assert select.round_complexity_block(ws, rec.rounds[1]) is None
def test_cli_texture_pass_textures_the_picked_round_not_the_last_build(tmp_path: Path, monkeypatch):
diff --git a/harness/tests/graphics/test_live.py b/harness/tests/graphics/test_live.py
index f966f34b..8aedf855 100644
--- a/harness/tests/graphics/test_live.py
+++ b/harness/tests/graphics/test_live.py
@@ -59,7 +59,7 @@ def test_live_plan_generate_build_judge(tmp_path, keys_ok):
pytest.skip(f"model wrote a shader that does not compile (repair loop not exercised here): {build.error_message[:200]}")
renders = frames_render_set(ws, build, 0)
assert len(renders.views) == 5 and renders.contact_sheet
- judge = VlmJudge(rubric="shader_v1", model_id=MODEL, n_samples=1)
+ judge = VlmJudge(rubric="shader_v2", model_id=MODEL, n_samples=1)
j = judge.judge(JudgeInput(spec=spec, renders=renders, gates=[lint], acceptance=plan.acceptance, plan_summary=plan.summary,
round_index=0, extra_context=""))
assert 0.0 <= j.overall <= 1.0 and set(j.scores) >= {"brief_fidelity", "motion_quality"}
diff --git a/harness/tests/graphics/test_round_metrics.py b/harness/tests/graphics/test_round_metrics.py
index 8f7bfb56..7c444bff 100644
--- a/harness/tests/graphics/test_round_metrics.py
+++ b/harness/tests/graphics/test_round_metrics.py
@@ -35,18 +35,3 @@ def test_a_round_recorded_before_the_copy_is_not_quoted_a_later_builds_metrics(t
(ws.root / "rounds" / f"r{i:02d}.json").write_text("{}")
assert "later build" in frame_stats_text(ws, 0) and "mean_lum" not in frame_stats_text(ws, 0)
assert "mean_lum=0.750" in frame_stats_text(ws, 1)
-
-
-def test_an_old_graphics_run_quotes_the_canonical_metrics_for_the_round_its_finalise_rebuilt(tmp_path):
- """smoke_glsl-like: three rounds recorded before rounds kept a copy; the old finalise rebuilt
- the best (``best_round`` 1), so artifacts/metrics.json is round 1's — not round 2's (the
- highest), and not "a later build's" for round 1."""
- ws = Workspace(tmp_path / "run").create()
- _metrics(ws, 0.5) # round 1's, rebuilt by the old finalise
- (ws.root / "rounds").mkdir()
- for i in (0, 1, 2):
- (ws.root / "rounds" / f"r{i:02d}.json").write_text("{}")
- ws.write_json(ws.record_path, {"best_round": 1})
- assert "mean_lum=0.500" in frame_stats_text(ws, 1)
- for i in (0, 2):
- assert "mean_lum" not in frame_stats_text(ws, i)
diff --git a/harness/tests/graphics/test_wrap_lint.py b/harness/tests/graphics/test_wrap_lint.py
index b49b8731..0f231c40 100644
--- a/harness/tests/graphics/test_wrap_lint.py
+++ b/harness/tests/graphics/test_wrap_lint.py
@@ -136,21 +136,3 @@ def test_program_lint_workspace(tmp_ws):
(tmp_ws.src / "helpers.py").write_text("x = 1\n")
rep = lint_program_ws(tmp_ws)
assert rep.passed and any(f.data["kind"] == "stray_file" for f in rep.findings)
-
-
-def test_a_pre_d107_runs_seeded_recipes_file_still_composes_and_is_not_a_stray_file(tmp_path):
- """Runs made before D107 call functions the harness seeded into ``src/recipes.glsl``: the build
- still composes that file (between the header and common.glsl, with its own line map) so
- ``resume`` / ``render`` / ``pick`` on such a run builds, and the lint does not call it stray."""
- from codeverse3d.languages.glsl_shader import LEGACY_RECIPES, GlslShaderRuntime
- from codeverse3d.workspace import Workspace
-
- ws = Workspace(tmp_path / "old_run").create()
- (ws.root / "src/shader.frag").write_text("void mainImage(out vec4 c, in vec2 f) { c = vec4(legacyGlow()); }\n")
- (ws.root / LEGACY_RECIPES).write_text("float legacyGlow() { return 0.5; }\n")
- image, buffer_a = GlslShaderRuntime().compose_sources(ws)
- assert buffer_a is None
- assert image.source.index("float legacyGlow") < image.source.index("void mainImage")
- assert LEGACY_RECIPES in {seg.file for seg in image.line_map.segments}
- assert not [f for f in lint_workspace(ws).findings if (f.data or {}).get("kind") == "stray_file"]
- assert LEGACY_RECIPES not in compose(SHADER, COMMON).source
diff --git a/harness/tests/judges/test_caps.py b/harness/tests/judges/test_caps.py
index 415ef0d6..4524c2db 100644
--- a/harness/tests/judges/test_caps.py
+++ b/harness/tests/judges/test_caps.py
@@ -15,7 +15,6 @@ from codeverse3d.judges.rubrics import (
R = load_rubric("static_object_v1")
A = load_rubric("articulated_v1")
S = load_rubric("scene_v2")
-S1 = load_rubric("scene_v1") # frozen: what a recorded v1 round replays under
POSE = [RenderView(name="pose_rest", path="p")]
@@ -73,9 +72,6 @@ E, W = Severity.ERROR, Severity.WARN
{"camera_in_geometry"}),
(S, [_gate("scene_frames", E, "the subject is hidden by a wall", target="Establishing", kind="camera_target_blocked")], {}, 0.9,
set()),
- # the frozen v1 rubric still replays its recorded rounds the old way
- (S1, [_gate("scene_placement", E, "Pondside/Lantern is floating 0.30 m above PondWater", target="Pondside/Lantern")],
- {"defects_present": {}}, 0.6, {"floating_or_sunken_asset", "floating_part"}),
])
def test_gate_caps(rubric, gates, kw, overall, rules):
res = apply_caps(rubric, 0.9, gates, {}, [], **kw)
@@ -114,8 +110,6 @@ CONTRACT_ERR = GateReport(gate="contract", passed=False, findings=[GateFinding(
# a contract ERROR about the bbox does not switch off the veto connectivity earned
(R, "floating_part", [CONTRACT_ERR, _connectivity(True, ("info", "all 4 parts are connected"))], True),
(R, "interpenetration", [CONTRACT_ERR, _connectivity(True, ("info", "all 4 parts are connected"))], True),
- (S1, "floating_or_sunken_asset", [GateReport(gate="scene_placement", passed=True, findings=[GateFinding(
- gate="scene_placement", severity=Severity.INFO, target="scene", message="13 assets checked: 0 floating")])], True),
# a failed report that names no ERROR finding cannot say what failed: not clean
(R, "floating_part", [GateReport(gate="connectivity", passed=False, findings=[])], False),
])
@@ -196,7 +190,6 @@ def test_graded_acceptance_cap_keeps_the_gradient_but_not_the_pass():
assert apply_caps(R, 0.99, [], {"M0": True}, ten[:2]).overall == pytest.approx(0.8)
should = [AcceptanceItem(id="S1", text="y", priority="should")]
assert apply_caps(R, 0.9, [], {"S1": False}, should).overall == 0.9, "a should item never caps"
- assert apply_caps(S1, 0.99, [], nine_ok, ten).overall == 0.6, "an ungraded rule (scene_v1, frozen) keeps its flat cap"
assert apply_caps(S, 0.99, [], nine_ok, ten).overall == pytest.approx(0.96), "scene_v2 grades it like the object rubrics"
# pass/fail is the owner's policy: the verdict still fails on must_missing
sample = JudgeOutput(criteria={c.id: CriterionScore(score=0.99, evidence="") for c in R.criteria},
diff --git a/harness/tests/judges/test_defects.py b/harness/tests/judges/test_defects.py
index 36e8d8dc..61cc90b4 100644
--- a/harness/tests/judges/test_defects.py
+++ b/harness/tests/judges/test_defects.py
@@ -30,7 +30,7 @@ def _reply(score=0.9, defects=None):
def test_rubrics_declare_defects_with_costs():
- for name in ("static_object_v1", "articulated_v1", "scene_v1", "scene_v2", "asset_v1", "reference_v1"):
+ for name in ("static_object_v1", "articulated_v1", "scene_v2", "asset_v1", "reference_v1"):
r = load_rubric(name)
assert r.defects, name
assert all(d.penalty > 0 or d.cap is not None for d in r.defects)
diff --git a/harness/tests/judges/test_likeness.py b/harness/tests/judges/test_likeness.py
index e3d771dd..892786ec 100644
--- a/harness/tests/judges/test_likeness.py
+++ b/harness/tests/judges/test_likeness.py
@@ -14,8 +14,8 @@ def test_likeness_context_attaches_the_photos_and_the_note(judge_input, tmp_path
draw_chair(ref)
judge_input.spec = make_spec(track=Track.GRAPHICS, language=Language.GLSL_SHADER,
references=[ReferenceImage(path=str(ref), role="likeness", note="aurora green spiral sea")])
- model = FakeChatModel([good_reply(load_rubric("shader_v1"), ["A1", "A2"], 0.8)])
- j = LikenessJudge("fake:fake-1", rubric="shader_v1", chat_model=model, cache_dir=cache_dir)
+ model = FakeChatModel([good_reply(load_rubric("shader_v2"), ["A1", "A2"], 0.8)])
+ j = LikenessJudge("fake:fake-1", rubric="shader_v2", chat_model=model, cache_dir=cache_dir)
ctx = j.context(judge_input)
assert ctx.extra_images == [("REAL-WORLD REFERENCE 1/1 — aurora green spiral sea", str(ref))]
assert ctx.extra_text == LIKENESS_NOTE and "evenly spaced bars" in LIKENESS_NOTE
diff --git a/harness/tests/judges/test_scene_judge.py b/harness/tests/judges/test_scene_judge.py
index a5d847e5..4dee6f91 100644
--- a/harness/tests/judges/test_scene_judge.py
+++ b/harness/tests/judges/test_scene_judge.py
@@ -20,7 +20,6 @@ from codeverse3d.judges.prompt_builder import (
RIG_RULES,
build_judge_messages,
gates_section,
- judge_prompt_hash,
placement_block,
placement_findings_for_crops,
plan_contact_crops,
@@ -335,7 +334,6 @@ def test_scene_v2_numbers_are_pinned():
# six anchors on every criterion; the weights are v1's
for c in S.criteria:
assert sorted(c.anchors, key=float) == ["0.1", "0.4", "0.55", "0.7", "0.85", "1.0"], c.id
- assert {c.id: c.weight for c in S.criteria} == {c.id: c.weight for c in load_rubric("scene_v1").criteria}
notes = S.extra_instructions
for phrase in ("CALIBRATION", "at most 0.35", "around 0.55", "0.80 or more", "at least 0.3 apart", "room ceilings lifted",
"CONTACT CROP images are diagnostic close-ups", "must name the VIEW"):
@@ -343,7 +341,6 @@ def test_scene_v2_numbers_are_pinned():
# the object rubrics did not move: no veto_warn_keys, the same content hash as their YAML
for name in ("static_object_v1", "articulated_v1", "reference_v1"):
assert all(not c.veto_warn_keys for c in load_rubric(name).caps), name
- assert judge_prompt_hash(S) != judge_prompt_hash(load_rubric("scene_v1"))
# --------------------------------------------------------------------------- the real gate → the judge
diff --git a/harness/tests/judges/test_vlm_judge.py b/harness/tests/judges/test_vlm_judge.py
index 3f58c33e..fa1ba27e 100644
--- a/harness/tests/judges/test_vlm_judge.py
+++ b/harness/tests/judges/test_vlm_judge.py
@@ -121,7 +121,7 @@ def test_judge_prompt_hash_tracks_the_protocol_not_the_run(monkeypatch):
# per-run content (acceptance ids) is NOT part of it: the schema is hashed with no ids
assert wire_schema(R, ["A1"]) != wire_schema(R, []) and judge_prompt_hash(R) == base
# the rubric is part of it (through the rendered rubric block)
- other = load_rubric("shader_v1")
+ other = load_rubric("shader_v2")
assert judge_prompt_hash(other) != base
# an edit to the role prompt or the rig rules changes it — that is the whole point
monkeypatch.setattr(pb, "_ROLE", pb._ROLE + "\nScore generously.")
diff --git a/harness/tests/orchestrator_tracks/test_likeness_routing.py b/harness/tests/orchestrator_tracks/test_likeness_routing.py
index 15775142..39d4d098 100644
--- a/harness/tests/orchestrator_tracks/test_likeness_routing.py
+++ b/harness/tests/orchestrator_tracks/test_likeness_routing.py
@@ -13,7 +13,7 @@ from codeverse3d.tracks.prompting import reference_note
def _ctx(track: Track, refs: list[str], *, single_shot: bool = False) -> SimpleNamespace:
spec = SimpleNamespace(references=[ReferenceImage(path=p, role="likeness", note="x") for p in refs],
backends=SimpleNamespace(judge="gemini:pro"))
- return SimpleNamespace(spec=spec, track=track, single_shot=single_shot, rubric="shader_v1",
+ return SimpleNamespace(spec=spec, track=track, single_shot=single_shot, rubric="shader_v2",
policy=SimpleNamespace(judge_samples=2))
@@ -40,7 +40,7 @@ def test_make_judge_routes_photos_to_the_likeness_judge_and_a_replay_picks_the_s
assert BaseTrack.make_judge(me, _ctx(Track.SCENE, ["/x.png"])) == "L"
assert BaseTrack.make_judge(me, _ctx(Track.STATIC_OBJECT, ["/x.png"])) == "R"
assert BaseTrack.make_judge(me, _ctx(Track.GRAPHICS, [])) == "P"
- assert calls[0] == ("likeness", "shader_v1")
+ assert calls[0] == ("likeness", "shader_v2")
# a replay picks the judge the live run did: `3dcode judge` / calibration and the live run share
# `judge_for` — a graphics or scene run with photos was re-judged by ReferenceJudge (silhouette +
# diff pass) where the run used likeness
@@ -49,7 +49,6 @@ def test_make_judge_routes_photos_to_the_likeness_judge_and_a_replay_picks_the_s
assert judge_for(Track.GRAPHICS, "shader_v2", references=True) is LikenessJudge
assert judge_for(Track.SCENE, "scene_v2", references=True) is LikenessJudge
- assert judge_for(Track.SCENE, "scene_v1", references=True) is LikenessJudge # a replay of a v1 round
assert judge_for(Track.STATIC_OBJECT, "reference_v1", references=True) is ReferenceJudge
assert judge_for(Track.STATIC_OBJECT, "reference_v1", references=False) is ReferenceJudge # measured criteria
assert judge_for(Track.GRAPHICS, "shader_v2", references=False) is VlmJudge
diff --git a/harness/tests/orchestrator_tracks/test_orchestrator.py b/harness/tests/orchestrator_tracks/test_orchestrator.py
index ca7de11e..6945f390 100644
--- a/harness/tests/orchestrator_tracks/test_orchestrator.py
+++ b/harness/tests/orchestrator_tracks/test_orchestrator.py
@@ -2,7 +2,6 @@
from __future__ import annotations
-import json
import time
from pydantic import BaseModel
@@ -15,7 +14,6 @@ from codeverse3d.contracts.artifacts import (
Severity,
)
from codeverse3d.contracts.plan import AcceptanceItem
-from codeverse3d.contracts.run import RunStatus
from codeverse3d.orchestrator import (
RefineTask,
RunState,
@@ -45,17 +43,6 @@ def test_fan_out_preserves_order_and_captures_exceptions():
assert set(fan_out(range(6), lambda _i: var.get(), max_workers=4, label="attr")) == {"run-42"}
-def test_a_run_state_saved_before_2026_09_22_still_loads(tmp_ws):
- """Its best-round and journal keys are ignored and ``passed`` / ``plateau`` read as ``stopped``."""
- tmp_ws.state_path.write_text(json.dumps({
- "status": "passed", "stop_reason": "pass", "current_round": 2, "completed_rounds": [0, 1],
- "round_commits": {"0": "a0", "1": "a1"}, "best_round": 0, "best_commit": "a0", "best_score": 0.81,
- "best_considered_through": 1}))
- st = RunState.load(tmp_ws)
- assert st is not None and st.status is RunStatus.STOPPED and st.stop_reason == "pass"
- dumped = st.model_dump()
- assert not {"best_round", "completed_rounds", "round_commits", "current_round"} & set(dumped)
- assert RunStatus("plateau") is RunStatus.STOPPED
def test_an_unreadable_cached_stage_is_a_miss_not_a_dead_run(tmp_ws):
diff --git a/harness/tests/orchestrator_tracks/test_resume_reconcile.py b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
index a4073f9b..eed66e08 100644
--- a/harness/tests/orchestrator_tracks/test_resume_reconcile.py
+++ b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
@@ -9,7 +9,6 @@ from types import SimpleNamespace
import pytest
from codeverse3d.contracts.common import Language
-from codeverse3d.contracts.run import RunStatus
from codeverse3d.orchestrator import RoundPolicy
from codeverse3d.proc import EventLog
from codeverse3d.tracks.lifecycle import SpecChanged
@@ -76,36 +75,6 @@ def test_crash_between_round_write_and_state_save_ends_at_the_newer_round(comple
assert ev and ev[-1]["rounds"] == 2 and ev[-1]["restored_last_round"] == 1
-def test_an_old_run_that_restored_its_best_round_resumes_from_its_last(completed_run, settings):
- """A pre-2026-09-22 run that ended on "restore best round" resumes from, and refines, its LAST round."""
- run = completed_run(max_rounds=1)
- rec1, ws = run.record, run.ws
- state = json.loads(ws.state_path.read_text())
- state.update(status="passed", stop_reason="pass", best_round=0, best_commit=rec1.rounds[0].commit,
- best_score=0.5, best_considered_through=1)
- ws.state_path.write_text(json.dumps(state))
- record = json.loads(ws.record_path.read_text())
- record.update(status="passed", best_round=0, baseline_score=0.5, final_score=0.5)
- ws.record_path.write_text(json.dumps(record))
- ws.restore(rec1.rounds[0].commit) # what the old finalise did
- ws.commit("restore best round r00")
-
- seen: list[tuple[int, str]] = []
-
- def writer(job, ws_):
- seen.append((job.round, (ws_.src / "model.py").read_text()))
- return _writer(job, ws_)
-
- track = StaticObjectTrack(services=FakeServices(), judge=FakeJudge(scores=(0.6,)), agent=FakeAgent(writer),
- planner_model=_planner(run.plan), settings=settings,
- runtime=FakeRuntime(Language.BLENDER), policy=RoundPolicy(max_rounds=2))
- rec2 = track.run(make_spec(language=Language.BLENDER, max_rounds=2), ws, resume=True)
- assert [r.index for r in rec2.rounds] == [0, 1, 2] and rec2.status is RunStatus.MAX_ROUNDS
- assert seen and all(rnd == 2 for rnd, _ in seen), "only the new round generated"
- assert seen[0][1] == _code_at(ws, rec1.rounds[1].commit) != _code_at(ws, rec1.rounds[0].commit), "round 2 refines round 1"
- ev = [e for e in EventLog(ws.events_path).read() if e["event"] == "resume.reconciled"]
- assert ev[-1]["restored_last_round"] == 1
- assert ws.head() == rec2.rounds[-1].commit and _code_at(ws, ws.head()) == (ws.src / "model.py").read_text()
def _code_at(ws: Workspace, commit: str) -> str:
diff --git a/harness/tests/orchestrator_tracks/test_step_timing.py b/harness/tests/orchestrator_tracks/test_step_timing.py
index 19a07d84..5324de46 100644
--- a/harness/tests/orchestrator_tracks/test_step_timing.py
+++ b/harness/tests/orchestrator_tracks/test_step_timing.py
@@ -7,7 +7,7 @@ import time
from codeverse3d.contracts.agent import AgentJob, AgentResult
from codeverse3d.contracts.common import Language
-from codeverse3d.contracts.run import RoundRecord, RunRecord, StepTime
+from codeverse3d.contracts.run import RoundRecord
from codeverse3d.cost.instrument import MeteredAgent
from codeverse3d.orchestrator import RunState
from codeverse3d.tracks.static_object import StaticObjectTrack
@@ -48,14 +48,3 @@ def test_every_step_is_timed_and_the_minutes_leave_out_the_provider_errors(tmp_p
# the step log survives on disk: the journal carries each round's, run_state the run's
assert RoundRecord.model_validate(ws.read_json(ws.root / "rounds" / "r00.json")).steps == rec.rounds[0].steps
assert RunState.load(ws).steps == rec.steps
-
-
-def test_a_record_from_before_step_timing_counts_its_own_clock():
- old = RunRecord.model_validate({"spec": make_spec().model_dump(mode="json"), "workspace": "w",
- "rounds": [{"index": 0, "kind": "baseline", "duration_s": 120.0}],
- "extra": {"budget": {"elapsed_min": 7.5}}})
- assert old.steps is None and old.minutes == 7.5 and old.rounds[0].minutes == 2.0
- assert RunRecord.model_validate({"spec": make_spec().model_dump(mode="json"), "workspace": "w"}).minutes is None
- # a run resumed across the change: new steps, and an old round that still counts its clock
- mixed = old.model_copy(update={"steps": [StepTime(step="plan", wall_s=90.0, lost_s=30.0)]})
- assert mixed.minutes == 1.0 + 2.0
diff --git a/harness/tests/scene_prompts/test_quality_teaching.py b/harness/tests/scene_prompts/test_quality_teaching.py
index 06f66558..13012070 100644
--- a/harness/tests/scene_prompts/test_quality_teaching.py
+++ b/harness/tests/scene_prompts/test_quality_teaching.py
@@ -29,7 +29,6 @@ def test_scene_rubric_craft_defects_inform_and_cannot_zero_a_scene() -> None:
# diorama_look, 2026-10-15); this test keeps the invariant.
total = sum(d.penalty for d in r.defects)
assert 1.0 <= total <= 1.10, total
- assert sum(d.penalty for d in load_rubric("scene_v1").defects) <= 0.62 # the frozen replay rubric
def test_no_scene_stage_inlines_cookbook_recipes() -> None:
diff --git a/harness/tests/texturing/test_gate.py b/harness/tests/texturing/test_gate.py
index e556e279..91520789 100644
--- a/harness/tests/texturing/test_gate.py
+++ b/harness/tests/texturing/test_gate.py
@@ -17,7 +17,7 @@ def _asset(tid: str, seam: float, ok_path: Path) -> TextureAsset:
@pytest.mark.parametrize(("rubric", "criterion"), [
("static_object_v1", "materials"), ("reference_v1", "material_color"), ("asset_v1", "material_truth"),
- ("scene_v1", "materials_shaders_effects"), ("scene_v2", "materials_shaders_effects"), ("articulated_v1", ""), ("shader_v2", ""),
+ ("scene_v2", "materials_shaders_effects"), ("articulated_v1", ""), ("shader_v2", ""),
])
def test_the_rubric_flags_its_materials_criterion(rubric, criterion):
"""N64: the gate sniffed criterion ids by prefix (law 4); a rubric now says which one it is."""
diff --git a/toolkits/README.md b/toolkits/README.md
index 8ed536b9..d4a4bc59 100644
--- a/toolkits/README.md
+++ b/toolkits/README.md
@@ -29,7 +29,7 @@ If both copies are edited they can drift; coordinate changes with the upstream r
| source | scripts | notes |
|---|---|---|
-| `deepcad/` | `convert_vec_to_cq.py`, `batch_convert.py`, `cq_check{,_batch}.py`, `gen_gt_stl.py`, `iou_compute.py`, `render_all.py`, `dedup_check.py`, `attach_text.py`, `pack_tar_parquet.py`, `finalize.py`, `upload_to_hf.py` | DeepCAD vector sequences → CadQuery programs, executed and checked, GT meshes + IoU, captions attached, packed and uploaded |
+| `deepcad/` | `convert_vec_to_cq.py`, `batch_convert.py`, `cq_check{,_batch}.py`, `gen_gt_stl.py`, `iou_compute.py`, `render_all.py`, `dedup_vec.py`, `attach_text.py`, `pack_tar_parquet.py`, `finalize.py`, `upload_to_hf.py` | DeepCAD vector sequences → CadQuery programs, executed and checked, GT meshes + IoU, captions attached, packed and uploaded |
| `articraft/` | `articraft_cq.py`, `assemble_shim.py`, … | articulated assets → CadQuery / URDF projects |
The shape of a curation pass is **convert → execute → render → compute ground truth → dedupe →
diff --git a/toolkits/curation/deepcad/README.md b/toolkits/curation/deepcad/README.md
index 0264b4da..fc52b4b1 100644
--- a/toolkits/curation/deepcad/README.md
+++ b/toolkits/curation/deepcad/README.md
@@ -33,8 +33,8 @@ geometry: mean IoU 0.985, median 1.0, 96.9% > 0.9.**
(CC-BY-NC-SA) 4-level descriptions by uid. `attach_text.py`. (Kept in
`curation.json`; the official caption is filled by the maintainer.)
6. **Dedup** on the *source vec hash* (deterministic conversion ⇒ identical
- code+geometry). `dedup_vec.py`. (`dedup_fast.py` does a geometry-fingerprint
- variant — kept for reference; it over-merges, see Gotchas.)
+ code+geometry). `dedup_vec.py`. Geometry-fingerprint deduplication was retired because it
+ over-merges; see Gotchas.
7. **Assemble + finalize**: merge into a JSONL, mark dedup + leakage-free splits +
IoU fidelity tiers. `assemble_corpus.py` → `mark_dedup.py` → `finalize.py`.
8. **Format + pack**: emit the official per-sample dir layout (`to_3dcodeverse.py`),
@@ -71,7 +71,6 @@ assemble / dedup:
mark_dedup.py annotate is_canonical/duplicate_of + cross-split leakage
finalize.py fidelity tiers (IoU) + leakage-free split_dedup
dedup_vec.py TRUE dedup on source vec hash
- dedup_fast.py geometry-fingerprint dedup (reference; over-merges)
format / pack / upload:
to_3dcodeverse.py official per-sample dir layout (meta.json + curation.json + renders/)
diff --git a/toolkits/curation/deepcad/dedup_check.py b/toolkits/curation/deepcad/dedup_check.py
deleted file mode 100644
index adea7671..00000000
--- a/toolkits/curation/deepcad/dedup_check.py
+++ /dev/null
@@ -1,109 +0,0 @@
-"""
-dedup_check.py
-Compute a geometry fingerprint (volume, surface area, inertia-trace) for each
-STEP and flag near-duplicates. Batched like validate_fast (import cadquery once
-per worker). Writes duplicates.json: {kept_id: [dup_id, ...]}.
-
-Fingerprint is rounded so numerically-identical solids collide; this catches
-exact/near duplicates within the batch (and can be diffed against an existing
-corpus's fingerprints later).
-"""
-import os
-import sys
-import json
-import argparse
-import tempfile
-import subprocess
-from pathlib import Path
-from collections import defaultdict
-from joblib import Parallel, delayed
-from tqdm import tqdm
-
-WORKER_SRC = '''
-import sys, json, os
-import cadquery as cq
-from OCP.GProp import GProp_GProps
-from OCP.BRepGProp import BRepGProp
-for line in open(sys.argv[1]):
- step = line.strip()
- if not step: continue
- sub = os.path.basename(os.path.dirname(step))
- name = os.path.splitext(os.path.basename(step))[0]
- try:
- shape = cq.importers.importStep(step).val()
- vp = GProp_GProps(); BRepGProp.VolumeProperties_s(shape.wrapped, vp)
- sp = GProp_GProps(); BRepGProp.SurfaceProperties_s(shape.wrapped, sp)
- mat = vp.MatrixOfInertia()
- itr = mat.Value(1,1)+mat.Value(2,2)+mat.Value(3,3)
- fp = [round(abs(vp.Mass()),4), round(sp.Mass(),4), round(itr,4)]
- print(json.dumps({"id": f"{sub}/{name}", "fp": fp}), flush=True)
- except Exception as e:
- print(json.dumps({"id": f"{sub}/{name}", "fp": None}), flush=True)
-'''
-
-
-def run_chunk(steps, py_exe, worker_path):
- with tempfile.NamedTemporaryFile("w", suffix=".txt", delete=False) as mf:
- mf.write("\n".join(str(s) for s in steps))
- manifest = mf.name
- out = []
- try:
- pr = subprocess.run([py_exe, worker_path, manifest],
- capture_output=True, text=True,
- timeout=30 * len(steps) + 60)
- for line in pr.stdout.splitlines():
- line = line.strip()
- if line:
- try:
- r = json.loads(line)
- out.append((r["id"], tuple(r["fp"]) if r["fp"] else None))
- except Exception:
- pass
- except subprocess.TimeoutExpired:
- pass
- finally:
- os.unlink(manifest)
- return out
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--step_dir", required=True)
- ap.add_argument("--workers", type=int, default=40)
- ap.add_argument("--chunk", type=int, default=64)
- ap.add_argument("--python", default=sys.executable)
- ap.add_argument("--out", default="duplicates.json")
- args = ap.parse_args()
-
- worker_path = str(Path(tempfile.gettempdir()) / "_dedup_worker.py")
- Path(worker_path).write_text(WORKER_SRC)
-
- steps = sorted(Path(args.step_dir).rglob("*.step"))
- chunks = [steps[i:i + args.chunk] for i in range(0, len(steps), args.chunk)]
- print(f"Fingerprinting {len(steps)} STEP files in {len(chunks)} chunks...")
-
- chunk_results = Parallel(n_jobs=args.workers)(
- delayed(run_chunk)(c, args.python, worker_path) for c in tqdm(chunks)
- )
-
- seen = {}
- dups = defaultdict(list)
- n_bad = 0
- for chunk in chunk_results:
- for mid, fp in chunk:
- if fp is None:
- n_bad += 1
- continue
- if fp in seen:
- dups[seen[fp]].append(mid)
- else:
- seen[fp] = mid
-
- total_dups = sum(len(v) for v in dups.values())
- print(f"Unique fingerprints: {len(seen)}, duplicate models: {total_dups}, "
- f"unreadable: {n_bad}")
- json.dump(dups, open(args.out, "w"), indent=2)
-
-
-if __name__ == "__main__":
- main()
diff --git a/toolkits/curation/deepcad/dedup_fast.py b/toolkits/curation/deepcad/dedup_fast.py
deleted file mode 100644
index 2fdcdb37..00000000
--- a/toolkits/curation/deepcad/dedup_fast.py
+++ /dev/null
@@ -1,101 +0,0 @@
-"""
-dedup_fast.py
-Geometry-fingerprint dedup using the already-generated ground-truth STLs
-(trimesh reads STL directly -- far faster than re-importing STEP).
-
-Fingerprint = (volume, area, inertia-trace), rounded. Exact-match collisions
-are flagged as duplicates. Writes duplicates.json: {kept_id: [dup_id,...]}.
-"""
-import os
-import sys
-import json
-import argparse
-import tempfile
-import subprocess
-from pathlib import Path
-from collections import defaultdict
-from joblib import Parallel, delayed
-from tqdm import tqdm
-
-WORKER_SRC = r'''
-import sys, os, json
-import numpy as np
-import trimesh
-for line in open(sys.argv[1]):
- stl = line.strip()
- if not stl: continue
- sub=os.path.basename(os.path.dirname(stl)); name=os.path.splitext(os.path.basename(stl))[0]
- mid=f"{sub}/{name}"
- try:
- m = trimesh.load(stl, force="mesh")
- vol=round(abs(float(m.volume)),4); area=round(float(m.area),4)
- itr=round(float(np.trace(m.moment_inertia)),4)
- print(json.dumps({"id":mid,"fp":[vol,area,itr]}), flush=True)
- except Exception as e:
- print(json.dumps({"id":mid,"fp":None}), flush=True)
-'''
-
-
-def run_chunk(ids, stl_dir, py_exe, worker_path):
- lines = [str(Path(stl_dir) / mid.split("/")[0] / (mid.split("/")[1] + ".stl")) for mid in ids]
- with tempfile.NamedTemporaryFile("w", suffix=".txt", delete=False) as mf:
- mf.write("\n".join(lines))
- manifest = mf.name
- res = []
- try:
- pr = subprocess.run([py_exe, worker_path, manifest], capture_output=True,
- text=True, timeout=10 * len(ids) + 60)
- for line in pr.stdout.splitlines():
- line = line.strip()
- if line:
- try:
- r = json.loads(line)
- res.append((r["id"], tuple(r["fp"]) if r["fp"] else None))
- except Exception:
- pass
- except subprocess.TimeoutExpired:
- pass
- finally:
- os.unlink(manifest)
- return res
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--stl_dir", required=True)
- ap.add_argument("--ids", required=True)
- ap.add_argument("--workers", type=int, default=48)
- ap.add_argument("--chunk", type=int, default=64)
- ap.add_argument("--python", default=sys.executable)
- ap.add_argument("--out", default="duplicates.json")
- args = ap.parse_args()
-
- ids = [l.strip() for l in open(args.ids) if l.strip()]
- worker_path = str(Path(tempfile.gettempdir()) / "_dedupfast_worker.py")
- Path(worker_path).write_text(WORKER_SRC)
- chunks = [ids[i:i + args.chunk] for i in range(0, len(ids), args.chunk)]
- print(f"Fingerprinting {len(ids)} models in {len(chunks)} chunks...")
-
- results = Parallel(n_jobs=args.workers)(
- delayed(run_chunk)(c, args.stl_dir, args.python, worker_path) for c in tqdm(chunks)
- )
- seen = {}
- dups = defaultdict(list)
- n_bad = 0
- for chunk in results:
- for mid, fp in chunk:
- if fp is None:
- n_bad += 1
- continue
- if fp in seen:
- dups[seen[fp]].append(mid)
- else:
- seen[fp] = mid
- total = sum(len(v) for v in dups.values())
- print(f"Unique: {len(seen)}, duplicate models: {total}, unreadable: {n_bad}")
- print(f"Dup groups (>=1 dup): {len(dups)}")
- json.dump(dict(dups), open(args.out, "w"))
-
-
-if __name__ == "__main__":
- main()