Merge pull request #646 from AssetOverflow/feat/router-organ-hygiene-pr
test(contemplation): standing router-organ-hygiene invariant
This commit is contained in:
commit
e98289ee89
2 changed files with 92 additions and 0 deletions
36
docs/analysis/router-organ-hygiene-invariant-2026-06-08.md
Normal file
36
docs/analysis/router-organ-hygiene-invariant-2026-06-08.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Router-organ hygiene — standing invariant
|
||||
|
||||
**Rule:** *No organ may block another organ's legitimate proposal unless it has first positively
|
||||
recognized the input as belonging to its own family.*
|
||||
|
||||
Operationally, in the multi-organ contemplation router (`route_setup` → contemplation pass):
|
||||
|
||||
> On any **other** organ's text, when an organ refuses, the refusal reason must map to the
|
||||
> non-substantive `input_shape` family ("not my domain") — **never** a substantive boundary and
|
||||
> **never** a growth surface.
|
||||
|
||||
## Why this exists
|
||||
|
||||
The contemplation pass classifies an `all_refused` problem **boundary-first**: a substantive
|
||||
`must_remain_refused` family (anything but `input_shape`) blocks any proposal. That is correct
|
||||
*within* an organ's domain — but if an organ emits a substantive boundary on text that is **not**
|
||||
its domain, it silently **suppresses another organ's legitimate proposal**.
|
||||
|
||||
This exact hazard has now appeared three times:
|
||||
|
||||
| Where | Organ | Over-broad refusal | Fix |
|
||||
|---|---|---|---|
|
||||
| N6 | R2 | `category_pair_not_found` on any non-R2 text | → `input_shape`; `missing_category_pair` reserved |
|
||||
| R3e | R3 | `temporal_state` (clock detector) on non-rate text | kept a boundary, **not** a growth surface |
|
||||
| R3.1 | R3 | `missing_rate` on non-rate R2 text (blocked an R2 proposal) | claim only with a duration present; else `not_rate_shaped` → `input_shape` |
|
||||
|
||||
## The gate
|
||||
|
||||
`tests/test_router_organ_hygiene.py` enforces it for every organ × every other organ's gold. It is
|
||||
**MUST-PASS before any new organ joins `route_setup`**: add the new organ's gold to `_GOLD` and its
|
||||
classifier to `_ORGANS`, and the rule is enforced for free.
|
||||
|
||||
In plain terms — an organ's refusals on foreign text must say *"not my problem"*, never *"this is a
|
||||
broken problem of my kind."* Only a refusal that follows **positive recognition** of the organ's own
|
||||
structure (e.g. R3's `missing_time` requires a rate clause; `rate_unit_mismatch` requires a rate
|
||||
clause + a duration) may be a substantive boundary.
|
||||
56
tests/test_router_organ_hygiene.py
Normal file
56
tests/test_router_organ_hygiene.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
"""Standing router-hygiene invariant.
|
||||
|
||||
**No organ may block another organ's legitimate proposal unless it has first POSITIVELY recognized
|
||||
the input as belonging to its own family.**
|
||||
|
||||
Operationally: on every OTHER organ's gold corpus, when an organ refuses, the refusal reason must
|
||||
map to the non-substantive ``input_shape`` family ("not my domain") — never a substantive boundary
|
||||
and never a growth surface. (An organ reading foreign text as ``setup_correct`` would be the
|
||||
ambiguity case, separately guaranteed to be 0 by the router tests.) A substantive boundary on
|
||||
foreign text is what lets one organ suppress another organ's legitimate proposal (boundary-first),
|
||||
the exact hazard caught at N6 (``category_pair_not_found``), R3e (``temporal_state``), and R3.1
|
||||
(``missing_rate``).
|
||||
|
||||
This is a MUST-PASS gate before any future organ joins ``route_setup``: add the new organ's gold
|
||||
to ``_GOLD`` and its classifier to ``_ORGANS``, and this test enforces the rule for free.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from core.comprehension_attempt import (
|
||||
classify_r1,
|
||||
classify_r2,
|
||||
classify_r3,
|
||||
family_for_reason,
|
||||
)
|
||||
from evals.constraint_oracle.runner import _load_r2_gold
|
||||
from evals.rate_oracle.runner import _load_rate_gold
|
||||
from evals.setup_oracle.runner import _load_r1_gold
|
||||
|
||||
_ORGANS = {
|
||||
"r1_quantitative": classify_r1,
|
||||
"r2_constraints": classify_r2,
|
||||
"r3_rate": classify_r3,
|
||||
}
|
||||
_GOLD = {
|
||||
"r1_quantitative": _load_r1_gold,
|
||||
"r2_constraints": _load_r2_gold,
|
||||
"r3_rate": _load_rate_gold,
|
||||
}
|
||||
|
||||
|
||||
def test_no_organ_claims_a_substantive_boundary_on_foreign_text() -> None:
|
||||
for owner, load in _GOLD.items():
|
||||
for fx in load():
|
||||
for organ_name, classify in _ORGANS.items():
|
||||
if organ_name == owner:
|
||||
continue
|
||||
att = classify(fx["text"])
|
||||
if att.outcome != "setup_refused":
|
||||
continue # setup_correct on foreign text == ambiguity (guarded == 0 elsewhere)
|
||||
fam = family_for_reason(att.refusal_reason)
|
||||
assert fam is not None and fam.name == "input_shape", (
|
||||
f"{organ_name} refused {owner}'s {fx.get('id')!r} with reason "
|
||||
f"{att.refusal_reason!r} -> family {fam.name if fam else None!r}; an organ must "
|
||||
f"refuse foreign text as input_shape (not-my-domain), never a substantive boundary"
|
||||
)
|
||||
Loading…
Reference in a new issue