Skip to content

chore: Update device and plans to use model name - #1697

Draft
oliwenmandiamond wants to merge 30 commits into
mainfrom
Remove_outdated_name_from_client_plans_and_devices
Draft

oliwenmandiamond wants to merge 30 commits into
mainfrom
Remove_outdated_name_from_client_plans_and_devices

Conversation

@oliwenmandiamond

Copy link
Copy Markdown
Contributor

As requested by @ZohebShaikh , this is done in a separate PR. The only logic that has changed is to remove the redundant name for Plan and DeviceRef as the model.name attribute shares the exact same one. The previous logic duplicated the name. Instead, we remove the name attribute and just delegate to the model for the name.

@oliwenmandiamond
oliwenmandiamond requested a review from a team as a code owner October 13, 2026 10:11
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (89952c9) to head (76d43ca).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1697      +/-   ##
==========================================
- Coverage   96.42%   96.42%   -0.01%     
==========================================
  Files          49       49              
  Lines        3749     3745       -4     
==========================================
- Hits         3615     3611       -4     
  Misses        134      134              

☔ View full report in Codecov by Harness.
📢 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.

@oliwenmandiamond oliwenmandiamond changed the title Update device and plans to use model name chore: Update device and plans to use model name Oct 13, 2026
@oliwenmandiamond
oliwenmandiamond added this pull request to stack #1698 October 13, 2026 10:18
oliwenmandiamond and others added 4 commits October 13, 2026 13:08
Co-authored-by: Zoheb Shaikh <zoheb.shaikh@diamond.ac.uk>
Co-authored-by: Zoheb Shaikh <zoheb.shaikh@diamond.ac.uk>
Co-authored-by: Zoheb Shaikh <zoheb.shaikh@diamond.ac.uk>
@oliwenmandiamond
oliwenmandiamond force-pushed the Remove_outdated_name_from_client_plans_and_devices branch from 3d0d15a to 6314ac0 Compare October 13, 2026 12:10
@oliwenmandiamond
oliwenmandiamond force-pushed the Remove_outdated_name_from_client_plans_and_devices branch from 6314ac0 to f6553fd Compare October 13, 2026 12:18
…github.com:DiamondLightSource/blueapi into Remove_outdated_name_from_client_plans_and_devices
@oliwenmandiamond
oliwenmandiamond marked this pull request as draft October 13, 2026 13:54
Base automatically changed from Split_client_devices_and_plans to main October 13, 2026 13:56
@oliwenmandiamond
oliwenmandiamond force-pushed the Remove_outdated_name_from_client_plans_and_devices branch from 6586ab6 to 6be2823 Compare October 13, 2026 13:56
…github.com:DiamondLightSource/blueapi into Remove_outdated_name_from_client_plans_and_devices
@oliwenmandiamond

oliwenmandiamond commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@ZohebShaikh, I had a look at your integration test and also tested it myself locally

>>> pl.rd(devs.stage.x)
Traceback (most recent call last):
  File "<python-input-9>", line 1, in <module>
    pl.rd(devs.stage.x)
    ~~~~~^^^^^^^^^^^^^^
  File "/scratch/bluesky_development/blueapi/src/blueapi/client/plan_cache.py", line 78, in __call__
    match self._client.run_task(req):
          ~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/scratch/bluesky_development/blueapi/.venv/lib/python3.14/site-packages/observability_utils/tracing/decorators.py", line 151, in wrapper
    return func(*args, **kwargs)
  File "/scratch/bluesky_development/blueapi/src/blueapi/client/client.py", line 361, in run_task
    task_response = self._rest.create_task(task)
  File "/scratch/bluesky_development/blueapi/src/blueapi/client/rest.py", line 256, in create_task
    return self._request_and_deserialize(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        "/tasks",
        ^^^^^^^^^
    ...<3 lines>...
        data=task.model_dump(mode="json", fallback=_task_model_fallback),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/scratch/bluesky_development/blueapi/.venv/lib/python3.14/site-packages/observability_utils/tracing/decorators.py", line 151, in wrapper
    return func(*args, **kwargs)
  File "/scratch/bluesky_development/blueapi/src/blueapi/client/rest.py", line 340, in _request_and_deserialize
    raise exception
blueapi.client.rest.InvalidParametersError: [ParameterError(loc=['body', 'params', 'readable'], msg='Value error, Device stage-x cannot be found', type='value_error', input='stage-x')]

I now understand why we have a name for the model and the name for the cache. The issue is the name being used is stage-x. This relates to DiamondLightSource/dodal#2216 I raised a couple of weeks ago. Basically, dodal/ophyd-async treats all sub devices names like this: parent-child-x. However, blueapi internally treats all devices names like this: parent.child.x. So there is a conflict on the device name and the blueapi name for a device. So this must be unified first before we can make this change.

So the options are

  1. We make a change in ophyd-async that allows us to override the deliminator between sub device to be . and then apply this to dodal. MX have already expressed they do not want to do this.
  2. Blueapi updates the naming it uses to look up devices to use - to separate devices.

I and I think others would prefer option 2. It would be too painful to update ophyd-async plus dodal plus all plan repos to account for this. It is simpler to make blueapi to look up devices using the actual name given to them.

@oliwenmandiamond

Copy link
Copy Markdown
Contributor Author

Blocked by #1700

@abbiemery

Copy link
Copy Markdown
Contributor

From many past conversations, 1 is not an option. Happy to discuss 2.

@fajinyuan
fajinyuan force-pushed the Remove_outdated_name_from_client_plans_and_devices branch 2 times, most recently from f17053e to 6146e62 Compare October 21, 2026 11:02
@fajinyuan
fajinyuan marked this pull request as ready for review October 21, 2026 11:03
fajinyuan
fajinyuan previously approved these changes Oct 21, 2026

@fajinyuan fajinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please mark this a breaking API change, and ensure change log records this for release.

@oliwenmandiamond

Copy link
Copy Markdown
Contributor Author

@fajinyuan I think this can't be merged yet. This change focuses on the client, simplifying the name. However, the server still uses the old name which is different and will cause the client to fail. #1700 is needed first which hasn't been done yet. I think once #1699 is merged which adds more system tests for client, it will demonstrate the issue and cause this to fail system tests

@oliwenmandiamond
oliwenmandiamond marked this pull request as draft October 21, 2026 13:11
@oliwenmandiamond
oliwenmandiamond force-pushed the Remove_outdated_name_from_client_plans_and_devices branch from 6146e62 to e6b19b4 Compare October 21, 2026 16:02
…github.com:DiamondLightSource/blueapi into Remove_outdated_name_from_client_plans_and_devices
@abbiemery

Copy link
Copy Markdown
Contributor

Please mark this a breaking API change, and ensure change log records this for release.

This is a draft and shouldn't be approved yet. In addition we still need to decide some things about it.

@abbiemery
abbiemery dismissed fajinyuan’s stale review October 21, 2026 19:07

This is still a draft and depends on other work before it is viable.

This branch has not been deployed

No deployments
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.

3 participants