Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/scenex/adaptors/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,25 @@ def handle_event(self, info: EmissionInfo) -> None:
# Parent change events are handled by the parent adaptor.
return

arg = info.args[0]
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

info.args[0] can raise IndexError if an emission occurs with no positional args (even if uncommon). Since this value is only used for logging and passing to the setter, consider guarding (e.g., check info.args length) or using a safe fallback before indexing.

Copilot uses AI. Check for mistakes.
try:
name = self.SETTER_METHOD.format(name=signal_name)
setter = getattr(self, name)
except AttributeError as e:
if len(info.path) > 1:
# A length 2+ path implies a child event bubbling up to a parent that
# doesn't have a handler for it. Let's just ignore it.
nested_name = "".join(f".{step.attr}" for step in info.path)[1:]
logger.debug(
"EVENT: %r ignored %s=%r (bubbling up, no handler)",
type(self),
nested_name,
arg,
)
return
logger.exception(e)
return

arg = info.args[0]
logger.debug("EVENT: %r -> %s=%r ", type(self), signal_name, arg)

try:
Expand Down
Loading