Skip to content

test: termlens 0.10.1, the CLI, and the invariant the suite rests on - #103

Merged
vyncint merged 1 commit into
mainfrom
termlens-0.10
Sep 8, 2026
Merged

test: termlens 0.10.1, the CLI, and the invariant the suite rests on#103
vyncint merged 1 commit into
mainfrom
termlens-0.10

Conversation

@vyncint

@vyncint vyncint commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Upgrades the harness from 0.9 → 0.10.1 and puts the two things that ship beside it — the CLI and the skill — under test. 240 tests.

The upgrade cost three lines

0.10 spread drag's two coordinate pairs into four column-first arguments, so a transposed find result can no longer be handed over by mistake. That was the entire breakage; the other 236 tests passed unchanged.

tests/emulation.rs — the invariant everything else rests on

Every other file here asserts on a grid a VT emulator produced from mossaic's bytes. If mossaic emits a sequence that emulator does not implement, the grid is quietly wrong and every assertion in this repository is a claim about a plausible-looking fiction. 0.10's Screen::unsupported made that checkable, and the answer is clean:

mode dropped
text cells ["^[[59m"]
kitty ["^[[59m"]
sixel ["^[[59m"]

One SGR 59 — underline colour, which changes no cell. The list is pinned exactly, because anything joining it is a sequence that might change one. The image paths matter most here: they put bytes on the wire that no cell shows, so a drop there is invisible in every other assertion.

It also pins three things nothing else would notice: insert mode off (it would shift every row right and still look like a chart), no bells, and no wrapped rows (a wrapped row means the layout overflowed and the text is silently on two).

Plus round trips: a chart survives the snapshot text format byte for byte and JSON, with the palette intact — checked against a truecolour cell, since a round trip that dropped colour would still pass a text comparison.

tests/cli.rs — termlens-cli against mossaic's own screens

Saved, rendered to SVG with every truecolour the chart chose still in it (read off the live screen first, not hardcoded), and diffed. Plus inspect pointed at the real binary.

#[ignore]d: a cargo test that installs something behind a contributor's back is a surprise a published crate should not spring. CI runs it by name — the same arrangement smoke.rs already uses for the tests needing gh.

The skill, and a check so it cannot rot again

Refreshed to 0.10.1 (upstream vyncint/termlens#322 corrects the marker, since the file already described 0.10.1 behaviour). check-skill-version.sh asserts the copy and the dependency agree on major.minor. Nothing can diff it against upstream — the published crate does not ship the skill — but version agreement is the drift that actually happens. Verified it fails in both directions and tolerates a patch bump.

CI

TERMLENS_ARTIFACT_DIR on the test steps and termlens's report action on failure, so a red PTY test arrives as a picture in the job summary instead of a grid in a log. The action is SHA-pinned like everything else here.

One finding, filed not fixed

#102 — the event loop draws on every 80 ms tick whether or not anything changed, so an idle mossaic reports 244 repaints over a 20-second wait against 2 after load. Not a correctness bug (DEC 2026 is what stops it flickering), but it costs a wakeup and a write every 80 ms, and it makes this suite's wait_frame discipline load-bearing rather than belt-and-braces. Changing the event loop deserves its own consideration.

Upgrades the harness from 0.9 and puts the two things that ship beside it
under test.

The upgrade itself cost three call sites: 0.10 spread `drag`'s two
coordinate pairs into four column-first arguments, so a transposed `find`
result can no longer be handed over by mistake. Nothing else broke; 236
tests passed unchanged.

`tests/emulation.rs` is the new one worth reading. Every other file here
asserts on a grid a VT emulator produced from mossaic's bytes, so a
sequence the emulator does not implement makes that grid quietly wrong and
every assertion in the repository a claim about a plausible-looking
fiction. 0.10 made it checkable, and the answer is clean: in text, kitty
and sixel modes alike the only thing dropped is one `SGR 59` — underline
colour, which changes no cell. That list is now pinned exactly, because
anything joining it is a sequence that might change one. It also pins
three invariants nothing else would notice: no insert mode, no bells, no
wrapped rows.

`tests/cli.rs` drives termlens-cli against mossaic's own screens: saved,
rendered to SVG with every truecolour the chart chose still in it, and
diffed. It is `#[ignore]`d, because a `cargo test` that installs something
behind a contributor's back is a surprise a published crate should not
spring; CI runs it by name, the same arrangement smoke.rs uses for the
tests needing `gh`.

The vendored skill is refreshed to 0.10.1 and `check-skill-version.sh`
keeps it honest. Nothing can diff that copy against upstream — the
published crate does not ship the skill — but the two versions agreeing is
checkable, and that is the drift that actually happens. Verified it fails
in both directions and tolerates a patch bump.

CI now sets TERMLENS_ARTIFACT_DIR and runs termlens's `report` action on
failure, so a red PTY test arrives as a picture in the summary instead of
a grid in a log.

Found while measuring, filed as #102 rather than fixed here: the event
loop draws on every 80ms tick whether or not anything changed, so an idle
mossaic reports 244 repaints over a 20-second wait against 2 after load.

240 tests.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
@vyncint
vyncint merged commit 89552ac into main Sep 8, 2026
23 checks passed
@vyncint vyncint mentioned this pull request Sep 8, 2026
6 tasks
vyncint added a commit that referenced this pull request Sep 8, 2026
Patch release: the idle-repaint fix (#102/#104) and the termlens 0.10.1 upgrade with its two new suites (#103). cargo-semver-checks against 0.8.0 reports no semver update required. Gated on stress green at 10/10 on main.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
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