Files
tty7/crates/tty7-cli/tests
l0ng-ai 8dd23203b9 fix(cli): an error quoting a name cannot drive the terminal either
The previous commit sanitised the tables. Errors quote what was typed and
did not:

    $ tty7 ws rm "$(printf 'X\033[31mY\033[0m')"
    tty7: no workspace named 'X<ESC>[31mY<ESC>[0m' -- `tty7 ls` lists them

Measured across eight verbs with a hostile argument, every leak was on
stderr and none on stdout -- the tables cover the stdout side already, and
nothing else there embeds free-form input. So this is one boundary, not
one call per message: `main` sanitises whatever an error carries, and a
message written later is covered by having been written at all.

The sanitiser is the one from the tables rather than a second copy, which
is the mistake the daemon's two disconnect logs already made once.

stdout is deliberately left alone. `tty7 capture` prints a pane's stored
bytes with their escapes intact -- that is the point of the verb -- and
sanitising the report path would have quietly gutted it. Checked after
the change: 46 escape bytes still come back raw, `--plain` still returns
none, and the text is unchanged.

The e2e test runs the real binary, because the unit test covers the
sanitiser while only a spawned process covers the single call in `main`
that puts it on the error path -- the part an edit could drop with every
other test still green. It also asserts the name is still readable: a
message that hides which name was refused has traded one failure for
another.
2026-08-16 11:56:54 +08:00
..