Skip to content

fix: Check if plan parameter is subclass of Device#1368

Merged
tpoliaw merged 4 commits intomainfrom
device-lookup
Feb 19, 2026
Merged

fix: Check if plan parameter is subclass of Device#1368
tpoliaw merged 4 commits intomainfrom
device-lookup

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jan 30, 2026

The previous check for whether a parameter was a bluesky device (and
would therefore go via the string-to-device lookup) was based on the
type being an instance of one of the bluesky protocols.

isinstance(param_type, BLUESKY_PROTOCOLS)

For types, isinstance returns True if the type being compared to is a
protocol that is implemented but False if it is a class that is
extended.

This means that for a device that only extends Device, this check would
return False and the device could not be injected.

Including a check for the type being a subclass of Device allows all
device subclasses to be looked up.

@tpoliaw tpoliaw linked an issue Jan 30, 2026 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.15%. Comparing base (d0803d1) to head (0a67ad3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1368   +/-   ##
=======================================
  Coverage   95.15%   95.15%           
=======================================
  Files          43       43           
  Lines        3016     3016           
=======================================
  Hits         2870     2870           
  Misses        146      146           

☔ 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.

@tpoliaw tpoliaw marked this pull request as ready for review January 30, 2026 17:36
@tpoliaw tpoliaw requested a review from a team as a code owner January 30, 2026 17:36
@tpoliaw tpoliaw requested a review from abbiemery February 11, 2026 11:33
The previous check for whether a parameter was a bluesky device (and
would therefore go via the string-to-device lookup) was based on the
type being an instance of one of the bluesky protocols.

For a device that only extends `Device`, this check would return False
and the device could not be injected.

Including a check for the type being a subclass of Device allows all
device subclasses to be looked up.
get_origin returns 'Any | None' so we should accept the same
@tpoliaw tpoliaw merged commit fc472d9 into main Feb 19, 2026
18 checks passed
@tpoliaw tpoliaw deleted the device-lookup branch February 19, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants