Official Codebase of 3DCodeVerse
Python
readers: an unjudged run shows one round everywhere — select.fallback_round, the latest round that built with renders
gaoypeng9cb22308e486
diff --git a/eval/bench/ab_gate_rates.py b/eval/bench/ab_gate_rates.pyindex 613d5c65..fbc4433d 100644--- a/eval/bench/ab_gate_rates.py+++ b/eval/bench/ab_gate_rates.py@@ -27,7 +27,7 @@ def cell_stats(record: Path, rec: dict) -> dict | None:if not rounds:return Nonesummary = select.summarise(record.parent)- rnd = next((r for r in rounds if r.get("index") == summary.picked_round), rounds[-1])+ rnd = next((r for r in rounds if r.get("index") == summary.round), rounds[-1])pairs = floats = islands = contract_n = 0worst = 0.0for g in rnd.get("gates") or []:diff --git a/eval/bench/complexity_report.py b/eval/bench/complexity_report.pyindex 79ea4f9f..43a65a2f 100644--- a/eval/bench/complexity_report.py+++ b/eval/bench/complexity_report.py@@ -99,11 +99,11 @@ def _vector_for(run: Path, rnd: dict[str, Any] | None) -> ComplexityVector | Nondef _picked_round(run: Path, record: dict[str, Any], rec: RunRecord | None) -> dict[str, Any] | None:- """The round ``addons/select`` picks, as its raw dict; the last round when the record- will not load (the scan reads the historic corpus as-is)."""+ """The round every reader shows (``select.summarise().round``), as its raw dict; the last+ round when the record will not load (the scan reads the historic corpus as-is)."""rounds = record.get("rounds") or []try:- idx = select.summarise(run, record=rec).picked_round if rec is not None else None+ idx = select.summarise(run, record=rec).round if rec is not None else Noneexcept Exception: # noqa: BLE001 - one unreadable record must not stop the scanidx = Nonereturn next((r for r in rounds if r.get("index") == idx), rounds[-1] if rounds else None)diff --git a/eval/bench/judge_calib_graphics.py b/eval/bench/judge_calib_graphics.pyindex ed23e8e0..a02c4083 100644--- a/eval/bench/judge_calib_graphics.py+++ b/eval/bench/judge_calib_graphics.py@@ -45,12 +45,12 @@ def judge_one(run: Path, rubric: str, model: str, n: int) -> dict[str, Any]:ws = Workspace(run)try:rec = load_record(ws)- idx = select.pick(run, record=rec)+ idx = select.summarise(run, record=rec).round # the pick, else select.fallback_roundexcept RecordError:return {"run": str(run), "error": "no judged round"}rnd = load_round(ws, rec, idx) if idx is not None else Noneif rnd is None:- return {"run": str(run), "error": "no judged round"}+ return {"run": str(run), "error": "no round built with renders"}v = VlmJudge(rubric=rubric, model_id=model, n_samples=n).judge(build_judge_input(ws, rec, rnd))raw = v.raw if isinstance(v.raw, dict) else json.loads(v.raw or "{}")return {diff --git a/harness/codeverse3d/addons/calibration.py b/harness/codeverse3d/addons/calibration.pyindex 5ab08cfa..50ed538b 100644--- a/harness/codeverse3d/addons/calibration.py+++ b/harness/codeverse3d/addons/calibration.py@@ -160,15 +160,15 @@ def load_run_cases(run_dir: Path, *, rounds: list[int] | None = None) -> list[Ro"""Rebuild judge inputs for every judgeable round of a run (rounds with renders)."""run_dir = Path(run_dir)ws = Workspace(run_dir)+ saved = [RoundRecord.model_validate_json(p.read_text()) for p in sorted((run_dir / "rounds").glob("r*.json"))]try:run = load_record(ws)- picked = select.summarise(run_dir, record=run).picked_round- except RecordError: # an interrupted run: rounds/ + spec.json+ picked = select.summarise(run_dir, record=run).round+ except RecordError: # an interrupted run: rounds/ + spec.json, and the same fallback rule over themrun = RunRecord(spec=Spec.model_validate_json(ws.spec_path.read_text()), workspace=str(run_dir))- picked = None+ picked = select.fallback_round(saved)cases: list[RoundCase] = []- for path in sorted((run_dir / "rounds").glob("r*.json")):- rec = RoundRecord.model_validate_json(path.read_text())+ for rec in saved:if rounds is not None and rec.index not in rounds:continueif rec.renders is None or not rec.renders.views:@@ -182,8 +182,6 @@ def load_run_cases(run_dir: Path, *, rounds: list[int] | None = None) -> list[Rostored=rec.judgment, is_picked=picked == rec.index,glb=str(glb) if (glb := select.round_file(ws, rec)) is not None else None,))- if picked is None and cases: # no record / nothing judged: the last round that kept its own GLB stands in- next((c for c in reversed(cases) if c.glb), cases[-1]).is_picked = Truereturn casesdiff --git a/harness/codeverse3d/addons/dataset/index.py b/harness/codeverse3d/addons/dataset/index.pyindex 3d543cdb..ec81323f 100644--- a/harness/codeverse3d/addons/dataset/index.py+++ b/harness/codeverse3d/addons/dataset/index.py@@ -2,7 +2,8 @@``build_index(runs_dir, out_sqlite)`` rebuilds the database from scratch;query helpers return plain dicts so a dashboard / notebook needs no ORM. A run's-row describes the round ``addons/select`` picks (``picked_round``); a run has no+row describes the round every reader shows (``picked_round`` = ``select.summarise().round``:+the pick, else ``select.fallback_round``; a NULL ``picked_score`` marks it unjudged); a run has nopass/fail — the ``rounds`` table carries the judge's own verdict per round."""@@ -48,14 +49,14 @@ CREATE INDEX idx_rounds_slug ON rounds(slug);def _run_row(ws: Workspace, rec: RunRecord, rid: RunId) -> tuple:s = select.summarise(ws.root, record=rec)- picked = next((r for r in rec.rounds if r.index == s.picked_round), None)+ picked = next((r for r in rec.rounds if r.index == s.round), None)j = effective_judgment(picked) if picked is not None else None # degraded → unjudgedn_err = sum(gate_error_summary(picked).values())tier = quality_tier(passed=j.passed if j else None, gate_errors=n_err, score=j.overall if j else None)return (rid.slug, str(ws.root), rec.spec.track.value, rec.spec.language.value, rec.spec.prompt,prompt_id(rec.spec.prompt), rec.spec.backends.generator, rec.spec.backends.planner,- rec.spec.backends.judge, s.stop_reason, s.baseline_score, s.picked_score, s.picked_round,+ rec.spec.backends.judge, s.stop_reason, s.baseline_score, s.picked_score, s.round,len(rec.rounds), rec.total_usage.cost_usd, rec.total_usage.input_tokens,rec.total_usage.output_tokens, rec.started_at.isoformat(),rec.finished_at.isoformat() if rec.finished_at else None, rec.minutes, rec.error,diff --git a/harness/codeverse3d/addons/dataset/sample.py b/harness/codeverse3d/addons/dataset/sample.pyindex cf52c614..e1a859d4 100644--- a/harness/codeverse3d/addons/dataset/sample.py+++ b/harness/codeverse3d/addons/dataset/sample.py@@ -136,14 +136,11 @@ def sample_rel_dir(record: RunRecord, key: str) -> Path:def exported_round(ws: Workspace, record: RunRecord) -> RoundRecord | None:- """The round a sample is made of: the one ``addons/select`` picks, else — a run with no- judged round — its last round that built (a score-less, tier-D sample), else its last."""- picked = select.summarise(ws.root, record=record).picked_round- rnd = next((r for r in record.rounds if r.index == picked), None)- if rnd is None:- built = [r for r in record.rounds if r.build is not None and r.build.ok]- rnd = (built or record.rounds or [None])[-1]- return rnd+ """The round a sample is made of: the one every reader shows (``select.summarise().round``:+ the pick, else — nothing judged — ``select.fallback_round``, a score-less tier-D sample),+ else — no round built with renders — the last round (``export --include-unbuilt``'s code)."""+ shown = select.summarise(ws.root, record=record).round+ return next((r for r in record.rounds if r.index == shown), record.rounds[-1] if record.rounds else None)def code_files_for_round(ws: Workspace, rnd: RoundRecord | None) -> tuple[dict[str, bytes], str]:diff --git a/harness/codeverse3d/addons/gallery/index.py b/harness/codeverse3d/addons/gallery/index.pyindex 3ae07432..82e1a62f 100644--- a/harness/codeverse3d/addons/gallery/index.py+++ b/harness/codeverse3d/addons/gallery/index.py@@ -83,17 +83,10 @@ def _round_sheet(ws: Workspace, rec: RunRecord, index: int) -> str:def picked_sheet(ws: Workspace, rec: RunRecord, picked: int | None) -> str:- """Contact sheet of the picked round, else the latest round that has one, else the- packaged deliverable sheet."""- if picked is not None:- rel = _round_sheet(ws, rec, picked)- if rel:- return rel- for rnd in reversed(rec.rounds):- rel = _round_sheet(ws, rec, rnd.index)- if rel:- return rel- return _first_file(ws.root, "deliverable/sheet.png", "artifacts/frames_sheet.png")+ """Contact sheet of the card's round (``select.summarise().round``), else the packaged+ deliverable sheet — never another round's."""+ return (_round_sheet(ws, rec, picked) if picked is not None else "") or _first_file(+ ws.root, "deliverable/sheet.png", "artifacts/frames_sheet.png")#: view names that make the best single thumbnail, most telling first. A ¾ view@@ -122,13 +115,9 @@ def hero_view(ws: Workspace, rec: RunRecord, picked: int | None) -> tuple[str, sdef _articulation_sheet(ws: Workspace, picked: int | None) -> str:- order = [picked] if picked is not None else []- order += ws.rendered_rounds()[::-1]- for idx in order:- rel = f"artifacts/renders/r{idx:02d}/poses/articulation_sheet.png"- if (ws.root / rel).is_file():- return rel- return ""+ """The card's round's pose sheet — never another round's."""+ rel = f"artifacts/renders/r{picked:02d}/poses/articulation_sheet.png" if picked is not None else ""+ return rel if rel and (ws.root / rel).is_file() else ""def entry_links(ws: Workspace, rec: RunRecord | None, picked: int | None) -> list[RunLink]:@@ -136,7 +125,7 @@ def entry_links(ws: Workspace, rec: RunRecord | None, picked: int | None) -> lisartifact files of the handed-over round (``deliverable/``), else of the picked round(``select.round_file``: ``artifacts/rNN/``, or ``artifacts/`` of a run recorded before roundskept their own, for the round it rebuilt there) — never another round's. A run with no- picked round (no record yet, none judged) links whatever ``artifacts/`` holds."""+ round to show (no record yet, no round built with renders) links whatever ``artifacts/`` holds."""run = ws.rootrnd = next((r for r in rec.rounds if r.index == picked), None) if rec is not None else Noneout = round_outputs(ws, rnd)@@ -227,9 +216,10 @@ def entry_from_record(battery: str, ws: Workspace, rec: RunRecord, *, slug: str``slug`` is the RunId slug the scan minted; without one the directory basename isused (correct for flat layouts only — nested battery runs are all named ``run``).- The card is the round ``addons/select`` picks: its score, sheet, hero and tier."""+ The card is the round every reader shows (``select.summarise().round``: the pick, else+ ``select.fallback_round``): its score, sheet, hero and tier."""summary = select.summarise(ws.root, record=rec)- picked = summary.picked_round+ picked = summary.roundrnd = next((r for r in rec.rounds if r.index == picked), None)j = effective_judgment(rnd) if rnd is not None else Nonegates = gate_error_summary(rnd)diff --git a/harness/codeverse3d/addons/gallery/model.py b/harness/codeverse3d/addons/gallery/model.pyindex 94d7f836..c5809f96 100644--- a/harness/codeverse3d/addons/gallery/model.py+++ b/harness/codeverse3d/addons/gallery/model.py@@ -145,7 +145,8 @@ class RunEntry(BaseModel):cost_usd: float = 0.0minutes: float | None = Nonerounds: int = 0- picked_round: int | None = Field(default=None, description="the round addons/select hands over")+ picked_round: int | None = Field(default=None, description="the round every reader shows: "+ "select.summarise().round (the pick, else select.fallback_round)")complexity: float | None = Field(default=None, description="objective complexity index of the delivered artifact (spatial/complexity.py)")diff --git a/harness/codeverse3d/addons/select.py b/harness/codeverse3d/addons/select.pyindex ea558606..01b2e08b 100644--- a/harness/codeverse3d/addons/select.py+++ b/harness/codeverse3d/addons/select.py@@ -14,7 +14,10 @@ other reader asks (gallery, dataset, cost report, calibration, the CLI, eval/ben``artifacts/judge/``);* :func:`summarise` baseline score, the picked round and its score, the delta, rounds runand the stop reason — the round ``selection.json`` names when the run- was packaged, else :func:`pick`'s;+ was packaged, else :func:`pick`'s — and ``round``, the one a reader+ SHOWS: the picked round, else :func:`fallback_round`;+* :func:`fallback_round` the round every reader shows when nothing was judged: the latest+ round that built and has renders;* :func:`round_file` a round's OWN build output (its GLB, GIF), never the last build's —and :func:`round_complexity_block` its complexity vector;* :func:`package` ``deliverable/`` for one round, the texture pass on it when asked@@ -29,6 +32,7 @@ from __future__ import annotationsimport hashlibimport logging+from collections.abc import Iterablefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any, Literal@@ -88,6 +92,8 @@ class RunSummary(BaseModel):baseline_score: float | None = Field(default=None, description="round 0's effective score")picked_round: int | None = Nonepicked_score: float | None = None+ round: int | None = Field(default=None, description="the round a reader shows: picked_round, else "+ "fallback_round (None = no round built with renders)")delta: float | None = Field(default=None, description="picked − baseline, when both were judged")method: Method = "score"@@ -218,6 +224,14 @@ def pairwise_verdict(ws: Workspace, rec: RunRecord, a: int, b: int, *, model: streturn note+def fallback_round(rounds: Iterable[RoundRecord]) -> int | None:+ """The round a reader shows when nothing was judged (no pick, no ``selection.json``): the+ latest round that built and has renders, else None. The ONE rule for the gallery card,+ the dataset sample and index row, ``3dcode judge``'s default and calibration's stand-in."""+ return max((r.index for r in rounds+ if r.build is not None and r.build.ok and r.renders is not None and r.renders.views), default=None)++# --------------------------------------------------------------------------- summarisedef load_selection(ws: Workspace) -> Selection | None:data = read_json_or_none(ws.root / SELECTION_NAME)@@ -229,7 +243,8 @@ def load_selection(ws: Workspace) -> Selection | None:def summarise(run_dir: Path | str, *, record: RunRecord | None = None) -> RunSummary:"""The run in one line. The picked round is the one ``selection.json`` names (what was- packaged), else what :func:`pick` chooses by score."""+ packaged), else what :func:`pick` chooses by score; ``round`` is that, else+ :func:`fallback_round`."""rec = _load(run_dir, record)rows = round_rows(run_dir, record=rec)by_index = {r.index: r for r in rows}@@ -242,6 +257,7 @@ def summarise(run_dir: Path | str, *, record: RunRecord | None = None) -> RunSumscore = by_index[picked].score if picked is not None else Nonereturn RunSummary(rounds=len(rows), stop_reason=stop_reason(rec),baseline_score=baseline, picked_round=picked, picked_score=score, method=method,+ round=picked if picked is not None else fallback_round(rec.rounds),delta=round(score - baseline, 6) if score is not None and baseline is not None else None)diff --git a/harness/codeverse3d/cli/_common.py b/harness/codeverse3d/cli/_common.pyindex 7a6294bb..ba49c4d0 100644--- a/harness/codeverse3d/cli/_common.py+++ b/harness/codeverse3d/cli/_common.py@@ -81,7 +81,8 @@ def print_record_summary(record: RunRecord, ws_root: Path | None = None) -> Nonef"track={spec.track.value} language={spec.language.value} generator={spec.backends.generator} "f"judge={spec.backends.judge}",f"stop=[{status_col}]{s.stop_reason}[/{status_col}] baseline={fmt_score(s.baseline_score)} "- f"picked={fmt_score(s.picked_score)} (round {s.picked_round}, by {s.method}) rounds={s.rounds} "+ f"picked={fmt_score(s.picked_score)} (round {s.round}, "+ f"{f'by {s.method}' if s.picked_round is not None else 'nothing judged: the latest built round with renders'}) rounds={s.rounds} "f"cost={fmt_usd(record.total_usage.cost_usd)}",]if record.error:@@ -89,7 +90,7 @@ def print_record_summary(record: RunRecord, ws_root: Path | None = None) -> Noneif ws_root is not None:ws = Workspace(ws_root)lines.append(f"workspace: {ws_root}")- picked = next((r for r in record.rounds if r.index == s.picked_round), None)+ picked = next((r for r in record.rounds if r.index == s.round), None)if picked is not None and picked.renders is not None and picked.renders.contact_sheet:# rebase, never print the stored string: record.json holds the ABSOLUTE path# of the host that produced the run, so a moved/archived run printed a sheet@@ -99,7 +100,7 @@ def print_record_summary(record: RunRecord, ws_root: Path | None = None) -> Nonelines.append(f"deliverable: {ws.deliverable}")console.print(Panel("\n".join(lines), title="run", expand=False))if record.rounds:- console.print(rounds_table(select.round_rows(root, record=record), s.picked_round))+ console.print(rounds_table(select.round_rows(root, record=record), s.round))def kv_table(title: str, rows: dict[str, Any]) -> Table:diff --git a/harness/codeverse3d/cli/inspect_cmd.py b/harness/codeverse3d/cli/inspect_cmd.pyindex 6fa94f32..fa172244 100644--- a/harness/codeverse3d/cli/inspect_cmd.py+++ b/harness/codeverse3d/cli/inspect_cmd.py@@ -116,9 +116,10 @@ def judge(rec = load_record(ws)except RecordError as e:raise C.CliError(str(e), code=2) from e- # the round `pick` packaged (selection.json), else the best-scored one- picked = select.summarise(ws.root, record=rec).picked_round if round_index is None else None- idx = round_index if round_index is not None else (picked if picked is not None else max(ws.rendered_rounds(), default=0))+ # the round `pick` packaged (selection.json), else the best-scored one, else select.fallback_round+ idx = round_index if round_index is not None else select.summarise(ws.root, record=rec).round+ if idx is None:+ raise C.CliError(f"no round of {ws.root.name} built with renders: nothing to judge (--round N names one)")rnd = J.load_round(ws, rec, idx)if rnd is None or rnd.renders is None or not rnd.renders.views:raise C.CliError(f"round {idx} has no renders (rounds/r{idx:02d}.json / record.json)")diff --git a/harness/codeverse3d/cli/layout_cmd.py b/harness/codeverse3d/cli/layout_cmd.pyindex 6e2a1bf3..e9de50bb 100644--- a/harness/codeverse3d/cli/layout_cmd.py+++ b/harness/codeverse3d/cli/layout_cmd.py@@ -172,7 +172,7 @@ def print_evidence(ws: Workspace, record: RunRecord) -> None:_section("QUALITY EVIDENCE — why we believe it")s = select.summarise(ws.root, record=record)- rnd = next((r for r in record.rounds if r.index == s.picked_round), None)+ rnd = next((r for r in record.rounds if r.index == s.round), None) # the pick, else select.fallback_roundj = effective_judgment(rnd) if rnd is not None else Nonegates = gate_error_summary(rnd)rows: dict[str, Any] = {diff --git a/harness/codeverse3d/texturing/run.py b/harness/codeverse3d/texturing/run.pyindex 6d774559..9a62bf1b 100644--- a/harness/codeverse3d/texturing/run.py+++ b/harness/codeverse3d/texturing/run.py@@ -82,12 +82,6 @@ class TextureReport(BaseModel):}-def latest_sheet(ws: Workspace) -> Path | None:- """The most recent round's contact sheet (``artifacts/renders/rNN/sheet.png``)."""- sheets = (ws.renders_dir(i) / "sheet.png" for i in reversed(ws.rendered_rounds()))- return next((p for p in sheets if p.is_file()), None)--def _render_quick(glb: Path, out_dir: Path, views: Sequence[ViewPreset], render: Any | None) -> RenderSet:if render is None:from codeverse3d.spatial.render import render_glb@@ -170,7 +164,7 @@ def texture_pass(textured and no seam failed); ``judge_obj`` replaces the constructed``VlmJudge`` (tests; ``image_model`` / ``plan_model`` / ``render`` / ``cache_dir`` arethe other injection points). ``sheet`` is the contact sheet the material- planner looks at — the round being textured; the latest round's otherwise.+ planner looks at — the round being textured; a quick render of ``glb_in`` otherwise.``normalise=True`` first runs the deterministic material normaliser(:func:`codeverse3d.texturing.apply.normalise_materials`) over the input GLB,@@ -188,8 +182,9 @@ def texture_pass(notes: list[str] = []events.emit("texture.start", model=model_id, glb=glb_in.name)- # 1. renders for the planner (the round's own sheet, else the latest; else a quick render)- sheet = sheet if sheet is not None and Path(sheet).is_file() else latest_sheet(ws)+ # 1. renders for the planner: the round's own sheet, else a quick render of glb_in — never+ # another round's sheet (the planner would name materials for parts this GLB may not have)+ sheet = sheet if sheet is not None and Path(sheet).is_file() else Noneif sheet is None:rs = _render_quick(glb_in, tex_dir / "planner_views", views, render)sheet = Path(rs.contact_sheet) if rs.contact_sheet else (Path(rs.views[0].path) if rs.views else None)diff --git a/harness/tests/flywheel_cli/test_select.py b/harness/tests/flywheel_cli/test_select.pyindex 7ebc7daa..d7a931de 100644--- a/harness/tests/flywheel_cli/test_select.py+++ b/harness/tests/flywheel_cli/test_select.py@@ -88,6 +88,41 @@ def test_summarise_is_baseline_pick_delta_rounds_and_the_stop_reason(tmp_path):assert (none.picked_round, none.picked_score, none.baseline_score, none.delta) == (None, None, None, None)+def test_an_unjudged_run_shows_one_fallback_round_in_every_reader(tmp_path, monkeypatch):+ """N55b: nothing judged → every reader shows ``select.fallback_round``, the latest round that+ built AND has renders — here r0 (r1 failed to build but kept renders, r2 built with no+ renders). Before, five readers gave four answers (2, None, r02's sheet, 1, 2)."""+ from codeverse3d.addons.calibration import load_run_cases+ from codeverse3d.addons.dataset import index as dsi+ from codeverse3d.addons.dataset.sample import exported_round+ from codeverse3d.addons.gallery.index import entry_from_record+ from codeverse3d.cli import _judge as J+ from codeverse3d.contracts.run import RunId+ from codeverse3d.record.record import load_record++ ws = _run(tmp_path / "u", [(None, 2), (None, 0), (None, 0)])+ rec = load_record(ws)+ rec.rounds[1].build = BuildResult(ok=False, language="blender")+ rec.rounds[2].renders = None+ ws.write_json(ws.record_path, rec)+ (ws.root / "rounds").mkdir()+ for r in rec.rounds:+ ws.write_json(ws.root / "rounds" / f"r{r.index:02d}.json", r)++ s = select.summarise(ws.root, record=rec)+ assert (s.picked_round, s.round) == (None, 0)+ assert exported_round(ws, rec).index == 0+ row = dsi._run_row(ws, rec, RunId(battery="b", rel="u"))+ assert (row[12], row[-6], row[-4]) == (0, 2, rec.rounds[0].commit) # picked_round, n_err, commit+ card = entry_from_record("b", ws, rec)+ assert (card.picked_round, card.gate_errors, card.sheet) == (0, 2, "artifacts/renders/r00/sheet.png")+ assert [c.round_index for c in load_run_cases(ws.root) if c.is_picked] == [0]+ asked: list[int] = []+ monkeypatch.setattr(J, "load_round", lambda ws, rec, idx: asked.append(idx))+ runner.invoke(app, ["judge", str(ws.root)])+ 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")diff --git a/harness/tests/judges/test_calibration.py b/harness/tests/judges/test_calibration.pyindex c1370238..5a22033e 100644--- a/harness/tests/judges/test_calibration.py+++ b/harness/tests/judges/test_calibration.py@@ -4,7 +4,7 @@ from pathlib import Pathimport pytestfrom codeverse3d.addons.calibration import calibrate, load_run_cases-from codeverse3d.contracts.artifacts import GateFinding, GateReport, Severity+from codeverse3d.contracts.artifacts import BuildResult, GateFinding, GateReport, Severityfrom codeverse3d.contracts.run import RoundRecordfrom codeverse3d.judges.rubrics import load_rubricfrom tests.judges.conftest import (@@ -35,16 +35,17 @@ def _fake_run(root: Path, name: str) -> Path:GateFinding(gate="connectivity", severity=Severity.WARN, message="sliver")])for i, gates in enumerate(([bad], [GateReport(gate="connectivity", passed=True)])):rec = RoundRecord(index=i, kind="baseline" if i == 0 else "refine", gates=gates, measurement=make_measurement(),+ build=BuildResult(ok=True, language="blender"),renders=make_renders(run / "artifacts" / "renders" / f"r{i:02d}", sheet=False))(run / "rounds" / f"r{i:02d}.json").write_text(rec.model_dump_json())return run-def test_load_cases_reads_the_plan_and_picks_the_last_round_that_kept_a_glb(tmp_path, caplog):+def test_load_cases_reads_the_plan_and_picks_the_fallback_round(tmp_path, caplog):"""No usable record.json: the plan comes from plan.json, typed, and its digest is thein-run one — a Z-up object's size in the measurement frame (W×H×D). No picked round: the- geometry montage used the last round even when IT kept no GLB (and the render was skipped in- silence) while an earlier round kept one."""+ stand-in is ``select.fallback_round`` (the latest built round with renders), as in every other+ reader — even when an earlier round kept a GLB and it did not; its skipped geometry montage says so."""from codeverse3d.addons.calibration import render_geometry_viewsrun = _fake_run(tmp_path, "runA")@@ -58,7 +59,7 @@ def test_load_cases_reads_the_plan_and_picks_the_last_round_that_kept_a_glb(tmp_(run / "artifacts" / "r00").mkdir(parents=True)(run / "artifacts" / "r00" / "object.glb").write_bytes(b"glTF")cases = load_run_cases(run)- assert cases[0].is_picked and not cases[1].is_picked and cases[0].glb.endswith("r00/object.glb")+ assert cases[1].is_picked and not cases[0].is_picked and cases[0].glb.endswith("r00/object.glb")assert render_geometry_views(cases[1], tmp_path / "out", "clay") is Noneassert "kept no GLB" in caplog.textdiff --git a/harness/tests/texturing/test_run.py b/harness/tests/texturing/test_run.pyindex 994b182f..a29c3c7d 100644--- a/harness/tests/texturing/test_run.py+++ b/harness/tests/texturing/test_run.py@@ -11,7 +11,6 @@ from typer.testing import CliRunnerfrom codeverse3d.contracts.run import RunRecordfrom codeverse3d.texturing.run import (TextureReport,- latest_sheet,load_report,texture_pass,)@@ -31,6 +30,9 @@ def _ws(tmp_path: Path, chair_glb: Path, chair_spec, chair_plan) -> Workspace:def test_texture_pass_ships_records_and_shows(tmp_path, chair_glb, chair_spec, chair_plan):ws = _ws(tmp_path, chair_glb, chair_spec, chair_plan)+ other = ws.renders_dir(0) / "sheet.png" # another round's sheet: never the planner's picture of THIS glb+ other.parent.mkdir(parents=True)+ other.write_bytes(b"not this glb")judge = FakeJudge([(0.70, {"materials": 0.6, "intent_fidelity": 0.8}), (0.73, {"materials": 0.75, "intent_fidelity": 0.8})])img = FakeImageModel(usd_per_image=0.05)rep = texture_pass(ws, chair_spec, chair_plan, model_id="", image_model=img, judge_obj=judge, render=fake_render,@@ -49,8 +51,8 @@ def test_texture_pass_ships_records_and_shows(tmp_path, chair_glb, chair_spec, cassert events[0] == "texture.start" and "texture.gate" in events and events[-1] == "texture.done"# report reloadsassert load_report(ws).shipped- # planner quick render was written because there was no sheet- assert latest_sheet(ws) is None and (ws.artifacts / "textures" / "planner_views" / "sheet.png").is_file()+ # planner quick render was written because the round passed no sheet of its own+ assert (ws.artifacts / "textures" / "planner_views" / "sheet.png").is_file()# `3dcode texture show` reads it backfrom codeverse3d.cli.main import app