Skip to content

Add ANSI.replay to collapse captured repaints - #623

Merged
GoodForOneFare merged 0 commit into
gordo-expand-csi-strippingfrom
gordo-ansi-replay
Aug 13, 2026
Merged

Add ANSI.replay to collapse captured repaints#623
GoodForOneFare merged 0 commit into
gordo-expand-csi-strippingfrom
gordo-ansi-replay

Conversation

@GoodForOneFare

@GoodForOneFare GoodForOneFare commented Aug 11, 2026

Copy link
Copy Markdown
Member

tl;dr - add ANSI.replay that removes noise from log files piped from cli-ui output.

Spinners and progress bars repaint by moving the cursor, so a capture of the stream (a log file, StdoutRouter's duplicate output, test output) holds one frame per tick. ANSI.strip_codes deletes those control sequences instead of applying them, which leaves every frame side by side rather than overwriting: \r disappears, and CSI_SEQUENCE matches neither the parameterless (\e[K) nor the private (\e[?25l) forms, so those survive as text.

ANSI.replay applies the stream's viewport-independent controls -- CR/LF/BS, relative cursor moves, erase-line, insert/delete-line, cursor save/restore -- to a line grid and returns the text the repaints settled on. Presentation sequences and control-string payloads (OSC, DCS) are dropped, as a terminal drops them, and so are operations that assume a viewport (absolute positioning, display erasure): a capture does not record scrolling, so a screen coordinate has no buffer row to map onto. Shopify's dev CLI attaches its dev up log to error reports, where a 450KB capture replays to 41KB of what the developer actually saw.

There is no viewport: a capture has no scrollback to lose, so height is unbounded and cursor moves, gap padding and insert-line are capped instead. Only rows a control sequence conjures count against that cap, so an ordinary long capture never exhausts it.

@GoodForOneFare GoodForOneFare self-assigned this Aug 11, 2026
@GoodForOneFare
GoodForOneFare force-pushed the gordo-ansi-replay branch 3 times, most recently from 31d9039 to 3189348 Compare August 12, 2026 17:34
@GoodForOneFare
GoodForOneFare changed the base branch from main to gordo-expand-csi-stripping August 12, 2026 17:40
@GoodForOneFare
GoodForOneFare force-pushed the gordo-expand-csi-stripping branch from 1cb093c to a833fef Compare August 12, 2026 19:00
@GoodForOneFare
GoodForOneFare force-pushed the gordo-expand-csi-stripping branch from a833fef to 7760ee3 Compare August 12, 2026 19:08
@GoodForOneFare
GoodForOneFare force-pushed the gordo-expand-csi-stripping branch from 7760ee3 to d92d828 Compare August 12, 2026 19:30
@GoodForOneFare
GoodForOneFare force-pushed the gordo-expand-csi-stripping branch from d92d828 to 5ce45be Compare August 12, 2026 20:58
@GoodForOneFare
GoodForOneFare force-pushed the gordo-ansi-replay branch 2 times, most recently from 01198dc to 965643e Compare August 13, 2026 11:19
@GoodForOneFare
GoodForOneFare merged commit 965643e into gordo-expand-csi-stripping Aug 13, 2026
@GoodForOneFare
GoodForOneFare force-pushed the gordo-expand-csi-stripping branch from 5ce45be to 5cc704f Compare August 13, 2026 11:19
@GoodForOneFare
GoodForOneFare deleted the gordo-ansi-replay branch August 13, 2026 11:19
@GoodForOneFare
GoodForOneFare restored the gordo-ansi-replay branch August 13, 2026 11:20
@GoodForOneFare

Copy link
Copy Markdown
Member Author

This stack was inverted so replay could ship first. GitHub marked this PR merged when its rewritten head became an ancestor of the former base; no replay commits merged to main here. The standalone replacement is #625, with #624 now stacked above it.

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