Skip to content

Harden the declared-name label in fwl-io list - #44

Merged
timlichtenberg merged 3 commits into
mainfrom
tl/list-skip-blank-label
Sep 15, 2026
Merged

timlichtenberg merged 3 commits into
mainfrom
tl/list-skip-blank-label

Conversation

@timlichtenberg

Copy link
Copy Markdown
Member

Harden the declared-name label that fwl-io list prints below a dataset key, so a manifest name field 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 name carrying a control character cannot inject extra lines into the listing; a name that filters to nothing prints no bare indented line; and a name that 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.

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.
@timlichtenberg
timlichtenberg merged commit 539d9d3 into main Sep 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant