Add memBase validation for devices with remote variables (ESROGUE-732)#1171
Merged
Conversation
- 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)
Contributor
There was a problem hiding this comment.
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
memBaseby walking ancestors so sub-devices can inherit a parent device’smemBase. - 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.
…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.
Contributor
There was a problem hiding this comment.
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.
slacrherbst
approved these changes
Apr 13, 2026
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.
Summary
_validateMemBase()toDevicethat raisesDeviceErrorwhen a device with RemoteVariables or RemoteCommands is added to Root without amemBase, catching silent runtime timeouts at start timenode._parent is node) thatRoot._rootAttached()creates, which safely handles Root subclasses without circular importsResolves ESROGUE-732
Test plan
test_remote_variable_no_membase_raises— DeviceError raised for RemoteVariable device without memBasetest_remote_command_no_membase_raises— DeviceError raised for RemoteCommand device without memBasetest_local_only_device_no_membase_passes— Local-only device starts without errortest_sub_device_inherits_membase— Child device inherits memBase from parenttest_root_subclass_no_membase_raises— DeviceError raised for Root subclass without memBase (no infinite loop)