Severity: P4.
readLogTail reads the last maxBytes and always throws away the first line, in case the window started mid-line. When the window happens to start exactly at the beginning of a line, that first line is whole and valid, and it gets dropped.
Repro on main (ten identical-length 97 byte events C00 to C09):
await readLogTail(file, { maxBytes: 97 * 4 }) // [C07, C08, C09] (expected C06..C09)
await readLogTail(file, { maxBytes: 97 * 4 + 1 }) // [C06, C07, C08, C09]
Fix: read one byte before the window, so the first piece is either the end of a cut-off line or empty, and only then drop it.
Severity: P4.
readLogTailreads the last maxBytes and always throws away the first line, in case the window started mid-line. When the window happens to start exactly at the beginning of a line, that first line is whole and valid, and it gets dropped.Repro on main (ten identical-length 97 byte events C00 to C09):
Fix: read one byte before the window, so the first piece is either the end of a cut-off line or empty, and only then drop it.