INNER CODE UNIT · Python
_protection_guard_note
qrak/LLM_trader · src/app.py:607
def _protection_guard_note(
self,
decision: TradeDecision | None,
protection_before: tuple[Any, Any] | None,
protection_after: tuple[Any, Any] | None,
) -> str | None:
"""Refuse an UPDATE whose protection snapshot is no longer current, or None.
Only consulted when the protection actually changed during the analysis (this
token pairs SL/TP and cannot version a REPLACED set; the executor's
``protection_version`` is the versioned guard — see ``_protection_version_guard``,
which runs on top of this one). The strategy's monotone guard then decides:
tightening passes, loosening is refused. Without that guard the safe answer is to
refuse, not to forward.
"""
if decision is None or str(getattr(decision, "action", "")).upper() != "UPDATE":
return None
if protection_before is None or protection_after is None: