Classification by recorded facts only: no name parser or tier words, no guessed classes; sisi workers classify prints the question for a cheap worker and --record validates and stores its answer; identity (maker, class) and release date drive supersession, inheritance, tie-break; route and session start ask only when it matters. done / next: proof on a copy, repeat runs, report

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-23 16:45:08 -07:00
1 parent d6bdb799c5
commit d36550d00f
15 files changed
+619 -677

No files matched your search

+16 -16
View File
@@ -1,5 +1,5 @@
"""Recency breaks ties: where the arithmetic falls back to a stable order, the more recently released model wins
first (a recorded release date, else the version within one line, else the old tie-break by worker id), and the
first (its recorded release date, else the old tie-break by worker id), and the
rule is in the text agents and people read. Requirement ids: R-7.2-1, R-7.2-2."""
import os, unittest
from support import *
@@ -9,27 +9,25 @@ from test_model_supersession import cand, pick
class RecencyTieBreakTests(unittest.TestCase):
def test_a_recorded_release_date_decides_a_tie_between_unrelated_models(self):
a = cand("prov/aaa-1.0", cost=1.0, fact={"released": "2026-01-10"}, maker="aaa")
b = cand("prov/bbb-2.0", cost=1.0, fact={"released": "2026-08-01"}, maker="bbb")
a = cand("prov/aaa-1.0", cost=1.0, rel="2026-01-10", maker="aaa")
b = cand("prov/bbb-2.0", cost=1.0, rel="2026-08-01", maker="bbb")
who, r = pick([a, b])
self.assertEqual(who, "prov/bbb-2.0")
self.assertIn(("prov/aaa-1.0", "equal on price and load; the choice is the more recently released"), r["passed_over"])
def test_the_version_inside_one_line_decides_when_nothing_supersedes(self):
old, new = cand("prov/abc-5.9", cost=1.0), cand("prov/abc-5.10", cost=1.0)
who, r = pick([old, new], opts={"supersede_guessed": False})
self.assertEqual(who, "prov/abc-5.10")
self.assertEqual(pick([new, old], opts={"supersede_guessed": False})[0], "prov/abc-5.10")
self.assertEqual(pick([b, a])[0], "prov/bbb-2.0")
def test_unknown_recency_keeps_the_old_tie_break(self):
a, b = cand("prov/aaa-1.0", cost=1.0, maker="aaa"), cand("prov/bbb-9.0", cost=1.0, maker="bbb")
a, b = cand("prov/aaa-1.0", cost=1.0, maker="aaa"), cand("prov/bbb-9.0", cost=1.0, maker="bbb", rel="2026-08-01")
who, r = pick([a, b])
self.assertEqual(who, "prov/bbb-9.0") # a recorded date beats none
a2, b2 = cand("prov/aaa-1.0", cost=1.0, maker="aaa", known=False), cand("prov/bbb-9.0", cost=1.0, maker="bbb", known=False)
who, r = pick([a2, b2])
self.assertEqual(who, "prov/aaa-1.0")
self.assertIn(("prov/bbb-9.0", "equal on price and load; the choice came first in worker-id order"), r["passed_over"])
def test_price_and_load_still_come_before_recency(self):
cheap_old = cand("prov/aaa-1.0", cost=0.5, fact={"released": "2026-01-10"}, maker="aaa")
dear_new = cand("prov/bbb-2.0", cost=1.0, fact={"released": "2026-08-01"}, maker="bbb")
cheap_old = cand("prov/aaa-1.0", cost=0.5, rel="2026-01-10", maker="aaa")
dear_new = cand("prov/bbb-2.0", cost=1.0, rel="2026-08-01", maker="bbb")
self.assertEqual(pick([cheap_old, dear_new])[0], "prov/aaa-1.0")
@@ -58,11 +56,13 @@ class TextTests(unittest.TestCase):
class SessionLineTests(SisiCase):
def test_session_start_asks_for_the_release_date_of_each_worker_that_lacks_one(self):
def test_session_start_names_unclassified_workers_in_the_one_facts_line(self):
from sisi import workers
line = workers.facts_line()
self.assertIn("release date", line)
self.assertIn("--released", line)
line = workers.facts_line(unclassified=2)
self.assertEqual(len(line.splitlines()), 1)
self.assertIn("2 routable workers have no recorded maker, class and release date", line)
self.assertIn("sisi workers classify", line)
self.assertNotIn("classify", workers.facts_line(unclassified=0))
if __name__ == "__main__":