Skip to content

Add ctypes differential corpus suite against libghostty-vt 1.0 #12

Open

Description

@tony

Summary

DEFAULT_PROFILE in #2 has not yet been differentially verified in CI against a compiled Ghostty libghostty-vt 1.0+ shared library across a recorded multi-application session corpus, leaving default-profile divergences outside tmux pane mode (TMUX_PROFILE) to manual spot checks. In addition, pytest --cov under-reports branch coverage (65% vs 79%) because pytest11 entry-point discovery imports libvt before coverage starts tracing, and docs/ lacks an auto-generated per-profile sequence conformance matrix.

Motivation

libghostty-vt reached a stable zero-dependency C ABI in vt-1.0.0 / vt-1.0.1 under the MIT license (ghostty_terminal_new, ghostty_terminal_vt_write, formatter and cell inspection). Driving libghostty-vt in-process via stdlib ctypes alongside an isolated tmux server gives libvt two independent, permissively licensed (MIT and ISC) headless reference engines — testing both inner tmux pane streams (TMUX_PROFILE via capture-pane -R) and outer attached-client streams (DEFAULT_PROFILE, required to verify tmux display-popup overlays, borders, status bars, and background restoration).

Proposal

Invariants

The invariants below are load-bearing; everything under Intent is open.

  • libghostty-vt is an opt-in CI/integration test oracle loaded via ctypes under a pytest marker (never a runtime package dependency of libvt).
  • Clean-room MIT provenance in AGENTS.md explicitly forbids reading, translating, or copying GPL-2.0 / LGPL test suites (ThomasDickey/esctest2 and gnachman/esctest are GPL-2.0; pyte is LGPL-3.0), while permitting Unicode License v3 data (GraphemeBreakTest.txt, DerivedCoreProperties.txt), BSD/MIT vttest (repo), MIT/Apache-2.0 vtebench, ISC tmux, MIT/X11 xterm, and MIT libghostty-vt.
  • Every recorded trace and short regression vector enforces the prefix + external-event determinism invariant: feeding whole, byte-by-byte, or across split boundaries with interposed committed reads produces identical live cells/styles, committed cells/styles, cursor, pending_wrap, scrollback, and concatenated reply bytes.

Intent (non-binding)

  • Build (and cache by tag SHA) libghostty-vt (vt-1.0.1) in an integration CI job on .github/workflows/tests.yml and replay a 30-plus recorded session corpus (explicitly aligning mode ?2027 grapheme clustering and dimensions), settling the DEFAULT_PROFILE differential pass rate.
  • Commit three permanent multi-checkpoint .jsonl traces (recording ordered write, resize, and reply events with plain-text framed grid + sparse style checkpoints verified against libghostty-vt and tmux): tmux_popup_lifecycle (captured from the attached tmux client PTY rather than pipe-pane or %output), nvim_edit_scroll_exit (?1049h, DECSTBM, DECSC/DECRC, scrollback isolation), and resize_mid_sync_wide (?2026h + CJK/emoji right-margin resizes).
  • Switch CI coverage invocation to uv run python -m coverage run --branch --source=libvt -m pytest so module-import definitions and pytest_plugin paths are measured accurately.
  • Generate a per-profile control-function conformance page (Supported, Partial, Ignored, Divergent with documented rationale and test IDs) from src/libvt/codec.py and test metadata, failing CI if codec.py and docs drift.

Not doing

  • Running xterm under Xvfb on every pull-request commit (keep xterm for offline tie-breaking).
  • Regenerating golden expectations from libvt's own unverified output.

References

Activity

  1. added
    enhancement
    on Nov 22, 2026
  2. tony commented on Nov 23, 2026

    @tony
    MemberAuthor

    Option normalization notes against libghostty-vt vt-1.0.1

    Inspection of Ghostty include/ghostty/vt/terminal.h at 11ed660d9 and Terminal.zig at 11ed660d9 establishes six runner alignment rules when building the libghostty-vt 1.0.1 differential suite:

    • Enable ?2027 via GHOSTTY_TERMINAL_OPT_MODE_DEFAULT (libghostty-vt defaults ?2027 to off, and OPT_MODE_DEFAULT preserves configured modes across RIS and DECSTR).
    • Install GHOSTTY_TERMINAL_OPT_WRITE_PTY and configure default fg/bg RGB colors (libghostty-vt suppresses DA/DSR/DECRQM replies without a write callback and suppresses OSC 10/11/12 replies until default colors are set).
    • Account for byte-capped scrollback (10,000 bytes default in libghostty-vt versus line-count scrollback in libvt) and omit SIXEL vectors (libghostty-vt 1.0.1 omits SIXEL).
    • Compare snapshots at ParserState.GROUND boundaries without pending UTF-8 bytes, and ignore WidthRole.SPACER_TAIL SGR words (libvt copies base-cell SGR onto SPACER_TAIL, whereas Ghostty stamps the active stream pen).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions