Skip to content

Add memBase validation for devices with remote variables (ESROGUE-732)#1171

Merged
ruck314 merged 3 commits into
pre-releasefrom
ESROGUE-732
Apr 13, 2026
Merged

Add memBase validation for devices with remote variables (ESROGUE-732)#1171
ruck314 merged 3 commits into
pre-releasefrom
ESROGUE-732

Conversation

@ruck314

@ruck314 ruck314 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add _validateMemBase() to Device that raises DeviceError when a device with RemoteVariables or RemoteCommands is added to Root without a memBase, catching silent runtime timeouts at start time
  • Walk the ancestor chain to allow sub-devices that inherit memBase from a parent to continue working
  • Detect Root via the parent self-cycle (node._parent is node) that Root._rootAttached() creates, which safely handles Root subclasses without circular imports
  • Add 5 unit tests covering all validation cases: RemoteVariable error, RemoteCommand error, local-only pass, inherited memBase pass, Root subclass error

Resolves ESROGUE-732

Test plan

  • test_remote_variable_no_membase_raises — DeviceError raised for RemoteVariable device without memBase
  • test_remote_command_no_membase_raises — DeviceError raised for RemoteCommand device without memBase
  • test_local_only_device_no_membase_passes — Local-only device starts without error
  • test_sub_device_inherits_membase — Child device inherits memBase from parent
  • test_root_subclass_no_membase_raises — DeviceError raised for Root subclass without memBase (no infinite loop)
  • Full existing test suite passes with no regressions

ruck314 added 2 commits April 4, 2026 09:41
- Add _validateMemBase method to Device that raises DeviceError when a device
  has RemoteVariable children but no memBase in its ancestor chain
- Call _validateMemBase from _buildBlocks after remVars list is assembled
- Detect Root via type().__name__ to avoid circular import with _Root
- Covers VALID-01 through VALID-04: raises for missing memBase, silent for
  local-only devices, silent for sub-devices inheriting memBase from parent
- Tests for RemoteVariable device without memBase raising DeviceError (TEST-01)
- Tests for RemoteCommand device without memBase raising DeviceError (TEST-02)
- Tests for local-only device without memBase starting successfully (TEST-03)
- Tests for sub-device inheriting memBase from parent (TEST-04)
@ruck314 ruck314 changed the title Add memBase validation for devices with remote variables Add memBase validation for devices with remote variables (ESROGUE-732) Apr 4, 2026
@ruck314 ruck314 requested a review from Copilot April 5, 2026 06:10

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

Adds a startup-time validation to prevent devices that declare remote memory-mapped nodes from being attached to a root tree without any upstream memBase, avoiding otherwise silent runtime timeouts during initialization.

Changes:

  • Add Device._validateMemBase() and invoke it from _buildBlocks() when remote-backed nodes are present.
  • Validate memBase by walking ancestors so sub-devices can inherit a parent device’s memBase.
  • Add unit tests covering error and non-error cases for remote variables/commands and inherited memBase.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
python/pyrogue/_Device.py Adds ancestor-walk memBase validation and hooks it into block-building.
tests/core/test_core_validate_membase.py Introduces tests for the new validation behavior across several device configurations.

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

Comment thread python/pyrogue/_Device.py
Comment thread python/pyrogue/_Device.py
Comment thread tests/core/test_core_validate_membase.py
…validateMemBase

Replace type(node).__name__ == 'Root' with node._parent is node to detect
the tree root. The old approach failed for Root subclasses (e.g. MemoryRoot)
because the class name wouldn't match 'Root', causing an infinite loop.
Also update docstring to reflect RemoteCommand coverage and add a test
for Root subclass validation.

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

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


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

Comment thread python/pyrogue/_Device.py
@ruck314 ruck314 merged commit 2dfce31 into pre-release Apr 13, 2026
11 checks passed
@ruck314 ruck314 deleted the ESROGUE-732 branch April 13, 2026 16:51
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