fix(fakefocuser): return primitive types to keep metadata bus-serializable#241
Open
wschoenell wants to merge 1 commit into
Open
fix(fakefocuser): return primitive types to keep metadata bus-serializable#241wschoenell wants to merge 1 commit into
wschoenell wants to merge 1 commit into
Conversation
…ature Coerce internal state and return values to Python int/float so metadata remains serializable over the bus. Previously, callers (e.g. autofocus routines) could pass numpy scalars into move_to/_set_position, causing get_metadata to emit np.int64 values that the bus encoder rejects. Co-Authored-By: Claude Opus 4.7 (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.
Summary
FakeFocuser.get_positionandget_temperaturecould leaknumpyscalar types (e.g.np.int64) into the FITS metadata returned byFocuserBase.get_metadata, which the bus encoder cannot serialize._positiontointon assignment and castget_position/get_temperaturereturn values to native Pythonint/float.Context
Observed in the wild as:
…raised from
chimera/core/bus.pywhen a remote bus tried to serialize aResponsecontaining('FOCUS', np.int64(2500), ...). The numpy value originates from autofocus routines that callmove_to(position)with a numpy scalar;_set_positionpreviously stored it as-is.The fix is at the source (the focuser itself) rather than papering over it in
get_metadata, so all consumers ofget_position/get_temperaturesee a primitive.Test plan
numpy.int64serialization errormove_tostill works when called with numpy scalars🤖 Generated with Claude Code