Skip to content

feat(device): simplify device info structure by removing redundant keys#1007

Open
wakonig wants to merge 2 commits into
mainfrom
feature/simplify_device_info
Open

feat(device): simplify device info structure by removing redundant keys#1007
wakonig wants to merge 2 commits into
mainfrom
feature/simplify_device_info

Conversation

@wakonig

@wakonig wakonig commented Jul 23, 2026

Copy link
Copy Markdown
Member

Description

This PR simplifies the device info: https://github.com/bec-project/bec/pull/1007/changes#diff-48a79e17403712240993cc8b6d62287987743c8c3f9c064dbd858f64b491aea4L311

The device name is already part of the device info message so we don't need to add it to the info as well. With the device name gone, there is no need for a nesting.

Additional Comments

This should allow us to write a proper device info api more cleanly.

We need to update some tests in BW though.

Definition of Done

  • Documentation is up-to-date.

Copilot AI review requested due to automatic review settings July 23, 2026 08:29
@wakonig
wakonig marked this pull request as draft July 23, 2026 08:29

Copilot AI 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.

Pull request overview

This PR flattens the device info payload structure by removing the redundant device_info wrapper key (and associated nested access patterns), updating both server-side serialization and client/test expectations accordingly.

Changes:

  • Flatten get_device_info() output in the device server serializer (remove the device_info wrapper).
  • Update DeviceBase/DeviceManager and multiple test fixtures to consume the flattened info structure.
  • Adjust tests and mocks that construct/inspect device info dicts (signals, ownership mode, hints, sub-devices).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
bec_server/tests/tests_device_server/test_device_serializer.py Updates assertions to read flattened keys (e.g., info["signals"], info["ownership_mode"]).
bec_server/bec_server/scan_server/tests/scan_fixtures.py Updates scan test fixtures to pass flattened device info into DeviceBase.
bec_server/bec_server/device_server/devices/device_serializer.py Flattens the get_device_info() return structure by removing device_info nesting.
bec_lib/tests/test_dap_plugins.py Updates mocked DeviceBase(info=...) construction to match flattened info format.
bec_lib/bec_lib/tests/utils.py Updates multiple device-info mocks/messages to the flattened structure.
bec_lib/bec_lib/devicemanager.py Updates device manager parsing/instantiation to read top-level info keys.
bec_lib/bec_lib/device.py Updates DeviceBase to store the entire info dict directly and parse flattened sub-device/custom-access shapes.
Comments suppressed due to low confidence (1)

bec_lib/bec_lib/tests/utils.py:419

  • There should be two blank lines between the end of the # fmt: off/on block and the next top-level function definition to satisfy Black/PEP8; otherwise the formatter check may fail.
# fmt: on
def get_device_info_mock(device_name, device_class) -> messages.DeviceInfoMessage:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bec_server/bec_server/scan_server/tests/scan_fixtures.py
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@wakonig
wakonig marked this pull request as ready for review July 23, 2026 08:49
@wakonig wakonig self-assigned this Jul 23, 2026
@wakonig
wakonig requested a review from a team July 23, 2026 08:51
@wakonig
wakonig force-pushed the feature/simplify_device_info branch from 7c8db5e to 2ff613c Compare July 23, 2026 08:53
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.

2 participants