Skip to content

Official Codebase of 3DCodeVerse

Python

select: a pick rewrites record.json only after a texture pass, as before — an old record keeps its best_round

gaoypeng9e86997ee175
diff --git a/harness/codeverse3d/addons/select.py b/harness/codeverse3d/addons/select.py
index 3a2edb82..63a515f0 100644
--- a/harness/codeverse3d/addons/select.py
+++ b/harness/codeverse3d/addons/select.py
@@ -219,9 +219,10 @@ def package(run_dir: Path | str, round_index: int, *, texture: bool = False, met
``texture=True`` runs the texture pass on that round's own GLB first, unless a pass
already started from those exact bytes (a paid pass is never bought twice); a pack
- ships into the deliverable only when its judge gate shipped it. The record is then
- re-packaged, so its total takes in what the pick paid for (a texture pass, a pairwise
- verdict): the run's money is its ledger's (``record.package_run``)."""
+ ships into the deliverable only when its judge gate shipped it, and the record is
+ re-packaged so its total takes the pass in (the run's money is its ledger's,
+ ``record.package_run``). Otherwise the record is not rewritten: a record from before
+ 2026-09-22 keeps the ``best_round`` its canonical build is found by."""
ws = Workspace(run_dir)
rec = load_record(ws)
rnd = next((r for r in rec.rounds if r.index == round_index), None)
@@ -230,8 +231,8 @@ def package(run_dir: Path | str, round_index: int, *, texture: bool = False, met
if texture:
_texture(ws, rec, round_index, image_model=image_model)
rec = load_record(ws) # the pass wrote extra["texturing"]
- package_run(ws, rec)
- ws.write_json(ws.record_path, rec)
+ package_run(ws, rec)
+ ws.write_json(ws.record_path, rec)
manifest = build_deliverable(ws, rec, round_index)
sel = Selection(round=round_index, method=method, scores={r.index: r.score for r in round_rows(ws.root, record=rec)},
textured=any(f.path == "deliverable/object_textured.glb" for f in manifest.files))
diff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.py
index 4a9e61e2..03f9c827 100644
--- a/harness/tests/flywheel_cli/test_run_layout_cli.py
+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py
@@ -7,7 +7,6 @@ import json
import shutil
from pathlib import Path
-import pytest
from typer.testing import CliRunner
from codeverse3d.addons import select
@@ -97,9 +96,9 @@ def test_package_run_builds_a_stable_independent_and_loadable_handover(fake_run)
assert first.generated_at == second.generated_at # unchanged content → no diff
assert [(f.path, f.sha256) for f in first.files] == [(f.path, f.sha256) for f in second.files]
- # A pick re-packages the record: its telemetry and its total (the ledger's) are on disk.
+ # Package metadata can be recovered from files even before the caller saves rec.
bare = load_record(ws)
- assert bare.telemetry is not None and bare.total_usage.cost_usd == pytest.approx(0.06)
+ assert bare.telemetry is None
assert load_telemetry(ws, bare) is not None and load_deliverable(ws) is not None
# Delivered assets are copies: editing a hand-over cannot mutate evidence.