Harden the declared-name label in fwl-io list - #44
Merged
Merged
Conversation
A dataset name made only of invisible characters passed the manifest's non-empty check but still tried to print a label, leaving a bare indented line in `fwl-io list` output. Now the name is filtered and stripped once, and the label only prints when that leaves something. Also broadened the control-character test to cover tab, carriage return, and the Unicode line separator, not just newline, and added a case that distinguishes the strip from plain non-empty checks.
A name that differs from the key only by trailing whitespace or an invisible character, like "evil " or "evil" against the key "evil", still triggered the label print because the check ran against the raw name. After filtering it prints the same text as the key line above it, so list output showed the key twice. Now I filter and strip the name once and gate on that value against the key, so the check and the printed text always agree. Extended the tests with the trailing-space and trailing-invisible-character cases that reach this path.
Two manifest.write_text calls wrapped across lines that ruff format collapses to a single line once it fits under the limit. Running ruff format brings the file back in line so lint stays green.
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.
Harden the declared-name label that
fwl-io listprints below a dataset key, so a manifestnamefield cannot produce misleading output.The label is filtered to printable characters and stripped, then printed only when something remains and it does not collapse to the key already shown. This blocks three cases: a
namecarrying a control character cannot inject extra lines into the listing; anamethat filters to nothing prints no bare indented line; and anamethat differs from the key only by trailing whitespace or an invisible character does not repeat the key.Tests cover control characters (newline, tab, carriage return, line separator), an all-non-printable name, and a name that collapses to the key.