Skip to content

fix(mecatui): kitty mascot never rendered on Ghostty — downscale before transmit + spec-level verifier - #165

Merged
JAORMX merged 3 commits into
mainfrom
fix/mecatui-kitty-mascot-ghostty-render
Jun 25, 2026
Merged

JAORMX merged 3 commits into
mainfrom
fix/mecatui-kitty-mascot-ghostty-render

Conversation

@JAORMX

@JAORMX JAORMX commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

The welcome-splash kitty mascot (the mecatito dog, issue #44) painted nothing on Ghostty. The previous fix (a=t → a=T, commit 1282545) was necessary but not sufficient: TransmitMascot sent the full 1254×1254 PNG (~1 MB across ~265 base64 chunks) even though it displays at ~60×30 cells. Two things compound:

  1. The exact a=T/U=1/U+10EEEE virtual-placement pattern mecatl uses is known-buggy on Ghostty 1.3.1 stable (ghostty-org/ghostty#13056): a large multi-chunk transmit renders at only a fraction of its intended width, fixed only on Ghostty tip.
  2. With q=2 (response suppression) on every chunk, a dropped/malformed chunk in that huge payload paints nothing — silent failure, no error surfaces.

The fix

Downscale before transmit. downscaleMascot box-downscales the mascot to the target cols×rows cell footprint before PNG re-encoding, reusing the same alpha-weighted box-average the half-block path uses (buildGrid), so the two renders sample the dog identically and the terminal does no pixel scaling.

Payload: ~1 MB (265 chunks) → ~4.3 KB (1 chunk) — a 246× reduction, sidestepping the worst of the Ghostty virtual-placement bug.

The reliability layer

The existing tests only checked the control-key strings (a=T, U=1, c=, r=, i=, f=100) — none ever proved the bytes a terminal actually consumes are self-consistent. That is exactly the class issue #44's a=t bug slipped past: the control keys parsed fine, f=100 claimed PNG, yet a terminal painted nothing.

TestTransmitAndPlaceholderAgree is a spec-level verifier that reassembles the escape the way a terminal does and asserts the full render contract against the real image bytes:

  • ✅ reassembled base64 payload is a valid, decodable PNG
  • ✅ PNG dimensions match the downscale footprint (cols × rows*2)
  • ✅ image ID in the transmit's i= matches the ID encoded in the PlaceholderGrid's foreground SGR color (the precise contract that broke under a=t — a mismatch means the grid references an image the terminal never placed)
  • ✅ placeholder grid dimensions match the transmit's c=×r=

Mutation-verified — breaking the downscale, the transmit ID, or the grid ID each turns the verifier red with a precise message; restoring turns it green.

TestTransmitMascotPayloadBounded (≤100 KB ceiling) pins the downscale-before-transmit so a regression to the ~1 MB multi-chunk transmit fails CI.

Test plan

  • task lint green
  • task test green (full suite, race, engine-standalone, api-compat)
  • task docs:check green (0 broken links/anchors)
  • go run ./cmd/mecademo prints a full offline session unchanged
  • Mutation test: 3 breakages (downscale dims, transmit ID, grid ID) each fail the verifier; restore passes
  • Live eyeball on Ghostty (dev env has no Kitty terminal — this is the one check a CI test cannot provide)

Closes #44 (for real this time).

🤖 This PR was authored by mecatl.

jhrozek and others added 2 commits June 25, 2026 09:37
Same class of staticcheck SA5011 failure as #185: a t.Fatalf nil-check
without a trailing return makes staticcheck flag the next line as a
possible nil pointer dereference. Adds the missing return after each
t.Fatal in the three engine-module test files CI flagged.

- engine/adapter/eventsource/review_test.go (result nil-check)
- engine/adapter/sessnap/sessnap_test.go (restoredCall nil-check)
- engine/agent/childregistry_internal_test.go (registry entry nil-check)
@JAORMX
JAORMX force-pushed the fix/mecatui-kitty-mascot-ghostty-render branch from 02625eb to 40539e3 Compare June 25, 2026 06:39
The #174 docs split created 11 docs/usage/*.md leaf files that had inbound
links from the usage.md landing page's TOC but no outbound links onward —
each was a 'dead-end' under matlatl's graduated-structure check. mecatl's
.matlatl.yml promotes dead-ends from Info to Warning, and the CI docs gate
runs --strict, so warnings fail the build.

Adds a short 'See also' cross-link block to the tail of each dead-end file,
linking to a natural sibling and back to the operator-guide index. This is
the minimal fix: one outbound link clears the finding per file.

Regenerates llms.txt (task docs:llms) for the changed markdown.
@JAORMX
JAORMX merged commit e6f51bc into main Jun 25, 2026
13 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.

Mascot is not displayed in the kitty terminal in Linux on the splash/welcome screen

2 participants