Skip to main content

✅ Recursive trigger depth limit

CategoryAbility
StatusPassing
Testtests/test_events.py::test_recursive_trigger_depth_limit

A trigger that fires another event of the same type recursively

Preconditions

  • Trigger registered for DAMAGE_DEALT on unit "001"

  • Handler calls fire_event internally, passing _depth+1 to properly chain depth.

  • P1's Duban (#001) on field

Action

  • fire_event(state, GameEvent(DAMAGE_DEALT, ...), _depth=0)

Expected Postconditions

  • State is returned (no crash, no infinite loop)

  • Handler was called exactly MAX_TRIGGER_DEPTH times (depths 0..9), then stopped

Assertions

assert isinstance(result, GameState)
assert call_count["n"] == MAX_TRIGGER_DEPTH