From f8bc461c8e9356b11507acc8ac48d38417e28a18 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Thu, 20 Aug 2026 13:31:20 +0200 Subject: [PATCH] test(edl): pin the full-transcript contract with words outside the old window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing test's words all sat inside the removed ±45s window, so it passed with or without the change. Add words starting 160s after the clip ends: the old windowed code drops them, the new contract ships them. Also assert the words arrive sorted by start time, which the editor's follow-along binary search depends on. --- tests/test_rerender_endpoint.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_rerender_endpoint.py b/tests/test_rerender_endpoint.py index 8445141..5bb3247 100644 --- a/tests/test_rerender_endpoint.py +++ b/tests/test_rerender_endpoint.py @@ -121,6 +121,28 @@ class TestGetEdl: # Self-host meters nothing. assert data["rerender_minutes"] == 0 + def test_ships_words_far_outside_the_clip(self, job): + """The EDL carries the WHOLE source transcript. The old ±45s window + would drop these words (clip ends at 40s, they start at 200s), and a + cut can only be extended into material whose words were sent.""" + meta = json.loads(job["meta_path"].read_text()) + meta["transcript"]["segments"].append({ + "start": 200.0, "end": 260.0, "text": "distant tail", + "words": [ + {"word": "distant", "start": 200.0, "end": 200.4}, + {"word": "tail", "start": 259.0, "end": 259.5}, + ], + }) + job["meta_path"].write_text(json.dumps(meta)) + + data = _request("GET", f"/api/clip/{JOB_ID}/0/edl").json() + assert [w["w"] for w in data["words"]] == [ + "hello", "world", "again", "distant", "tail"] + # Word order is the binary-search invariant the editor's follow-along + # highlight depends on. + starts = [w["s"] for w in data["words"]] + assert starts == sorted(starts) + def test_reports_missing_source(self, job): os.remove(job["dir"] / "src.mp4") data = _request("GET", f"/api/clip/{JOB_ID}/0/edl").json()