Skip to content

Align payload member length across targets - #129

Merged
glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:align-member-length
Aug 25, 2026
Merged

Align payload member length across targets#129
glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:align-member-length

Conversation

@glopesdev

@glopesdev glopesdev commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

A payload member that declares a length now generates an array in the Python target whatever number the length holds, matching the rule the C# target already follows. A member declaring length: 1 is an array on both sides, and a member declaring no length remains a single value.

Test coverage

The test device metadata gains three registers, which between them generate every combination of the length rule for the first time:

  • MultiElementPayload, an array register
  • SingleElementPayload, an array register of one element
  • MixedMemberLength, a payload whose members declare no length, length: 1 and length: 2

None of these was generated during the tests before, so a disagreement of this kind could not fail a test. The interop test writes frames through the generated C# interface and reads them back through the generated Python one, so all three cases are now compared across both stacks on every run.

Interop dependency

The interop test resolves harp-protocol and harp-device from the published 0.5.0 release, so it no longer builds them from a git commit. That is the first release that decodes multi-element payloads for array registers declared through subclassing, which is how this generator declares them, and the new registers are the first to exercise it. The upstream fix is harp-tech/python#44.

The same release exports ArrayConverter, so #123 is no longer waiting upstream.

Notes for review

Generated output for every existing register is unchanged, because no member in the test metadata declared length: 1. The additions to the expected output files are the three new registers and the firmware register bank size that follows from them.

Closes #124

@glopesdev
glopesdev requested a review from bruno-f-cruz August 25, 2026 13:19
@glopesdev glopesdev added the fix Pull request that fixes an issue label Aug 25, 2026
A payload member declaring a length now generates an array in the
Python target whatever number the length holds, matching the C# rule,
so a member declaring length 1 is an array on both sides. A member
declaring no length still generates a single value.

The test device metadata gains three registers covering an array
register, a single element array register, and a payload with members
at no length, length 1 and length 2. None of those cases was generated
during the tests before.

The interop test now resolves harp-protocol and harp-device from the
published 0.5.0 release rather than from a git commit. That is the
first release that sizes payloads for array registers declared through
subclassing, which the new registers are the first to exercise.

Closes harp-tech#124
@glopesdev
glopesdev force-pushed the align-member-length branch from 4f736b0 to f4019c0 Compare August 25, 2026 23:41
@glopesdev
glopesdev merged commit 6fa63c8 into harp-tech:main Aug 25, 2026
9 checks passed
@glopesdev
glopesdev deleted the align-member-length branch August 25, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull request that fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Payload member length disagrees between the C# and Python targets

1 participant