www: Fix log viewer losing ANSI colors partway through a log by lsgunth · Pull Request #9216 · buildbot/buildbot · GitHub
Skip to content

www: Fix log viewer losing ANSI colors partway through a log - #9216

Open
lsgunth wants to merge 1 commit into
buildbot:masterfrom
lsgunth:log-viewer-ansi-chunk-index
Open

lsgunth wants to merge 1 commit into
buildbot:masterfrom
lsgunth:log-viewer-ansi-chunk-index

Conversation

@lsgunth

@lsgunth lsgunth commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

With python unittests in 3.14 now outputting coloured lines, I found that the buildbot console was not always displaying them correctly. I traced this to issue #7852 which turns out was only partially fixed. This patch fixes it in the remaining branch.

Contributor Checklist:

  • I have created a file in the newsfragments directory (and read the README.txt in that directory)

Here's a screenshot showing the issue:

Screenshot_20261015_150241

In a log where most lines are colored, the log viewer stops applying
colors partway down and shows each line's escape sequences as text
instead, such as "test_foo ... [32mok[0m". With a 581-line unittest
log, every line from 530 onwards was affected.

The viewer downloads a log in chunks, and parseCssClassesForChunk()
works out the colors of a chunk's lines in one of two ways, depending
on how many of them contain escape sequences. LogTextManager looks up
a line by its position within the chunk, but when no more than 100 of
the chunk's lines, or no more than 30% of them, contain escape
sequences, the colors are stored under the line's number in the whole
log. For a chunk that doesn't start at the top of the log, the lookup
then finds nothing and the line is shown with its escape sequences, or
finds an earlier line's entry and shows that line's text in its place.

The viewer fetches 500 lines beyond the ones on screen, so the log
above arrives as lines 0-529, most of them colored, and lines 530-580,
of which only 39 are. That second chunk is the one that loses its
colors.

f9df823 ("www: Fix indexing of log chunks") fixed the same
mismatch in the other branch for buildbot#7852 and left this one. The basic
test expected the whole-log line numbers and is updated to match.
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