Official Codebase of 3DCodeVerse
Python
claims: a number in prompts/**, a bundle's references/ or a JS constant is pinned like a SKILL body — as its own token, on its line
gaoypeng974b33be011d
diff --git a/harness/codeverse3d/addons/skill_targets.py b/harness/codeverse3d/addons/skill_targets.pyindex 3cdcb98a..682bcd4a 100644--- a/harness/codeverse3d/addons/skill_targets.py+++ b/harness/codeverse3d/addons/skill_targets.py@@ -27,6 +27,7 @@ rows against the live gate vocabulary and against each bundle's own frontmatter.from __future__ import annotationsimport importlib+import reimport tomllibfrom dataclasses import dataclass, fieldfrom pathlib import Path@@ -302,7 +303,16 @@ def gate_kinds_claimed() -> frozenset[str]:# ===================================================================== claims+# A claim pins a number some text states to the code constant that produces it: a skill's+# ``_claims/<name>.toml`` (its SKILL.md body, or a bundle file such as ``references/x.md`` via+# ``file``) and the prompt corpus's ``prompts/_claims.toml`` (``file`` relative to prompts/).+# The constant is ``python = "module:NAME"`` or ``js = "<path>:NAME"`` (an ``export const`` numeric+# literal; ``runtime_js/...`` under the configured runtime, any other path under the package).+# The text must stand as its own token (``0.5 m`` is not inside ``10.5 m`` or ``0.5 mm``) and, with+# ``context``, on a line that also carries that phrase — a short "2 mm" cannot pass by occurring+# anywhere else in the file.CLAIMS_DIR = "_claims"+PROMPT_CLAIMS = "_claims.toml"def claims_path(name: str, root: Path | None = None) -> Path:@@ -312,18 +322,20 @@ def claims_path(name: str, root: Path | None = None) -> Path:return base / CLAIMS_DIR / f"{name}.toml"-def load_claims(name: str, root: Path | None = None) -> list[dict[str, Any]]:- """The claim rows for one skill ([] when the bundle pins nothing)."""- p = claims_path(name, root)+def _load_rows(p: Path) -> list[dict[str, Any]]:if not p.is_file():return []- data = tomllib.loads(p.read_text())- rows = data.get("claim") or []+ rows = tomllib.loads(p.read_text()).get("claim") or []if not isinstance(rows, list):raise ValueError(f"{p}: [[claim]] must be an array of tables")return [dict(r) for r in rows]+def load_claims(name: str, root: Path | None = None) -> list[dict[str, Any]]:+ """The claim rows for one skill ([] when the bundle pins nothing)."""+ return _load_rows(claims_path(name, root))++def resolve(dotted: str) -> Any:"""``module:NAME`` or ``module.NAME`` → the live object."""mod, _, attr = dotted.partition(":") if ":" in dotted else dotted.rpartition(".")@@ -332,42 +344,104 @@ def resolve(dotted: str) -> Any:return getattr(importlib.import_module(mod), attr)+def resolve_js(target: str) -> float:+ """``<path>:NAME`` → the number ``[export] const NAME = <literal>`` states in that JS file."""+ rel, _, name = target.rpartition(":")+ if not rel or not name:+ raise ValueError(f"claim js target {target!r} must be '<path>:NAME'")+ head, _, tail = rel.partition("/")+ if head == "runtime_js":+ from codeverse3d.spatial.node import runtime_js_dir++ path = runtime_js_dir() / tail+ else:+ path = Path(__file__).resolve().parents[1] / rel+ m = re.search(rf"^\s*(?:export\s+)?const\s+{re.escape(name)}\s*=\s*([-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)\s*[;,]",+ path.read_text(), re.M)+ if m is None:+ raise ValueError(f"{path} states no numeric `const {name} = …`")+ return float(m.group(1))+++def _target(row: dict[str, Any]) -> tuple[str, Any]:+ """``(target, live value)`` of a row — its ``python`` or ``js`` constant."""+ if row.get("js"):+ return f"js:{row['js']}", resolve_js(str(row["js"]))+ return str(row["python"]), resolve(str(row["python"]))++def render_claim(row: dict[str, Any]) -> str:- """The string the live constant produces, per this row's scale/format."""- value = resolve(str(row["python"]))+ """The string the live constant produces, per this row's scale/format. With ``sep`` the+ constant is a sequence: each item is formatted (default ``{:g}``) and joined by ``sep``, the+ last pair by ``last_sep`` when given — so ``(0, 1, 2.5)`` renders ``0, 1 and 2.5`` whole,+ and a fourth item changes the text."""+ value = _target(row)[1]scale = row.get("scale")+ fmt = row.get("format")+ if row.get("sep"):+ items = [str(fmt or "{:g}").format(v * scale if scale is not None else v) for v in value]+ head, last = items[:-1], items[-1:]+ return str(row["sep"]).join(head) + (str(row.get("last_sep") or row["sep"]) if head else "") + "".join(last)if scale is not None:value = value * scale- fmt = row.get("format")return format(value, "") if not fmt else str(fmt).format(value)-def check_claims(skill: Skill, root: Path | None = None) -> list[str]:- """Every stale or missing claim in one bundle, as human lines (empty == clean)."""+def stated(text: str, doc: str, context: str = "") -> bool:+ """Does ``doc`` state ``text`` as its own token (on a line that also says ``context``)?"""+ pat = re.compile(rf"(?<![\w.]){re.escape(text)}(?!\w|\.\d)")+ return any(pat.search(line) and context in line for line in doc.splitlines())+++def check_rows(rows: list[dict[str, Any]], read: Any) -> list[str]:+ """Every stale or missing claim among ``rows``; ``read(file)`` returns the text a row's+ ``file`` names (``file`` absent → ``read(None)``)."""issues: list[str] = []- try:- rows = load_claims(skill.name, root)- except (ValueError, OSError) as e:- return [f"claims file unreadable: {e}"]for i, row in enumerate(rows):where = f"claim[{i}] {row.get('key', '?')}"- for key_name in ("key", "text", "python"):- if not row.get(key_name):- issues.append(f"{where}: missing `{key_name}`")- if issues and issues[-1].startswith(where):+ missing = [k for k in ("key", "text") if not row.get(k)]+ if not row.get("python") and not row.get("js"):+ missing.append("python` or `js")+ if missing:+ issues += [f"{where}: missing `{k}`" for k in missing]continuetry:live = render_claim(row)- except Exception as e: # noqa: BLE001 — a bad dotted path is a claim problem- issues.append(f"{where}: cannot resolve {row['python']!r}: {e}")+ except Exception as e: # noqa: BLE001 — a bad target is a claim problem+ issues.append(f"{where}: cannot resolve {row.get('js') or row.get('python')!r}: {e}")+ continue+ try:+ doc = read(row.get("file"))+ except OSError as e:+ issues.append(f"{where}: cannot read {row.get('file')!r}: {e}")continueif live != row["text"]:- issues.append(f"{where}: the constant now renders {live!r}, the body says {row['text']!r}")- elif row["text"] not in skill.body:- issues.append(f"{where}: {row['text']!r} no longer appears in the body")+ issues.append(f"{where}: the constant now renders {live!r}, the text says {row['text']!r}")+ elif not stated(row["text"], doc, str(row.get("context", ""))):+ ctx = f" on a line with {row['context']!r}" if row.get("context") else ""+ issues.append(f"{where}: {row['text']!r} no longer appears{ctx} in {row.get('file') or 'the body'}")return issues+def check_claims(skill: Skill, root: Path | None = None) -> list[str]:+ """Every stale or missing claim in one bundle, as human lines (empty == clean)."""+ try:+ rows = load_claims(skill.name, root)+ except (ValueError, OSError) as e:+ return [f"claims file unreadable: {e}"]+ return check_rows(rows, lambda f: skill.body if not f else (skill.dir / f).read_text())+++def check_prompt_claims(root: Path | None = None) -> list[str]:+ """The same check over the prompt corpus: ``prompts/_claims.toml``, ``file`` relative to prompts/."""+ base = Path(root) if root is not None else Path(__file__).resolve().parents[1] / "prompts"+ try:+ rows = _load_rows(base / PROMPT_CLAIMS)+ 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(name: str, root: Path | None = None) -> dict[str, tuple[str, Any]]:"""``key -> (dotted target, live value)`` — the agreement test's real comparison.@@ -380,7 +454,7 @@ def claim_bases(name: str, root: Path | None = None) -> dict[str, tuple[str, Anyout: dict[str, tuple[str, Any]] = {}for row in load_claims(name, root):key = row.get("key")- if not key or not row.get("python"):+ if not key or not (row.get("python") or row.get("js")):continue- out[str(key)] = (str(row["python"]), resolve(str(row["python"])))+ out[str(key)] = _target(row)return outdiff --git a/harness/codeverse3d/cli/skills_cmd.py b/harness/codeverse3d/cli/skills_cmd.pyindex 7fc19bfb..1654a81a 100644--- a/harness/codeverse3d/cli/skills_cmd.py+++ b/harness/codeverse3d/cli/skills_cmd.py@@ -85,7 +85,7 @@ def validate(strict: Annotated[bool, typer.Option("--strict", help="also fail on a routed skill with no bundle")] = False,) -> None:"""Check every bundle against the open spec and our budget/evidence rules."""- from codeverse3d.addons.skill_targets import check_claims+ from codeverse3d.addons.skill_targets import check_claims, check_prompt_claimsfrom codeverse3d.skills import bundle_dirs, validate_bundlefrom codeverse3d.skills.model import SkillError, parse_skillfrom codeverse3d.skills.registry import ROUTED_SKILLS@@ -103,12 +103,15 @@ def validate(console.print(f" - {i}")else:console.print(f"[green]ok[/] {d.name}")+ prompt_issues = check_prompt_claims() # the prompt corpus's pinned numbers, the same check+ for i in prompt_issues:+ console.print(f"[red]FAIL[/] prompts/_claims.toml - {i}")missing = [n for n in ROUTED_SKILLS if n not in {d.name for d in dirs}]if missing:style = "red" if strict else "yellow"console.print(f"[{style}]{len(missing)} routed skill(s) have no bundle:[/] {', '.join(missing)}")console.print(f"\n{len(dirs) - bad}/{len(dirs)} bundles valid")- if bad or (strict and missing):+ if bad or prompt_issues or (strict and missing):raise typer.Exit(code=1)diff --git a/harness/codeverse3d/prompts/_claims.toml b/harness/codeverse3d/prompts/_claims.tomlnew file mode 100644index 00000000..2422b687--- /dev/null+++ b/harness/codeverse3d/prompts/_claims.toml@@ -0,0 +1,60 @@+# Numbers the prompt corpus states, pinned to the code constant that produces them+# (addons/skill_targets.check_prompt_claims; `file` is relative to prompts/). Change the+# constant, or reword the sentence, and tests/skills/test_library.py fails until both agree.++[[claim]]+key = "judge_times"+file = "tracks/plan_graphics.j2"+text = "0, 1, 2.5, 4 and 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+last_sep = " and "+context = "judged on frames sampled at"++[[claim]]+key = "judge_times"+file = "glsl_shader/contract.md"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "renders frames"++[[claim]]+key = "judge_times"+file = "glsl_shader/contract.md"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "uniform float u_time"++[[claim]]+key = "judge_times"+file = "opengl_python/contract.md"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "PNG per frame"++[[claim]]+key = "judge_times"+file = "opengl_python/system.md"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "sampled-time trap"++[[claim]]+key = "scene_times"+file = "scene_threejs/cookbook.md"+text = "0 and t = 1.5"+python = "codeverse3d.tracks.scene:SCENE_TIMES"+sep = " and t = "+context = "renders every camera at t ="++[[claim]]+key = "scene_times"+file = "scene_threejs/cookbook.md"+text = "0, 1.5"+python = "codeverse3d.tracks.scene:SCENE_TIMES"+sep = ", "+context = "scene_views(times=["diff --git a/harness/codeverse3d/skills/_claims/c3d-glsl-craft.toml b/harness/codeverse3d/skills/_claims/c3d-glsl-craft.tomlnew file mode 100644index 00000000..1e875238--- /dev/null+++ b/harness/codeverse3d/skills/_claims/c3d-glsl-craft.toml@@ -0,0 +1,8 @@+# The judged frame times this bundle quotes, pinned to the tuple the graphics track renders.++[[claim]]+key = "judge_times"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "renders five frames"diff --git a/harness/codeverse3d/skills/_claims/c3d-opengl-pipeline.toml b/harness/codeverse3d/skills/_claims/c3d-opengl-pipeline.tomlnew file mode 100644index 00000000..467d6ff2--- /dev/null+++ b/harness/codeverse3d/skills/_claims/c3d-opengl-pipeline.toml@@ -0,0 +1,17 @@+# The judged frame times this bundle quotes, pinned to the tuple the graphics track renders.++[[claim]]+key = "judge_times"+text = "0, 1, 2.5, 4 and 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+last_sep = " and "+context = "judged times"++[[claim]]+key = "judge_times"+file = "references/sampled-time.md"+text = "0, 1, 2.5, 4, 6"+python = "codeverse3d.languages._gl_common:JUDGE_TIMES"+sep = ", "+context = "Judged times"diff --git a/harness/codeverse3d/skills/_claims/c3d-part-contact.toml b/harness/codeverse3d/skills/_claims/c3d-part-contact.tomlindex 43ac82ac..4ad08908 100644--- a/harness/codeverse3d/skills/_claims/c3d-part-contact.toml+++ b/harness/codeverse3d/skills/_claims/c3d-part-contact.toml@@ -49,3 +49,32 @@ text = "10 mm"python = "codeverse3d.spatial.connectivity:MIN_PART_SIZE_M"scale = 1000format = "{:.0f} mm"++# references/contact-recipes.md quotes the same gate numbers in its finding table++[[claim]]+key = "penetration_error"+file = "references/contact-recipes.md"+text = "10 mm"+python = "codeverse3d.spatial.connectivity:PENETRATION_ERROR_M"+scale = 1000+format = "{:.0f} mm"+context = "WARN below"++[[claim]]+key = "penetration_min_fraction"+file = "references/contact-recipes.md"+text = "2%"+python = "codeverse3d.spatial.connectivity:PENETRATION_MIN_FRACTION"+scale = 100+format = "{:.0f}%"+context = "surface samples are inside"++[[claim]]+key = "tiny_island_fraction"+file = "references/contact-recipes.md"+text = "5%"+python = "codeverse3d.spatial.connectivity:TINY_ISLAND_FRACTION"+scale = 100+format = "{:.0f}%"+context = "tiny disconnected island"diff --git a/harness/codeverse3d/skills/_claims/c3d-repeats-and-mirrors.toml b/harness/codeverse3d/skills/_claims/c3d-repeats-and-mirrors.tomlindex e2871196..4dcfa242 100644--- a/harness/codeverse3d/skills/_claims/c3d-repeats-and-mirrors.toml+++ b/harness/codeverse3d/skills/_claims/c3d-repeats-and-mirrors.toml@@ -17,3 +17,20 @@ format = "{:.2f}"key = "error_factor"text = "3.0"python = "codeverse3d.spatial.contract:ERROR_FACTOR"++# references/instances.md works the tolerance through for one part++[[claim]]+key = "bbox_tolerance_m"+file = "references/instances.md"+text = "0.01"+python = "codeverse3d.conventions:BBOX_TOLERANCE_M"+context = "max(0.01, 0.10 * 0.04)"++[[claim]]+key = "rel_tol"+file = "references/instances.md"+text = "0.10"+python = "codeverse3d.spatial.contract:REL_TOL"+format = "{:.2f}"+context = "max(0.01, 0.10 * 0.04)"diff --git a/harness/codeverse3d/skills/_claims/c3d-scene-composition.toml b/harness/codeverse3d/skills/_claims/c3d-scene-composition.tomlindex 968c1a01..883cfcef 100644--- a/harness/codeverse3d/skills/_claims/c3d-scene-composition.toml+++ b/harness/codeverse3d/skills/_claims/c3d-scene-composition.toml@@ -20,3 +20,47 @@ text = "80 m"python = "codeverse3d.spatial.frame_metrics:EYE_MAX_ABOVE_GROUND_M"scale = 1format = "{:.0f} m"++# references/measured-cameras.md quotes the host's backdrop classifier (runtime_js/lib/backdrop.mjs)++[[claim]]+key = "ground_named_span_m"+file = "references/measured-cameras.md"+text = "20 m"+js = "runtime_js/lib/backdrop.mjs:GROUND_NAMED_SPAN_M"+format = "{:.0f} m"+context = "| ground |"++[[claim]]+key = "ground_named_flat"+file = "references/measured-cameras.md"+text = "6%"+js = "runtime_js/lib/backdrop.mjs:GROUND_NAMED_FLAT"+scale = 100+format = "{:.0f}%"+context = "| ground |"++[[claim]]+key = "sky_named_span_m"+file = "references/measured-cameras.md"+text = "50 m"+js = "runtime_js/lib/backdrop.mjs:SKY_NAMED_SPAN_M"+format = "{:.0f} m"+context = "| sky |"++[[claim]]+key = "ground_span_m"+file = "references/measured-cameras.md"+text = "40 m"+js = "runtime_js/lib/backdrop.mjs:GROUND_SPAN_M"+format = "{:.0f} m"+context = "flatter than"++[[claim]]+key = "ground_flat"+file = "references/measured-cameras.md"+text = "2%"+js = "runtime_js/lib/backdrop.mjs:GROUND_FLAT"+scale = 100+format = "{:.0f}%"+context = "flatter than"diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.mdindex 517c1222..67afba8a 100644--- a/harness/docs/SKILLS.md+++ b/harness/docs/SKILLS.md@@ -331,7 +331,7 @@ the `live` cases drive a real CLI.| `test_freshness.py` | every tool, gate kind, rubric criterion, constant, switch, sibling skill and cookbook section a bundle names still exists || `test_router.py` / `test_routing_property.py` | the four routing laws by row; every corpus finding kind from every session || `test_telemetry.py` | the read probe, **including the control that catches git reading the tree** |-| `test_packaging.py` | **a built wheel contains all 17 `SKILL.md`, all 17 `references/`, all 9 `_claims`** |+| `test_packaging.py` | **a built wheel contains all 17 `SKILL.md`, all 17 `references/`, every `_claims` file** || `test_live_discovery.py` | §7 — a real CLI actually finds and opens a bundle |Two contradiction checks are worth separating, because they answer different questions:@@ -621,6 +621,12 @@ chose to go deeper" (§1).scale = 1000format = "{:.0f} mm"```+ A row may also pin a sentence in a bundle file (`file = "references/x.md"`), a JS constant+ (`js = "runtime_js/lib/backdrop.mjs:GROUND_SPAN_M"`, a numeric `export const`), a whole+ sequence (`sep = ", "`, optional `last_sep = " and "`), and the line it must stand on+ (`context = "WARN below"`); the text counts only as its own token. The prompt corpus pins+ its numbers the same way in `codeverse3d/prompts/_claims.toml` (`file` relative to prompts/;+ `check_prompt_claims`, also run by `3dcode skills validate`).4. Add its rows to `ROUTES` in `codeverse3d/skills/registry.py`, in the same commit.5. Add a `Target` row to `codeverse3d/addons/skill_targets.py` and the matching `target_*` keys tothe frontmatter — the ONE deterministic quantity the bundle claims to move, itsdiff --git a/harness/runtime_js/lib/backdrop.mjs b/harness/runtime_js/lib/backdrop.mjsindex a7cbf9a4..63484812 100644--- a/harness/runtime_js/lib/backdrop.mjs+++ b/harness/runtime_js/lib/backdrop.mjs@@ -71,6 +71,14 @@ export function nameWords(name) {/** `nameWords` as one string, for the word regexes: 'HDRISky' → 'hdri sky'. */export function nameText(name) { return nameWords(name).join(' '); }+/** classifyBackdrop's shape rules (metres, fractions of the horizontal span). The scene-composition+ * skill quotes them; its `_claims` pin each one, so a change here fails that test. */+export const SKY_NAMED_SPAN_M = 50; // a sky-named mesh wider than this is sky+export const GROUND_NAMED_SPAN_M = 20; // a ground-named mesh wider than this ...+export const GROUND_NAMED_FLAT = 0.06; // ... and flatter than this fraction of its span is ground+export const GROUND_SPAN_M = 40; // ANY mesh wider than this ...+export const GROUND_FLAT = 0.02; // ... and flatter than this fraction of its span is ground+export const SKY_NAME_RE = /\b(sky|skydome|skybox|stars|clouds?|sun|moon|atmosphere)\b/i;export const GROUND_NAME_RE = /\b(ground|terrain|floor|water|ocean|sea|lake|river|plane|sand|grass|land)\b/i;@@ -89,7 +97,7 @@ export function classifyBackdrop(obj, box, contentSpan = 0) {const span = Math.max(sx, sz);// sunRig's MoonDisc can be only five metres wide in a compact worldShell, but// its non-depth-writing light image still must not move the scene's centre.- if (SKY_NAME_RE.test(name) && (span > 50 || nonSolid(obj))) return 'sky';+ if (SKY_NAME_RE.test(name) && (span > SKY_NAMED_SPAN_M || nonSolid(obj))) return 'sky';if (span > 2000 || (sy > 300 && span > 300)) return 'sky';// a small thing kilometres from the origin is a backdrop whatever it is called: the sun/moon// disc `sunRig` parks at 0.9 × the sky radius ('SunDisc' — no word boundary for the regex)@@ -98,8 +106,8 @@ export function classifyBackdrop(obj, box, contentSpan = 0) {Math.abs(box.min.z), Math.abs(box.max.z));if (far > 1500 && span < 0.1 * far) return 'sky';if (obj.isInstancedMesh) return 'content'; // scattered instances span the map but are not ground- if (span > 20 && sy < 0.06 * span && GROUND_NAME_RE.test(name)) return 'ground';- if (span > 40 && sy < 0.02 * span) return 'ground';+ if (span > GROUND_NAMED_SPAN_M && sy < GROUND_NAMED_FLAT * span && GROUND_NAME_RE.test(name)) return 'ground';+ if (span > GROUND_SPAN_M && sy < GROUND_FLAT * span) return 'ground';if (contentSpan > 0 && span > 2.5 * contentSpan && sy < 0.1 * span) return 'ground';return 'content';}diff --git a/harness/tests/skills/test_library.py b/harness/tests/skills/test_library.pyindex f65d28ab..940816a3 100644--- a/harness/tests/skills/test_library.py+++ b/harness/tests/skills/test_library.py@@ -3,12 +3,18 @@from __future__ import annotationsimport datetime as dt+import jsonimport refrom collections import defaultdictimport pytest-from codeverse3d.addons.skill_targets import check_claims, claim_bases, load_claims+from codeverse3d.addons.skill_targets import (+ check_claims,+ check_prompt_claims,+ claim_bases,+ load_claims,+)from codeverse3d.skills import bundle_dirs, iter_skills, skills_dir, validate_bundlefrom codeverse3d.skills.registry import ROUTES@@ -62,6 +68,31 @@ def test_every_bundle_is_valid_and_its_claims_are_current():assert PROVENANCE.search(window), (f"{skill.name} gives {match.group(0)!r} without nearby provenance")+ assert not check_prompt_claims(), check_prompt_claims() # prompts/_claims.toml, the same check+++_JS = "export const SPAN_M = 40;\n"++[email protected]("row,doc,js", [+ ({"text": "0.5 m", "python": "codeverse3d.spatial.frame_metrics:NEAR_HIT_M", "format": "{:.1f} m"},+ "stay 10.5 m back", _JS), # inside a longer number+ ({"text": "0.5 m", "python": "codeverse3d.spatial.frame_metrics:NEAR_HIT_M", "format": "{:.1f} m",+ "context": "near-hit"}, "near-hit: see below\nkeep 0.5 m", _JS), # not on the line that says what it is+ ({"text": "40 m", "js": "{js}:SPAN_M", "format": "{:.0f} m"}, "over 40 m", _JS.replace("40", "45")), # JS moved+ ({"text": "0, 1, 2.5, 4", "python": "codeverse3d.languages._gl_common:JUDGE_TIMES", "sep": ", "},+ "t = 0, 1, 2.5, 4, 6 s", _JS), # a sequence renders whole+], ids=["token", "context", "js", "sequence"])+def test_a_claim_fails_when_its_text_or_its_constant_moves(tmp_path, row, doc, js):+ """N48: prompts/**, a bundle's references/ and JS constants are pinned like a SKILL body — and a+ short number only counts where it stands as its own token, on the line its ``context`` names."""+ (tmp_path / "x.js").write_text(js)+ (tmp_path / "doc.md").write_text(doc)+ cells = {**row, "key": "k", "file": "doc.md"}+ if "js" in cells:+ cells["js"] = cells["js"].format(js=tmp_path / "x.js")+ (tmp_path / "_claims.toml").write_text("[[claim]]\n" + "".join(f"{k} = {json.dumps(v)}\n" for k, v in cells.items()))+ assert check_prompt_claims(tmp_path), rowdef test_no_two_skills_anywhere_point_one_claim_key_at_different_numbers():@@ -87,7 +118,7 @@ def test_co_routing_skills_render_a_shared_number_the_same_way():continuefor key in sorted(set(rows[a]) & set(rows[b])):ra, rb = rows[a][key], rows[b][key]- if (ra.get("scale"), ra.get("format")) != (rb.get("scale"), rb.get("format")):+ if any(ra.get(k) != rb.get(k) for k in ("scale", "format", "sep", "last_sep")):continueassert ra.get("text") == rb.get("text"), f"{a} and {b} disagree about {key}"