v1: hamilton: hold the STAR error definitions once, in star/driver/errors - #1221
Merged
Conversation
…/errors` The exception classes, the error-code table and the message tables lived inside the legacy backend. Moved to pylabrobot/hamilton/star/driver/errors.py, which the legacy backend now imports from and re-exports, so the v1 driver does not have to reach into pylabrobot.legacy or carry a second copy. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The STAR error definitions - the exception classes, the error-code table and the message tables - live inside the legacy backend, so the v1 driver would have to either import them from
pylabrobot.legacyor carry a second copy.error_code_to_exception,trace_information_to_string,STARFirmwareError,star_firmware_string_to_errorandconvert_star_module_error_to_plr_errorintopylabrobot/hamilton/star/driver/errors.pySlaveErrortoSubsystemError, in its message text as well as its name, and keepsSlaveErroras an aliasBehaviour
Unchanged. Every error code maps to the same exception, every message string is the same, and the legacy backend's own error parsing is untouched.
The move is otherwise line-for-line. The one structural change is that the module-name table is now a module-level constant instead of a dictionary rebuilt on each call; its entries are unchanged.
Tests
The existing suite passes unchanged. Equivalence was also checked directly against
main: 200 error codes, 2730 module/trace messages, 1323 whole replies and 294 error conversions decode identically, and a simulated protocol covering the channels, the 96-head and the iSWAP emits 480 byte-identical commands.