fix(actions): add downgraded:immediate_swift to ACTION_RESULT_REASONS (emitted since conformance L10 but absent from the published vocabulary); grep showed no other emitted-but-missing ActionResult reason (no_charge_path is a ChargeResult field) - drift guard test pins every _REASON_* constant against the frozenset

This commit is contained in:
2026-09-19 17:06:30 +02:00
parent 0ad627c97c
commit 9459adee02
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -10,7 +10,9 @@ from __future__ import annotations
from typing import Literal
import pf1e_simulator.combat as combat_mod
from pf1e_simulator.combat import (
ACTION_RESULT_REASONS,
Action,
CombatantState,
CombatEngine,
@@ -497,3 +499,16 @@ def test_damage_taken_reaction_fires() -> None:
result = engine.run()
assert any("reactor: short bow vs caster" in line for line in result.transcript)
assert caster_state.hp < 50
def test_downgraded_immediate_swift_is_in_action_result_reasons() -> None:
"""The reason vocabulary published to policies must contain every reason the
engine emits: downgraded:immediate_swift (swift dropped because an
in-turn immediate spent it) was emitted but missing from the frozenset."""
assert "downgraded:immediate_swift" in ACTION_RESULT_REASONS
emitted = {
value
for name, value in vars(combat_mod).items()
if name.startswith("_REASON_") and isinstance(value, str)
}
assert emitted <= set(ACTION_RESULT_REASONS)