Decode declared EPICS DBR_CHAR waveforms as text - #645
Merged
Conversation
EPICS gives a char waveform holding a NUL-terminated string (e.g. tomoscan's ScanStatus, FileName) and one holding raw bytes (an NTNDArray image) the same wire type, so EpicsCaControlPort could only ever unpack it as an integer tuple. A deployment now declares which addresses on a route actually carry text via ControlPortRoute.text_addresses; declared addresses decode to Measurement(kind="Scalar", value=<str>), everything else is unaffected. Needed to read 2-BM's tomoscan status/filename PVs at all ahead of wiring an observer for them. Guards element_count > 1 so the declaration stays inert (rather than raising) against a length-1 char waveform, which aioca collapses to a non-iterable scalar type. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||
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
ScanStatus,FileName,FilePath,FullFileName) and one holding raw bytes (an NTNDArray image) the same wire type, soEpicsCaControlPortcould only ever unpack it as an integer tuple.ControlPortRoute.text_addresses; declared addresses decode toMeasurement(kind="Scalar", value=<str>), everything else is unaffected.element_count > 1so the declaration stays inert (rather than raising) against a length-1 char waveform, which aioca collapses to a non-iterable scalar type — caught by code review before commit and covered by a regression test.Test plan
pytest tests/unit/operation/test_control_port_config.py tests/integration/test_epics_ca_control_port.py— 47 passedpytest tests/integration/test_caproto_control_port.py tests/integration/test_epics_pva_control_port.py— confirms the shared soft-IOC db addition doesn't disturb sibling adapterspytest tests/architecture— 30408 passed, 621 skippedruff check/ruff format/pyright/tach checkall cleantext_addresses— no violations🤖 Generated with Claude Code