Skip to content

Official Codebase of 3DCodeVerse

Python

judges: one plan digest and one round payload — a replayed round reads what the in-run judge read

gaoypeng2716cf600a45
diff --git a/eval/bench/judge_calib_graphics.py b/eval/bench/judge_calib_graphics.py
index 123bc606..69240eae 100644
--- a/eval/bench/judge_calib_graphics.py
+++ b/eval/bench/judge_calib_graphics.py
@@ -32,8 +32,9 @@ from typing import Any
from codeverse3d.addons import select
from codeverse3d.addons.calibration import spearman
from codeverse3d.contracts.artifacts import GateReport, RenderSet
+from codeverse3d.contracts.plan import GraphicsPlan
from codeverse3d.contracts.spec import Spec
-from codeverse3d.judges.base import JudgeInput, plan_digest
+from codeverse3d.judges.base import JudgeInput, plan_summary
from codeverse3d.judges.vlm_judge import VlmJudge
from codeverse3d.record.record import RecordError
from codeverse3d.tracks.graphics import frame_stats_text
@@ -64,14 +65,14 @@ def judge_one(run: Path, rubric: str, model: str, n: int) -> dict[str, Any]:
# judge is told so — without it, pro called four moving effects "static" in the first pass)
ws = Workspace(run)
plan_path = run / "plan.json"
- plan_summary = plan_digest(json.loads(plan_path.read_text())) if plan_path.is_file() else ""
+ digest = plan_summary(GraphicsPlan.model_validate_json(plan_path.read_text()), spec.language) if plan_path.is_file() else ""
last_index = max((int(f.stem[1:]) for f in run.glob("rounds/r*.json")), default=0)
if int(rnd.get("index", 0)) == last_index:
extra = "FRAME METRICS (harness-measured):\n" + frame_stats_text(ws)
else:
extra = "FRAME METRICS: not available for this round (an earlier round than the last build); judge motion from the frames."
inp = JudgeInput(spec=spec, renders=renders, gates=gates, round_index=int(rnd.get("index", 0)),
- plan_summary=plan_summary, extra_context=extra)
+ plan_summary=digest, extra_context=extra)
judge = VlmJudge(rubric=rubric, model_id=model, n_samples=n)
v = judge.judge(inp)
raw = v.raw if isinstance(v.raw, dict) else json.loads(v.raw or "{}")
diff --git a/harness/codeverse3d/cli/_judge.py b/harness/codeverse3d/cli/_judge.py
index 29509347..a23ea4e8 100644
--- a/harness/codeverse3d/cli/_judge.py
+++ b/harness/codeverse3d/cli/_judge.py
@@ -1,28 +1,29 @@
"""``3dcode judge`` implementation: re-judge a round with the SAME inputs the
in-run judge saw.
-The round's renders / measurement / gates come from ``rounds/rNN.json``
-(fallback: the round inside record.json), the acceptance checklist and plan
-digest from ``plan.json``, ``previous`` is the preceding round's (non-degraded)
-verdict, the track-specific ``extra_context`` is rebuilt from the stored gates
-/ frame metrics, and the clay geometry views rendered for the in-run judge
-(``renders/rNN/clay/``) are reattached when present. The judge class matches
-the in-run choice: ``ReferenceJudge`` when the rubric has measured criteria or
-the spec carries reference images, ``VlmJudge`` otherwise.
+The payload is ``judges.base.round_input`` — the builder the in-run judge uses — fed from
+disk: the round's renders / measurement / gates from ``rounds/rNN.json`` (fallback: the
+round inside record.json), the typed plan from record.json (else ``plan.json``), ``previous``
+the preceding round's (non-degraded) verdict, the track's ``extra_context`` rebuilt from the
+stored gates / frame metrics, and the clay geometry views rendered for the in-run judge
+(``renders/rNN/clay/``) reattached when present. The judge class matches the in-run choice:
+``ReferenceJudge`` when the rubric has measured criteria or the spec carries reference
+images, ``VlmJudge`` otherwise.
"""
from __future__ import annotations
-import json
from typing import Any
+from pydantic import ValidationError
+
from codeverse3d.cli import _common as C
from codeverse3d.contracts.artifacts import BuildResult, RenderSet, RenderView
from codeverse3d.contracts.common import TRACK_INFO
-from codeverse3d.contracts.plan import AcceptanceItem
+from codeverse3d.contracts.plan import Plan
from codeverse3d.contracts.run import RoundRecord, RunRecord
from codeverse3d.contracts.spec import Spec
-from codeverse3d.judges.base import SLICE_TRACKS, judged_subset, plan_digest, resolve_paths
+from codeverse3d.judges.base import judged_subset, resolve_paths, round_input
from codeverse3d.proc import read_json_or_none
from codeverse3d.workspace import Workspace
@@ -47,10 +48,18 @@ def rubric_for(rec: RunRecord, rnd: RoundRecord, override: str | None) -> str:
return TRACK_INFO[rec.spec.track].rubric
-def plan_summary_for(ws: Workspace) -> str:
- """Track-agnostic plan digest from plan.json (same fields the tracks summarise)."""
+def stored_plan(ws: Workspace, rec: RunRecord) -> Plan | None:
+ """The run's typed plan: record.json's, else ``plan.json`` read as the track's plan model
+ (a run that stopped before its record was written)."""
+ if rec.plan is not None:
+ return rec.plan
+ from codeverse3d.tracks import get_track
+
data = read_json_or_none(ws.plan_path)
- return plan_digest(data) if data else ""
+ try:
+ return get_track(rec.spec.track).plan_model.model_validate(data) if data else None
+ except ValidationError:
+ return None
def previous_judgment(ws: Workspace, rec: RunRecord, index: int) -> Any:
@@ -67,7 +76,7 @@ def previous_judgment(ws: Workspace, rec: RunRecord, index: int) -> Any:
return None
-def extra_context_for(ws: Workspace, rec: RunRecord, rnd: RoundRecord) -> str:
+def extra_context_for(ws: Workspace, rec: RunRecord, plan: Plan | None, rnd: RoundRecord) -> str:
"""The track pipeline's OWN ``judge_context`` over the stored artifacts —
``judge_context(ws, plan, round_index, build, gates)`` needs no run context,
so the CLI never restates the per-track formatting."""
@@ -75,7 +84,7 @@ def extra_context_for(ws: Workspace, rec: RunRecord, rnd: RoundRecord) -> str:
build = rnd.build if rnd.build is not None else BuildResult(ok=False, language=rec.spec.language.value)
try:
- return get_track(rec.spec.track).make_pipeline().judge_context(ws, rec.plan, rnd.index, build, list(rnd.gates))
+ return get_track(rec.spec.track).make_pipeline().judge_context(ws, plan, rnd.index, build, list(rnd.gates))
except Exception as e: # noqa: BLE001 — extra context is optional judge input
return f"(judge context unavailable: {type(e).__name__}: {e})"
@@ -91,28 +100,17 @@ def clay_geometry_views(ws: Workspace, index: int) -> RenderSet | None:
def build_judge_input(ws: Workspace, rec: RunRecord, rnd: RoundRecord) -> Any:
- from codeverse3d.judges.base import JudgeInput
+ """``round_input`` for a stored round (``3dcode judge``, calibration)."""
+ plan = stored_plan(ws, rec)
+ return round_input(rec.spec, plan, rnd, renders=judged_subset(resolve_paths(ws, rnd.renders)), gates=rnd.gates,
+ previous=previous_judgment(ws, rec, rnd.index), extra_context=extra_context_for(ws, rec, plan, rnd),
+ geometry_views=clay_geometry_views(ws, rnd.index), glb_path=stored_glb_path(ws, rnd))
- acceptance: list[AcceptanceItem] = list(getattr(rec.plan, "acceptance", []) or [])
- if not acceptance and ws.plan_path.is_file():
- try:
- raw = json.loads(ws.plan_path.read_text()).get("acceptance") or []
- acceptance = [AcceptanceItem.model_validate(a) for a in raw]
- except (ValueError, TypeError):
- acceptance = []
- return JudgeInput(
- spec=rec.spec, renders=judged_subset(resolve_paths(ws, rnd.renders)), measurement=rnd.measurement, gates=rnd.gates,
- acceptance=acceptance, plan_summary=plan_summary_for(ws), round_index=rnd.index,
- previous=previous_judgment(ws, rec, rnd.index), extra_context=extra_context_for(ws, rec, rnd),
- geometry_views=clay_geometry_views(ws, rnd.index),
- glb_path=stored_glb_path(ws, rec, rnd),
- )
-
-
-def stored_glb_path(ws: Workspace, rec: RunRecord, rnd: RoundRecord) -> str | None:
- """The round's canonical GLB (object tracks), rebased to THIS workspace — what lets
- ``3dcode judge`` reproduce the D48 conditional slice payload from the stored gates."""
- if rec.spec.track.value not in SLICE_TRACKS or rnd.build is None or not rnd.build.glb_path:
+
+def stored_glb_path(ws: Workspace, rnd: RoundRecord) -> str | None:
+ """The round's canonical GLB, rebased to THIS workspace — what lets ``3dcode judge``
+ reproduce the D48 conditional slice payload from the stored gates."""
+ if rnd.build is None or not rnd.build.glb_path:
return None
kept = ws.round_artifacts(rnd.index) / "object.glb" # the round's own GLB; the stored path is
p = kept if kept.is_file() else ws.rebase(rnd.build.glb_path) # the canonical one, rebuilt since
diff --git a/harness/codeverse3d/judges/base.py b/harness/codeverse3d/judges/base.py
index 25abb089..c77f723b 100644
--- a/harness/codeverse3d/judges/base.py
+++ b/harness/codeverse3d/judges/base.py
@@ -1,14 +1,24 @@
-"""``JudgeInput`` + the pure round-replay helpers ``3dcode judge`` and calibration share."""
+"""``JudgeInput``, the ONE way a round becomes one (``round_input`` + ``plan_summary``: the in-run
+judge and every replay of a stored round build it here) and the pure replay helpers."""
from __future__ import annotations
-from typing import Any
+from collections.abc import Sequence
from pydantic import BaseModel, Field
from codeverse3d.contracts.artifacts import GateReport, Judgment, Measurement, RenderSet
-from codeverse3d.contracts.plan import AcceptanceItem
+from codeverse3d.contracts.plan import (
+ AcceptanceItem,
+ ArticulatedPlan,
+ GraphicsPlan,
+ Plan,
+ ScenePlan,
+ StaticPlan,
+)
+from codeverse3d.contracts.run import RoundRecord
from codeverse3d.contracts.spec import Spec
+from codeverse3d.conventions import to_authoring_frame
from codeverse3d.workspace import Workspace
#: tracks whose rounds have one canonical GLB the judge slice channel (D48) may cut;
@@ -36,36 +46,47 @@ class JudgeInput(BaseModel):
)
-# ===================================================================== round replay
-def plan_digest(plan: dict[str, Any]) -> str:
- """A track-agnostic plan summary (parts / joints / zones / assets / cameras) from ``plan.json``."""
- bits: list[str] = []
- title = plan.get("object_name") or plan.get("title") or ""
- if title:
- bits.append(f"{title}: {plan.get('summary', '')}".strip())
- bbox = plan.get("overall_bbox") or {}
- if isinstance(bbox, dict) and bbox.get("extents"):
- e = bbox["extents"]
- bits.append(f"Overall {e[0]:.2f}×{e[1]:.2f}×{e[2]:.2f} m.")
- parts = plan.get("parts") or []
- if parts:
- bits.append("Parts: " + ", ".join(f"{p['name']}×{p['instances']}" if p.get("instances", 1) > 1 else p["name"] for p in parts) + ".")
- if plan.get("root_link"):
- bits.append(f"Root link {plan['root_link']}.")
- joints = plan.get("joints") or []
- if joints:
- bits.append("Joints: " + "; ".join(
- f"{j['name']} ({j.get('type', '?')} {j.get('parent', '?')}→{j.get('child', '?')}, [{j.get('lower', 0):.2f},{j.get('upper', 0):.2f}])"
- for j in joints) + ".")
- for key, label in (("zones", "Zones"), ("assets", "Assets"), ("cameras", "Cameras")):
- items = plan.get(key) or []
- if items:
- bits.append(f"{label}: " + ", ".join(str(i.get("name", "?")) for i in items) + ".")
- if plan.get("setting"):
- bits.append(f"Setting: {plan['setting']}.")
- return " ".join(bits)
+# ===================================================================== one round → one JudgeInput
+def plan_summary(plan: Plan | None, language: str) -> str:
+ """The plan digest the judge reads, for every track. An object's overall size is written
+ W×H×D in the GLB frame (Y-up) — the frame of the measurement table beside it — so a Z-up
+ plan's (W, D, H) is permuted first. Four track methods and a fifth dict digest for the
+ replays used to write this: a replayed Z-up object read W×D×H, and a replayed shader lost
+ its style, passes, key visuals and motion."""
+ if isinstance(plan, GraphicsPlan):
+ passes = ", ".join(f"{p.name} ({p.kind})" for p in plan.passes)
+ return (f"{plan.title}: {plan.summary} Style: {plan.style}. Passes: {passes}. Key visuals: {'; '.join(plan.key_visuals)}. "
+ f"Motion: {plan.motion or '(none planned)'}. {plan.resolution[0]}x{plan.resolution[1]}, loop {plan.duration_s:g}s.")
+ if isinstance(plan, ScenePlan):
+ return (f"{plan.title}: {plan.summary} Setting: {plan.setting}. Zones: {', '.join(z.name for z in plan.zones)}. "
+ f"Assets: {', '.join(a.name for a in plan.assets)}. Cameras: {', '.join(c.name for c in plan.cameras)}.")
+ if not isinstance(plan, StaticPlan):
+ return ""
+ parts = ", ".join(f"{p.name}×{p.instances}" if p.instances > 1 else p.name for p in plan.parts)
+ e = to_authoring_frame(plan.overall_bbox.extents, language, extents=True)
+ text = f"{plan.object_name}: {plan.summary} Overall {e[0]:.2f}×{e[1]:.2f}×{e[2]:.2f} m (W×H×D). Parts: {parts}."
+ if isinstance(plan, ArticulatedPlan):
+ joints = "; ".join(f"{j.name} ({j.type} {j.parent}→{j.child}, [{j.lower:.2f},{j.upper:.2f}])" for j in plan.joints)
+ text += f" Root link {plan.root_link}. Joints: {joints}."
+ return text
+
+def round_input(spec: Spec, plan: Plan | None, rnd: RoundRecord, *, renders: RenderSet, gates: Sequence[GateReport],
+ previous: Judgment | None, extra_context: str, geometry_views: RenderSet | None,
+ glb_path: str | None) -> JudgeInput:
+ """The judge payload of one round. The in-run judge (``tracks/steps._judge``) builds it from the
+ round in hand, every replay of a stored round (``3dcode judge``, calibration:
+ ``cli/_judge.build_judge_input``) from disk — so a replay reads what the in-run judge read."""
+ return JudgeInput(
+ spec=spec, renders=renders, measurement=rnd.measurement, gates=list(gates),
+ acceptance=list(getattr(plan, "acceptance", None) or []), plan_summary=plan_summary(plan, spec.language),
+ round_index=rnd.index, previous=previous, extra_context=extra_context, geometry_views=geometry_views,
+ # D48: the round's canonical GLB feeds the conditional slice channel (object tracks only)
+ glb_path=glb_path if spec.track.value in SLICE_TRACKS else None,
+ )
+
+# ===================================================================== round replay
def resolve_paths(ws: Workspace, rs: RenderSet | None) -> RenderSet | None:
"""Render paths out of a round record, resolved against THIS workspace.
diff --git a/harness/codeverse3d/judges/vlm_judge.py b/harness/codeverse3d/judges/vlm_judge.py
index d4c3f8e7..7e687f0c 100644
--- a/harness/codeverse3d/judges/vlm_judge.py
+++ b/harness/codeverse3d/judges/vlm_judge.py
@@ -549,7 +549,7 @@ class ReferenceJudge(VlmJudge):
def _plan_part_names(inp: JudgeInput) -> list[str]:
"""Part names from the plan digest the judge already receives (best effort).
- ``judges.base.plan_digest`` writes them as one ``Parts: A, B×2, C`` segment;
+ ``judges.base.plan_summary`` writes them as one ``Parts: A, B×2, C`` segment;
a multi-line digest lists one ``- Name · role · …`` per line. Both are handled, and
an unrecognised digest simply yields no names (the diff prompt then says so).
"""
diff --git a/harness/codeverse3d/texturing/generate.py b/harness/codeverse3d/texturing/generate.py
index 7a22c43c..b238afd3 100644
--- a/harness/codeverse3d/texturing/generate.py
+++ b/harness/codeverse3d/texturing/generate.py
@@ -29,7 +29,7 @@ from codeverse3d.contracts.common import Usage
from codeverse3d.contracts.plan import AcceptanceItem, StaticPlan
from codeverse3d.contracts.spec import Spec
from codeverse3d.conventions import OBJECT_VIEWS_QUICK, ViewPreset
-from codeverse3d.judges.base import JudgeInput, plan_digest
+from codeverse3d.judges.base import JudgeInput, plan_summary
from codeverse3d.judges.rubrics import is_degraded
from codeverse3d.proc import fan_out, unique_tmp
@@ -342,7 +342,7 @@ def judge_gate(
rs_before = render(glb_before, out_dir / "before", views=list(views), width=size, height=size)
rs_after = render(glb_after, out_dir / "after", views=list(views), width=size, height=size)
acceptance: list[AcceptanceItem] = list(getattr(plan, "acceptance", []) or [])
- summary = plan_digest(plan.model_dump()) if plan is not None else ""
+ summary = plan_summary(plan, spec.language)
res = GateResult(shipped=False, renders_before=rs_before, renders_after=rs_after)
jb = judge.judge(JudgeInput(spec=spec, renders=rs_before, measurement=measurement, acceptance=acceptance,
plan_summary=summary, round_index=0,
diff --git a/harness/codeverse3d/tracks/articulated_object.py b/harness/codeverse3d/tracks/articulated_object.py
index 269bee7a..56c9fc19 100644
--- a/harness/codeverse3d/tracks/articulated_object.py
+++ b/harness/codeverse3d/tracks/articulated_object.py
@@ -90,14 +90,6 @@ class ArticulatedPipeline(ObjectPipeline):
rs.views = list(rs.views) + pose_views
return rs
- def plan_summary(self, ctx: RunContext) -> str:
- base = super().plan_summary(ctx)
- plan = ctx.plan
- if not isinstance(plan, ArticulatedPlan):
- return base
- joints = "; ".join(f"{j.name} ({j.type} {j.parent}→{j.child}, [{j.lower:.2f},{j.upper:.2f}])" for j in plan.joints)
- return f"{base} Root link {plan.root_link}. Joints: {joints}."
-
def judge_context(self, ws: Workspace, plan: Plan | None, round_index: int, build: BuildResult, gates: list[GateReport]) -> str:
report = next((g for g in gates if g.gate == SWEEP_GATE), None)
motion = next((g for g in gates if g.gate == MOTION_GATE), None)
diff --git a/harness/codeverse3d/tracks/graphics.py b/harness/codeverse3d/tracks/graphics.py
index b710a4ac..ffee83e4 100644
--- a/harness/codeverse3d/tracks/graphics.py
+++ b/harness/codeverse3d/tracks/graphics.py
@@ -413,15 +413,6 @@ class GraphicsPipeline:
def render(self, ctx: RunContext, round_index: int, build: BuildResult, measurement: Measurement | None) -> RenderSet:
return frames_render_set(ctx.ws, build, round_index)
- def plan_summary(self, ctx: RunContext) -> str:
- plan = ctx.plan
- if not isinstance(plan, GraphicsPlan):
- return ""
- passes = ", ".join(f"{p.name} ({p.kind})" for p in plan.passes)
- visuals = "; ".join(plan.key_visuals)
- return (f"{plan.title}: {plan.summary} Style: {plan.style}. Passes: {passes}. Key visuals: {visuals}. "
- f"Motion: {plan.motion or '(none planned)'}. {plan.resolution[0]}x{plan.resolution[1]}, loop {plan.duration_s:g}s.")
-
def judge_context(self, ws: Workspace, plan: Plan | None, round_index: int, build: BuildResult, gates: list[GateReport]) -> str:
renderer = build.census.get("renderer", "") if isinstance(build.census, dict) else ""
return f"FRAME METRICS (harness-measured, renderer {renderer or 'moderngl'}):\n{frame_stats_text(ws)}"
diff --git a/harness/codeverse3d/tracks/scene.py b/harness/codeverse3d/tracks/scene.py
index df47c626..05c95826 100644
--- a/harness/codeverse3d/tracks/scene.py
+++ b/harness/codeverse3d/tracks/scene.py
@@ -158,12 +158,6 @@ class ScenePipeline:
the per-view ``judge`` flags ``render_scene`` stamps on every set it returns."""
return judged_subset(renders) # type: ignore[return-value]
- def plan_summary(self, ctx: RunContext) -> str:
- plan: ScenePlan = ctx.plan # type: ignore[assignment]
- zones = ", ".join(z.name for z in plan.zones)
- assets = ", ".join(a.name for a in plan.assets)
- return f"{plan.title}: {plan.summary} Setting: {plan.setting}. Zones: {zones}. Assets: {assets}. Cameras: {', '.join(c.name for c in plan.cameras)}."
-
def judge_context(self, ws: Workspace, plan: Plan | None, round_index: int, build: BuildResult, gates: list[GateReport]) -> str:
if not isinstance(plan, ScenePlan):
return ""
diff --git a/harness/codeverse3d/tracks/static_object.py b/harness/codeverse3d/tracks/static_object.py
index bf13ef86..b30a47e0 100644
--- a/harness/codeverse3d/tracks/static_object.py
+++ b/harness/codeverse3d/tracks/static_object.py
@@ -27,7 +27,6 @@ from codeverse3d.conventions import (
BBOX_TOLERANCE_M,
OBJECT_CLAY_VIEWS,
OBJECT_VIEWS,
- to_authoring_frame,
)
from codeverse3d.orchestrator import RefineTask, TaskGroup, compact_instructions
from codeverse3d.prompts import render
@@ -129,19 +128,6 @@ class ObjectPipeline:
)
return None
- def plan_summary(self, ctx: RunContext) -> str:
- plan = ctx.plan
- if plan is None:
- return ""
- parts = ", ".join(
- f"{p.name}×{p.instances}" if p.instances > 1 else p.name for p in plan.parts
- )
- # reorder into the measurement table's frame (W×H×D, Y-up): the (x,|z|,y) swap is
- # self-inverse for extents, so Z-up plans (W,D,H) → (W,H,D), threejs is identity —
- # otherwise the judge compares the digest position-wise against swapped numbers.
- e = to_authoring_frame(plan.overall_bbox.extents, ctx.language, extents=True)
- return f"{plan.object_name}: {plan.summary} Overall {e[0]:.2f}×{e[1]:.2f}×{e[2]:.2f} m (W×H×D). Parts: {parts}."
-
def judge_context(
self,
ws: Workspace,
diff --git a/harness/codeverse3d/tracks/steps.py b/harness/codeverse3d/tracks/steps.py
index 5b496c9f..eeeab956 100644
--- a/harness/codeverse3d/tracks/steps.py
+++ b/harness/codeverse3d/tracks/steps.py
@@ -38,7 +38,7 @@ from codeverse3d.contracts.artifacts import (
from codeverse3d.contracts.common import Usage
from codeverse3d.contracts.plan import AcceptanceItem, Plan
from codeverse3d.contracts.run import RoundRecord
-from codeverse3d.judges.base import SLICE_TRACKS, JudgeInput
+from codeverse3d.judges.base import round_input
from codeverse3d.judges.rubrics import is_degraded
from codeverse3d.orchestrator import BudgetExceeded, usage_delta
from codeverse3d.proc import fan_out
@@ -59,7 +59,6 @@ class RoundPipeline(Protocol):
def measure(self, ctx: RunContext, build: BuildResult) -> Measurement | None: ...
def gates(self, ctx: RunContext, round_index: int, build: BuildResult, measurement: Measurement | None) -> list[GateReport]: ...
def render(self, ctx: RunContext, round_index: int, build: BuildResult, measurement: Measurement | None) -> RenderSet: ...
- def plan_summary(self, ctx: RunContext) -> str: ...
def judge_context(self, ws: Workspace, plan: Plan | None, round_index: int, build: BuildResult, gates: list[GateReport]) -> str:
"""Track-specific judge context. Deliberately ``RunContext``-free so
``3dcode judge`` can rebuild the in-run context from stored artifacts."""
@@ -465,14 +464,9 @@ def _judge(ctx: RunContext, pipeline: RoundPipeline, index: int, build: BuildRes
except Exception as e: # noqa: BLE001 — clay views are optional judge context
log.warning("geometry views failed in round %d: %s", index, e)
ctx.events.emit("judge.geometry_views_failed", round=index, error=f"{type(e).__name__}: {e}")
- inp = JudgeInput(
- spec=ctx.spec, renders=renders, measurement=rec.measurement, gates=gates,
- acceptance=list(getattr(ctx.plan, "acceptance", []) or []), plan_summary=pipeline.plan_summary(ctx),
- round_index=index, previous=previous, extra_context=pipeline.judge_context(ctx.ws, ctx.plan, index, build, gates),
- geometry_views=geometry,
- # D48: the round's canonical GLB feeds the conditional slice channel (object tracks only)
- glb_path=build.glb_path if ctx.spec.track.value in SLICE_TRACKS else None,
- )
+ inp = round_input(ctx.spec, ctx.plan, rec, renders=renders, gates=gates, previous=previous,
+ extra_context=pipeline.judge_context(ctx.ws, ctx.plan, index, build, gates),
+ geometry_views=geometry, glb_path=build.glb_path)
t0 = time.time()
try:
judgment: Judgment = ctx.judge.judge(inp)
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 5a4cf37c..79e6147f 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -157,8 +157,9 @@ codeverse3d/
billing.py (SUBSCRIPTION_BACKENDS/bills_usd — which backends take real dollars,
so the ledger bills real money and not list price; docs/COST.md §25)
guard.py routing.py reconstruct.py (old runs)
- judges/ base.py (JudgeInput/Judgment helpers + the pure round-replay pieces `3dcode judge` and
- calibration share), rubrics.py + rubrics/*.yaml (defect checklists, the wire
+ judges/ base.py (JudgeInput; `round_input` + `plan_summary(plan, language)`, the ONE payload
+ builder and plan digest the in-run judge, `3dcode judge`, calibration, the texture
+ gate and eval all use; the pure replay helpers), rubrics.py + rubrics/*.yaml (defect checklists, the wire
schema, caps and scoring), prompt_builder.py (image prep, montages, the
judge messages), vlm_judge.py (+ the reference/likeness judges),
pairwise.py. No Judge Protocol: a judge is
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
index d2ef7465..4e42f61a 100644
--- a/harness/docs/INTERFACES.md
+++ b/harness/docs/INTERFACES.md
@@ -361,6 +361,14 @@ VlmJudge.slice_payload(inp) -> (list[(label, png_path)], provenance_elicitation:
from codeverse3d.judges.base import JudgeInput # (spec, renders, measurement=None, gates=[], acceptance=[], plan_summary="",
# round_index=0, previous=None, extra_context="", geometry_views=None,
# glb_path=None (D48: the round's canonical GLB; object tracks + 3dcode judge fill it))
+from codeverse3d.judges.base import round_input, plan_summary
+round_input(spec, plan, rnd, *, renders, gates, previous, extra_context, geometry_views, glb_path) -> JudgeInput
+ # THE payload of one round: tracks/steps._judge builds it from the round in hand, cli/_judge.build_judge_input
+ # (`3dcode judge`, addons/calibration) from the stored one — acceptance + digest from the plan, glb_path only on
+ # SLICE_TRACKS. Δ 2026-09-22: replays used a dict digest of plan.json (a Z-up object read W×D×H, a shader lost
+ # style / passes / key visuals / motion); cli/_judge.stored_plan types plan.json when record.json has no plan
+plan_summary(plan, language) -> str # the digest for every track (object: "Overall W×H×D m" in the GLB frame);
+ # also the texture gate's (texturing/generate.judge_gate) and eval/bench/judge_calib_graphics.py's
from codeverse3d.judges.prompt_builder import plan_montages, render_montage, Montage # ≤5 2×2 montages (shaded/geometry/poses) + ≤2 detail
# crops @≤1024px replace the sheet + the 14-view rig (D47); clay/normals views (RenderView.mode) auto-route to the GEOMETRY montage
from codeverse3d.judges.prompt_builder import build_judge_messages, connectivity_error_pairs, PROVENANCE_ELICITATION
diff --git a/harness/tests/graphics/test_track.py b/harness/tests/graphics/test_track.py
index e70dd879..53e4b198 100644
--- a/harness/tests/graphics/test_track.py
+++ b/harness/tests/graphics/test_track.py
@@ -24,7 +24,6 @@ from codeverse3d.prompts import render
from codeverse3d.spatial.gl_render import GlFrame, GlResult, gif_times
from codeverse3d.tracks import get_track
from codeverse3d.tracks.graphics import (
- GraphicsPipeline,
GraphicsTrack,
ensure_graphics_acceptance,
graphics_prompt_context,
@@ -163,6 +162,24 @@ def test_graphics_track_end_to_end(tmp_path, settings):
assert {"dropsLayer", "bokehSoft"} <= set(seeded["names"]) and seeded["present"] == seeded["names"] # + the night-sky chapter
+def test_a_replayed_round_reads_the_payload_the_in_run_judge_read(tmp_path, settings):
+ """``3dcode judge`` / calibration (``cli/_judge.build_judge_input``) replayed a graphics round with
+ a digest of the plan's title and summary alone — no style, passes, key visuals or motion — while
+ the in-run judge read all of them. Both build the payload with ``judges.base.round_input`` now."""
+ from codeverse3d.cli._judge import build_judge_input
+ from codeverse3d.record.record import load_record
+
+ ws = Workspace(tmp_path / "runs" / "replay")
+ judge = FakeJudge(scores=(0.55, 0.72), targets=("RainDrops",))
+ track = GraphicsTrack(services=_services(), judge=judge, agent=FakeAgent(_writer),
+ planner_model=FakeChatModel(lambda req: plan_example()), settings=settings, runtime=FakeGlRuntime())
+ rec = track.run(make_spec(max_rounds=1), ws)
+ replay = build_judge_input(ws, load_record(ws), rec.rounds[-1])
+ for field in ("plan_summary", "extra_context", "acceptance", "round_index"):
+ assert getattr(replay, field) == getattr(judge.calls[-1], field), field
+ assert "Passes: CityBokeh (fullscreen)" in replay.plan_summary and "Motion: drops slide down" in replay.plan_summary
+
+
def test_static_frames_become_a_gate_warning_and_refine_task(tmp_path, settings):
spec = make_spec(max_rounds=1)
ws = Workspace(tmp_path / "runs" / "static")
@@ -250,5 +267,6 @@ def test_templates_render_and_rubric_loads(tmp_path, settings):
ctx, round_index=1, tasks=["[judge/effect] overall: more bokeh"], targets=["overall"], files=["src/program.py"],
judge_summary="Previous score 0.5", frame_notes="(no frame metrics)", current_files={"src/program.py": "# y"}))
assert "more bokeh" in ref and "--- src/program.py ---" in ref
- pipe = GraphicsPipeline()
- assert "CityBokeh" in pipe.plan_summary(ctx)
+ from codeverse3d.judges.base import plan_summary
+
+ assert "CityBokeh" in plan_summary(ctx.plan, ctx.language)
diff --git a/harness/tests/judges/test_calibration.py b/harness/tests/judges/test_calibration.py
index 92eb28ed..14a02966 100644
--- a/harness/tests/judges/test_calibration.py
+++ b/harness/tests/judges/test_calibration.py
@@ -6,7 +6,6 @@ import pytest
from codeverse3d.addons.calibration import calibrate, load_run_cases, pearson, spearman
from codeverse3d.contracts.artifacts import GateFinding, GateReport, Severity
from codeverse3d.contracts.run import RoundRecord
-from codeverse3d.judges.base import plan_digest
from codeverse3d.judges.rubrics import load_rubric
from tests.judges.conftest import (
ACCEPTANCE,
@@ -24,8 +23,10 @@ def _fake_run(root: Path, name: str) -> Path:
run = root / name
(run / "rounds").mkdir(parents=True)
(run / "spec.json").write_text(make_spec(id=name).model_dump_json())
- plan = {"object_name": "Chair", "summary": "a chair.", "overall_bbox": {"center": [0, 0, 0.4], "extents": [0.5, 0.5, 0.9]},
- "parts": [{"name": "Seat", "instances": 1}, {"name": "Leg", "instances": 4}],
+ box = {"center": [0, 0, 0.4], "extents": [0.5, 0.5, 0.9]}
+ plan = {"object_name": "Chair", "summary": "a chair.", "overall_bbox": box,
+ "parts": [{"name": "Seat", "role": "seat", "description": "board", "bbox": box},
+ {"name": "Leg", "role": "leg", "description": "turned", "bbox": box, "instances": 4}],
"acceptance": [a.model_dump() for a in ACCEPTANCE]}
(run / "plan.json").write_text(json.dumps(plan))
(run / "record.json").write_text(json.dumps({"best_round": 1}))
@@ -39,15 +40,15 @@ def _fake_run(root: Path, name: str) -> Path:
return run
-def test_plan_digest_and_load_cases(tmp_path):
+def test_load_cases_reads_the_plan_the_in_run_judge_read(tmp_path):
+ """No usable record.json: the plan comes from plan.json, typed, and its digest is the
+ in-run one — a Z-up object's size in the measurement frame (W×H×D)."""
run = _fake_run(tmp_path, "runA")
cases = load_run_cases(run)
assert [c.round_index for c in cases] == [0, 1] and cases[0].gate_errors == 1 and cases[1].gate_errors == 0
assert cases[0].rubric == "static_object_v1" and len(cases[0].inp.acceptance) == 2
assert cases[1].is_picked and not cases[0].is_picked and cases[0].glb is None # no usable record: the last round
- assert cases[0].inp.plan_summary == "Chair: a chair. Overall 0.50×0.50×0.90 m. Parts: Seat, Leg×4."
- assert plan_digest({"title": "Harbour", "summary": "s", "zones": [{"name": "quay"}], "cameras": [{"name": "cam_hero"}], "setting": "dusk"}) \
- == "Harbour: s Zones: quay. Cameras: cam_hero. Setting: dusk."
+ assert cases[0].inp.plan_summary == "Chair: a chair. Overall 0.50×0.90×0.50 m (W×H×D). Parts: Seat, Leg×4."
assert load_run_cases(run, rounds=[1])[0].round_index == 1
diff --git a/harness/tests/orchestrator_tracks/test_fix_batch2.py b/harness/tests/orchestrator_tracks/test_fix_batch2.py
index e9a3d84b..63172157 100644
--- a/harness/tests/orchestrator_tracks/test_fix_batch2.py
+++ b/harness/tests/orchestrator_tracks/test_fix_batch2.py
@@ -3,7 +3,6 @@
from __future__ import annotations
import json
-from types import SimpleNamespace
import pytest
@@ -16,7 +15,7 @@ from codeverse3d.proc import EventLog
from codeverse3d.prompts import load_text
from codeverse3d.tracks.planner import plan_example
from codeverse3d.tracks.scene import SceneTrack
-from codeverse3d.tracks.static_object import ObjectPipeline, StaticObjectTrack
+from codeverse3d.tracks.static_object import StaticObjectTrack
from codeverse3d.workspace import Workspace
from tests.orchestrator_tracks.conftest import fake_clock, make_spec
from tests.orchestrator_tracks.fakes import (
@@ -305,13 +304,15 @@ def test_scene_refine_emits_rebuild_task_when_build_failed(tmp_path, settings):
# --------------------------------------------------------------------- finding: plan digest frame order
def test_plan_digest_is_labelled_w_h_d_in_the_measurement_frame():
+ from codeverse3d.judges.base import plan_summary
+
plan = StaticPlan(object_name="Cabinet", summary="A cabinet.",
overall_bbox=BBox(center=(0, 0, 0.4), extents=(0.48, 0.52, 0.80)), # Z-up plan: W×D×H
parts=[PartPlan(name="Body", role="body", description="box",
bbox=BBox(center=(0, 0, 0.4), extents=(0.48, 0.52, 0.80)))])
- zup = ObjectPipeline().plan_summary(SimpleNamespace(plan=plan, language=Language.BLENDER))
+ zup = plan_summary(plan, Language.BLENDER)
assert "Overall 0.48×0.80×0.52 m (W×H×D)" in zup # H and D swapped into the GLB/measurement order
- yup = ObjectPipeline().plan_summary(SimpleNamespace(plan=plan, language=Language.THREEJS))
+ yup = plan_summary(plan, Language.THREEJS)
assert "Overall 0.48×0.52×0.80 m (W×H×D)" in yup # identity for Y-up plans
diff --git a/harness/tests/orchestrator_tracks/test_round_economics.py b/harness/tests/orchestrator_tracks/test_round_economics.py
index c9747952..71fa0b43 100644
--- a/harness/tests/orchestrator_tracks/test_round_economics.py
+++ b/harness/tests/orchestrator_tracks/test_round_economics.py
@@ -209,7 +209,6 @@ class _Pipeline:
def measure(self, ctx, build): return None
def gates(self, ctx, i, build, m): return []
def render(self, ctx, i, build, m): return _renders()
- def plan_summary(self, ctx): return "plan"
def judge_context(self, ws, plan, i, build, gates): return ""