test(web): H2 real transcript corpus + parser-fidelity tests (WI-123) - #671
Closed
thedancingdeveloper wants to merge 1 commit into
Closed
thedancingdeveloper wants to merge 1 commit into
thedancingdeveloper wants to merge 1 commit into
Conversation
The ground-state trimming that both the server ring and the client cache rely on was only ever tested against synthetic `line\n` data. Add a corpus of real PTY captures and a fidelity suite that exercises it against genuine escape sequences, SGR colour, cursor moves, alt-screen switches and UTF-8. - web/tests/fixtures/transcripts/: claude-code-tui (curses alt-screen redraws: cursor addressing, SGR, OSC title, box/emoji UTF-8 — a seamless, newline-free stream), shell-plain (coloured recursive ls + multibyte chars), cargo-build (real `cargo build -v` colour output with \r). Gzipped; a README documents the intended production source (GET /api/history/:id/download from a dev stack) and how these local stand-ins were captured. - scripts/capture_transcript.py: a pty.fork capture helper. - scripts/sanitise_transcript.py: rewrites home paths/tokens/JWTs/emails to inert placeholders and ASSERTS no secret pattern survives before a fixture is committed. - src/__tests__/transcriptFidelity.test.ts: over each corpus at 4 KiB cut offsets, groundStateReplayStart / prepareReplayTail / sliceForReplay pick a start that is never inside an escape or on a UTF-8 continuation byte (just past a line feed, or start-of-stream), and the kept tail is byte-for-byte the source suffix. The alt-screen corpus documents the no-newline-seam case where raw-byte trimming can only fall back — the gap F5's serialized-state restore closes. The xterm serialize()-compare fidelity and the parse-rate baseline (both need @xterm/addon-serialize) fold into F5 (WI-129), where that addon becomes a real dependency, rather than adding a test-only copy here. Verification: pnpm vitest 928 passed (15 new); ruff check + format clean on the scripts; scripts/check_docs.py clean. WI-123. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UtEFLJAhLiq4NfZCN2vuBb
thedancingdeveloper
force-pushed
the
feat/terminal-attach-h2-corpus
branch
from
September 9, 2026 09:11
a72d02f to
b293632
Compare
This was referenced Sep 9, 2026
Contributor
Author
|
Cleanup: superseded by the single promotion PR #676. All of this work is already integrated into |
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.
Fifth PR of the terminal-attach-budget initiative (WI-121). Stacked on #670 (F2); all land on
feat/terminal-attach-budget.What this adds (H2 / WI-123)
The ground-state trimming both the server ring and the client cache rely on was only tested against synthetic
line\ndata. This adds a corpus of real PTY captures and a fidelity suite over it.web/tests/fixtures/transcripts/(gzipped, sanitised):claude-code-tui— a curses alt-screen redraw stream (cursor addressing, SGR, OSC title, box/emoji UTF-8). It emits no line feeds — the seamless case where raw-byte trimming has nothing to align to.shell-plain— coloured recursivels+ multibyte box/CJK/emoji chars.cargo-build— realcargo build -vcolour output with\r.README.mddocuments the intended production source (GET /api/history/:id/downloadfrom a dev stack) and how these local stand-ins were captured.scripts/capture_transcript.py— apty.forkcapture helper.scripts/sanitise_transcript.py— rewrites home paths / tokens / JWTs / emails to inert placeholders and asserts no secret pattern survives before a fixture is committed.src/__tests__/transcriptFidelity.test.ts— over each corpus at 4 KiB cut offsets,groundStateReplayStart/prepareReplayTail/sliceForReplaypick a start never inside an escape or on a UTF-8 continuation byte (just past a\n, or start-of-stream), and the kept tail is byte-for-byte the source suffix.Scope note
The plan's xterm
serialize()-compare fidelity and the parse-rate baseline both need@xterm/addon-serialize. Rather than add a test-only copy here, they fold into F5 (WI-129), where that addon becomes a real app dependency. This PR delivers the corpus, sanitiser, and the ground-state fidelity that F5 and H3 build on.The alt-screen corpus makes a real limitation explicit: a newline-free stream has no seam the raw-byte trim can prove is ground state, so it falls back to replaying as-is — exactly what F5's serialized-state restore closes.
Verification
pnpm vitest— 928 passed (15 new).ruff check+ruff format --checkclean on the scripts;scripts/check_docs.pyclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01UtEFLJAhLiq4NfZCN2vuBb