Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Exercise pending terminal changes together on Linux - #193

Draft
tony wants to merge 25 commits into
masterfrom
experiment/integrated-vt
Draft

tony wants to merge 25 commits into
masterfrom
experiment/integrated-vt

Conversation

@tony

@tony tony commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Summary

This experimental branch gives maintainers a single revision to exercise the remaining open concept branches together. The individual source PRs remain the review units for their changes.

Source PRs

PR Branch Source head Scope
#131 concept/interactive-readme 07e6006 Interactive POSIX PTY quickstart in README.md
#133 concept/snapshot-cell-search 7763e7b Snapshot.find_cells() and CellSpan display-cell coordinates
#138 concept/fzf-cookbook 618e28f fzf selection and cancellation cookbook and test
#139 concept/pytest-replay 8ef451d pytest --vt-replay-dir failure capture, python -m libvt replay, and hidden diff reporting in assert_screen()
#140 concept/last-beacon 98669dc Playable terminal game guide, live PTY walkthrough, and offline replay
#141 concept/tmux-which-screen 17eea55 Pane vs. attached tmux client guide, coordinate translation example, and tests
#142 concept/terminal-subprocess 6776ee2 Synchronous libvt.contrib.subprocess (open_terminal(), run_terminal(), POSIX PTY and Windows ConPTY) and docs/api/contrib/subprocess.md

Where changes meet

libvt.contrib.subprocess exposes TerminalProcess and CompletedTerminal (Capture) through SupportsVtTarget from #204 (#203), so vt_screen() and serialize_vt_snapshot() serialize synchronous child sessions alongside Snapshot.find_cells() lookups from #133. pytest --vt-replay-dir (#139) records terminal feeds and external resizes through TerminalRecorder without mutating Terminal internals and replays failures byte-by-byte through python -m libvt replay. docs/api/contrib/subprocess.md (#142) and docs/api/terminal.md (#133) align with the per-module API split and test_every_public_module_has_api_doc_page() check from #205.

Local verification

  • ruff check . and ruff format --check . pass.
  • ty check passes for Linux 3.12, Linux 3.15, macOS 3.14, and Windows 3.14.
  • Cold imports verified: import libvt leaves asyncio, pty, pytest, and libvt.terminal unloaded; import libvt.pytest_plugin leaves libvt.terminal, libvt._replay, libvt._ucd, asyncio, and pty unloaded.
  • Runtime top-level import graph has zero cycles across all 42 package modules.
  • Full pytest -q suite passes (1296 passed, 2 skipped), including tests/test_libvt.py::test_every_public_module_has_api_doc_page, README.md, and docs/ doctests.
  • Strict sphinx-build -q -b dirhtml -W --keep-going docs passes with zero warnings.
  • examples/last_beacon/tour.py passes live and with --replay --chunk-size 1, and cross-PR interoperability passes across snapshot(feat): Locate text by cell coordinates #133, testing(feat[replay]): Replay failed pytest runs #139, and Concept: Drive terminal subprocesses from synchronous Python #142.

tony added a commit that referenced this pull request Dec 4, 2026
why: Readers need the release notes for each public behavior in #193.

what:
- Preserve the breaking changes, examples and references from 48 PRs.
- Describe nested coordinates, live bounds and frozen row extents.
- Keep the existing release entries and the unreleased placeholder.
tony added a commit that referenced this pull request Dec 4, 2026
why: Readers need the release notes for each public behavior in #193.

what:
- Preserve the breaking changes, examples and references from 48 PRs.
- Describe nested coordinates, live bounds and frozen row extents.
- Keep the existing release entries and the unreleased placeholder.
@tony
tony force-pushed the experiment/integrated-vt branch from 6be85f1 to 1996c79 Compare December 4, 2026 01:51
@tony
tony force-pushed the experiment/integrated-vt branch from 3d1963c to 4c0bf02 Compare December 5, 2026 10:16
tony added a commit that referenced this pull request Dec 5, 2026
why: Readers need the release notes for each public behavior in #193.

what:
- Preserve the breaking changes, examples and references from 47 PRs.
- Describe nested coordinates, live bounds and frozen row extents.
- Keep the existing release entries and the unreleased placeholder.
@tony

tony commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Technical Assessment: libvt Baseline (v0.0.1a5) & PR #193 Posture

