Repository navigation
fix(lint): stop reporting lengths that can never truncate - #7
Open
venugopalanvip wants to merge 1 commit into
Open
venugopalanvip wants to merge 1 commit into
venugopalanvip wants to merge 1 commit into
Conversation
Two false positives in ValidateMaxLengthLinter, both the same shape: it
measures a string that never reaches a screen against the limit for strings
that do. This repository is the library clear-signing-erc7730-registry now
installs for its `validate descriptors` job, so the noise lands on every
contributor there.
1. A hidden label cannot be truncated. `_collect_long_labels` measured every
label, including fields the device never draws. Descriptors routinely spell
out hidden struct leaves in full -- it is how a reader tells
`#._referrerConfig.basisPoints` from `#._clientConfig.basisPoints`.
`never` and `mustMatch` are skipped. `ifNotIn` and `optional` are not: both
reach a screen at least some of the time. `mustMatch` is worth spelling out
because convert_erc7730_v2_input_to_calldata already lets such a field omit
its label entirely, so warning about a long one contradicted the converter.
2. `{path}` is template syntax, not displayed text. `interpolatedIntent` was
measured as written, so the braces and the path inside them counted toward
the 30 character limit -- `{execution.desc.minReturnAmount}` is 32 on its
own. Only the literal text is certain to reach the screen, so that is what
is measured now. Over the limit on that alone means it truncates whatever
the values render to.
Measured across every descriptor in the registry at 0fbe25b:
long labels on hidden fields 83 warnings, none of which can truncate
long labels on visible fields 24 warnings, all kept
interpolatedIntent over 30 111, of which 87 are placeholder text only
and 24 genuinely too long, all kept
Co-Authored-By: Claude Opus 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.
Two false positives in
ValidateMaxLengthLinter, both the same shape: it measures a string that never reaches a screen against the limit for strings that do.This matters here rather than only upstream because this is the library
clear-signing-erc7730-registryinstalls for itsvalidate descriptorsjob since ethereum/clear-signing-erc7730-registry#3008, so the noise lands on every contributor there.1. A hidden label cannot be truncated
_collect_long_labelsmeasured every label, including fields the device never draws:That field is
"visible": "never". Descriptors routinely spell out hidden struct leaves in full — it is how a reader tells#._referrerConfig.basisPointsfrom#._clientConfig.basisPoints.alwaysoptionalifNotInnevermustMatchmustMatchis worth spelling out: it is a constraint the device enforces without displaying the field, which is exactly whyconvert_erc7730_v2_input_to_calldataalready lets such a field omit its label —A linter that permits no label while warning about a long one contradicts the converter.
2.
{path}is template syntax, not displayed textinterpolatedIntentwas measured as written, so the braces and the path inside them counted toward the 30-character limit. Neither is displayed, and the length of the value replacing them is not knowable here — an amount may render as1 ETHor as eighteen decimal places.The clearest case in the registry:
116 characters as written, 33 of literal text.
{execution.desc.minReturnAmount}alone is 32 characters of path that never reaches a device.Measured across the registry, at 0fbe25b
interpolatedIntentover 30 as writtenSo 170 of the 218 warnings in this family are about characters that never reach a device, and all 48 real ones survive.
Only the literal text is certain to reach the screen, so that is what is measured now. Over the limit on that alone means the intent truncates whatever the values render to — conservative, and it keeps every genuine case.
Scope and tests
Both remain warnings; nothing changes an exit code. Neither touches
intent,id,metadataor enum lengths, which are literal strings and were always measured correctly.tests/v2/lint/test_lint_validate_max_length.pyis new: all six visibility rules, aResolvedFieldGroupcase proving a hidden child does not hide its visible sibling's label, and the literal-length measure including a 32-character path inside a placeholder and a literal that is genuinely over.Also raised upstream as LedgerHQ/python-erc7730#341, unreviewed. Sending it here too since this is the copy the registry runs.