191 build - поправлены старые падения, проверены 3 матча и 6 агентов одновременных

This commit is contained in:
2026-10-21 13:41:47 +03:00
parent 787f880c0e
commit bf5e0d3101
52 changed files with 4024 additions and 730 deletions

View File

@@ -7,6 +7,8 @@ from types import SimpleNamespace
from hockey_data.agent_bridge import VmixAgentHub
from hockey_data.auth_bridge import HockeyUser
from tests.support import LocalTestDatabase
from tests.timer_contract_support import assert_current_build_contract
from tests.test_build103_space_timer_fast_transport import run_transport_contract
ROOT = Path(__file__).resolve().parents[1]
APP_JS = (ROOT / "ui_builder/static/app.js").read_text(encoding="utf-8")
@@ -25,38 +27,18 @@ class FakeWebSocket:
return None
def _block(start: str, end: str) -> str:
return APP_JS.split(start, 1)[1].split(end, 1)[0]
def test_countdown_start_hard_reseeds_before_start() -> None:
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
assert 'Function: "PauseRender"' in helper
assert 'Function: "StopCountdown"' in helper
assert 'Function: "SetCountdown"' in helper
assert 'Function: "ResumeRender"' in helper
assert 'Function: "StartCountdown"' in helper
assert helper.index('Function: "StopCountdown"') < helper.index('Function: "SetCountdown"')
assert helper.rindex('Function: "SetCountdown"') < helper.rindex('Function: "StartCountdown"')
"""Keep the historical test ID; a fresh start now seeds once without render/reset wrappers."""
run_transport_contract("native_first_start")
def test_pause_is_reseeded_from_runtime_not_native_clock() -> None:
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
branch = helper.split('if (action === "stop" || action === "pause" || action === "set")', 1)[1].split('return reseedStopped;', 1)[0]
assert "Runtime value" in branch
reseed = helper.split("const reseedStopped = [", 1)[1].split("];", 1)[0]
assert 'Function: "StopCountdown"' in reseed
assert 'Function: "SetCountdown"' in reseed
assert 'Value: currentValue' in reseed
"""Keep the historical ID; BUILD159 replaces reseeding with native pause/resume."""
run_transport_contract("native_pause_resume")
def test_scoreboard_show_syncs_timer_before_overlay_steps() -> None:
runner = _block("async function runShortcutSequence", "function handleConfiguredShortcutCombo")
assert "if (sequence.is_scoreboard_sequence)" in runner
assert runner.index("await syncConfiguredScoreboardCountdownsToRuntime()") < runner.index("const stepErrors = []")
helper = _block("async function syncConfiguredScoreboardCountdownsToRuntime", "function penaltyMirrorKey")
assert 'timerState.running ? "start" : "set"' in helper
assert "await sendRuntimeVmixTimerSequence(commands)" in helper
run_transport_contract("scoreboard_before_overlay")
def test_ordered_timer_transport_sends_individual_frames_without_ack(tmp_path: Path) -> None:
@@ -89,11 +71,11 @@ def test_ordered_timer_transport_sends_individual_frames_without_ack(tmp_path: P
hub.run_vmix_sequence_for_user(
user,
[
{"Function": "PauseRender", "Input": "SCORE"},
{"Function": "StopCountdown", "Input": "SCORE", "SelectedName": "TIME.Text"},
{"Function": "SetCountdown", "Input": "SCORE", "SelectedName": "TIME.Text", "Value": "00:16:01"},
{"Function": "ResumeRender", "Input": "SCORE"},
{"Function": "SetCountdown", "Input": "SCORE", "SelectedName": "TIME.Text", "Value": "00:20:00"},
{"Function": "StartCountdown", "Input": "SCORE", "SelectedName": "TIME.Text"},
{"Function": "SetCountdown", "Input": "PENALTY", "SelectedName": "TIME.Text", "Value": "00:02:00"},
{"Function": "StopCountdown", "Input": "PENALTY", "SelectedName": "TIME.Text"},
{"Function": "StartCountdown", "Input": "PENALTY", "SelectedName": "TIME.Text"},
],
delivery_mode="timer-fast-ordered",
),
@@ -104,7 +86,7 @@ def test_ordered_timer_transport_sends_individual_frames_without_ack(tmp_path: P
batches = [item for item in ws.sent if item.get("type") == "vmix.batch"]
assert not batches
assert [item["command"]["Function"] for item in singles] == [
"PauseRender", "StopCountdown", "SetCountdown", "ResumeRender", "StartCountdown"
"SetCountdown", "StartCountdown", "SetCountdown", "StopCountdown", "StartCountdown"
]
assert result["ok"] is True
assert result["transport"] == "timer-ordered-no-ack"
@@ -115,5 +97,5 @@ def test_ordered_timer_transport_sends_individual_frames_without_ack(tmp_path: P
def test_build106_version() -> None:
assert 'BUILD_VERSION = "2026.08.24.9"' in APP
assert 'delivery_mode: "timer-fast-ordered"' in APP_JS
assert_current_build_contract()
run_transport_contract("ordered_transport")