Skip to content

Official Codebase of 3DCodeVerse

Python

tests: skills, prompts, languages, second pass — seven more exceptions did not hold (−111 lines)

gaoypengd2ff02cc3795
diff --git a/harness/tests/languages/test_ast_lint.py b/harness/tests/languages/test_ast_lint.py
index 818fb153..8109cc0d 100644
--- a/harness/tests/languages/test_ast_lint.py
+++ b/harness/tests/languages/test_ast_lint.py
@@ -69,13 +69,3 @@ def test_every_python_lint_survives_a_parser_crash(monkeypatch):
findings = run() # must not raise
errs = [f for f in findings if f.severity == Severity.ERROR]
assert errs and "deeper than the parser" in errs[0].message, (name, findings)
-
-
-def test_real_deeply_nested_source_does_not_escape_the_lint():
- """A 40 000-term binary chain: on 3.11 this is the SystemError, on 3.12+ a RecursionError,
- on some builds a plain SyntaxError — whichever, the lint returns a report."""
- from codeverse3d.languages.blender import lint_blender_source
-
- deep = "import bpy\nx = " + " + ".join(["1"] * 40_000) + "\n"
- rep = lint_blender_source(deep)
- assert isinstance(rep.passed, bool)
diff --git a/harness/tests/prompts/test_snippets_run.py b/harness/tests/prompts/test_snippets_run.py
index 1e7be339..403ad89d 100644
--- a/harness/tests/prompts/test_snippets_run.py
+++ b/harness/tests/prompts/test_snippets_run.py
@@ -83,9 +83,7 @@ def test_urdf_cookbook_runs(tmp_path) -> None:
def _build_urdf_example(tmp_path, tag: str, model_py: str, urdf: str):
- """Run a doc example through the REAL urdf_blender pipeline (lint → Blender export →
- FK consistency → rest-pose check) and the round's joint_sweep gate — what the agent's
- own files go through."""
+ """Run a doc example through the real urdf_blender build and the round's joint_sweep gate."""
from codeverse3d.config import get_settings
from codeverse3d.languages.urdf import UrdfBlenderRuntime
from codeverse3d.spatial.joints_sweep import sweep_gate
diff --git a/harness/tests/prompts/test_snippets_static.py b/harness/tests/prompts/test_snippets_static.py
index 87ef5ecf..e128fdd7 100644
--- a/harness/tests/prompts/test_snippets_static.py
+++ b/harness/tests/prompts/test_snippets_static.py
@@ -23,10 +23,7 @@ _NUM = re.compile(r"^-?\d+(\.\d+)?([eE]-?\d+)?$")
@pytest.mark.parametrize("rel", XML_FILES)
def test_xml_examples_follow_the_enforced_frame_recipe(rel: str, tmp_path) -> None:
- """Every worked URDF in the agent-facing docs must pass the harness lint AND the FK
- consistency rule the build enforces: meshes hold WORLD coordinates, so FK(q=0) of a
- link composed with its visual origin is the identity (visual origin = −link frame).
- This is the recipe the reviewer found the docs contradicting (visual origin 0 0 0)."""
+ """Every worked URDF passes the lint and the build's FK rule: visual origin = −(link frame world)."""
from codeverse3d.languages.urdf import lint_urdf_text
from codeverse3d.spatial.joints_model import fk, load_urdf
diff --git a/harness/tests/scene_prompts/test_prompt_assembler_contract.py b/harness/tests/scene_prompts/test_prompt_assembler_contract.py
index a1c73e8f..d2ccec36 100644
--- a/harness/tests/scene_prompts/test_prompt_assembler_contract.py
+++ b/harness/tests/scene_prompts/test_prompt_assembler_contract.py
@@ -1,11 +1,4 @@
-"""The scene track's prompts must describe the interface the harness ACTUALLY calls.
-
-The scene track never lets the model write `src/scene.js`: `languages.scene_threejs.assemble`
-generates it and is the only caller of `src/env.js` and `src/zones/*.js`. When a prompt
-teaches a different signature the model either wastes tokens on defensive shims or —
-worse — writes an animation hook nothing calls (the `nothing_moves` defect that cost three
-of the four v1 bench scenes a grade). These tests pin the prompts to the generated file.
-"""
+"""The scene prompts teach the hooks the generated src/scene.js actually calls (the `nothing_moves` defect)."""
from __future__ import annotations
diff --git a/harness/tests/skills/test_config.py b/harness/tests/skills/test_config.py
index 63c1639a..aa186166 100644
--- a/harness/tests/skills/test_config.py
+++ b/harness/tests/skills/test_config.py
@@ -15,17 +15,14 @@ def _settings(monkeypatch, **env: str) -> Settings:
return Settings()
[email protected]("raw, want", [("off", False), ("", True), ("maybe", True)])
-def test_on_by_default_and_garbage_keeps_the_default(monkeypatch, raw, want):
- """Default ON (D-rule, owner 2026-09-22); garbage warns and keeps it, never a crash (D44 c)."""
- s = _settings(monkeypatch, C3D_SKILLS=raw)
- assert (s.skills, s.skills_unverified, s.skills_max) == (want, True, 5)
-
-
[email protected]("raw, want", [("3", 3), ("-1", 5), ("nope", 5)])
-def test_max_is_never_a_crash(monkeypatch, raw, want):
- assert _settings(monkeypatch, C3D_SKILLS_MAX=raw).skills_max == want
-
[email protected]("name, raw, want", [
+ ("C3D_SKILLS", "off", (False, True, 5)), ("C3D_SKILLS", "", (True, True, 5)), ("C3D_SKILLS", "maybe", (True, True, 5)),
+ ("C3D_SKILLS_MAX", "3", (True, True, 3)), ("C3D_SKILLS_MAX", "-1", (True, True, 5)), ("C3D_SKILLS_MAX", "nope", (True, True, 5)),
+])
+def test_on_by_default_and_garbage_keeps_the_default(monkeypatch, name, raw, want):
+ """Default ON (owner 2026-09-22); garbage warns and keeps the default, never a crash (D44 c)."""
+ s = _settings(monkeypatch, **{name: raw})
+ assert (s.skills, s.skills_unverified, s.skills_max) == want
def test_doctor_reports_the_default_and_the_gemini_pin(monkeypatch):
diff --git a/harness/tests/skills/test_hook.py b/harness/tests/skills/test_hook.py
index 7b26b197..ee154c47 100644
--- a/harness/tests/skills/test_hook.py
+++ b/harness/tests/skills/test_hook.py
@@ -39,22 +39,6 @@ def test_the_switch_off_means_no_files_no_events_no_record(ctx, monkeypatch):
assert H.repair_pointers(ctx, None) == ""
-def test_single_shot_inlines_one_body_into_every_task(ctx, monkeypatch):
- monkeypatch.setenv("C3D_SKILLS", "on")
- ctx.single_shot = True
- got = H.attach_for_round(ctx, index=0, kind="baseline")
- assert got.inlined
-
- class Task:
- def __init__(self, prompt):
- self.prompt = prompt
-
- def model_copy(self, *, update):
- return Task(update["prompt"])
-
- out = H.with_inlined_skill(ctx, [Task("write the chair")])
- assert out[0].prompt.endswith("write the chair") and got.inlined in out[0].prompt
-
def test_a_broken_library_costs_the_skills_not_the_round(ctx, monkeypatch, caplog):
monkeypatch.setenv("C3D_SKILLS", "on")
diff --git a/harness/tests/skills/test_router.py b/harness/tests/skills/test_router.py
index 2ddb77a5..62e3b9b5 100644
--- a/harness/tests/skills/test_router.py
+++ b/harness/tests/skills/test_router.py
@@ -4,8 +4,6 @@ from __future__ import annotations
from types import SimpleNamespace as NS
-import pytest
-
from codeverse3d.skills.model import EVIDENCE_INHERITED
from codeverse3d.skills.registry import QUIET_KINDS, plan_signals, select
from tests.skills.conftest import write_bundle
@@ -63,23 +61,6 @@ def test_inherited_unverified_bundles_are_off_until_the_switch_says_otherwise(li
assert "c3d-cadquery-forms" in [s.name for s in on]
[email protected]("skill, without, with_", [
- ("c3d-part-contact", static_plan(1), static_plan(3)),
- ("c3d-repeats-and-mirrors", static_plan(), static_plan(symmetry="mirror_x")),
-])
-def test_a_plan_signal_decides_a_standing_row(library, skill, without, with_):
- off, on = ([s.name for s in skills_for("static_object", "blender", "baseline", plan=p, library=library)]
- for p in (without, with_))
- assert skill not in off and skill in on
-
-
-def test_language_rows_do_not_leak_across_languages(library):
- blender = [s.name for s in skills_for("static_object", "blender", "baseline", plan=static_plan(), library=library)]
- assert "c3d-blender-forms" in blender and "c3d-cadquery-forms" not in blender
- graphics = [s.name for s in skills_for("graphics", "glsl_shader", "baseline", library=library)]
- assert graphics == ["c3d-glsl-craft"]
-
-
def test_scene_gate_findings_route_the_matching_scene_skill(library):
for finding, want in (("scene_frames/dark_or_flat", "c3d-scene-lighting"),
("scene_frames/camera_placement", "c3d-scene-composition"),
diff --git a/harness/tests/skills/test_routing_property.py b/harness/tests/skills/test_routing_property.py
index 0c506ea8..35da6617 100644
--- a/harness/tests/skills/test_routing_property.py
+++ b/harness/tests/skills/test_routing_property.py
@@ -3,7 +3,6 @@
from __future__ import annotations
import itertools
-import random
import pytest
@@ -22,7 +21,6 @@ KINDS = ("baseline", "part", "refine", "rebuild", "repair", "env", "zone",
#: the boolean plan signals the table may test (n_parts / joint_types are derived)
SIGNAL_KEYS = tuple(plan_signals(None))
FLAGS = tuple(k for k in SIGNAL_KEYS if k not in ("n_parts", "joint_types"))
-JUNK = ("", " ", "no_such_track", "STATIC_OBJECT", "static object", "1", "../etc")
LIVE_KINDS = sorted({k for row in ROUTES for k in row.findings if not k.endswith("*")} |
{"connectivity/interpenetration", "connectivity/floating_part",
@@ -103,32 +101,3 @@ def test_every_corpus_finding_kind_routes_sanely_from_every_session():
), f"{skill.name} cannot explain why it answered {finding}"
answered_somewhere = answered_somewhere or bool(fired)
assert answered_somewhere, f"{finding} is classified but no route answers it"
-
-
-def test_every_track_language_pair_a_run_can_present_routes_something():
- """A pair the harness actually drives must not come back empty at baseline, or the
- library has a hole the read-rate metric would report as apathy."""
- real = [("static_object", "blender"), ("static_object", "cadquery"), ("static_object", "threejs"),
- ("articulated_object", "urdf_blender"), ("scene", "scene_threejs"),
- ("graphics", "glsl_shader"), ("graphics", "opengl_python")]
- sig = {"multi_part": True, "n_parts": 5}
- for track, language in real:
- got = select(track, language, "baseline", signals=sig, library=LIBRARY,
- allow_unverified=True)
- assert got, f"{track}/{language} routes nothing at baseline"
-
-
-def test_a_random_walk_of_mixed_findings_never_breaks_an_invariant():
- rng = random.Random(20260825)
- for _ in range(2000):
- track = rng.choice(TRACKS + JUNK)
- language = rng.choice(LANGUAGES + JUNK)
- kind = rng.choice(KINDS + JUNK)
- sig = {k: rng.random() < 0.5 for k in FLAGS}
- sig["n_parts"] = rng.randint(0, 30)
- findings = rng.sample(LIVE_KINDS, rng.randint(0, 4))
- cap = rng.randint(0, 7)
- got = select(track, language, kind, signals=sig, findings=findings,
- library=LIBRARY, max_skills=cap)
- assert len(got) <= cap
- assert [s.priority for s in got] == sorted((s.priority for s in got), reverse=True)
diff --git a/harness/tests/skills/test_telemetry.py b/harness/tests/skills/test_telemetry.py
index 8e723dd6..3dcb483d 100644
--- a/harness/tests/skills/test_telemetry.py
+++ b/harness/tests/skills/test_telemetry.py
@@ -64,18 +64,6 @@ def test_a_bundle_with_no_references_says_depth_is_unmeasurable(tmp_path, ws):
assert read.deep_measurable is False and read.deep is False
-def test_a_control_that_was_opened_makes_the_rate_unmeasurable(ws, library):
- """Everything looking read means nothing was measured: the rate is None, not 100%."""
- from codeverse3d.skills.materialize import CONTROL_NAME, materialize_skills
- from codeverse3d.skills.prompting import AGENTS_SKILL_ROOT
-
- materialize_skills(ws, [library["c3d-part-contact"]])
- _touch(ws / AGENTS_SKILL_ROOT / "c3d-part-contact" / "references" / "worked_example.md")
- _touch(ws / AGENTS_SKILL_ROOT / CONTROL_NAME / "references" / "control.md")
- usage = probe_reads(ws, _materialized(library, "c3d-part-contact"))
- assert usage.deep == ["c3d-part-contact"] # the raw signal is still reported
- assert usage.control_read and usage.deep_read_rate is None # but the RATE refuses to lie
-
def test_git_diff_alone_trips_the_control(tmp_path, library): # noqa: PLR0915
"""``Workspace.changed_files``' `git add -A -N` + `git diff` reads every untracked bundle file."""
@@ -112,14 +100,6 @@ def _materialized(library, *names):
return SkillsMaterialized(listed=list(names), selections=sels)
-def _touch(path):
- import os
- import time
-
- st = os.stat(path)
- os.utime(path, (st.st_mtime + 60, st.st_mtime))
- time.sleep(0)
-
# ===================================================================== transcript evidence
# Since 2026-09-22 every CLI backend folds its session's tool calls into