Five ways the scripted output lied, and the name that crashed it
The review pass found the CLI breaking its own written rules. A node broadcasts its own name, so every name the CLI prints is remote data — and Rich read `[...]` in it as a style tag. A node called `[bold]Loud` printed as `Loud`, silently no longer the string that identifies it; a node called `[/]Bob` raised MarkupError and took the command down. The log handler then failed the same way while reporting it, replacing the diagnostic with a traceback about the diagnostic. No log line and no scripted line is ever marked up, so all three consoles now say so. `right=` never right-aligned anything. Rich's `Text.wrap` returns early on `overflow="ignore"`, above the justify step, so asking for one threw the other away — every numeric lane in the CLI was left-aligned while CLAUDE.md, script.py's own docstring and the manual all said otherwise. "crop" refuses to elide just as firmly and still aligns. `config show` printed an empty string as `""` and `config set` read those two characters literally, so feeding a dump back in replaced every empty setting with a pair of quote marks — and the next dump looked identical, so nothing ever said so. It also masked an *unreported* PIN behind six bullets, telling the reader the radio was PIN-locked when it was not: `conceal` already declined to mask the menu's absence token and had simply never been shown the CLI's. `meshterm about` drew the `---` above its colophon as a rule sized to the console, which on a 16384-cell console is one 48KB line in a 4KB page. A rule is a frame; the scripted copy drops it with the QR. The contract fixture set only `--db`, which moves the history and nothing else — so the suite read whatever was in the developer's own ~/.meshterm. That is how `[/]Bob`, planted by hand on one machine, could crash the suite there and pass everywhere else. $MESHTERM_HOME moves the whole directory. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4a91845651
commit
369e29e44a
9 files changed
+194
-22
No files matched your search
+19
-5
@@ -153,7 +153,15 @@ def columns(*headers: str, right: Sequence[str] = ()) -> Table:
|
||||
header,
|
||||
justify="right" if header in wanted else "left",
|
||||
no_wrap=True,
|
||||
overflow="ignore",
|
||||
# "crop", not "ignore". Both refuse to elide — neither ever writes the "…"
|
||||
# that would make a key or a route unusable to the caller — but Rich's
|
||||
# ``Text.wrap`` returns early on "ignore" (text.py: ``if overflow ==
|
||||
# "ignore": lines.append(line); continue``) and that early return is *above*
|
||||
# the justify step, so "ignore" silently discards ``justify="right"``. The
|
||||
# two settings differ only past the console's 16384 cells, where "crop" cuts
|
||||
# and "ignore" also cuts; they differ on every line before that, where only
|
||||
# "crop" aligns.
|
||||
overflow="crop",
|
||||
)
|
||||
return table
|
||||
|
||||
@@ -179,8 +187,8 @@ def pairs(rows: Iterable[tuple[str, str]]) -> Table:
|
||||
expand=False,
|
||||
padding=(0, GUTTER, 0, 0),
|
||||
)
|
||||
table.add_column(no_wrap=True, overflow="ignore")
|
||||
table.add_column(no_wrap=True, overflow="ignore")
|
||||
table.add_column(no_wrap=True, overflow="crop")
|
||||
table.add_column(no_wrap=True, overflow="crop")
|
||||
for key, value in rows:
|
||||
table.add_row(key, value)
|
||||
return table
|
||||
@@ -294,6 +302,12 @@ def console(stream: Any = None) -> Console:
|
||||
soft_wrap=True,
|
||||
highlight=False,
|
||||
emoji=False,
|
||||
# A node broadcasts its own name, so every name on this console is remote data.
|
||||
# Rich reads `[...]` as a style tag: `[bold]Loud` printed as `Loud` — silently
|
||||
# corrupted, and no longer the string that identifies the node — while `[/]Bob`
|
||||
# raised MarkupError and took the whole command down with it. Nothing the scripted
|
||||
# CLI prints is ever marked up, so the parser has nothing to do here but misfire.
|
||||
markup=False,
|
||||
)
|
||||
|
||||
|
||||
@@ -312,7 +326,7 @@ def stderr_console() -> Console:
|
||||
|
||||
from .theme import active_theme
|
||||
|
||||
return Console(file=sys.stderr, theme=active_theme())
|
||||
return Console(file=sys.stderr, theme=active_theme(), markup=False, emoji=False)
|
||||
|
||||
|
||||
# -- the safety net ------------------------------------------------------------------
|
||||
@@ -349,7 +363,7 @@ def flatten(renderable: RenderableType) -> list[RenderableType]:
|
||||
renderable.padding = (0, GUTTER, 0, 0)
|
||||
for column in renderable.columns:
|
||||
column.no_wrap = True
|
||||
column.overflow = "ignore"
|
||||
column.overflow = "crop"
|
||||
column.ratio = None
|
||||
return [renderable]
|
||||
if isinstance(renderable, Group):
|
||||
|
||||
Reference in new issue
Block a user