Make EasyCom event review wearer anchor first

This commit is contained in:
Xin Wang
2026-09-14 23:30:31 +08:00
parent 06b5e6c385
commit 65347dd75d
12 changed files with 336 additions and 107 deletions

View File

@@ -194,6 +194,37 @@ class FloorEventReviewTests(unittest.TestCase):
self.assertEqual(record["review"]["human_subtype"], "EOT_WEARER_BACKCHANNEL")
self.assertTrue(record["review"]["relabeled"])
def test_eot_review_selects_only_a_supplied_opportunity_anchor(self) -> None:
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
_, events = self._fixture(root)
candidates = load_candidates([events])
candidate = candidates[0]
candidate.payload["temporal_evidence"] = {
"opportunity_options": [
{"uid": "release-1", "anchor_seconds": 1.0, "participant_id": 4}
]
}
store = ReviewStore(root / "reviews.jsonl", candidates)
base = {
"human_action": "relabel", "human_verdict": "POSITIVE",
"human_event_type": "EOT_RESPONSE", "human_subtype": None,
"exclude_reason": None, "boundary_correction_seconds": None,
"confidence": "high", "notes": "clear response",
}
record = store.save(
candidate.candidate_id, {**base, "selected_opportunity_uid": "release-1"}
)
self.assertEqual(record["review"]["selected_opportunity_uid"], "release-1")
self.assertEqual(
record["review"]["valid_prediction_interval_seconds"], [1.0, 1.2]
)
with self.assertRaisesRegex(ValueError, "requires one supplied"):
store.save(
candidate.candidate_id,
{**base, "selected_opportunity_uid": "invented"},
)
def test_byte_ranges(self) -> None:
self.assertEqual(parse_byte_range("bytes=2-5", 10), (2, 5))
self.assertEqual(parse_byte_range("bytes=7-", 10), (7, 9))