From c27d2f0916ebc230a9542516340cf80a90a7bd2e Mon Sep 17 00:00:00 2001 From: frindle <69526085+frindle@users.noreply.github.com> Date: Tue, 1 Dec 2026 14:34:03 -0800 Subject: [PATCH] Test: live-session promote order no longer depends on thread timing The live session's promote runs on its own thread outside the concurrency limit, so it can be recorded just after the queue's first promote. The test now checks that it ran as a want and that the queue kept episode order. It failed once on a comment-only PR. --- tiering/offload/tests/test_runner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tiering/offload/tests/test_runner.py b/tiering/offload/tests/test_runner.py index f00b67a..9805df6 100644 --- a/tiering/offload/tests/test_runner.py +++ b/tiering/offload/tests/test_runner.py @@ -237,7 +237,12 @@ def test_live_session_then_season_in_episode_order_then_rest(tmp_path, monkeypat w.deck = [{"ratingKey": "99"}] w.sessions = [{"ratingKey": "30"}] w.run() - assert w.ops("promote") == ["e30", "e50", "e40", "e20", "m99"] + ops = w.ops("promote") + # The live session's promote is a want: it starts on its own thread, outside the limit, so it + # can be recorded just before or just after the queue's first promote. The queue keeps its order. + assert sorted(ops) == ["e20", "e30", "e40", "e50", "m99"] + assert "e30" in w.runner.want_last + assert [o for o in ops if o != "e30"] == ["e50", "e40", "e20", "m99"] def test_promote_concurrency_cap(tmp_path, monkeypatch):