Skip to content

Official Codebase of 3DCodeVerse

Python

Delete five unreferenced functions (claim_bases, part_key, surface_distance, lint_text, deliverable_path) and their test-only callers

gaoypeng3e0df073775f
diff --git a/harness/codeverse3d/addons/skill_targets.py b/harness/codeverse3d/addons/skill_targets.py
index a44b5902..6c03f078 100644
--- a/harness/codeverse3d/addons/skill_targets.py
+++ b/harness/codeverse3d/addons/skill_targets.py
@@ -489,21 +489,3 @@ def check_prompt_claims(root: Path | None = None) -> list[str]:
except (ValueError, OSError) as e:
return [f"prompt claims file unreadable: {e}"]
return check_rows(rows, lambda f: (base / f).read_text() if f else "")
-
-
-def claim_bases(skill: Skill | str, root: Path | None = None) -> dict[str, tuple[str, Any]]:
- """``key -> (dotted target, live value)`` — the agreement test's real comparison.
-
- WHY not the rendered text: two skills may honestly quote one constant in two units.
- ``c3d-bbox-contract`` says "1 cm" (scale 100) and ``c3d-repeats-and-mirrors`` says
- "0.01" metres; both pin ``conventions:BBOX_TOLERANCE_M`` and both are right. A
- contradiction is two skills pointing a shared key at DIFFERENT numbers, so that is what
- is compared — the pre-scale value, and the target it came from.
- """
- out: dict[str, tuple[str, Any]] = {}
- for row in load_claims(skill, root):
- key = row.get("key")
- if not key or not (row.get("python") or row.get("js")):
- continue
- out[str(key)] = _target(row)
- return out
diff --git a/harness/codeverse3d/conventions.py b/harness/codeverse3d/conventions.py
index 20f2c50e..1b051335 100644
--- a/harness/codeverse3d/conventions.py
+++ b/harness/codeverse3d/conventions.py
@@ -21,7 +21,7 @@ Frames
from __future__ import annotations
import re
-from collections.abc import Collection, Sequence
+from collections.abc import Sequence
from dataclasses import dataclass
from enum import StrEnum
from typing import TYPE_CHECKING
@@ -265,16 +265,6 @@ LINK_PIECE_SEP = "__"
ZONE_ROOT_KEY = "c3d_zone"
-def part_key(node: str, plan_keys: Collection[str]) -> str | None:
- """The plan part (a snake key in ``plan_keys``) a GLB node belongs to, or None: the
- node's own name, else its link (``Link__2`` → ``link``), else that name's instance base
- (``Leg_0`` / ``Arm-2`` / ``Handle.001`` → ``leg`` / ``arm`` / ``handle``, one copy or
- many). The contract gate's
- ``match_parts`` applies the same :func:`split_instance` rule."""
- own = to_snake(node.split(LINK_PIECE_SEP, 1)[0])
- return next((k for k in (to_snake(node), own, split_instance(own)[0]) if k in plan_keys), None)
-
-
def to_pascal(name: str) -> str:
"""``seat_cushion`` / ``seat cushion`` → ``SeatCushion``; a name that is already
PascalCase (no underscore) comes back unchanged, so ``TVStand`` stays ``TVStand``.
diff --git a/harness/codeverse3d/languages/glsl_shader/__init__.py b/harness/codeverse3d/languages/glsl_shader/__init__.py
index 2bb92cd7..78d3cbc6 100644
--- a/harness/codeverse3d/languages/glsl_shader/__init__.py
+++ b/harness/codeverse3d/languages/glsl_shader/__init__.py
@@ -257,16 +257,6 @@ def lint_workspace(ws: Workspace) -> GateReport:
return GateReport.of(GATE, findings)
-def lint_text(shader_src: str, common_src: str | None = None, buffer_a_src: str | None = None) -> list[GateFinding]:
- """Lint in-memory sources (tests; the c3d-glsl-craft skill cites it)."""
- out = _check_file(SHADER, shader_src, role="shader")
- if common_src is not None:
- out += _check_file(COMMON, common_src, role="common")
- if buffer_a_src is not None:
- out += _check_file(BUFFER_A, buffer_a_src, role="buffer_a")
- return out
-
-
# ===================================================================== skeleton
COMMON_GLSL = """// src/common.glsl — pasted above shader.frag (and buffer_a.frag) by the harness; no #include.
// Functions and constants only: no main(), no uniforms, no #version. What goes here is yours.
diff --git a/harness/codeverse3d/record/deliverable.py b/harness/codeverse3d/record/deliverable.py
index fcd6845b..d9229dac 100644
--- a/harness/codeverse3d/record/deliverable.py
+++ b/harness/codeverse3d/record/deliverable.py
@@ -199,14 +199,3 @@ def load_deliverable(ws: Workspace) -> RunDeliverable | None:
except Exception as e:
log.warning("unreadable deliverable manifest in %s: %s", ws.root, e)
return None
-
-
-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: 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
- return None
diff --git a/harness/codeverse3d/spatial/joints_collide.py b/harness/codeverse3d/spatial/joints_collide.py
index b61e6919..feacdb28 100644
--- a/harness/codeverse3d/spatial/joints_collide.py
+++ b/harness/codeverse3d/spatial/joints_collide.py
@@ -133,10 +133,6 @@ class LinkBody:
pts = trimesh.transform_points(corners, self.T)
return np.vstack([pts.min(axis=0), pts.max(axis=0)])
- def surface_distance(self, points_world: np.ndarray) -> np.ndarray:
- """Unsigned distance of world points to this body's surface."""
- return self._pq.on_surface(trimesh.transform_points(points_world, self.T_inv))[1]
-
def depth_of(self, points_world: np.ndarray) -> float:
"""Max distance-to-surface of the ``points_world`` that lie inside one of this body's islands."""
local = trimesh.transform_points(points_world, self.T_inv)
diff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.py
index f68f26c0..0f39c0f4 100644
--- a/harness/tests/flywheel_cli/test_run_layout_cli.py
+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py
@@ -11,7 +11,7 @@ from typer.testing import CliRunner
from codeverse3d.addons import select
from codeverse3d.cli.main import app
from codeverse3d.cost.types import STAGE_ORDER
-from codeverse3d.record.deliverable import build_deliverable, deliverable_path, load_deliverable
+from codeverse3d.record.deliverable import build_deliverable, load_deliverable
from codeverse3d.record.record import load_record, package_run
from codeverse3d.record.telemetry import (
build_telemetry,
@@ -26,7 +26,6 @@ runner = CliRunner()
def test_package_run_builds_a_stable_independent_and_loadable_handover(fake_run):
ws, rec = fake_run
assert load_telemetry(ws, rec) is None and load_deliverable(ws) is None
- assert deliverable_path(ws, "object.glb") == ws.artifacts / "object.glb"
# Cross the old hard-link fast-path threshold before packaging.
(ws.artifacts / "object.glb").write_bytes(b"glTF" + b"\0" * (300 * 1024))
package_run(ws, rec)
@@ -44,8 +43,6 @@ def test_package_run_builds_a_stable_independent_and_loadable_handover(fake_run)
assert cost["by_round"]
settings = json.loads(ws.settings_path.read_text())
assert {r["role"] for r in settings["roles"]} == {"planner", "generator", "judge", "captioner"}
- assert deliverable_path(ws, "object.glb") == ws.deliverable / "object.glb"
- assert deliverable_path(ws, "nope.glb") is None
# Rebuilding unchanged content is byte-for-byte stable.
second = build_deliverable(ws, rec, 1)
diff --git a/harness/tests/graphics/test_wrap_lint.py b/harness/tests/graphics/test_wrap_lint.py
index f55f4707..f981334e 100644
--- a/harness/tests/graphics/test_wrap_lint.py
+++ b/harness/tests/graphics/test_wrap_lint.py
@@ -5,9 +5,9 @@ from __future__ import annotations
from codeverse3d.contracts.artifacts import Severity
from codeverse3d.languages.glsl_shader import (
HEADER,
+ _check_file,
compose,
first_error,
- lint_text,
parse_glsl_log,
)
from codeverse3d.languages.opengl_python import lint_source
@@ -16,6 +16,15 @@ SHADER = "void mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv =
COMMON = "float hash(float n) { return fract(sin(n) * 43758.5453); }\n"
+def lint_text(shader, common=None, buffer_a=None):
+ out = _check_file("src/shader.frag", shader, role="shader")
+ if common is not None:
+ out += _check_file("src/common.glsl", common, role="common")
+ if buffer_a is not None:
+ out += _check_file("src/buffer_a.frag", buffer_a, role="buffer_a")
+ return out
+
+
def test_parse_glsl_log_dialects_map_to_files():
c = compose(SHADER, COMMON)
off = HEADER.count("\n") + 1 # common.glsl starts here (1 line) → shader.frag starts at off+1