Overall Verdict

Assuming packaged availability, libvt (0.0.1a5) ranks #1 among pure-Python virtual terminal libraries by a wide margin—and is arguably the only genuinely modern one. Compared to pyte (LGPL-3.0, single-screen, no reflow, no truecolor/colon SGR, no ?2026/?2027, mutable buffers), libvt is in a different league on protocol depth, API ergonomics, static typing, and throughput. Against native bindings (libghostty-vt, libvterm, vte/PyGObject), it naturally trades 50–200× throughput and battle-tested mileage for zero-dependency pure-Python portability and MIT licensing.

However, the repository exhibits a stark split between a genuinely strong VT core and acute scope creep (29,897 LOC authored in 9 days on master, followed by ~48 PRs stacked in 4 days).

Dimension (master v0.0.1a5) Grade Summary
Modern Python & Typing A- Python 3.12+, zero runtime deps, ty clean with 0 ignores / 2 casts / 7 Any, PEP 562 lazy root (4.6 ms import), PEP 695/688/678.
API Design & Ergonomics B+ Strong sans-I/O layering (Profile/Policy/Limits, Snapshot, SyncToken), undermined by leaky Screen internals, Terminal/Snapshot drift, and 163 private-attr accesses from contrib/tmux.
Implementation Quality B Real VT500/Unicode 17/RLE engineering (6.6–7.8 MiB/s ANSI, 1.9–3.4 MiB for 10k rows), held back by monolithic god-files, a 56.6× RowView.runs cliff, and several reproduced correctness/security bugs.
Documentation & Verification B- Zero buzzword fluff, 234 doctests, 766 official UAX #29 vectors; undermined by 20 broken Sphinx xrefs, unamended stale ADRs, narrow 3-trace Ghostty oracle (unrun in CI), and overstated benchmark claims.
Scope & Cohesion C+ 49.2% of src/libvt sits outside core VT emulation (including a 3,156-LOC Python port of tmux's C UI renderer and a 2,127-LOC bitmap-less graphics tracker).
Overall ~8.0 / 10 Best pure-Python VT architecture available; pre-alpha maturity and sprawl require pruning before 0.1/1.0.

1. Evaluation of libvt (master)

API Design & Ergonomics

  • What works well:
    • Progressive disclosure: zero-setup libvt.render() / libvt.strip() → Terminal → Parser + zero-alloc ActionSink / Formatter / libvt.aio.
    • Clean separation of emulation quirks (src/libvt/config.py Profile), default-deny security gates (Policy), and DoS ceilings (Limits).
    • Zero-based (row, col) coordinates everywhere, immutable tear-free Snapshot / ?2026 committed, stateless Snapshot.viewport(offset), watermark SyncToken/ScreenDelta, and clean KeyEvent.parse("ctrl+c") in src/libvt/input.py.
  • Where it leaks or chafes:
    • Public Screen leaks _grid internals: top-level re-exported libvt.Screen exposes raw 64-bit packed attribute words (bce_word: int = 0 on scroll_up/scroll_down/push_scrollback_and_clear) and internal hooks (heal_before_edit, heal_wrapped_spacer_head, ensure_graphics) in src/libvt/screen.py:1105-1410.
    • Unchecked mutators & missing sequence ergonomics: Screen.cursor = Cursor(row=99, col=-5) (src/libvt/screen.py:1051-1060) is unvalidated and crashes the next feed() with IndexError; Screen/Snapshot/Terminal implement __getitem__ without __len__, __eq__, or __repr__ (so iter(snap) works via legacy fallback while len(snap) throws TypeError, and repr(snap) prints a memory address); RegionView lacks 2D slicing and value __eq__.
    • Core-to-contrib layering inversion: src/libvt/testing.py:903 unconditionally imports libvt.contrib.tmux.capture.TmuxCaptureResult at runtime, and contrib/tmux/{capture,control}.py reach into 163 private attributes/methods of Terminal/Screen (including a dead-in-core backdoor Terminal._tabstops_from_list at src/libvt/terminal.py:2632-2634).
    • API surface drift: Terminal.from_size omits 6 kwargs from Terminal.__init__; pytest_plugin.py TerminalFactory omits 3; Terminal.program_statuses/images return mutable dicts while Snapshot returns MappingProxyType; Screen.snapshot() defaults active_is_alt=False even on screens.alternate.

Implementation Quality & Measured Performance

  • Genuine engineering strengths:
    • Clean-room VT500 state machine in src/libvt/parser.py with regex-accelerated ground/CSI fast paths, ITU T.416 colon subparameter bitmasks, UTF-8/C1 isolation, and bounded buffers.
    • Two-tier storage in src/libvt/_grid.py: lazy array('Q') 64-bit packed viewport rows (uniform-word fast path for unstyled lines) + RLE FrozenRow scrollback. Measured tracemalloc for 10,000×80 rows: 1.91 MiB plain / 3.38 MiB styled.
    • Bundled Unicode 17.0.0 two-stage UCD table (src/libvt/_ucd.py) passing all 766 official GraphemeBreakTest-17.0.0.txt vectors plus SHA-256 tamper verification.
    • Measured CPython 3.15 throughput (in-process): Parser.feed_to = 22.9 MiB/s, Terminal.feed ASCII scroll = 7.8 MiB/s, bench_vt.py 80×24 truecolor frame = 6.6 MiB/s (~0.35 ms/frame), styled ANSI scroll = 2.7 MiB/s, CJK/ZWJ ?2027 = 1.1 MiB/s.
  • Concrete bugs reproduced on master:
    1. Security/policy bypass: src/libvt/terminal.py:6156 checks not cleaned.startswith("file://") case-sensitively, so OSC 9;9;FILE://evil.host/etc/passwd bypasses Policy.osc7_hosts.
    2. VT escape injection: Formatter._render_vt (src/libvt/terminal.py:1354-1360) emits raw link.uri and link.id without sanitizing \x1b/\x07/; or honoring allow_unsafe_uris (a crafted Hyperlink injects arbitrary terminal text on replay).
    3. Tmux resync state leak: _adopt_terminal_state (src/libvt/contrib/tmux/control.py:88-137) manually copies 43 of Terminal's 77 attributes and misses 36, leaking guest OSC 10/11/4 colors, OSC 7501 status, title stacks, pending OSC 99, and _replies across resyncs.
    4. Other reproduced bugs: vt_screen(t2, diff=vt_screen(t1)) crashes with TypeError despite matching its type annotation (src/libvt/testing.py:1020); _extract_target blindly calls .snapshot() on arbitrary objects inside nested containers (src/libvt/testing.py:917-925); AsyncTerminalStream.write_high_water is dead code (src/libvt/aio.py:362); open_pty leaks PTY FDs if os.pipe() fails (src/libvt/aio.py:1860-1866); malformed OSC 7501 permanently disables OSC 9;4 fallback (src/libvt/status.py:232); GraphicsTracker._next_auto_id starts at 0x8000_0001 and silently overwrites Kitty image i=2147483649 (src/libvt/graphics.py:615); codec.explain() destroys colon SGR subparameters (src/libvt/codec.py:138); Screen._reflow_primary drops trailing BCE backgrounds and inflates evicted_total on widen (src/libvt/screen.py:1554); ModeState.set_mode(Mode.DECTCEM) leaks visibility into ?2026 committed (src/libvt/terminal.py:3571).
  • Notable performance & structural flaws:
    • RowView.runs is 56.6× slower on _Row than FrozenRow (1,002 ms vs 17.7 ms for 200×24×80 uniform screens) because src/libvt/screen.py:482-526 unpacks a fresh 12-field Style per column with no uniform-attr or raw-word equality fast path.
    • Terminal has no __slots__ despite 77 instance attributes and every other core class using __slots__.
    • God-file monoliths: src/libvt/terminal.py is 7,216 LOC (Terminal alone is 5,097 LOC, 110 members; _handle_csi is 699 LOC / CC=245, _handle_print 423 LOC / CC=119, _handle_osc 333 LOC / CC=118); src/libvt/contrib/tmux/window.py is 3,156 LOC (composite_tmux_window 662 LOC); src/libvt/screen.py is 2,442 LOC (_reflow_primary 332 LOC / CC=96) with a circular runtime import of terminal.py.

Documentation & Verification

  • Good: Zero marketing fluff; 234 doctests enforced by tests/test_libvt.py:261-289; strong pyte 0.8.2 migration guide (docs/topics/migrating-from-pyte.md); solid clean-room provenance policy.
  • Gaps:
    • Docs CI omits Sphinx -n, hiding 20 broken Python xrefs (including non-existent Screen.region in docs/topics/testing.md:64 and 17 renamed 0.0.1a0 symbols in CHANGES).
    • docs/topics/architecture.md:17-18 falsely claims import libvt eagerly loads core modules (contradicting PEP 562 __init__.py).
    • ADRs 0001–0010 are all dated 2026-11-21 and unamended despite major rewrites (ADR 0002 specifies a closed Event union and flat Profile; ADR 0001 claims 10–35 MiB/s which only holds for standalone Parser, not Terminal.feed; ADR 0003 claims 400+ fuzz trials vs actual 130).
    • Ghostty differential testing (tests/test_differential_ghostty.py) only covers 3 tiny hardcoded traces, never asserts styles/colors/scrollback, and always skips in CI. There is no hypothesis or raw-byte fuzzing.

Modern Python 3.12+ Idiomatics

Legitimately strong: zero runtime dependencies, py.typed, strict ty (error-on-warning = true, blanket-ignore-comment = "error"), 25+ Ruff rule groups, 16 PEP 695 type aliases, 39 collections.abc.Buffer signatures, StrEnum/IntFlag, frozen=True, slots=True dataclasses, PEP 562 lazy root (4.6 ms cold import vs 49 ms with Terminal), PEP 678 __notes__ on TerminalTimeoutError, and PyPy 3.12 + CPython 3.12–3.15 CI.


2. How PR #193 (experiment/integrated-vt) Improves or Worsens Posture

Context: PR #193 is a draft integration cohort (+15,022 / -1,956 across 69 files; CI green at 3d1963c, including macOS/Windows/PyPy) combining 48 open PRs: ~40 focused bugfix/polish PRs (#149–#192), 7 speculative [draft] Concept: PRs (#131, #133, #138–#142), and agent workflow policy (#155).

Net verdict on PR #193: It materially IMPROVES core VT/transport correctness, while materially WORSENING architectural discipline, scope bloat, and maintainability. Merging it wholesale would be a mistake; landing the underlying ~35–40 bugfix PRs individually while rejecting or redesigning the speculative Concept: PRs would be a clear net win.

How PR #193 IMPROVES Posture

  • Real VT, parser, and input fixes:
    • Completes parser state transitions before invoking external sink callbacks so exceptions don't corrupt parser state (#175).
    • Adds _byte_view() for strided/non-contiguous Buffer inputs in parser/terminal/recorder (#186).
    • Fixes Kitty F3 (CSI 13 ~ vs cursor reply collision), special-key release gating (#176), "ctrl++" chord parsing (#187), and mutually exclusive mouse tracking vs coordinate encoding groups (#177).
    • Upgrades Formatter._render_vt to preserve DECSCA protection, scroll margins, active pen, and pending wrap (#180), and fixes HTML concealed-cell backgrounds (#178).
    • Adds first-class unwrapped_text across Screen, Snapshot, Terminal, RegionView, Formatter, and render (#152), Snapshot.find_cells() -> tuple[CellSpan, ...] (#133), nested RegionView[r, c] slicing + RowView.{used,text_used,full_row} + Snapshot.profile/Screen.profile (5d0be2b, #183), and fixes history wrap severing on viewport erase (#149).
  • Real aio.py transport hardening:
    • Shared foreground reader ownership (#159), _FrameWaits stepping through every ?2026 committed frame within a single read (#192), ECANCELED on drain interrupted by close (#162), safe concurrent aclose() joining (#160), open_pty() FD-leak fix + Linux pidfd/SCM_RIGHTS process-group teardown (#163), and reply-writer handoff (#168).
  • Fixes several testing.py / contrib bugs from master:
    • Deletes the fragile _absorb_2d_slack and scrollback-splicing heuristics in testing.py (#149)—a genuinely healthy simplification.
    • Fixes the vt_screen(diff=vt_screen(...)) crash (#191), moves _convert_nested out of core testing.py into contrib/syrupy.py (#151), removes the t.cast violation in contrib/tmux/control.py, and fixes shared control-client reply ownership (#161).

How PR #193 WORSENS Posture (Concrete Regressions, Seam Bugs & Bloat)

  1. Unreviewable integration lump & git hygiene: Squash commit 752ff4f alone is +10,313 / -1,692 lines across 45 files, and commit f2b3980 ships with author temp-merge <temp@localhost>. src/libvt grows from 29,897 → 33,598 LOC (src/libvt/terminal.py hits 7,635 LOC).
  2. Speculative, bolted-on contrib/subprocess.py (+1,108 LOC across 3 files, #142):
    • Re-exports stdlib Popen = subprocess.Popen and run = subprocess.run unchanged in __all__ (src/libvt/contrib/subprocess.py:22-23).
    • Invents a second, narrower process API (VT, Capture, CompletedTerminal, open_terminal, run_terminal) that cannot pass Profile, Policy, Limits, encoding, or tty_mode.
    • Spawns a dedicated ThreadPoolExecutor(1) + asyncio.Runner event loop per child process and passes timeout=sys.float_info.max into wait_for.
    • On macOS (src/libvt/contrib/_darwin_pty.py), boots two nested Python interpreters per process (open_pty's -I -S -c _PTY_TRAMPOLINE execs another -I -S -c _LEADER Python script that connects back over a temp Unix socket and Popens the command).
    • On Windows (src/libvt/contrib/_conpty.py), hard-requires ReleasePseudoConsole (Windows 11 24H2 build 26100+), throwing NotImplementedError on all Windows 10 and Win11 ≤23H2 hosts.
  3. Monkey-patching duplicate replay engine (src/libvt/_replay.py + src/libvt/pytest_plugin.py, #139):
    • Invents a second recording mechanism (_ReplayCapture) alongside FlightRecorder, then monkey-patches bound methods (term.feed = feed, term.feed_until = feed_until, term.resize = resize) directly onto live Terminal instances (src/libvt/pytest_plugin.py:82-84)—which permanently blocks adding __slots__ to Terminal.
    • Hardcodes scrollback=2_000 in vt_terminal (src/libvt/pytest_plugin.py:301).
  4. Verified integration seam bugs introduced inside PR Exercise pending terminal changes together on Linux #193 itself:
    • --vt-replay-dir breaks PR Exercise pending terminal changes together on Linux #193's own strided-buffer fix (#186): src/libvt/pytest_plugin.py:69 calls view.cast("B") directly instead of _byte_view(data), raising TypeError on non-contiguous buffers fed via feed_until(). Sibling sites src/libvt/aio.py:1728 and src/libvt/contrib/tmux/control.py:181,568 also still call raw .cast("B").
    • --vt-replay-dir breaks PR Exercise pending terminal changes together on Linux #193's own encoding="latin-1" fixture addition (#164): vt_factory and vt_pty (src/libvt/pytest_plugin.py:355-360, 447-451) omit encoding == "utf-8" from supported=, while _replay.py:_play() hardcodes UTF-8—producing false mismatch failures on Latin-1 terminals.
    • Conflicting raw_limit contract: src/libvt/contrib/subprocess.py:81 enforces raw_limit >= 64 even though #182 in the same PR removed FlightRecorder's 64-byte floor as a breaking change.
    • Inconsistent exceptions on adjacent methods: On TmuxPaneSync (src/libvt/contrib/tmux/control.py), begin_attach() raises ProtocolError for tmux < 3.2 (L971, with a redundant local import of ProtocolError at L963 already imported at L14), while watch_process() 40 lines below raises ValueError for the exact same < (3, 2) check (L1019).
    • Factual falsehood & broken PyPI links in README.md: README.md:130-133 on the PR branch still claims vt_screen "absorb[s] regex scrubber width changes inside │ borders" even though #149 deleted _absorb_2d_slack (the doctest passed only by coincidence because len("pid=48210") == len("pid=<PID>") == 9). PR Exercise pending terminal changes together on Linux #193 also inserts 6 relative repo links (docs/topics/..., tests/test_fzf_cookbook.py, examples/tmux_screens.py) into README.md—breaking PyPI's rendered description (examples/ isn't even packaged in the sdist).
  5. Over-engineered snapshot wire formats (#151):
    • src/libvt/testing.py appends JSON columns: {"0":[...]} footers to boxed frames, and src/libvt/contrib/syrupy.py adds ~180 lines of bespoke multi-section framing (libvt snapshot sections 1 + JSON path/height headers + <VT screen> placeholders), turning human-readable .ambr snapshots into a complex custom serialization format.
  6. Unfixed master defects still present in PR Exercise pending terminal changes together on Linux #193:
    • FILE:// uppercase policy bypass (src/libvt/terminal.py:6549), unsanitized OSC 8 VT injection (src/libvt/terminal.py:1596-1597), _adopt_terminal_state 36-field state leak, dead AsyncTerminalStream.write_high_water, testing.py's runtime import of contrib/tmux + blind .snapshot() invocation, status.py:232, graphics.py:615, codec.py:138, control.py:755 rstrip, and RowView.runs's 56.6× slowdown are all still unfixed.

3. Red Flags, Bloat & AI-Slop Assessment

To be fair: the core code is NOT generic AI slop. The VT500 transitions, packed 64-bit grid, UAX #29 tables, zero-type: ignore discipline, and crisp doc prose reflect serious engineering rigor.

The actual red flags and high-velocity bloat signatures are structural:

  1. Everything-bagel scope bloat: src/libvt/contrib/tmux/window.py (3,156 LOC porting tmux's C theme/border/format compositor, parsing ~650 inline X11 color names at import time), src/libvt/graphics.py (2,127 LOC with 16,384-bit Python int masks in a pixel-less emulator), niche Rex OSC 7501 woven through 7 core modules, and in PR Exercise pending terminal changes together on Linux #193: contrib/subprocess.py (+1,108 LOC), a 492-line text adventure (examples/last_beacon/), REVIEW.md, and .agents/skills/ + .claude/skills symlink checked into the library repo.
  2. "Coverage-by-doctest" padding on private internals (violating .github/WRITING.md):
    • 493 docstring lines on 26 _private functions in src/libvt/terminal.py (e.g., _event_byte_cost: 25 doc lines citing PEP 557 for 3 lines of code; _bump_appearance: 11 doc lines for 2 lines of code).
    • 8 copy-pasted dummy writer classes inside src/libvt/aio.py docstrings, 14 doctested private helpers in src/libvt/contrib/tmux/capture.py (_trim_unwrapped_row: 12 doc lines for a 1-line body), and tautological doctests (>>> MouseTracker() is not None -> True, >>> hasattr(PtySession, "_flush_terminal_replies") -> True).
    • Meanwhile, the genuinely hard algorithms have almost zero comments: _reflow_primary (332 LOC, 0 comments), _handle_csi (699 LOC, 0 docstrings), src/libvt/screen.py (1 comment line in 2,442 LOC).
  3. Hyper-velocity artifacts: Leaked scratchpad comments in tests/test_pyte_compat.py:315,361 (# ... = 5? Wait: cols=6 -> 'abcd日' fits!), a dead no-op assertion at tests/test_pyte_compat.py:335 (assert snap.screen_lines if hasattr(snap, "screen_lines") else True), kitchen-sink 200-line test functions, and a 1,174-line benchmark CLI (scripts/benchmark.py) that runs git checkout directly in the live working tree to drive 2 commands.

Bottom Line

  • As a Python VT library: Strongly promising Core(feat[vt]): Add initial Parser, Screen, Terminal, aio, and pytest layout #1 pure-Python contender—worth adopting for terminal testing/emulation once it stabilizes, provided you don't need native C/Zig/Rust throughput.
  • On PR Exercise pending terminal changes together on Linux #193: Keep it strictly as a throwaway integration testbed. Land the ~35–40 core parser/VT/aio/tmux/testing bugfix PRs individually; drop or rethink contrib/subprocess.py (#142), the monkey-patching _replay.py (#139), the last_beacon game (#140), and the bespoke Syrupy multi-section framing (#151); split terminal.py and move contrib/tmux/window.py to libtmux before cutting 0.1.0.

@tony

tony commented Dec 5, 2026 •

Copy link
Copy Markdown
Member Author

I would keep this draft as an integration check and land changes through their source PRs. Three findings affect what can ship from 4c0bf02.

Hold point First failing behavior Owner and disposition
Source distribution The checkout passes all eight example-dependent cases. In the extracted sdist, one replay test, four game doctests and three tmux guide cases fail. Adding the five missing files makes all eight pass. #139, #140 and #141 introduce the consumers. Put the shared Hatch include and an extracted-archive test in #196 before shipping the first example. The existing build (3.14) check builds the docs.
Retained live regions Scroll A/B/C up one row. The screen reads B/C/D, a retained region reads D/B/C, and a frozen frame correctly retains A/B/C. Master reproduces it. #2 retained recyclable row objects. #183 owns direct row width. Stack #197 there and use the same public coordinate selection for nested regions and serialization. Hold the nested-region change in #193 until that fix lands.
Pytest replay #186 accepts a strided buffer and consumes AB. With replay enabled, #139’s observer then raises and records no feed. A worker assertion re-raised after cleanup can save the later screen and lose the expected rows. Hold #139 for replay-on/off equivalence. #186 can land independently. Record consumed input and resizes at the terminal, preserve the failure frame at assertion time, and let pytest write the artifact. The reproductions are in #136, #127 and #122.

Erase performance belongs on #149. Its incoming-wrap correction checks predecessors repeatedly during a whole-display erase. On a pinned Linux CPU, the local candidate reduced 10,000 checks to 800 and raised median throughput from 3.65 to 4.85 MiB/s on that redraw stream. Keep #153’s history-boundary correction. #199 tracks the measured cost and controls.

Other owners. #198 covers deletion of fields from a shared committed snapshot, present since #2. #200 documents working assertions and committed goldens during a held redraw (#2, #66, #67). #201 corrects the root-import guide (#47, #51). #142’s predicate timeout and subprocess-compatible exit/EOF timeout have different catch types and leave the handle usable on Linux. #106 records both catches and the native support boundary.

One isolated run of untouched #193 also reproduced the #161 tmux fixture race. Waiting for the child’s first screen before starting the control requests passed all 48 repeat cases with mise-tmux 3.8. #202 tracks that test. #75 tracks reply ownership. For #12, both marked comparisons passed against a fresh, pinned Ghostty 1.0.2 build. That local result covers the two existing cases. #157 supplies the written-space comparison they need.

These corrections are in local worktrees. The linked issues distinguish the published reproductions from the proposed fixes.

The final local candidates passed 880 checkout tests and doctests, including the compiled Ghostty cases. The extracted sdist passed 878 and skipped two repository-only benchmark tests. The wheel contains py.typed and has zero mandatory runtime dependencies. Replay preserves the assertion frame across a worker and cleanup. If input interleaves with a callback resize, the CLI retains the known prefix and reports why a complete replay is unavailable. See #136.

Independent review recommends adopting the ten local source diffs as reviewed and requests changes on the published draft at 4c0bf026.

tony added 5 commits December 5, 2026 09:39
why: Readers need a first interactive test with an observable result.

what:
- Wait for a POSIX child to acknowledge a submitted line.
- Exercise the example through README doctest collection.
why: A terminal can echo a keystroke before the child reads it.

what:
- Point readers to the README check for the child's response.
why: A mouse event needs a terminal column for a visible label.

what:
- Add CellSpan and Snapshot.find_cells in libvt.snapshot and re-export
  CellSpan from libvt.terminal
- Return ordered row and column spans for complete graphemes
- Cover wide cells, written spaces, overlaps, and a real mouse target
- Document cell search in README.md and docs/topics/snapshots.md
why: Callers need the import location for matches returned by snapshot
     search.

what:
- Map CellSpan to the public terminal APIs
why: A wide or combined character can put a label at a different column
     from its string index.

what:
- Document CellSpan's row and half-open column range under 0.0.1a7
tony added 20 commits December 5, 2026 09:40
why: The visible highlight and the accepted record are independently
observable results of a terminal interaction.

what:
- Test Enter and Escape against a real POSIX fzf process.
- Include the tested source in the guide and link it from the README.
why: A highlighted candidate can still be cancelled before fzf writes a
     record.

what:
- Describe both selection outcomes in the README link.
why: The recipe should control the geometry and temporary files of the
     real picker.

what:
- Pass a private TMPDIR and an explicit viewport to fzf
- Skip only when the host cannot allocate a PTY
- Document the geometry and both outcomes in the recipe
why: Pressing Escape writes no selection, even if fzf highlighted a row.

what:
- Point to the recipe that checks the screen, output and exit status.
why: Relative links in README.md break when rendered on PyPI.

what:
- Point the fzf cookbook link at GitHub blob master.
why: Terminal failures need ordered byte spans, external resizes,
     initial encoding, and exact cell diagnostics to reproduce
     offline.

what:
- Attach a bounded TerminalRecorder capture via --vt-replay-dir
  without monkey-patching slotted Terminal instances
- Preserve initial utf-8 and latin-1 encoding and verify replayed
  frames, styles, cursor, wraps, and geometry in python -m libvt replay
- Report the first differing row, display column, and full glyph in
  assert_screen using RowView and existing UCD cluster stepping
- Cover ordered resizes, strided buffers, DECCOLM, latin-1, POSIX PTY
  replays, incomplete captures, and CLI validation
why: Readers need the failure-capture workflow, offline replay command,
     and cell-difference behavior documented alongside the fixtures.

what:
- Add the replay guide and runnable example reference in testing docs
- Link the published replay section from README.md
- Record the replay feature and assertion diagnostic fix in CHANGES
why: A complete terminal interaction can prove that a child received
input, adapted its layout, and rendered the expected style.

what:
- Include a solo text adventure and an executable POSIX tour.
- Check child-observed geometry, snapshots, and a green victory.
- Replay a bundled recording without launching a process.
why: Windows still supports reading transcripts and replaying a tour.

what:
- Restrict raw terminal configuration to the POSIX playback path.
why: Python -O skips assertions, so a corrupt recording or unexpected
     exit could pass the walkthrough.

what:
- Validate saved checkpoints and process results under Python
  optimization
- Keep the live game, transcript and replay instructions executable
why: The game gives readers a way to exercise a resize and reproduce the
     resulting screen.

what:
- Point to the walkthrough for checking and replaying a winning run.
why: Terminal.recorder now types as the TerminalRecorder protocol, and
relative README links break when rendered on PyPI.

what:
- Narrow player.terminal.recorder to FlightRecorder before reading byte bounds.
- Point the README walkthrough link at libvt.git-pull.com.
why: A pane grid and the copy-mode viewport can show different rows,
and a resize changes where a pane-local click lands.

what:
- Compare a selected ledger entry with the live application grid.
- Recover mode rows from their scroll offset when supported.
- Verify the child’s click coordinates and keyboard focus after resize.
why: The guide must display the same translation that the picker uses.

what:
- Render both coordinate calculations from the runnable example.
why: The mouse guest imports tty, which requires POSIX termios.

what:
- Gate the raw mouse reader on a supported platform.
why: The example must read the live client while commands run and verify
     which pane received input.

what:
- Drain command pipes asynchronously and reap cancelled subprocesses
- Check observed copy-mode rows and the translated mouse receipt
- Exercise command cancellation and stale coordinates
why: A tmux client in copy mode can show a different screen from the
     application in the pane.

what:
- Describe how the guide checks which pane receives a translated click.
why: Relative links in README.md break when rendered on PyPI.

what:
- Point the tmux screens guide link at libvt.git-pull.com.
- Point the runnable example link at GitHub blob master.
why: Reuse terminal initialization, slave PTY configuration, and
reader attachment between open_pty and the Darwin session-leader
launcher without duplicating termios or OSC 7 setup.

what:
- Extract _resolve_python_executable, _make_pty_terminal,
  _prepare_pty_fds, and _child_pty_env in libvt.aio._pty.
- Add PtySession._start_reading and call it from open_pty.
why: Synchronous tests need real PTY or ConPTY interaction, bounded
output capture, and separate child-exit vs terminal-EOF waits on top
of libvt's async sessions and recorder protocol.

what:
- Add libvt.contrib.subprocess with VT (raw_limit >= 0), Capture,
  CompletedTerminal, TerminalProcess, CalledTerminalError,
  TerminalTimeoutExpired, open_terminal, and run_terminal without
  re-exporting stdlib Popen or run.
- Resolve FlightRecorder via find_flight_recorder and implement
  SupportsVtTarget on Capture and TerminalProcess.
- Add a single-trampoline Darwin PTY session owner over
  socket.socketpair and a Win32 ConPTY backend.
- Document libvt.contrib.subprocess in docs, README, and CHANGES,
  and add cross-platform subprocess and Darwin helper tests.

Refs #106
@tony
tony force-pushed the experiment/integrated-vt branch from 949994b to eaa0410 Compare December 5, 2026 15:47

This branch was successfully deployed

1 active deployment
docs — eaa04102 Deployed Dec 5, 2026 by tony via build (3.14) #501
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