Skip to content

Official Codebase of 3DCodeVerse

Python

skills routing: a finding routes on the kind its gate wrote — R19 fires on a scene where nothing moves

gaoypeng7d5a9f600c11
diff --git a/harness/codeverse3d/addons/skill_targets.py b/harness/codeverse3d/addons/skill_targets.py
index a52cee39..3cdcb98a 100644
--- a/harness/codeverse3d/addons/skill_targets.py
+++ b/harness/codeverse3d/addons/skill_targets.py
@@ -58,7 +58,7 @@ class Target:
unit: str
source: str
why: str
- #: gate kinds (skills.registry slugs) counted when ``source == SRC_GATE``
+ #: ``gate/kind`` (or a ``gate/*`` family, see skills.registry) counted when ``source == SRC_GATE``
kinds: tuple[str, ...] = ()
#: severities that count; empty == every actionable (non-INFO) finding
severities: tuple[str, ...] = ()
@@ -78,7 +78,7 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="findings per run",
source=SRC_GATE,
- kinds=("connectivity/interpenetration",),
+ kinds=("connectivity/penetration",),
languages=OBJECT_LANGS,
why="the plain count of penetrating pairs is the strongest single predictor of "
"assembly_fit (r = -0.258, eval/docs/COMPLEXITY.md §6) and the bundle exists to lower it",
@@ -90,8 +90,8 @@ TARGETS: tuple[Target, ...] = (
unit="findings per run",
source=SRC_GATE,
kinds=("contract/part_bbox", "contract/overall_bbox", "contract/footprint_offset",
- "contract/ground_gap", "contract/scene_bounds"),
- languages=(*OBJECT_LANGS, "scene_threejs"),
+ "contract/ground_gap"),
+ languages=OBJECT_LANGS,
why="the bundle is the contract gate's own tolerance arithmetic: a part that IS there "
"and is the wrong size or in the wrong place",
caveat="two contract kinds are deliberately somebody else's. contract/instance_* is "
@@ -116,7 +116,7 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="findings per run",
source=SRC_GATE,
- kinds=("lint/api_trap", "lint/part_not_imported"),
+ kinds=("lint/untyped",),
languages=("blender", "urdf_blender"),
why="the bundle is written around the five bpy traps the static lint already counts",
),
@@ -126,7 +126,7 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="ERROR findings per run",
source=SRC_GATE,
- kinds=("joint_sweep/link_overlap", "joint_sweep/disconnected"),
+ kinds=("joint_sweep/penetration", "joint_sweep/unattached"),
severities=("error",),
languages=("urdf_blender",),
why="metadata.owns names joint_sweep; 653 of 691 sweep findings in the corpus are "
@@ -161,12 +161,12 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="findings per run",
source=SRC_GATE,
- kinds=("scene_frames/camera_placement",),
+ kinds=("scene_frames/camera_*",),
languages=("scene_threejs",),
why="cameras below ground or inside geometry are arithmetic failures, and the bundle's "
"whole method is deriving them from measured bounds",
- caveat="frame coverage (content_frac) is the bundle's other half and registry.py "
- "classifies no kind for it, so it is not in this count.",
+ caveat="frame coverage (content_small, hero_*) is the bundle's other half and routes it "
+ "too (R15), but is not in this count.",
),
Target(
skill="c3d-scene-lighting",
@@ -174,7 +174,7 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="findings per run",
source=SRC_GATE,
- kinds=("scene_frames/dark_or_flat",),
+ kinds=("scene_frames/dark_frame", "scene_frames/flat_frame", "scene_frames/blown_frame"),
languages=("scene_threejs",),
why="the bundle is the exposure thresholds of frame_metrics.py restated with a recipe; "
"the gate counts exactly the frames it failed to light",
@@ -201,9 +201,9 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="WARN+ERROR findings per run",
source=SRC_ARTIFACT,
- kinds=("shader/compile_or_binding",),
+ kinds=("shader_preflight/*",),
languages=("scene_threejs", "threejs"),
- why="metadata.owns names shader/compile_or_binding; every trap the bundle teaches lands "
+ why="every trap the bundle teaches lands "
"in the one shader_preflight report",
caveat="zero headroom in today's corpus: all 4 recorded scene runs are clean, so this can "
"only detect a regression until a battery makes it fire. Runs recorded before "
@@ -227,7 +227,7 @@ TARGETS: tuple[Target, ...] = (
direction=DOWN,
unit="findings per run",
source=SRC_GATE,
- kinds=("gl_frames/motion_or_detail",),
+ kinds=("gl_frames/*",),
languages=("opengl_python",),
why="every gl_frames finding in the whole graphics corpus (3 flicker, 1 low detail) came "
"from opengl_python, and flicker is trap 1 (a sampled solver) showing up in pixels",
diff --git a/harness/codeverse3d/skills/c3d-threejs-shader-traps/SKILL.md b/harness/codeverse3d/skills/c3d-threejs-shader-traps/SKILL.md
index 59d8afb7..b3c5802c 100644
--- a/harness/codeverse3d/skills/c3d-threejs-shader-traps/SKILL.md
+++ b/harness/codeverse3d/skills/c3d-threejs-shader-traps/SKILL.md
@@ -7,7 +7,7 @@ metadata:
evidence: mixed
evidence_note: "Every rule is read from the live runtime_js source and cross-checked against the shader_report merge path. Incidence is NOT measured: bench/out holds 4 scene_threejs runs, and all 4 shader_preflight reports are clean INFO (10, 9, 14 and 11 programs compiled; 1-12 custom materials). The corpus therefore supports the detection map, not a defect rate."
verified: "2026-08-25"
- owns: "shader/compile_or_binding"
+ owns: "shader_preflight"
target_metric: "shader_preflight_findings"
target_direction: "down"
target_unit: "WARN+ERROR findings per run"
diff --git a/harness/codeverse3d/skills/registry.py b/harness/codeverse3d/skills/registry.py
index b4a10974..43faf05a 100644
--- a/harness/codeverse3d/skills/registry.py
+++ b/harness/codeverse3d/skills/registry.py
@@ -1,38 +1,34 @@
-"""The routing table (design §5.2) and the ONE place gate message text is pattern-matched.
+"""The routing table (design §5.2) and the one place a gate finding becomes a routing kind.
Two things live here and nowhere else:
-**finding_kind()** — ``GateFinding`` carries no ``kind`` field (``contracts/artifacts.py``),
-so turning "'Lid' and 'Body' interpenetrate by ~7.4 mm" into the stable slug
-``connectivity/interpenetration`` needs a classifier. Keeping it in one function means a
-gate reword breaks one golden test instead of silently unrouting a repair skill. It
-classifies **actionable** findings only: INFO lines ("named objects: [...]") are census,
-not defects, and return ``None``.
+**finding_kind()** — a finding's kind is ``"<gate>/<data.kind>"``, the kind the gate itself
+wrote (``connectivity/penetration``, ``scene_frames/no_motion``); the ``lint:<language>``
+gates are one ``lint`` family. A finding whose gate writes no kind (the lints, motion_direction,
+render_console) is ``"<gate>/untyped"``, which only a family row (``lint/*``) answers. No
+message text is read: the regex this replaced left seven scene_frames kinds unrouted and R19
+unreachable (audit 2026-09-24, N52), and every gate reword could unroute a skill. INFO lines
+("all 7 parts are connected") are census, not defects, and have no kind.
**ROUTES** — typed rows, evaluated by ``select()`` below. A row fires when ALL of its stated
conditions hold; ``priority`` decides who survives the cap, and every gate-fired row sits
-at >= 90 so a repair round spends its budget on what actually broke.
-
-Classification is deliberately WIDER than routing: several kinds below have no rule at
-all. Naming a defect costs nothing and lets the golden test assert full coverage of the
-corpus; routing one is a claim that a skill helps, and that claim needs evidence.
+at >= 90 so a repair round spends its budget on what actually broke. Routing a kind is a
+claim that a skill helps, and that claim needs evidence; most kinds have no row.
"""
from __future__ import annotations
import logging
-import re
from dataclasses import dataclass
from typing import Any
from codeverse3d.skills.model import EVIDENCE_INHERITED, Selection, Skill
# --------------------------------------------------------------------------- finding kinds
-CONNECTIVITY_INTERPENETRATION = "connectivity/interpenetration"
-CONNECTIVITY_STRAY_ISLANDS = "connectivity/stray_islands"
-CONNECTIVITY_FLOATING_PART = "connectivity/floating_part"
-CONNECTIVITY_NO_GROUND = "connectivity/no_ground_contact"
-CONNECTIVITY_NO_GEOMETRY = "connectivity/no_geometry"
+#: the kind of a finding whose gate writes no ``data.kind``
+UNTYPED = "untyped"
+#: the kinds a route or a bundle target names on its own — the gates' own words
+CONNECTIVITY_PENETRATION = "connectivity/penetration"
CONTRACT_PART_BBOX = "contract/part_bbox"
CONTRACT_INSTANCE_BBOX = "contract/instance_bbox"
CONTRACT_OVERALL_BBOX = "contract/overall_bbox"
@@ -40,80 +36,37 @@ CONTRACT_FOOTPRINT = "contract/footprint_offset"
CONTRACT_GROUND_GAP = "contract/ground_gap"
CONTRACT_MISSING_PART = "contract/missing_part"
CONTRACT_INSTANCE_COUNT = "contract/instance_count"
-CONTRACT_SCENE_BOUNDS = "contract/scene_bounds"
-JOINT_SWEEP_LINK_OVERLAP = "joint_sweep/link_overlap"
-JOINT_SWEEP_DISCONNECTED = "joint_sweep/disconnected"
-JOINT_SWEEP_BURIED = "joint_sweep/buried_link"
-MOTION_WRONG_AXIS = "motion_direction/wrong_axis"
-MOTION_SKIPPED = "motion_direction/skipped"
-SCENE_DARK_OR_FLAT = "scene_frames/dark_or_flat"
-SCENE_CAMERA_PLACEMENT = "scene_frames/camera_placement"
-GL_MOTION_OR_DETAIL = "gl_frames/motion_or_detail"
-LINT_PART_NOT_IMPORTED = "lint/part_not_imported"
-LINT_LINK_NAME = "lint/link_name"
-LINT_API_TRAP = "lint/api_trap"
-SHADER_COMPILE_OR_BINDING = "shader/compile_or_binding"
-RUNTIME_SLOW = "render_console/slow_or_error"
-
-#: (gate predicate, message regex, kind). Order matters: first match wins.
-_RULES: tuple[tuple[str, str, str], ...] = (
- ("connectivity", r"interpenetrate", CONNECTIVITY_INTERPENETRATION),
- ("connectivity", r"tiny disconnected island", CONNECTIVITY_STRAY_ISLANDS),
- ("connectivity", r"is floating", CONNECTIVITY_FLOATING_PART),
- ("connectivity", r"no part touches the ground", CONNECTIVITY_NO_GROUND),
- ("connectivity", r"no mesh parts", CONNECTIVITY_NO_GEOMETRY),
- ("contract", r"\(each instance\)|\(all instances\)", CONTRACT_INSTANCE_BBOX),
- ("contract", r"part '.*' bbox deviates", CONTRACT_PART_BBOX),
- ("contract", r"overall bbox deviates", CONTRACT_OVERALL_BBOX),
- ("contract", r"footprint centre", CONTRACT_FOOTPRINT),
- ("contract", r"floats .* the ground", CONTRACT_GROUND_GAP),
- ("contract", r"missing from the GLB|not found in the exported scene", CONTRACT_MISSING_PART),
- ("contract", r"instance\(s\), plan asks for", CONTRACT_INSTANCE_COUNT),
- ("contract", r"exceeds the planned bounds", CONTRACT_SCENE_BOUNDS),
- # "overlap by" is one pose; the round gate aggregates a pair's poses ("overlap in N of the
- # sampled poses") and summarises the pairs past its cap ("more overlapping pair(s)")
- ("joint_sweep", r"overlap by|overlap in \d+ of the sampled poses|more overlapping pair", JOINT_SWEEP_LINK_OVERLAP),
- ("joint_sweep", r"lies entirely inside", JOINT_SWEEP_BURIED),
- ("joint_sweep", r"apart at rest|nothing physically connects", JOINT_SWEEP_DISCONNECTED),
- ("motion_direction", r"check skipped|checks skipped", MOTION_SKIPPED),
- ("motion_direction", r"WRONG", MOTION_WRONG_AXIS),
- ("scene_frames", r"too dark|flat frame", SCENE_DARK_OR_FLAT),
- ("scene_frames", r"BELOW the ground|inside / touching geometry", SCENE_CAMERA_PLACEMENT),
- ("gl_frames", r"frame-to-frame|visual detail|do not change over time"
- r"|essentially black|blown out|NaN/Inf|no frames were rendered", GL_MOTION_OR_DETAIL),
- ("render_console", r"frame rate|error", RUNTIME_SLOW),
- ("shader_preflight", r".", SHADER_COMPILE_OR_BINDING),
- ("lint", r"never imported", LINT_PART_NOT_IMPORTED),
- ("lint", r"never appears as a string", LINT_LINK_NAME),
- ("lint", r"unbound|uniform|ignores scene\.fog|shader (?:fail|error|compile)", SHADER_COMPILE_OR_BINDING),
- ("lint", r".", LINT_API_TRAP),
-)
-_COMPILED = tuple((gate, re.compile(pat, re.I), kind) for gate, pat, kind in _RULES)
-
-
-def finding_kind(gate: str, message: str, severity: str = "warn") -> str | None:
- """``(gate, message)`` → a stable defect slug, or ``None`` for census/INFO lines.
-
- ``severity`` is honoured, not guessed at: an INFO finding is the gate reporting what
- it saw ("all 7 parts are connected"), and routing a skill off it would attach the
- interpenetration sheet to a run with no interpenetration.
- """
- if str(severity).lower() == "info":
+JOINT_SWEEP_PENETRATION = "joint_sweep/penetration"
+JOINT_SWEEP_UNATTACHED = "joint_sweep/unattached"
+SCENE_CAMERAS = "scene_frames/camera_*"
+SCENE_DARK = "scene_frames/dark_frame"
+SCENE_FLAT = "scene_frames/flat_frame"
+SCENE_BLOWN = "scene_frames/blown_frame"
+SCENE_NO_MOTION = "scene_frames/no_motion"
+GL_FRAMES = "gl_frames/*"
+SHADER_PREFLIGHT = "shader_preflight/*"
+LINT = f"lint/{UNTYPED}"
+
+
+def finding_kind(finding: Any) -> str | None:
+ """A ``GateFinding`` → ``"<gate>/<data.kind>"``, or ``None`` for census/INFO lines.
+
+ Severity is honoured, not guessed at: an INFO finding is the gate reporting what it saw,
+ and routing a skill off it would attach the penetration sheet to a run with none."""
+ if str(getattr(finding, "severity", "warn")).lower() == "info":
return None
- g = (gate or "").strip().lower()
- text = message or ""
- for want, pattern, kind in _COMPILED:
- if (g == want or (want == "lint" and g.startswith("lint:"))) and pattern.search(text):
- return kind
- return None
+ gate = str(getattr(finding, "gate", "") or "").strip().lower()
+ family = "lint" if gate.startswith("lint") else gate
+ data = getattr(finding, "data", None)
+ kind = data.get("kind") if isinstance(data, dict) else None
+ return f"{family}/{kind if isinstance(kind, str) and kind else UNTYPED}"
def finding_kinds(findings: object) -> list[str]:
"""Distinct kinds of an iterable of ``GateFinding`` (or of ``GateReport``s), in order."""
out: list[str] = []
for f in _iter_findings(findings):
- k = finding_kind(getattr(f, "gate", ""), getattr(f, "message", ""),
- str(getattr(f, "severity", "warn")))
+ k = finding_kind(f)
if k and k not in out:
out.append(k)
return out
@@ -188,13 +141,13 @@ ROUTES: tuple[Route, ...] = (
kinds=("baseline", "part", "refine", "rebuild"),
requires_any=("has_instances", "has_symmetry"),
why="the plan repeats or mirrors a part, and the contract gate measures each instance"),
- Route("R7", "c3d-repeats-and-mirrors", 90, kinds=("repair", "refine"), findings=("contract/instance_bbox",),
+ Route("R7", "c3d-repeats-and-mirrors", 90, kinds=("repair", "refine"), findings=(CONTRACT_INSTANCE_BBOX,),
why="an instanced part's bbox drifted"),
Route("R8", "c3d-blender-forms", 75, languages=BLENDER_LANGS, kinds=BUILD_KINDS,
why="blender authoring: the language of 47 of our graded runs"),
Route("R9", "c3d-blender-forms", 95, languages=BLENDER_LANGS, kinds=("repair",),
- findings=(LINT_PART_NOT_IMPORTED,),
- why="a part file was written but never imported, so its geometry does not exist"),
+ findings=(LINT,),
+ why="the lint flagged the build script (a part file never imported, a bpy trap)"),
Route("R10", "c3d-cadquery-forms", 75, languages=("cadquery",), kinds=BUILD_KINDS,
why="cadquery authoring (evidence: inherited-unverified — unranked by our corpus; routed by default "
"since 2026-09-22, C3D_SKILLS_UNVERIFIED=0 drops it)"),
@@ -211,25 +164,25 @@ ROUTES: tuple[Route, ...] = (
kinds=("baseline", "env", "zone", "refine"),
why="scene layout and camera framing"),
Route("R15", "c3d-scene-composition", 95, tracks=("scene",), languages=("scene_threejs",),
- findings=(SCENE_CAMERA_PLACEMENT,),
- why="the camera was below ground or inside geometry"),
+ findings=(SCENE_CAMERAS, "scene_frames/content_small", "scene_frames/hero_*"),
+ why="a camera was badly placed, or a shot shows too little of the scene or its hero"),
Route("R16", "c3d-scene-lighting", 65, tracks=("scene",), languages=("scene_threejs",),
kinds=("baseline", "env", "refine"),
why="lighting and exposure decide whether the frame reads at all"),
Route("R17", "c3d-scene-lighting", 95, tracks=("scene",), languages=("scene_threejs",),
- findings=(SCENE_DARK_OR_FLAT,),
- why="the frame gate called the render dark or flat"),
+ findings=(SCENE_DARK, SCENE_FLAT, SCENE_BLOWN),
+ why="the frame gate called the render dark, flat or blown out"),
Route("R18", "c3d-scene-motion", 70, tracks=("scene",), languages=("scene_threejs",),
kinds=("baseline", "zone", "refine"),
why="animation_life 0.431 is the lowest criterion in the whole corpus"),
Route("R19", "c3d-scene-motion", 90, tracks=("scene",), languages=("scene_threejs",),
- findings=(GL_MOTION_OR_DETAIL,),
- why="the frame-difference gate saw a flicker or a still image"),
+ findings=(SCENE_NO_MOTION,),
+ why="the frame-difference gate saw nothing move on an authored camera"),
Route("R20", "c3d-threejs-shader-traps", 60, tracks=("scene", "static_object"), languages=THREEJS_LANGS,
requires_all=("has_custom_shader",),
why="the plan names a custom shader/material effect"),
- Route("R21", "c3d-threejs-shader-traps", 95, languages=THREEJS_LANGS, findings=(SHADER_COMPILE_OR_BINDING,),
- why="a shader failed to compile or a uniform was unbound"),
+ Route("R21", "c3d-threejs-shader-traps", 95, languages=THREEJS_LANGS, findings=(SHADER_PREFLIGHT,),
+ why="the shader preflight flagged a material (a compile error, an unbound uniform, no fog)"),
Route("R22", "c3d-glsl-craft", 80, tracks=("graphics",), languages=("glsl_shader",),
kinds=("baseline", "refine", "repair", "rebuild"),
why="fragment-shader craft: technical_cleanliness 0.597 is the lowest glsl criterion"),
@@ -239,9 +192,9 @@ ROUTES: tuple[Route, ...] = (
# R24 is one row per language: the design writes it as a single line, but a Route names
# exactly one skill so telemetry can say which one the finding routed.
Route("R24-glsl", "c3d-glsl-craft", 90, tracks=("graphics",), languages=("glsl_shader",),
- findings=(GL_MOTION_OR_DETAIL,), why="the frame gate saw no motion or no detail"),
+ findings=(GL_FRAMES,), why="the frame gate saw no motion or no detail"),
Route("R24-opengl", "c3d-opengl-pipeline", 90, tracks=("graphics",), languages=("opengl_python",),
- findings=(GL_MOTION_OR_DETAIL,), why="the frame gate saw no motion or no detail"),
+ findings=(GL_FRAMES,), why="the frame gate saw no motion or no detail"),
# R25-R28 (2026-09-01): the graphics-recipe port from the scene_multifile_graphics
# reference (eval/docs/EVAL.md sceneloop entry). Atmosphere and materials ride every
# env/baseline build; water and night only when the plan's own words ask for them.
diff --git a/harness/codeverse3d/spatial/contract.py b/harness/codeverse3d/spatial/contract.py
index 1a65863b..f69cfc88 100644
--- a/harness/codeverse3d/spatial/contract.py
+++ b/harness/codeverse3d/spatial/contract.py
@@ -18,6 +18,10 @@ Severity policy (``tol = max(tol_m, REL_TOL × plan extent)`` per axis):
extents swapped → WARN "turned" (the az-0 view then shows a side, not the front)
* not standing on the ground / footprint off-centre → WARN
* GLB parts the plan never mentioned → INFO
+
+Every WARN/ERROR carries ``data["kind"]`` (missing_part · instance_count · part_bbox ·
+instance_bbox · overall_bbox · orientation · ground_gap · footprint_offset): the rubric
+caps and the skill router key on it, never on the message.
"""
from __future__ import annotations
@@ -203,7 +207,7 @@ def _fmt_delta(v: np.ndarray) -> str:
return ", ".join(f"{a}{d * 100:+.1f}cm" for a, d in zip(_AXES, v, strict=True))
-def _box_findings(target: str, d: _BoxDelta, plan: BBox, *, what: str, language: str,
+def _box_findings(target: str, d: _BoxDelta, plan: BBox, *, what: str, kind: str, language: str,
check_center: bool = True) -> list[GateFinding]:
"""WARN/ERROR findings for one box comparison (empty when within tolerance).
``d``/``plan`` are in the GLB frame; every number in the hint (and ``data``) is
@@ -229,7 +233,7 @@ def _box_findings(target: str, d: _BoxDelta, plan: BBox, *, what: str, language:
gate=GATE, severity=sev, target=target,
message=f"{what} bbox deviates from the plan (worst {ratio:.1f}× tolerance)",
fix_hint=hint + f"; planned centre ({', '.join(f'{c:.3f}' for c in p_ctr)}) m ({frame_label(language)})",
- data={"delta_center_m": d_ctr.tolist(), "delta_extents_m": d_ext.tolist(),
+ data={"kind": kind, "delta_center_m": d_ctr.tolist(), "delta_extents_m": d_ext.tolist(),
"tol_m": glb_vec_to_plan(d.tol, language, extents=True).tolist(), "frame": language_frame(language).value},
))
return out
@@ -314,7 +318,7 @@ def _check_object_plan(m: Measurement, plan: StaticPlan, language: str, tol_m: f
message=f"plan part '{pp.name}' is missing from the GLB",
fix_hint=f"create a part named exactly '{pp.name}'" + (f" (×{pp.instances} as {pp.name}_0..{pp.instances - 1})" if pp.instances > 1 else "")
+ f" — {pp.role}; planned size {fmt_extent_cm(pp.bbox.extents)} cm",
- data={"expected_instances": pp.instances},
+ data={"kind": "missing_part", "expected_instances": pp.instances},
))
continue
box = plan_bbox_to_glb(pp.bbox, language)
@@ -323,11 +327,11 @@ def _check_object_plan(m: Measurement, plan: StaticPlan, language: str, tol_m: f
gate=GATE, severity=Severity.WARN, target=target,
message=f"'{pp.name}': found {len(rows)} instance(s), plan asks for {pp.instances}",
fix_hint=f"name the copies {pp.name}_0 .. {pp.name}_{pp.instances - 1}",
- data={"found": len(rows), "expected": pp.instances},
+ data={"kind": "instance_count", "found": len(rows), "expected": pp.instances},
))
if len(rows) == 1 and pp.instances == 1:
d = _box_delta(np.asarray(rows[0].bbox_min), np.asarray(rows[0].bbox_max), box, tol_m)
- findings.extend(_box_findings(target, d, box, what=f"part '{pp.name}'", language=language))
+ findings.extend(_box_findings(target, d, box, what=f"part '{pp.name}'", kind="part_bbox", language=language))
else:
# instances: each copy should have the planned extents; the centre is unknowable
per = [_box_delta(np.asarray(r.bbox_min), np.asarray(r.bbox_max), box, tol_m) for r in rows]
@@ -335,13 +339,13 @@ def _check_object_plan(m: Measurement, plan: StaticPlan, language: str, tol_m: f
worst_each = max(per, key=lambda d: float(np.max(np.abs(d.extents) / d.tol)))
# accept whichever reading (per-instance or union) fits the plan better
if float(np.max(np.abs(union.extents) / union.tol)) < float(np.max(np.abs(worst_each.extents) / worst_each.tol)):
- findings.extend(_box_findings(target, union, box, what=f"'{pp.name}' (all instances)", language=language, check_center=False))
+ findings.extend(_box_findings(target, union, box, what=f"'{pp.name}' (all instances)", kind="instance_bbox", language=language, check_center=False))
else:
- findings.extend(_box_findings(target, worst_each, box, what=f"'{pp.name}' (each instance)", language=language, check_center=False))
+ findings.extend(_box_findings(target, worst_each, box, what=f"'{pp.name}' (each instance)", kind="instance_bbox", language=language, check_center=False))
# overall bbox
ob = plan_bbox_to_glb(plan.overall_bbox, language)
d = _box_delta(np.asarray(m.bbox_min), np.asarray(m.bbox_max), ob, tol_m)
- findings.extend(_box_findings("overall", d, ob, what="overall", language=language))
+ findings.extend(_box_findings("overall", d, ob, what="overall", kind="overall_bbox", language=language))
if (orient := _orientation_finding(m, plan, language)) is not None:
findings.append(orient)
# ground + footprint
@@ -351,7 +355,7 @@ def _check_object_plan(m: Measurement, plan: StaticPlan, language: str, tol_m: f
gate=GATE, severity=Severity.WARN if abs(m.ground_gap_m) <= ERROR_FACTOR * tol_m else Severity.ERROR,
target="overall", message=f"object floats {abs(m.ground_gap_m) * 1000:.1f} mm {where} the ground",
fix_hint=f"translate everything by {-m.ground_gap_m:+.4f} m along the up axis so the lowest point is at 0",
- data={"ground_gap_m": m.ground_gap_m},
+ data={"kind": "ground_gap", "ground_gap_m": m.ground_gap_m},
))
if m.footprint_offset_m > max(tol_m, REL_TOL * max(m.extents[0], m.extents[2], 1e-9)):
findings.append(GateFinding(
@@ -359,7 +363,7 @@ def _check_object_plan(m: Measurement, plan: StaticPlan, language: str, tol_m: f
message=f"footprint centre is {m.footprint_offset_m * 100:.1f} cm off the up axis",
fix_hint=f"translate everything by {fmt_vec(glb_vec_to_plan((-m.center[0], 0.0, -m.center[2]), language))} m "
f"({frame_label(language)}) to centre the footprint",
- data={"footprint_offset_m": m.footprint_offset_m, "frame": language_frame(language).value},
+ data={"kind": "footprint_offset", "footprint_offset_m": m.footprint_offset_m, "frame": language_frame(language).value},
))
for r in extra:
findings.append(GateFinding(gate=GATE, severity=Severity.INFO, target=r.name,
diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.md
index b5c5e5cd..517c1222 100644
--- a/harness/docs/SKILLS.md
+++ b/harness/docs/SKILLS.md
@@ -192,8 +192,8 @@ against the 20 the rule requires (design §5.2 law 3).
## 3. Routing
-`codeverse3d/skills/registry.py` holds the typed table (R1–R24) and `finding_kind()`, the one
-place a gate message is pattern-matched; its router half (`select()`) turns
+`codeverse3d/skills/registry.py` holds the typed table (R1–R28) and `finding_kind()`, which names
+a finding `<gate>/<data.kind>` — the kind the gate wrote, never its message; its router half (`select()`) turns
`(track, language, kind, plan signals, findings)` into a ranked, capped, reasoned set.
Four laws, all tested:
@@ -216,12 +216,12 @@ the finding), and checks that every signal a route requires is one `plan_signals
cap and the order themselves come from `select`'s final sort and slice, pinned by row in
`test_router` (the exhaustive plan-signal sweep went in the D96 second pass, 2026-09-23).
-`finding_kind()` classifies **wider** than it routes — 113 distinct WARN/ERROR message
-shapes mined from `eval/bench/out`, with a 43-row golden fixture
-(`tests/skills/data/gate_findings.json`) asserting no `unknown`. Naming a defect costs
-nothing; routing one is a claim that a skill helps. INFO findings are census, not defects,
-and classify to `None` — routing off "all 7 parts are connected" would attach the
-interpenetration sheet to a run with no interpenetration.
+`finding_kind()` reads no message text (audit 2026-09-24, N52): the message regex it replaced
+left seven `scene_frames` kinds unrouted and R19 unreachable, and any gate reword could unroute
+a skill. A gate that writes no `data.kind` (the lints, motion_direction, render_console) gives
+`<gate>/untyped`, which only a family row (`lint/*`, `motion_direction/*`) answers; the lint gates
+are one `lint` family. INFO findings are census, not defects, and have no kind — routing off
+"all 7 parts are connected" would attach the penetration sheet to a run with none.
Adding a bundle means adding its rows in the same commit: an unroutable bundle pays the
index and never helps, and a test fails on both halves of that.
diff --git a/harness/tests/skills/data/gate_findings.json b/harness/tests/skills/data/gate_findings.json
deleted file mode 100644
index e54ea74c..00000000
--- a/harness/tests/skills/data/gate_findings.json
+++ /dev/null
@@ -1,331 +0,0 @@
-{
- "source": "bench/out/**/artifacts/gates/**/*.json — 2,113 gate reports, mined 2026-08-25",
- "note": "Real WARN/ERROR gate messages, one row per distinct message shape (up to 6 per defect kind, including the shortest and longest shape seen). finding_kind() must classify every row: an `unknown` here means a gate reword has silently unrouted a repair skill. INFO findings are excluded on purpose — they are census, not defects.",
- "n_shapes_mined": 113,
- "findings": [
- {
- "gate": "connectivity",
- "severity": "error",
- "message": "part 'door_leaf' is floating: nearest supported part is 'frame' at 4.0 mm",
- "n": 262,
- "kind": "connectivity/floating_part"
- },
- {
- "gate": "connectivity",
- "severity": "warn",
- "message": "'Leg_2' and 'Seat' interpenetrate by ≈5.0 mm (3% of surface samples inside)",
- "n": 5406,
- "kind": "connectivity/interpenetration"
- },
- {
- "gate": "connectivity",
- "severity": "error",
- "message": "GLB has no mesh parts",
- "n": 0,
- "kind": "connectivity/no_geometry",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- },
- {
- "gate": "connectivity",
- "severity": "warn",
- "message": "no part touches the ground (z=0)",
- "n": 0,
- "kind": "connectivity/no_ground_contact",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- },
- {
- "gate": "connectivity",
- "severity": "warn",
- "message": "part 'frame' contains 8 tiny disconnected island(s) (< 5% of the part size) — stray geometry",
- "n": 2907,
- "kind": "connectivity/stray_islands"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "footprint centre is 4.6 cm off the up axis",
- "n": 233,
- "kind": "contract/footprint_offset"
- },
- {
- "gate": "contract",
- "severity": "error",
- "message": "object floats 130.0 mm above the ground",
- "n": 6,
- "kind": "contract/ground_gap"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "'BaseFootPlates' (all instances) bbox deviates from the plan (worst 1.1× tolerance)",
- "n": 94,
- "kind": "contract/instance_bbox"
- },
- {
- "gate": "contract",
- "severity": "error",
- "message": "'Leg' (each instance) bbox deviates from the plan (worst 3.4× tolerance)",
- "n": 224,
- "kind": "contract/instance_bbox"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "'ApexFinial': found 1 instance(s), plan asks for 2",
- "n": 12,
- "kind": "contract/instance_count"
- },
- {
- "gate": "contract",
- "severity": "error",
- "message": "plan part 'WoodenPlatform' is missing from the GLB",
- "n": 2,
- "kind": "contract/missing_part"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "overall bbox deviates from the plan (worst 1.1× tolerance)",
- "n": 348,
- "kind": "contract/overall_bbox"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "part 'ConicalShade' bbox deviates from the plan (worst 2.2× tolerance)",
- "n": 1386,
- "kind": "contract/part_bbox"
- },
- {
- "gate": "contract",
- "severity": "warn",
- "message": "scene geometry exceeds the planned bounds by x +2.1 m",
- "n": 0,
- "kind": "contract/scene_bounds",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- },
- {
- "gate": "gl_frames",
- "severity": "warn",
- "message": "very large frame-to-frame change (max |Δ| 0.392); flicker or hard cuts",
- "n": 6,
- "kind": "gl_frames/motion_or_detail"
- },
- {
- "gate": "gl_frames",
- "severity": "warn",
- "message": "very low visual detail (edge density 0.0000); the image is a near-flat gradient",
- "n": 2,
- "kind": "gl_frames/motion_or_detail"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "link 'moving_jaw' slides in 'fixed_jaw_body' (prismatic joint) but the meshes are 42.5 mm apart at rest — nothing physically connects them",
- "n": 4,
- "kind": "joint_sweep/disconnected"
- },
- {
- "gate": "joint_sweep",
- "severity": "warn",
- "message": "link 'seat' hinges on 'main_frame' (revolute joint) but the meshes are 11.0 mm apart at rest — nothing physically connects them",
- "n": 2,
- "kind": "joint_sweep/disconnected"
- },
- {
- "gate": "joint_sweep",
- "severity": "warn",
- "message": "links 'door_leaf' and 'lever_handle' overlap by 3.0 mm at pose rest",
- "n": 51,
- "kind": "joint_sweep/link_overlap"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "links 'shaft_and_handle' and 'rib_assembly1' overlap by 4.6 mm at pose crown_hinge1=-0.891,crown_hinge2=-1.17,crown_hinge3=-1.2,crown_hinge4=-0.228,crown_hinge5=-0.106,crown_hinge6=-0.48,runner_slide=0.191 (pose q={'runner_slide': 0.19108850619643628, 'crown_hinge1': -0.8908602092080782, 'crown_hinge2': -1.1700123007978425, 'crown_hinge3': -1.1998362846551944, 'crown_hinge4': -0.2278103081756676, 'crown_hinge5': -0.10643819572117952, 'crown_hinge6': -0.4799043535640406}) [approx: non-watertight mesh]",
- "n": 78,
- "kind": "joint_sweep/link_overlap"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "links 'table_top' and 'left_leg_frame' overlap by 5.4 mm at pose left_brace_elbow_joint=0.0778,left_brace_upper_joint=0.424,left_leg_joint=0.968,right_brace_elbow_joint=1.73,right_brace_upper_joint=1.28,right_leg_joint=0.0251 (pose q={'left_leg_joint': 0.9681817647286105, 'left_brace_upper_joint': 0.4235651406092764, 'left_brace_elbow_joint': 0.07784969547876991, 'right_leg_joint': 0.025122006003364224, 'right_brace_upper_joint': 1.2768342755444277, 'right_brace_elbow_joint': 1.7342355968276713})",
- "n": 334,
- "kind": "joint_sweep/link_overlap"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "links 'turret' and 'lower_arm' overlap by 2.9 mm at pose elbow_joint=-1.01,head_tilt_joint=-0.967,shoulder_joint=-0.241,swivel_joint=0.548 (pose q={'swivel_joint': 0.5478467492858172, 'shoulder_joint': -0.241079353346475, 'elbow_joint': -1.0098582473403717, 'head_tilt_joint': -0.9669447289429418})",
- "n": 48,
- "kind": "joint_sweep/link_overlap"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "links 'body|door' overlap in 2 of the sampled poses (worst 199.9 mm at hinge=0.79)",
- "n": 0,
- "kind": "joint_sweep/link_overlap",
- "origin": "codeverse3d source (the round gate's aggregated form, 2026-09-22)"
- },
- {
- "gate": "joint_sweep",
- "severity": "warn",
- "message": "3 more overlapping pair(s) not listed: base|lid, base|arm, arm|lid",
- "n": 0,
- "kind": "joint_sweep/link_overlap",
- "origin": "codeverse3d source (the round gate's aggregated form, 2026-09-22)"
- },
- {
- "gate": "joint_sweep",
- "severity": "error",
- "message": "link 'Hinge' lies entirely inside 'Body' at rest (100% of its surface): it can neither be seen nor move",
- "n": 0,
- "kind": "joint_sweep/buried_link",
- "origin": "codeverse3d source (the round gate's aggregated form, 2026-09-22)"
- },
- {
- "gate": "lint:blender",
- "severity": "warn",
- "message": "bpy.context.selected_objects is unreliable in background mode (often empty)",
- "n": 18,
- "kind": "lint/api_trap"
- },
- {
- "gate": "lint:blender",
- "severity": "warn",
- "message": "bpy.ops.object.join needs all parts selected + an active object; the result inherits the ACTIVE object's transform",
- "n": 231,
- "kind": "lint/api_trap"
- },
- {
- "gate": "lint:blender",
- "severity": "warn",
- "message": "bpy.ops.object.modifier_apply needs the object active+selected in OBJECT mode",
- "n": 94,
- "kind": "lint/api_trap"
- },
- {
- "gate": "lint:blender",
- "severity": "warn",
- "message": "no PascalCase object names found (e.g. obj.name = 'SeatCushion')",
- "n": 122,
- "kind": "lint/api_trap"
- },
- {
- "gate": "lint:blender",
- "severity": "warn",
- "message": "src/parts/backrest_assembly.py is never imported by src/model.py → its part is not built",
- "n": 144,
- "kind": "lint/part_not_imported"
- },
- {
- "gate": "lint:scene_threejs",
- "severity": "warn",
- "message": "GLSL declares/reads uTime but JS never binds it (uniforms: { uTime: { value: 0 } } and update .value in update(t))",
- "n": 0,
- "kind": "shader/compile_or_binding",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- },
- {
- "gate": "lint:urdf",
- "severity": "warn",
- "message": "link 'rib_assembly1' never appears as a string in src/model.py — the wrapper looks for an object named exactly 'rib_assembly1'",
- "n": 12,
- "kind": "lint/link_name"
- },
- {
- "gate": "motion_direction",
- "severity": "warn",
- "message": "motion check skipped: motion_direction_check: 'lower_latch_mount' is not a movable joint",
- "n": 2,
- "kind": "motion_direction/skipped"
- },
- {
- "gate": "motion_direction",
- "severity": "error",
- "message": "elbow_joint: child 'upper_arm' moves (0.0, 0.48, 0.877) for q=+0.35; expected front (WRONG — flip the axis sign or swap limits). Plan says: \"upper arm articulates forward and back over a 126 degree range\"",
- "n": 8,
- "kind": "motion_direction/wrong_axis"
- },
- {
- "gate": "motion_direction",
- "severity": "error",
- "message": "left_leg_joint: child 'left_leg_frame' moves (0.985, 0.0, 0.174) for q=+0.35; expected +y (WRONG — flip the axis sign or swap limits). Plan says: \"Left leg frame rotates clockwise (+Y axis) folding inward toward table center\"",
- "n": 6,
- "kind": "motion_direction/wrong_axis"
- },
- {
- "gate": "motion_direction",
- "severity": "error",
- "message": "right_leg_joint: child 'right_leg_frame' moves (-0.985, 0.0, 0.174) for q=+0.35; expected -y (WRONG — flip the axis sign or swap limits). Plan says: \"Right leg frame rotates counter-clockwise (-Y axis) folding inward toward table center\"",
- "n": 6,
- "kind": "motion_direction/wrong_axis"
- },
- {
- "gate": "motion_direction",
- "severity": "error",
- "message": "shade_joint: child 'lamp_shade' moves (0.0, 0.73, -0.683) for q=+0.35; expected up (WRONG — flip the axis sign or swap limits). Plan says: \"tilts lamp shade up and down at the arm tip\"",
- "n": 1,
- "kind": "motion_direction/wrong_axis"
- },
- {
- "gate": "motion_direction",
- "severity": "error",
- "message": "shoulder_joint: child 'lower_arm' moves (0.0, 0.895, 0.445) for q=+0.35; expected up (WRONG — flip the axis sign or swap limits). Plan says: \"lower arm pitches up and down from 20 to 80 degrees elevation\"",
- "n": 8,
- "kind": "motion_direction/wrong_axis"
- },
- {
- "gate": "render_console",
- "severity": "warn",
- "message": "low frame rate 10 fps",
- "n": 3,
- "kind": "render_console/slow_or_error"
- },
- {
- "gate": "scene_frames",
- "severity": "warn",
- "message": "camera inside / touching geometry: inside ['CityTower', 'CityTower']",
- "n": 2,
- "kind": "scene_frames/camera_placement"
- },
- {
- "gate": "scene_frames",
- "severity": "error",
- "message": "camera is 1.0 m BELOW the ground level (6.21 m)",
- "n": 3,
- "kind": "scene_frames/camera_placement"
- },
- {
- "gate": "scene_frames",
- "severity": "warn",
- "message": "flat frame: one luminance band holds 100% of the pixels",
- "n": 5,
- "kind": "scene_frames/dark_or_flat"
- },
- {
- "gate": "scene_frames",
- "severity": "warn",
- "message": "frame too dark: mean luminance 0.11, 36% of pixels near black",
- "n": 11,
- "kind": "scene_frames/dark_or_flat"
- },
- {
- "gate": "shader_preflight",
- "severity": "warn",
- "message": "ShaderMaterial 'Water' ignores scene.fog (set fog: true, merge THREE.UniformsLib.fog, include fog_pars_fragment/fog_fragment)",
- "n": 0,
- "kind": "shader/compile_or_binding",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- },
- {
- "gate": "shader_preflight",
- "severity": "error",
- "message": "ShaderMaterial 'Water' reads uTime but uniforms.uTime is missing",
- "n": 0,
- "kind": "shader/compile_or_binding",
- "origin": "codeverse3d source (gate not yet represented in bench/out)"
- }
- ]
-}
\ No newline at end of file
diff --git a/harness/tests/skills/test_end_to_end.py b/harness/tests/skills/test_end_to_end.py
index ab115114..2f43e187 100644
--- a/harness/tests/skills/test_end_to_end.py
+++ b/harness/tests/skills/test_end_to_end.py
@@ -28,17 +28,15 @@ from tests.skills.conftest import write_bundle
class RealMessageServices(FakeServices):
- """FakeServices, but the contract gate speaks the words the real gate speaks.
-
- The stock fake says "Seat bbox off by 0.03 m", which ``finding_kind`` correctly
- refuses to classify — it is not a message our gates emit. Routing off a gate is only
- proven by the real text."""
+ """FakeServices, but the contract gate writes the findings the real gate writes —
+ routing keys on their ``data.kind``, so only the real shape proves it."""
def contract(self, measurement, plan, tol_m, language=""):
parts = list(getattr(plan, "parts", []))[: self.contract_errors]
findings = [GateFinding(gate="contract", severity=Severity.ERROR, target=p.name,
message=f"part '{p.name}' bbox deviates from the plan (worst 3.4x tolerance)",
- fix_hint=f"resize {p.name} to its plan extents") for p in parts]
+ fix_hint=f"resize {p.name} to its plan extents", data={"kind": "part_bbox"})
+ for p in parts]
return GateReport(gate="contract", passed=not findings, findings=findings)
@@ -130,5 +128,5 @@ def test_enabled_run_delivers_routes_repairs_and_records_skills(run):
assert len(rows) == len(rec.rounds) == 4 and all('"listed"' in r for r in rows)
repair = next(job for job in agent.jobs if job.kind == "repair")
- assert "c3d-threejs-shader-traps" in repair.prompt
+ assert "unbound uniform u_time" in repair.prompt
assert rec.rounds[0].notes.startswith("repair attempts: 1/2 (fixed)")
diff --git a/harness/tests/skills/test_hook.py b/harness/tests/skills/test_hook.py
index 73a77788..504a67fd 100644
--- a/harness/tests/skills/test_hook.py
+++ b/harness/tests/skills/test_hook.py
@@ -8,6 +8,7 @@ from types import SimpleNamespace as NS
import pytest
from codeverse3d.config import get_settings
+from codeverse3d.contracts.artifacts import GateFinding, GateReport, Severity
from codeverse3d.tracks import skills_hook as H
@@ -58,3 +59,12 @@ def test_no_skill_failure_costs_the_round(ctx, monkeypatch):
get_settings.cache_clear()
got = H.attach_for_round(ctx, index=2, kind="refine")
assert got is not None and got.listed == []
+
+
+def test_a_repair_names_the_sheet_that_answers_the_lint_it_is_fixing(ctx, monkeypatch):
+ """The lint is found after the round attached its set: R9 (``lint/*``) points at the sheet."""
+ monkeypatch.setenv("C3D_SKILLS", "on")
+ assert H.attach_for_round(ctx, index=0, kind="repair")
+ lint = GateReport(gate="lint:blender", passed=True, findings=[GateFinding(
+ gate="lint:blender", severity=Severity.WARN, message="src/parts/leg.py is never imported by src/model.py")])
+ assert "c3d-blender-forms" in H.repair_pointers(ctx, lint)
diff --git a/harness/tests/skills/test_materialize_prompting.py b/harness/tests/skills/test_materialize_prompting.py
index 2f5da0dc..5dac2f6d 100644
--- a/harness/tests/skills/test_materialize_prompting.py
+++ b/harness/tests/skills/test_materialize_prompting.py
@@ -72,9 +72,9 @@ def test_native_loader_backends_get_one_sentence_and_no_second_index(library):
def test_repair_pointers_and_the_inlined_body_come_from_the_gate_fired_skill(library):
sel = select("static_object", "blender", "repair", signals={"multi_part": True},
- findings=["connectivity/interpenetration"], library=library)
+ findings=["connectivity/penetration"], library=library)
text = repair_pointers(sel)
- assert "c3d-part-contact" in text and "connectivity/interpenetration" in text
+ assert "c3d-part-contact" in text and "connectivity/penetration" in text
assert "c3d-blender-forms" not in text # standing rows are already in the workspace
assert repair_pointers([]) == ""
# single-shot: the highest-priority body is inlined, within the cap
diff --git a/harness/tests/skills/test_registry.py b/harness/tests/skills/test_registry.py
index c2708b08..7e6a24e8 100644
--- a/harness/tests/skills/test_registry.py
+++ b/harness/tests/skills/test_registry.py
@@ -1,48 +1,49 @@
-"""Classify the recorded gate-message corpus and validate the routing table."""
+"""Name gate findings by their typed kind and validate the routing table."""
from __future__ import annotations
-import json
-from pathlib import Path
+import pytest
-from codeverse3d.skills.registry import ROUTES, finding_kind, finding_kinds
+from codeverse3d.contracts.artifacts import GateFinding, GateReport, Severity
+from codeverse3d.skills.registry import ROUTES, finding_kind, finding_kinds, select
-DATA = Path(__file__).parent / "data" / "gate_findings.json"
-GOLDEN = json.loads(DATA.read_text())["findings"]
+E, W, I = Severity.ERROR, Severity.WARN, Severity.INFO # noqa: E741
-def test_every_recorded_finding_classifies_to_its_expected_kind():
- assert len(GOLDEN) >= 30
- assert {r["severity"] for r in GOLDEN} == {"warn", "error"}
- for index, row in enumerate(GOLDEN):
- got = finding_kind(row["gate"], row["message"], row["severity"])
- label = f"row {index} ({row['gate']} / {row['message'][:90]})"
- assert got is not None, f"unknown {label}"
- assert got == row["kind"], label
+def _f(gate, sev, message="", **data):
+ return GateFinding(gate=gate, severity=sev, message=message, data=data)
-def test_info_findings_are_census_not_defects():
- # "all 7 parts are connected" must not attach the interpenetration sheet
- assert finding_kind("connectivity", "all 7 parts are connected (9 contacts, gap <= 2 mm)", "info") is None
- assert finding_kind("contract", "all plan parts present and within tolerance", "info") is None
- assert finding_kind("lint:blender", "named objects: ['Seat', 'Leg']", "info") is None
[email protected](("finding", "kind"), [
+ # the gate's own kind, whatever the message says (N52: the regex read "interpenetrate")
+ (_f("connectivity", W, "part 'X' contains 3 tiny disconnected island(s)", kind="penetration"),
+ "connectivity/penetration"),
+ (_f("scene_frames", E, "nothing moves: the largest change …", kind="no_motion"), "scene_frames/no_motion"),
+ # a gate that writes no kind; the lint gates are one family
+ (_f("lint:blender", W, "src/parts/leg.py is never imported by src/model.py"), "lint/untyped"),
+ (_f("motion_direction", E, "shoulder_joint: … (WRONG — flip the axis sign)"), "motion_direction/untyped"),
+ # INFO is census: "all 7 parts are connected" must not attach the penetration sheet
+ (_f("connectivity", I, "contact ledger: 7 parts", kind="ledger"), None),
+])
+def test_a_finding_is_named_by_its_gate_and_typed_kind(finding, kind):
+ assert finding_kind(finding) == kind
-def test_finding_kinds_accepts_reports_findings_and_strings():
- class F:
- def __init__(self, gate, message, severity="warn"):
- self.gate, self.message, self.severity = gate, message, severity
+def test_finding_kinds_accepts_reports_and_findings_distinct_in_order():
+ a = _f("connectivity", E, kind="penetration")
+ b = _f("contract", W, kind="part_bbox")
+ assert finding_kinds([a, b]) == finding_kinds([GateReport(gate="x", passed=False, findings=[a, b])]) \
+ == finding_kinds([a, b, a]) == ["connectivity/penetration", "contract/part_bbox"]
+ assert finding_kinds([]) == [] and finding_kinds(None) == []
- class R:
- def __init__(self, findings):
- self.findings = findings
- a = F("connectivity", "'A' and 'B' interpenetrate by 5.0 mm (3% of surface samples inside)")
- b = F("contract", "part 'Leg' bbox deviates from the plan (worst 2.2x tolerance)")
- assert finding_kinds([a, b]) == ["connectivity/interpenetration", "contract/part_bbox"]
- assert finding_kinds([R([a]), R([b])]) == ["connectivity/interpenetration", "contract/part_bbox"]
- assert finding_kinds([a, a]) == ["connectivity/interpenetration"] # distinct, in order
- assert finding_kinds([]) == [] and finding_kinds(None) == []
+def test_r19_answers_a_scene_with_nothing_moving(library):
+ """N52: R19 keyed on a gl_frames-only regex, so a scene's no_motion ERROR routed nothing."""
+ nothing_moves = _f("scene_frames", E, "nothing moves: …", kind="no_motion")
+ got = select("scene", "scene_threejs", "refine", findings=[GateReport(gate="scene_frames", passed=False, findings=[nothing_moves])],
+ library=library)
+ motion = next(s for s in got if s.name == "c3d-scene-motion")
+ assert "R19" in motion.rules and motion.gate_fired
# --------------------------------------------------------------------------- the table
@@ -68,14 +69,3 @@ def test_gate_fired_rows_always_outrank_standing_rows():
standing = [r for r in ROUTES if not r.gate_fired]
assert min(r.priority for r in fired) > max(r.priority for r in standing)
assert all(r.priority >= 90 for r in fired)
-
-
-def test_route_finding_patterns_are_real_kinds_or_families():
- families = {k.split("/", 1)[0] for k in (finding_kind(g, m, s) or ""
- for g, m, s in ((r["gate"], r["message"], r["severity"]) for r in GOLDEN))}
- families |= {"shader"} # shader_preflight rows exist in the fixture as source-derived
- for r in ROUTES:
- for pat in r.findings:
- assert pat.split("/", 1)[0] in families, f"{r.rule} routes on unknown family {pat!r}"
-
-
diff --git a/harness/tests/skills/test_router.py b/harness/tests/skills/test_router.py
index 833dee68..c0efa469 100644
--- a/harness/tests/skills/test_router.py
+++ b/harness/tests/skills/test_router.py
@@ -24,11 +24,11 @@ def skills_for(track, language, kind, *, plan=None, **kw):
def test_a_repair_round_spends_its_budget_on_what_broke(library):
got = select("static_object", "blender", "repair",
signals=plan_signals(static_plan()),
- findings=["connectivity/interpenetration", "contract/part_bbox"],
+ findings=["connectivity/penetration", "contract/part_bbox"],
library=library, max_skills=2)
assert [s.name for s in got] == ["c3d-part-contact", "c3d-bbox-contract"]
assert all(s.gate_fired for s in got)
- assert "R2" in got[0].rules and "connectivity/interpenetration" in got[0].reason
+ assert "R2" in got[0].rules and "connectivity/penetration" in got[0].reason
def test_quiet_kinds_attach_nothing_unless_a_gate_fired(library):
@@ -36,12 +36,12 @@ def test_quiet_kinds_attach_nothing_unless_a_gate_fired(library):
for kind in QUIET_KINDS:
assert select("scene", "scene_threejs", kind, signals=plan_signals(static_plan()), library=library) == []
fired = select("scene", "scene_threejs", kind, signals=plan_signals(static_plan()),
- findings=["scene_frames/dark_or_flat"], library=library)
+ findings=["scene_frames/dark_frame"], library=library)
assert [s.name for s in fired] == ["c3d-scene-lighting"]
# R2 is scoped to repair/refine/rebuild, so a connectivity finding does NOT
# reopen an asset session
assert select("static_object", "blender", kind, signals=plan_signals(static_plan()),
- findings=["connectivity/floating_part"], library=library) == []
+ findings=["connectivity/floating"], library=library) == []
def test_inherited_unverified_bundles_are_off_until_the_switch_says_otherwise(library_dir):
@@ -56,8 +56,8 @@ def test_inherited_unverified_bundles_are_off_until_the_switch_says_otherwise(li
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"),
- ("gl_frames/motion_or_detail", "c3d-scene-motion")):
+ for finding, want in (("scene_frames/dark_frame", "c3d-scene-lighting"),
+ ("scene_frames/camera_below_high_ground", "c3d-scene-composition"),
+ ("scene_frames/no_motion", "c3d-scene-motion")):
got = select("scene", "scene_threejs", "repair", findings=[finding], library=library, max_skills=1)
assert got and got[0].name == want, finding
diff --git a/harness/tests/skills/test_routing_property.py b/harness/tests/skills/test_routing_property.py
index a11816f9..eadd4519 100644
--- a/harness/tests/skills/test_routing_property.py
+++ b/harness/tests/skills/test_routing_property.py
@@ -20,11 +20,10 @@ KINDS = ("baseline", "part", "refine", "rebuild", "repair", "env", "zone",
SIGNAL_KEYS = tuple(plan_signals(None))
LIVE_KINDS = sorted({k for row in ROUTES for k in row.findings if not k.endswith("*")} |
- {"connectivity/interpenetration", "connectivity/floating_part",
- "connectivity/stray_islands", "contract/part_bbox", "contract/overall_bbox",
- "joint_sweep/link_overlap", "motion_direction/wrong_axis",
- "scene_frames/dark_or_flat", "gl_frames/motion_or_detail",
- "lint/part_not_imported", "shader/compile_or_binding"})
+ {"connectivity/penetration", "connectivity/floating", "connectivity/untyped",
+ "contract/part_bbox", "contract/orientation", "joint_sweep/penetration",
+ "motion_direction/untyped", "scene_frames/camera_low", "scene_frames/hero_unseen",
+ "gl_frames/static", "shader_preflight/no_fog", "lint/untyped"})
BASE_INPUTS = [(t, lang, kind) for t in TRACKS for lang in LANGUAGES for kind in KINDS]
diff --git a/harness/tests/skills/test_targets.py b/harness/tests/skills/test_targets.py
index 693f5b38..2f6f42c7 100644
--- a/harness/tests/skills/test_targets.py
+++ b/harness/tests/skills/test_targets.py
@@ -19,7 +19,7 @@ from codeverse3d.addons.skill_targets import (
target_for,
)
from codeverse3d.skills import bundle_dirs, skills_dir
-from codeverse3d.skills.registry import ROUTED_SKILLS, finding_kind
+from codeverse3d.skills.registry import ROUTED_SKILLS
BUNDLES = bundle_dirs()
pytestmark = pytest.mark.skipif(not BUNDLES, reason=f"no bundles in {skills_dir()} yet")
@@ -90,23 +90,6 @@ def test_no_two_bundles_claim_the_same_quantity():
seen[k] = t.skill
-# --------------------------------------------------------------------------- classification
-def test_every_actionable_gl_frames_message_classifies():
- messages = (
- "very large frame-to-frame change (max |Δ| 0.412); flicker or hard cuts",
- "very low visual detail (edge density 0.0014); the image is a near-flat gradient",
- "frames do not change over time (mean |Δ| 0.0001); the shader looks static",
- "frames are essentially black (mean luminance 0.004)",
- "frames are blown out white (mean luminance 0.991)",
- "NaN/Inf pixels in 3 frame(s) (first at t=1s: nan=1200 inf=0)",
- "no frames were rendered",
- )
- for message in messages:
- assert finding_kind("gl_frames", message, "warn") == "gl_frames/motion_or_detail", (
- message
- )
-
-
def test_3dcode_skills_list_shows_every_bundles_claim():
"""The ledger has to be visible from the CLI, or it is a document nobody opens."""
from typer.testing import CliRunner
diff --git a/harness/tests/spatial_tools/test_contract.py b/harness/tests/spatial_tools/test_contract.py
index d4c84dee..60baafe7 100644
--- a/harness/tests/spatial_tools/test_contract.py
+++ b/harness/tests/spatial_tools/test_contract.py
@@ -58,6 +58,9 @@ def test_ground_and_footprint_warnings() -> None:
r = check_contract(m, _stool_plan(), language="blender")
msgs = " | ".join(f.message for f in r.findings)
assert "above the ground" in msgs and "footprint centre" in msgs
+ # every defect is typed: the caps and the skill router key on the kind, not the words (N52)
+ kinds = {f.data.get("kind") for f in r.findings if f.severity != Severity.INFO}
+ assert {"ground_gap", "footprint_offset", "part_bbox", "overall_bbox"} <= kinds and None not in kinds
def test_an_exact_name_wins_over_another_part_instance_pattern() -> None: