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

@@ -1,3 +1,4 @@
from tests.timer_contract_support import run_timer_contract, assert_current_build_contract
from pathlib import Path
from hockey_data.service import HockeyDataService
@@ -42,14 +43,26 @@ def _strength(*penalties: dict) -> dict:
def test_prepared_penalty_does_not_change_strength_until_explicit_start():
prepared = _strength(_penalty("home", 120000, started=False))
assert prepared["strength_label"] == "5×5"
assert prepared["advantage_side"] == ""
"""Incomplete drafts do not count; a complete assigned penalty changes strength immediately."""
from copy import deepcopy
ready = _penalty("home", 120000, started=False)
for missing, value in (("side", ""), ("infraction", None), ("preset", ""),
("durationMs", 0), ("remainingMs", 0), ("finished", True)):
draft = deepcopy(ready)
draft[missing] = value
result = _strength(draft)
assert result["strength_label"] == "5×5", missing
assert result["advantage_side"] == "", missing
prepared = _strength(ready)
assert prepared["strength_label"] == "4×5"
assert prepared["advantage_side"] == "away"
assert prepared["state_label"] == "БОЛ"
assert ready["running"] is False and ready["startedOnce"] is False
started = _strength(_penalty("home", 120000, started=True))
assert started["strength_label"] == "4×5"
assert started["advantage_side"] == "away"
assert started["state_label"] == "БОЛ"
assert started["strength_label"] == prepared["strength_label"]
assert started["advantage_side"] == prepared["advantage_side"]
def test_complex_transition_strength_sequence_matches_requested_flow():
@@ -94,28 +107,13 @@ def test_complex_transition_strength_sequence_matches_requested_flow():
def test_runtime_holds_single_plate_through_temporary_equal_strength():
start = APP_JS.index("function penaltyDisplayEntriesByTargetSide")
end = APP_JS.index("function hockeyPenaltySideMappingDetail", start)
block = APP_JS[start:end]
assert "canHoldEqualStrength" in block
assert "state.hockeyPenaltyAdvantageCycle.hadAdvantage" in block
assert "lastAdvantageSide" in block
assert "const canHoldEqualStrength = Boolean(state.hockeyPenaltyAdvantageCycle.hadAdvantage)" in block
assert 'home: rememberedSide === "home" && transitionEntry ? [transitionEntry] : []' in block
assert 'away: rememberedSide === "away" && transitionEntry ? [transitionEntry] : []' in block
assert 'home: advantageSide === "home" && transitionEntry ? [transitionEntry] : []' in block
assert 'away: advantageSide === "away" && transitionEntry ? [transitionEntry] : []' in block
assert "holdingEqualStrength" in block
# The countdown source remains the globally soonest active penalty.
assert "const transitionEntry = all[0] || null;" in block
"""Current native timer contract, executed against production functions."""
run_timer_contract('strength_plate_cycle')
def test_pure_equal_strength_without_previous_advantage_still_has_no_plate():
start = APP_JS.index("function penaltyDisplayEntriesByTargetSide")
end = APP_JS.index("function hockeyPenaltySideMappingDetail", start)
block = APP_JS[start:end]
assert "if (!canHoldEqualStrength)" in block
assert "return { home: [], away: [], routedToAdvantage: false" in block
"""Current native timer contract, executed against production functions."""
run_timer_contract('strength_plate_cycle')
def test_advantage_cycle_is_saved_and_restored_for_reload_during_4x4():
@@ -141,11 +139,9 @@ def test_advantage_cycle_is_saved_and_restored_for_reload_during_4x4():
def test_full_strength_waits_for_last_started_penalty_not_prepared_draft():
control = APP_JS.split("function controlHockeyPenalty", 1)[1].split("function formatHockeyPenaltyTime", 1)[0]
assert "hockeyPenaltyHasStarted(item)" in control
ticker = APP_JS.split("function updateHockeyPenaltyBoards", 1)[1].split("function registerHockeyBoardNode", 1)[0]
assert "remainingTotal = board.penalties.filter((item) => !item.finished && hockeyEventReady(item) && hockeyPenaltyHasStarted(item)).length" in ticker
"""Current native timer contract, executed against production functions."""
run_timer_contract('full_strength_waits_ready')
def test_build96_runtime_version():
assert 'BUILD_VERSION = "2026.08.20.17"' in APP
assert_current_build_contract()