Debug log adds each line instead of drawing the whole panel (closes #131) #135

Merged
clawbot merged 1 commits from issue-131-debug-log-append-line into next 2026-10-14 14:13:04 +02:00
Collaborator

With the debug log open, every line written drew the panel again with up to 1000 lines. A check that ends while the page draws is timed only when the drawing is done, so the latencies shown and reported with the panel open read too high (#131).

Each line is now appended to the open panel, and its first line is dropped once it holds more than maxLogEntries. The whole panel is drawn only when it is opened. Lines are still set as text, never as HTML (#29).

What the diff does not show:

  • Scrolling to the newest line after every line still raised the latencies, because reading the panel's height lays out all of its lines, about 30 times a round. The scroll now runs in the next frame. cancelAnimationFrame keeps at most one request waiting, since a hidden tab runs no frames and would otherwise collect one per line.
  • log is exported only for the unit test. The test tells a line drawn again from one left alone by object identity, because a redraw makes new lines that compare equal.

Disclosures:

  • Judgement call: the once-a-frame scroll goes beyond appending and dropping lines. Without it, latencies with the panel open still read higher than with it closed.
  • Not verified: a hidden tab, and browsers other than headless Chrome.
  • The headless Chrome check was a one-off script and is not added to test/viewport/, whose checks are about layout.

Model: opus-5-5

With the debug log open, every line written drew the panel again with up to 1000 lines. A check that ends while the page draws is timed only when the drawing is done, so the latencies shown and reported with the panel open read too high (https://git.eeqj.de/sneak/netwatch/issues/131). Each line is now appended to the open panel, and its first line is dropped once it holds more than `maxLogEntries`. The whole panel is drawn only when it is opened. Lines are still set as text, never as HTML (https://git.eeqj.de/sneak/netwatch/issues/29). What the diff does not show: - Scrolling to the newest line after every line still raised the latencies, because reading the panel's height lays out all of its lines, about 30 times a round. The scroll now runs in the next frame. `cancelAnimationFrame` keeps at most one request waiting, since a hidden tab runs no frames and would otherwise collect one per line. - `log` is exported only for the unit test. The test tells a line drawn again from one left alone by object identity, because a redraw makes new lines that compare equal. Disclosures: - Judgement call: the once-a-frame scroll goes beyond appending and dropping lines. Without it, latencies with the panel open still read higher than with it closed. - Not verified: a hidden tab, and browsers other than headless Chrome. - The headless Chrome check was a one-off script and is not added to `test/viewport/`, whose checks are about layout. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 12:13:55 +02:00
clawbot self-assigned this 2026-10-14 12:13:55 +02:00
Author
Collaborator

FAIL (needs-rebase)

  • test/unit/main.test.js, lines 16 and 386 to 417: the branch no longer applies to the current next. next now has the two Reporter tests from #124 at the same place, and imports Reporter next to where this branch adds log, so the test file conflicts, not only the TODO.md Completed Steps entry. Acceptable: the branch rebased onto the current next, importing both log and Reporter, with the new debug log test after the two Reporter tests and this change's TODO.md entry above the one for #126.

Deviation: the rest of the change was reviewed with that conflict resolved as above, and nothing else was found.

Model: opus-5-5

**FAIL** (needs-rebase) - `test/unit/main.test.js`, lines 16 and 386 to 417: the branch no longer applies to the current `next`. `next` now has the two `Reporter` tests from https://git.eeqj.de/sneak/netwatch/issues/124 at the same place, and imports `Reporter` next to where this branch adds `log`, so the test file conflicts, not only the `TODO.md` Completed Steps entry. Acceptable: the branch rebased onto the current `next`, importing both `log` and `Reporter`, with the new debug log test after the two `Reporter` tests and this change's `TODO.md` entry above the one for https://git.eeqj.de/sneak/netwatch/issues/126. Deviation: the rest of the change was reviewed with that conflict resolved as above, and nothing else was found. Model: opus-5-5
clawbot added needs-rebase and removed needs-review labels 2026-10-14 13:02:05 +02:00
clawbot force-pushed issue-131-debug-log-append-line from 95e8acd771 to 3848fbc6f4 2026-10-14 13:15:34 +02:00 Compare
Author
Collaborator

Rebased onto the current next, with the conflict in the test file and TODO.md resolved as the review asked.

Model: opus-5-5

Rebased onto the current `next`, with the conflict in the test file and `TODO.md` resolved as the review asked. Model: opus-5-5
clawbot added needs-review and removed needs-rebase labels 2026-10-14 13:30:37 +02:00
Author
Collaborator

PASS: with the debug log open, each line written is now added to the panel without drawing the lines already shown again, the panel keeps its newest 1000 lines, each set as text, opening it still shows the lines written while it was closed, and the new unit test fails if a line draws the whole panel again (#131).

Model: opus-5-5

PASS: with the debug log open, each line written is now added to the panel without drawing the lines already shown again, the panel keeps its newest 1000 lines, each set as text, opening it still shows the lines written while it was closed, and the new unit test fails if a line draws the whole panel again (https://git.eeqj.de/sneak/netwatch/issues/131). Model: opus-5-5
clawbot added 1 commit 2026-10-14 14:07:56 +02:00
With the debug log open, every line written drew the panel again with
up to 1000 lines, and a check that ends while the page draws is timed
only when the drawing is done, so latencies measured with the panel open
read too high. Each line is now appended to the open panel and its first
line dropped once it holds more than maxLogEntries; the whole panel is
drawn only when it is opened. Scrolling to the newest line reads the
panel's height, which lays out all its lines, so it runs once a frame,
with at most one frame request waiting.

Model: opus-5-5
clawbot force-pushed issue-131-debug-log-append-line from 3848fbc6f4 to 01cf095c3c 2026-10-14 14:07:56 +02:00 Compare
clawbot merged commit 12f3dd5b07 into next 2026-10-14 14:13:04 +02:00
clawbot deleted branch issue-131-debug-log-append-line 2026-10-14 14:13:04 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#135