fix(guardrails/alice_wonderfence): narrow self.guardrail_name to str for mypy

Base CustomGuardrail declares guardrail_name as Optional[str]. Our
__init__ requires a non-empty value (factory rejects empty), so override
the attribute type after super().__init__() to satisfy mypy on
dict-key indexing in _stash_resolved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lior-k 2026-04-30 20:34:11 +03:00
parent 2ade1208bc
commit 8092a22ddc
No known key found for this signature in database

View file

@ -158,6 +158,9 @@ class WonderFenceGuardrail(CustomGuardrail):
supported_event_hooks=supported_event_hooks,
**kwargs,
)
# Narrow attribute type: base class declares Optional[str], but our
# __init__ requires a non-empty string and the factory rejects empty.
self.guardrail_name: str = guardrail_name
key_suffix = f"***{self.api_key[-4:]}" if self.api_key else "<unset>"
logger.debug(