fix(spine): the measured dichotomy decides — hints demoted to labeled fallbacks (#2461, Nick correction)

Nick caught the deviation: module verdicts were substring-guessed from names (memory→rust, gitea→go) with a silent rust default. Authority order now: the measured classification map (import-evidence) decides FIRST for every module; hint hits are labeled "(name hint)" so provenance is visible; unmeasured+unhinted modules are "unclassified" (12), never a guessed rust. Store rebuilt: 106 rust / 45 go measured, 33+7 hint-labeled, 23 test-infra, 12 honest unclassified. Battery 95 green (test updated to pin the authority contract).
This commit is contained in:
Nick committed 2026-10-06 02:28:16 +01:00
1 parent d4d43dbf67
commit d8ce21b76d
3 files changed
+408 -362

No files matched your search

+22 -4
View File
@@ -19,7 +19,9 @@ from __future__ import annotations
import json
from pathlib import Path
from rune.structural_store import add_entity, now
from rune.structural_store import (
add_entity, add_relationship, entity, new_doc, relationships, _sorted, now,
)
ROOT = Path(__file__).resolve().parents[2]
SRC_DIR = ROOT / "src" / "rune"
@@ -56,6 +58,14 @@ def _place_languages(doc: dict) -> int:
for e in doc.get("entities", []):
eid = e.get("id", "")
kind = e.get("kind", "")
# AUTHORITY ORDER (Nick's dichotomy, 2026-10-06 correction): the
# MEASURED classification map (import-evidence per module) decides
# FIRST. The name-hint lists are only a fallback for entities with
# no measurement — never allowed to override the evidence. A module
# with neither measurement nor hint is "unclassified", not a silent
# rust default.
measured = str(CLASSIFICATION_SIDES.get(
eid.split(":", 1)[1] if ":" in eid else eid, "") or "").upper()
if eid.startswith("contract:"):
lang = "n/a"
elif kind == "rust-crate":
@@ -66,14 +76,22 @@ def _place_languages(doc: dict) -> int:
lang = "n/a"
elif kind == "deployment_surface":
lang = "go"
elif measured == "RUST":
lang = "rust"
elif measured == "GO":
lang = "go"
elif measured == "TUI-LAST":
lang = "python-tui (Wave 6)"
elif measured == "TEST-INFRA" or measured == "RETIRES":
lang = "test-infra" if measured == "TEST-INFRA" else "retires"
elif "tui" in eid:
lang = "python-tui (Wave 6)"
elif any(h in eid for h in GO_HINTS):
lang = "go"
lang = "go (name hint)"
elif any(h in eid for h in RUST_HINTS):
lang = "rust"
lang = "rust (name hint)"
elif kind == "module":
lang = "rust"
lang = "unclassified"
elif kind == "subsystem":
# A subsystem is a CONTAINER — its language is its members'
# majority side per the measured dichotomy. The evidence map is
+377 -353
View File
File diff suppressed because it is too large. Load diff
+9 -5
View File
@@ -47,13 +47,17 @@ def test_language_verdicts_kind_defaults(doc):
assert by["contract:BUILDER-x"] == "n/a"
def test_language_verdicts_tui_and_hints(doc):
sl.add_entity(doc, id="module:rune_tui", kind="module")
sl.add_entity(doc, id="module:spine", kind="module")
def test_language_verdicts_measured_authoritative_then_hints(doc):
"""Nick's dichotomy correction: the measured map decides; hints only
label UNMEASURED entities and say so; nothing silently defaults."""
sl.add_entity(doc, id="module:rune_tui", kind="module") # TUI-LAST measured
sl.add_entity(doc, id="module:spine", kind="module") # RUST measured
sl.add_entity(doc, id="module:totally_unknown_name", kind="module")
sl._place_languages(doc)
by = {e["id"]: e["identities"]["language"] for e in doc["entities"]}
assert by["module:rune_tui"] == "python-tui (Wave 6)"
assert by["module:spine"] == "rust"
assert by["module:rune_tui"] == "python-tui (Wave 6)" # from the MAP
assert by["module:spine"] == "rust" # from the MAP
assert by["module:totally_unknown_name"] == "unclassified"
def test_subsystem_language_from_member_majority(doc):