Official Codebase of 3DCodeVerse
Python
cost: STAGE_ORDER is defined once as the Stage enum's order — the cost report restated it as a literal and telemetry derived it a second way
gaoypeng1c13192cba6e
diff --git a/harness/codeverse3d/addons/costreport/report.py b/harness/codeverse3d/addons/costreport/report.pyindex 4b988901..62111403 100644--- a/harness/codeverse3d/addons/costreport/report.py+++ b/harness/codeverse3d/addons/costreport/report.py@@ -18,10 +18,7 @@ from codeverse3d.addons.costreport.audit import (stage_latency,uncached_if_no_cache,)-from codeverse3d.cost.types import CostBucket--STAGE_ORDER = ("plan", "skeleton", "assets", "env", "zones", "assemble", "baseline", "candidate",- "repair", "refine", "gates", "render", "judge", "pairwise", "texture", "caption", "other")+from codeverse3d.cost.types import STAGE_ORDER, CostBucketdef _usd(x: float) -> str:diff --git a/harness/codeverse3d/cost/types.py b/harness/codeverse3d/cost/types.pyindex 5bfe9b69..9aafa3a0 100644--- a/harness/codeverse3d/cost/types.py+++ b/harness/codeverse3d/cost/types.py@@ -22,7 +22,7 @@ class Stage(StrEnum):PLAN = "plan"#: SKELETON / GATES / RENDER are *deterministic harness work* (no model call at#: all); kept in the enum so latency can be attributed to them from events- #: (``report.STAGE_ORDER``, ``audit.stage_latency``). ASSEMBLE is deterministic too+ #: (:data:`STAGE_ORDER`, ``audit.stage_latency``). ASSEMBLE is deterministic too#: since the scene track's ``compose`` agent session was removed (2026-09-22); older#: ledgers still carry it.SKELETON = "skeleton"@@ -43,6 +43,10 @@ class Stage(StrEnum):OTHER = "other"+#: the order stages are shown in (the cost report, the telemetry summary): the enum's own+STAGE_ORDER: tuple[str, ...] = tuple(s.value for s in Stage)++class Role(StrEnum):"""Which job the model was doing (``Backends`` roles + the image model)."""diff --git a/harness/codeverse3d/record/telemetry.py b/harness/codeverse3d/record/telemetry.pyindex 1e15168b..296c7c75 100644--- a/harness/codeverse3d/record/telemetry.py+++ b/harness/codeverse3d/record/telemetry.py@@ -33,7 +33,7 @@ from codeverse3d.contracts.run import (StageCost,)from codeverse3d.cost.ledger import load_ledger, summarise-from codeverse3d.cost.types import CallCost, Stage+from codeverse3d.cost.types import STAGE_ORDER, CallCostfrom codeverse3d.proc import read_json_or_none, write_json_atomicfrom codeverse3d.workspace import Workspace@@ -145,10 +145,6 @@ _TOOL_KEYS = frozenset({"python", "platform", "host", "blender", "blender_path",# --------------------------------------------------------------------------- the ledger (codeverse3d.cost)-def stage_order() -> tuple[str, ...]:- return tuple(s.value for s in Stage)--def ledger_rows(ws: Workspace) -> list[CallCost]:"""The run's priced per-call rows, ``telemetry/cost.jsonl`` (none when it has no ledger)."""try:@@ -163,7 +159,7 @@ def cost_summary(record: RunRecord, rows: list[CallCost]) -> CostSummary:ledger's own ``summarise`` — money by stage is computed there and nowhere else), per round,and the run's minutes against ``max_minutes``."""summ = summarise(rows, dimensions=("stage", "role", "model"))- rank = {s: i for i, s in enumerate(stage_order())}+ rank = {s: i for i, s in enumerate(STAGE_ORDER)}by_stage = [StageCost(stage=b.key, calls=b.n_calls, input_tokens=b.input_tokens, output_tokens=b.output_tokens,cached_tokens=b.cached_tokens, thoughts_tokens=b.thoughts_tokens,cost_usd=round(b.cost_usd, 6), seconds=round(b.latency_ms / 1000.0, 1))diff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.pyindex 1956b2fd..33059282 100644--- a/harness/tests/flywheel_cli/test_run_layout_cli.py+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py@@ -15,13 +15,13 @@ from codeverse3d.addons.gallery import build_staticfrom codeverse3d.addons.gallery.index import entry_from_recordfrom codeverse3d.cli.main import appfrom codeverse3d.contracts.run import RunRecord+from codeverse3d.cost.types import STAGE_ORDERfrom codeverse3d.record.deliverable import build_deliverable, deliverable_path, load_deliverablefrom codeverse3d.record.record import load_record, package_runfrom codeverse3d.record.telemetry import (build_telemetry,ledger_rows,load_telemetry,- stage_order,)from codeverse3d.workspace import LAYOUT_ALIASES, Workspace@@ -119,7 +119,7 @@ def test_telemetry_summarises_the_runs_own_ledger(fake_run):"model": "gemini-3.7-flash", "n_calls": 1}) + "\n")tele = build_telemetry(ws, rec)assert tele.cost is not None and tele.cost.by_stage[0].stage == "plan"- assert {s.stage for s in tele.cost.by_stage} <= set(stage_order())+ assert {s.stage for s in tele.cost.by_stage} <= set(STAGE_ORDER)assert not (ws.telemetry / "usage.jsonl").exists(), "one ledger, one name"