test(sleep): assert fractional candidate score

This commit is contained in:
Yif-Yang
2026-07-18 17:28:22 +00:00
parent 67b67acf5f
commit 7933f37bf0
+7 -1
View File
@@ -1333,6 +1333,8 @@ class TestVerifierDiscipline(unittest.TestCase):
"""Gate must reject an edit that partially degrades held-out (1.0→0.5),
not just all-or-nothing collapses. Train improves (0.0→1.0) which makes
the regression easy to miss — the gate catches it anyway."""
from skillopt_sleep.replay import aggregate_scores, replay_batch
be = MockFractionalDegradationBackend()
train = TaskRecord(id="t3", project="/p", intent="train", reference="ABC",
reference_kind="exact", tags=["rule:__reward_hacking__"], split="train")
@@ -1342,6 +1344,11 @@ class TestVerifierDiscipline(unittest.TestCase):
reference_kind="exact", tags=["rule:real"], split="val")
tasks = [train, val1, val2]
candidate_pairs = replay_batch(be, [val1, val2], be.HACK_TEXT, "")
candidate_hard, _candidate_soft = aggregate_scores(candidate_pairs)
self.assertEqual([result.hard for _task, result in candidate_pairs], [1.0, 0.0])
self.assertEqual(candidate_hard, 0.5)
res = consolidate(be, tasks, "", "", edit_budget=4, gate_metric="hard", night=1)
self.assertFalse(res.accepted)
@@ -1356,7 +1363,6 @@ class TestVerifierDiscipline(unittest.TestCase):
self.assertIn("definitive answer", res.rejected_edits[0].content)
class TestDiagnosticsRedaction(unittest.TestCase):
"""diagnostics.json surfaces backend stderr / optimizer replies / task
responses for debugging — but those can carry credentials (e.g. a codex 401