test: termlens 0.10.1, the CLI, and the invariant the suite rests on - #103
Merged
Conversation
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>
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.
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 transposedfindresult 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 onEvery 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::unsupportedmade that checkable, and the answer is clean:["^[[59m"]["^[[59m"]["^[[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 screensSaved, rendered to SVG with every truecolour the chart chose still in it (read off the live screen first, not hardcoded), and diffed. Plus
inspectpointed at the real binary.#[ignore]d: acargo testthat installs something behind a contributor's back is a surprise a published crate should not spring. CI runs it by name — the same arrangementsmoke.rsalready uses for the tests needinggh.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.shasserts 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_DIRon the test steps and termlens'sreportaction 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_framediscipline load-bearing rather than belt-and-braces. Changing the event loop deserves its own consideration.