Repository navigation
fix(send-receive): write a TCP address without leading zeros - #168
Merged
Merged
Conversation
ModbusTcpTarget kept a padded address such as 010.002.003.004 as given. Each part is a decimal number, so the target now holds 10.2.3.4, and to_csv(), write_csv and encode() write that form. A part of zeros is 0. The same values are refused, with the same code, reason and CLICK id. A clipboard or program file can hold a padded address. The decoders read it in the written form, and the Send or Receive keeps the blob it was decoded from while it is unchanged, so encode() writes the padded address back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrite the CHANGELOG entry as three sentences and a Do line. Correct the editor-answers note that said a padded address is written as given. Say in the _check_ip docstring that it sets target.ip. Add the TCP address to the places that list the forms a decoder reads in another form. Test the program-file decode against the real coverage fixture, padding each TCP address in it and comparing the kept blob with the clipboard's blob of the same box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first line of the _check_ip docstring now says that the function sets target.ip as well as refusing an address. The IP_PADDED reason is wrapped to the file's line length with its text unchanged. Co-Authored-By: Claude Opus 5.5 <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.
ModbusTcpTargetaccepted a TCP address with leading zeros, such as010.002.003.004, and wrote it as given. v0.4.0 did the same. CLICK's Send and Receive dialog reads each part as a decimal number and saves it without leading zeros:010is 10, not octal 8. Sam ruled on 2026-11-20 that laddercodec writes the address the way the dialog saves it. This follows the rule for addresses: accept what CLICK accepts, and write the form that CLICK writes.What changes:
ModbusTcpTargetholds each part as a decimal number without leading zeros. A part that is all zeros becomes0.read_csv,from_csv_token,to_csv,write_csvandencode()all go through the constructor, so they agree.decode()anddecode_program()read such an address without its leading zeros. While the Send or Receive is unchanged,encode()writes the blob that it was decoded from, with the padded address. That is the same rule as for the other fields that CLICK saves in another form. Once you change a field, the address is written without leading zeros.tests/fixtures/scr_captures/coverage.scr. It checks that each decoded Send and Receive keeps a blob that equals the matching box incoverage.bin, with only the address changed.AGENTS.mddecoding notes and one reason text intests/test_editor_answers.pysay what the code now does. No recorded CLICK answer and no golden changed.Gate:
make lint,make test(19166 passed, 139 skipped) andmake docs-buildpassed on 097f007. The last commit changes a docstring and wraps a string.make lintand the two affected test files passed on it.Nothing waits on Sam. No CLICK check is needed, because no golden changed and CLICK accepts an address without leading zeros.