Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@elupus
Copy link
Contributor

@elupus elupus commented Nov 29, 2025

Add callback wrapper to application controller
that catches exceptions heading for event loop
and logs these with device context

Remove the now unneeded handling of this
in CallbackListener.

Add callback wrapper to application controller
that catches exceptions heading for event loop
and logs these with device context

Remove the now unneeded handling of this
in CallbackListener.
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.29%. Comparing base (7c805e0) to head (68f4758).
⚠️ Report is 3 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1715   +/-   ##
=======================================
  Coverage   99.29%   99.29%           
=======================================
  Files          63       63           
  Lines       12263    12271    +8     
=======================================
+ Hits        12177    12185    +8     
  Misses         86       86           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MattWestb
Copy link
Contributor

This fix is needed for problems with device checkins and also other cases like end device is offline or having problems that is not possible see what device is having the problems only "some" ZHA devices as its today.

@puddly puddly merged commit 13645a4 into zigpy:dev Dec 17, 2025
12 checks passed
async def test_callback_wrapping(
app: zigpy.application.ControllerApplication, ieee, caplog
) -> None:
# The default is True
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: stale comment

Suggested change
# The default is True

async def test_callback_wrapping_async(
app: zigpy.application.ControllerApplication, ieee, caplog
) -> None:
# The default is True
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: stale comment

Suggested change
# The default is True


def wrap_callback(
self, src: zigpy.device.Device | zigpy.listeners.ANY_DEVICE, callback: _C
) -> _C:
Copy link
Contributor

Choose a reason for hiding this comment

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

So this likely doesn't really matter with how we use it, but for a sync callback, the returned callable can now also return None if an exception occurs. So, the return type is not really _C anymore.

For async callbacks, the returned wrapper is a sync function that fires the task and returns None, so also not _C at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I suppose it might be possible to unwrap the callable into its basic elements like the register function is defined and add the None return. We could probably also just have it be a none return.

@elupus elupus deleted the fix/handle_checkin_resp branch December 18, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants