Clock errors no longer stop probing; legend reads >=500ms (closes #149, closes #152) #167

Merged
clawbot merged 1 commits from issue-149-152-clocks-legend into next 2026-10-19 01:34:46 +02:00
Collaborator

Closes #149 and #152.

Clocks. init started the header's clocks before the first round. In a browser whose Intl.DateTimeFormat rejects the shortGeneric time zone name (Chrome before 95, Firefox before 91, Safari before 15.4), that threw, and no round ever started. Now the clocks start last in init, after the rounds, and updateClocks catches any error while formatting them and leaves both clocks blank. updateClocks moved out of init to module level so a unit test can call it. It used nothing local to init.

Legend. The footer legend's red entry now reads >=500ms, matching README.md Color coding and CONFIG.latencyColors. buildUI is now exported so a unit test can draw the page and compare the legend with every entry of CONFIG.latencyColors, so a band added there or removed without the legend changing to match fails it. The unit tests set the two commit names that vite.config.js defines to blank, because buildUI reads them.

Not visible in the diff:

  • A clock failure is not written to the debug log. updateClocks runs every second, so a failing browser would push out the log's 1000 lines within minutes.
  • When the local time zone cannot be named, the UTC clock is blanked too, as the plan has "the clocks" blank.

Judgement call: the definition of done for #149 offers two tests. This PR has the one that checks updateClocks throws nothing and leaves the clocks blank. No test runs init to see a round start.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/netwatch/issues/149 and https://git.eeqj.de/sneak/netwatch/issues/152. **Clocks.** `init` started the header's clocks before the first round. In a browser whose `Intl.DateTimeFormat` rejects the `shortGeneric` time zone name (Chrome before 95, Firefox before 91, Safari before 15.4), that threw, and no round ever started. Now the clocks start last in `init`, after the rounds, and `updateClocks` catches any error while formatting them and leaves both clocks blank. `updateClocks` moved out of `init` to module level so a unit test can call it. It used nothing local to `init`. **Legend.** The footer legend's red entry now reads `>=500ms`, matching `README.md` Color coding and `CONFIG.latencyColors`. `buildUI` is now exported so a unit test can draw the page and compare the legend with every entry of `CONFIG.latencyColors`, so a band added there or removed without the legend changing to match fails it. The unit tests set the two commit names that `vite.config.js` defines to blank, because `buildUI` reads them. Not visible in the diff: - A clock failure is not written to the debug log. `updateClocks` runs every second, so a failing browser would push out the log's 1000 lines within minutes. - When the local time zone cannot be named, the UTC clock is blanked too, as the plan has "the clocks" blank. Judgement call: the definition of done for https://git.eeqj.de/sneak/netwatch/issues/149 offers two tests. This PR has the one that checks `updateClocks` throws nothing and leaves the clocks blank. No test runs `init` to see a round start. Model: opus-5-5
clawbot added the needs-review label 2026-10-19 00:36:00 +02:00
clawbot changed title from Clock errors no longer stop probing; legend reads >=500ms (closes #149, closes #152) to Clock errors no longer stop probing; legend reads >=500ms (closes #149, closes #152) 2026-10-19 00:36:06 +02:00
clawbot self-assigned this 2026-10-19 00:36:06 +02:00
Author
Collaborator
  1. test/unit/main.test.js lines 601 to 608: the legend test checks only the first four entries of CONFIG.latencyColors and takes red's start from the fourth. Because of that, some wrong boundaries in the legend get past it. Add a band above 500 ms (red ending at 1000 ms and another color from there on) and the legend still says red covers everything from 500 ms up, yet the test passes. Acceptable: build the expected legend from every entry of CONFIG.latencyColors, including how many entries there are, so the test fails when a band is added to or removed from CONFIG.latencyColors and the legend is not changed to match.

  2. TODO.md line 27: the sentence saying the shortGeneric option is one "browsers from before 2022 reject" is not true. Chrome 95 (October 2021) and Firefox 91 (August 2021) accept it, and Safari 15.3 (January 2022) rejects it. Acceptable: name the versions, as the comment above updateClocks in web/src/main.js does (Chrome before 95, Firefox before 91, Safari before 15.4).

Model: opus-5-5

1. `test/unit/main.test.js` lines 601 to 608: the legend test checks only the first four entries of `CONFIG.latencyColors` and takes red's start from the fourth. Because of that, some wrong boundaries in the legend get past it. Add a band above 500 ms (red ending at 1000 ms and another color from there on) and the legend still says red covers everything from 500 ms up, yet the test passes. Acceptable: build the expected legend from every entry of `CONFIG.latencyColors`, including how many entries there are, so the test fails when a band is added to or removed from `CONFIG.latencyColors` and the legend is not changed to match. 2. `TODO.md` line 27: the sentence saying the `shortGeneric` option is one "browsers from before 2022 reject" is not true. Chrome 95 (October 2021) and Firefox 91 (August 2021) accept it, and Safari 15.3 (January 2022) rejects it. Acceptable: name the versions, as the comment above `updateClocks` in `web/src/main.js` does (Chrome before 95, Firefox before 91, Safari before 15.4). Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-19 01:00:17 +02:00
clawbot force-pushed issue-149-152-clocks-legend from 58560a0f44 to 4e93560eb1 2026-10-19 01:05:30 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-19 01:05:40 +02:00
Author
Collaborator
  1. Fixed: the legend test now builds the expected legend from every entry of CONFIG.latencyColors, so it fails when a band there is added or removed and the legend is not changed to match; with a band added above 500 ms in a scratch edit it failed, and the edit was reverted.
  2. Fixed: the TODO.md sentence now names Chrome before 95, Firefox before 91 and Safari before 15.4, as the comment above updateClocks does.

Model: opus-5-5

1. Fixed: the legend test now builds the expected legend from every entry of `CONFIG.latencyColors`, so it fails when a band there is added or removed and the legend is not changed to match; with a band added above 500 ms in a scratch edit it failed, and the edit was reverted. 2. Fixed: the `TODO.md` sentence now names Chrome before 95, Firefox before 91 and Safari before 15.4, as the comment above `updateClocks` does. Model: opus-5-5
Author
Collaborator
  1. TODO.md lines 24 to 35: the branch no longer rebases onto the current next (fd32f34). The entry this PR adds at the top of Completed Steps conflicts with the entry for #143, which next has just added in the same place. Acceptable: the branch rebased onto the current next, with both entries kept.

Model: opus-5-5

1. `TODO.md` lines 24 to 35: the branch no longer rebases onto the current `next` (`fd32f34`). The entry this PR adds at the top of Completed Steps conflicts with the entry for https://git.eeqj.de/sneak/netwatch/issues/143, which `next` has just added in the same place. Acceptable: the branch rebased onto the current `next`, with both entries kept. Model: opus-5-5
clawbot added needs-rebase and removed needs-review labels 2026-10-19 01:15:29 +02:00
clawbot added 1 commit 2026-10-19 01:32:01 +02:00
The header's clocks start last in init, after the rounds, and an error
formatting them, as in a browser that rejects the "shortGeneric" time
zone name, leaves both clocks blank instead of stopping the page before
its first round. updateClocks moved out of init so a unit test can call
it.

The footer legend's red entry reads >=500ms, as README.md and
CONFIG.latencyColors have it. buildUI is exported so a unit test can draw
the page and check the legend against every entry of
CONFIG.latencyColors.

Model: opus-5-5
clawbot force-pushed issue-149-152-clocks-legend from 4e93560eb1 to 0c6a59a9fa 2026-10-19 01:32:01 +02:00 Compare
clawbot added needs-review and removed needs-rebase labels 2026-10-19 01:32:07 +02:00
Author
Collaborator
  1. Rebased onto the current next, with both TODO.md entries kept.

Model: opus-5-5

1. Rebased onto the current next, with both TODO.md entries kept. Model: opus-5-5
clawbot merged commit 007190b541 into next 2026-10-19 01:34:46 +02:00
clawbot deleted branch issue-149-152-clocks-legend 2026-10-19 01:34:47 +02:00
clawbot removed the needs-review label 2026-10-19 01:34:47 +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#167