LAB-1654: Cap vt parser data buffer - #16
Conversation
|
Claude finished @cweill's task in 3m 3s —— View job Review
Parser cap enforcement (
|
Greptile SummaryThis PR reduces the per-emulator ANSI parser data buffer from 4 MiB to 128 KiB by introducing a named constant
Confidence Score: 4/5Safe to merge; the only behavioural change is the buffer ceiling, and the parser's fixed-size path never reallocates, so no heap surprise is possible. The production change is a one-line constant substitution with no logic risk. The test correctly validates both the initial cap and the no-growth guarantee after an oversized payload, but it duplicates the magic number vt/parser_buffer_test.go — the test constant should reference Important Files Changed
Reviews (1): Last reviewed commit: "LAB-1654: Cap vt parser data buffer" | Re-trigger Greptile |
| ) | ||
|
|
||
| func TestNewEmulatorCapsParserDataBuffer(t *testing.T) { | ||
| const wantParserDataSize = 128 * 1024 |
There was a problem hiding this comment.
Test constant duplicates production constant
The test declares its own wantParserDataSize = 128 * 1024 instead of referencing the unexported constant defaultParserDataSize defined in emulator.go. Because the test lives in package vt (not package vt_test), it has direct access to unexported identifiers. If defaultParserDataSize is ever updated, the test constant must be updated separately and in sync — a silent drift that this test is specifically designed to catch.
Motivation
vt.NewEmulatoreagerly allocates a 4 MiB ANSI parser data buffer for every emulator. In amux this shows up as the largest fixed per-pane parser cost in heap profiles.Summary
Testing
go test -run TestNewEmulatorCapsParserDataBuffer -count=100go test ./... -count=1Review focus
Review the 128 KiB cap choice for OSC, DCS, SOS, PM, and APC payload retention. This PR changes only the parser data buffer size; it does not change terminal wire handling, output encoding, or parser ownership.