Skip to content

termtest: emulate the escape sequences bubbletea v2 emits - #7736

Draft
pietern wants to merge 1 commit into
pietern/termtest-pinsfrom
pietern/charm-v2/01-termtest-emulator
Draft

pietern wants to merge 1 commit into
pietern/termtest-pinsfrom
pietern/charm-v2/01-termtest-emulator

Conversation

@pietern

@pietern pietern commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Test-only. The termtest emulator (libs/cmdio/cmdiotest/termtest) learns the sequences bubbletea v2's cell renderer emits: REP, ECH, ICH, DCH, IRM, IL/DL, SU/SD, DECSTBM, RI and tab stops. It ignores prefixed and intermediate CSIs (kitty keyboard, modifyOtherKeys, DECRQM), so CSI > 1 u is no longer read as restore-cursor. Scrolls and cell shifts keep the styles grid aligned with the text.

LF returns to column 0 when the emulator maps newlines. That follows what bubbletea v2 assumes when its input is not a TTY, except on Windows. termtest now only turns the mapping on (MapNewline), so the default stays on off Windows.

Esc disambiguation is 100 ms (was 20 ms). v2's reader holds a lone Esc for ultraviolet's 50 ms timeout, from when the byte is read.

Why

The v2 swap (last PR in this stack) moves the pins' terminal output to bubbletea v2's cell renderer. The emulator has to understand those sequences before the goldens can show a v2 diff that means something. This PR changes no production code and no golden.

Tests

  • go build ./..., golangci-lint on libs/cmdio/..., gofmt.
  • TERM=xterm-256color go test -race -count=3 ./libs/cmdio/....
  • The pins pass without -update. No golden changes.

Stack: this PR is based on the pins branch pietern/termtest-pins (termtest capabilities and the v1 pin tests), which sits on #7688. Merge order: #7688, pietern/termtest-pins, then this PR and the stack above it.

Manual checks for real terminals: none for this PR.

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 50020e8

Run: 44344018792

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 19 17:32
💚​ aws-windows-latest-4core-16gb 1 274 17 11:56
💚​ azure linux-2core-8gb 1 271 19 16:04
💚​ azure-windows-latest-4core-16gb 1 273 17 10:19
💚​ gcp linux-2core-8gb 1 272 19 17:34
💚​ gcp-windows-latest-4core-16gb 1 274 17 11:52
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 45 slowest tests (at least 2 minutes):
duration env testname
4:54 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
4:30 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
3:45 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
3:41 aws-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
3:37 gcp-windows-latest-4core-16gb TestAccept
3:26 azure-windows-latest-4core-16gb TestAccept
3:26 aws-windows-latest-4core-16gb TestAccept
3:23 gcp linux-2core-8gb TestImportDirWithOverwriteFlag
3:21 aws linux-2core-8gb TestImportDirDoesNotOverwrite
3:19 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
3:08 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
3:02 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
3:00 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
2:58 azure linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:56 azure linux-2core-8gb TestImportDirWithOverwriteFlag
2:54 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:53 aws-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
2:50 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:48 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:47 azure linux-2core-8gb TestWorkspaceFilesExtensions_ExportFormatIsPreserved/jupyter_scala
2:47 gcp-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
2:41 aws linux-2core-8gb TestImportDir
2:40 aws-windows-latest-4core-16gb TestSyncNestedSpacePlusAndHashAreEscapedSync
2:37 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:37 aws-windows-latest-4core-16gb TestSyncIncrementalSyncPythonNotebookToFile
2:37 gcp-windows-latest-4core-16gb TestFilerWorkspaceNotebook/pythonJupyterNb.ipynb
2:36 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:33 gcp-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
2:28 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files_extensions
2:25 gcp linux-2core-8gb TestFilerWorkspaceNotebook/sqlJupyterNotebook.ipynb
2:24 gcp linux-2core-8gb TestFilerReadDir/workspace_files
2:18 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:12 aws-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
2:11 azure-windows-latest-4core-16gb TestSyncFullFileSync
2:10 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:10 gcp-windows-latest-4core-16gb TestSyncIncrementalFileSync
2:09 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:06 azure-windows-latest-4core-16gb TestFilerWorkspaceNotebook/sqlNb.sql
2:06 azure linux-2core-8gb TestAccept
2:06 aws linux-2core-8gb TestExportWithFileFlag
2:05 gcp linux-2core-8gb TestImportDirDoesNotOverwrite
2:05 azure linux-2core-8gb TestSyncFullFileSync
2:04 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
2:03 azure linux-2core-8gb TestImportDir
2:00 aws-windows-latest-4core-16gb TestFilerReadWrite/workspace_files_extensions

@pietern
pietern added this pull request to stack #7754 November 18, 2026 08:35
@pietern

pietern commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/review

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — no issues found.

@pietern
pietern force-pushed the pietern/charm-v2/01-termtest-emulator branch from 732780f to 2f74a7b Compare November 18, 2026 13:07
@github-actions github-actions Bot added the test-only-fix PRs that update failing of flaky tests without changing CLI code. label Nov 18, 2026
@pietern
pietern force-pushed the pietern/charm-v2/01-termtest-emulator branch from 2f74a7b to 2b3ac00 Compare November 18, 2026 15:55
bubbletea v2's cell renderer moves and edits cells with REP, ECH, ICH,
DCH, IRM, IL/DL, SU/SD, DECSTBM, RI and tab stops. The emulator now
handles them, ignores prefixed and intermediate CSIs (kitty keyboard,
modifyOtherKeys, DECRQM), and maps LF to column 0 the way v2 expects
when its input is not a TTY (off Windows). Scrolls and cell shifts keep
the styles grid aligned with the text.

Esc disambiguation is 100 ms. v2's reader holds a lone Esc for
ultraviolet's 50 ms timeout, which starts when the byte is read.

No v1 golden changes.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern
pietern force-pushed the pietern/charm-v2/01-termtest-emulator branch from 2b3ac00 to 50020e8 Compare November 18, 2026 16:07
@pietern

pietern commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

/review

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 50020e8. Each finding was verified against the code.

Not ready yet: part of the automated review did not complete.

This test-only PR teaches the termtest terminal emulator the escape sequences bubbletea v2's cell renderer emits (REP, ECH, ICH, DCH, IRM, IL/DL, SU/SD, DECSTBM, RI, tab stops) and makes LF map to column 0 by default off Windows. The new sequences are well-tested, the scroll/cell helpers are cleanly factored, and the prefixed-CSI guard closes a real misparse. No production code is touched and no issues survived verification.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants