Repository navigation
Conversation
The registration side of the delegate interface: a characteristic or a service gets a delegate property, and Service.configure_char accepts one. Assigning an instance or a class - instantiated with no arguments - is when everything about the delegate is decided: the driver records which methods it overrides, and an overridden method that is not a coroutine function fails right there with a TypeError. The read and write paths never introspect a delegate again; None or del removes it. The legacy setter_callback/getter_callback attributes become storage properties that keep returning the assigned callable, so existing code - the driver, the camera stack, tests that patch them - sees no change. Assigning a delegate does not remove a legacy callback; which one wins is decided when the pipelines dispatch delegates. The driver does not call delegates yet - that is the gate pipeline change. This wires them so everything about them is validated at assignment, as the interface promises.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor/getter-error-isolation #563 +/- ##
===================================================================
+ Coverage 92.06% 92.08% +0.02%
===================================================================
Files 54 54
Lines 10920 10996 +76
Branches 1407 1413 +6
===================================================================
+ Hits 10053 10126 +73
- Misses 579 582 +3
Partials 288 288
🚀 New features to boost your workflow:
|
Owner
Author
|
Closing per maintainer decision — continuing locally; the work continues on local branches and will return as PRs when the design settles. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #561 (APIs: #562). The registration side of the delegate interface — delegates can now be assigned and validated, still without being dispatched.
What
Characteristic.delegate/Service.delegateproperties — assign aCharacteristicDelegate/ServiceDelegateinstance, or its class (instantiated with no arguments).Noneordelremoves it.TypeErrornaming the method — no sync/async detection later, ever.Service.configure_char(..., delegate=...)wires a delegate while configuring the characteristic, alongside the legacy callbacks.setter_callback/getter_callbackonCharacteristicandServicekeep returning the assigned callable unchanged, so the driver, the camera stack and tests thatpatch.objectthem see no difference — including thedelattrteardown ofpatch.object, which is why the properties implement deleters. One instance may serve many characteristics; the context says which one a call is about.Not in this PR (deliberately): dispatch. The write and read pipelines call delegates starting with the next PR in the stack (the gate pipeline); until then a delegate is wired, validated, but not called. Which of delegate vs. legacy callback wins is also decided there. CHANGELOG stays untouched per review.
Tests
+14 tests: instance/class/removal/replacement round-trips, wrong-type and sync-override
TypeErrors with the right messages, hook recording, legacy/delegate coexistence, legacy removal semantics,configure_charwiring at both the instance and class level, and the service-level equivalents. Three existing tests reachassert_called_once_withthrough the old plain attributes; they now keep their mock in a local, which is cleaner anyway.Stack tip: 1743 tests pass, ruff clean,
tyat the pre-existing baseline with zero new findings, docs-Wclean.