Repository navigation
fix(decode): warn on a flag field that is stored empty - #164
Merged
Merged
Conversation
CLICK runs a flag that is stored empty as clear. decode() reads such a flag as set, and now emits a LegacyEncodingWarning for each one that encoding the rung again writes set. The warning names the field, such as Coil.oneshot or Send.sending, or the class and tag when no single field drives the flag. A kept blob gets the flag written as the encoder writes it, so the rung decodes again with no warning. Condition cells and a Tee are checked too. decode_program() does not warn: a program file writes a flag as a tag with no value, which is CLICK's own form. Every LegacyEncodingWarning now ends "Encode this rung again and paste it." 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.
Sam's ruling of 2026-11-19: an empty flag field still decodes as set, and
decode()now warns about it.CLICK runs a flag stored empty as clear, and CLICK's own saves never write one. An older laddercodec did write them, in blobs composed from program-file tags.
decode()now emits aLegacyEncodingWarningfor each empty flag that encoding the rung again writes set.What warns
Flags
decode()reads. There are 20 fields, such asCoil.oneshot,Contact.immediate,Math.mode,Drum.jog_enabledandSearch.continuous. The warning gives both values:Coil.oneshot: the flag is stored empty, so laddercodec reads it as True. CLICK runs it as False. Encode this rung again and paste it.Flags the encoder writes from another field. These are:
The warning names the one field that drives the flag. When no single field does, it names the class and tag, such as
OutVariantand1246=.Flags the encoder writes
0get no warning: RD, SD, Fill, Pack and Unpack.A kept blob has each flag written as the encoder writes it. Decode, encode, decode ends with no warning.
decode_program()never warns. A program file writes a flag as a tag with no value, which is CLICK's own form.The new ending. Every
LegacyEncodingWarningnow ends "Encode this rung again and paste it." That includes the existing MathH70000warning.Known gap
A Send or Receive that also holds a refused field gets no warning for its derived flags. Its kept blob keeps the flag empty, so it still encodes as CLICK ran it. v0.4.0 never wrote an empty flag in a Send or Receive.
Checks
decode_program()output is unchanged on all 134 program files.Gate
make lint: passed.make docs-build: passed.make test: 19014 passed, 139 skipped.