Align payload member length across targets - #129
Merged
Conversation
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
force-pushed
the
align-member-length
branch
from
August 25, 2026 23:41
4f736b0 to
f4019c0
Compare
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.
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: 1is 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 registerSingleElementPayload, an array register of one elementMixedMemberLength, a payload whose members declare no length,length: 1andlength: 2None 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-protocolandharp-devicefrom 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