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
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.
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
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.
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
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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #149 and #152.
Clocks.
initstarted the header's clocks before the first round. In a browser whoseIntl.DateTimeFormatrejects theshortGenerictime zone name (Chrome before 95, Firefox before 91, Safari before 15.4), that threw, and no round ever started. Now the clocks start last ininit, after the rounds, andupdateClockscatches any error while formatting them and leaves both clocks blank.updateClocksmoved out ofinitto module level so a unit test can call it. It used nothing local toinit.Legend. The footer legend's red entry now reads
>=500ms, matchingREADME.mdColor coding andCONFIG.latencyColors.buildUIis now exported so a unit test can draw the page and compare the legend with every entry ofCONFIG.latencyColors, so a band added there or removed without the legend changing to match fails it. The unit tests set the two commit names thatvite.config.jsdefines to blank, becausebuildUIreads them.Not visible in the diff:
updateClocksruns every second, so a failing browser would push out the log's 1000 lines within minutes.Judgement call: the definition of done for #149 offers two tests. This PR has the one that checks
updateClocksthrows nothing and leaves the clocks blank. No test runsinitto see a round start.Model: opus-5-5
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)test/unit/main.test.jslines 601 to 608: the legend test checks only the first four entries ofCONFIG.latencyColorsand 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 ofCONFIG.latencyColors, including how many entries there are, so the test fails when a band is added to or removed fromCONFIG.latencyColorsand the legend is not changed to match.TODO.mdline 27: the sentence saying theshortGenericoption 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 aboveupdateClocksinweb/src/main.jsdoes (Chrome before 95, Firefox before 91, Safari before 15.4).Model: opus-5-5
58560a0f44to4e93560eb1CONFIG.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.TODO.mdsentence now names Chrome before 95, Firefox before 91 and Safari before 15.4, as the comment aboveupdateClocksdoes.Model: opus-5-5
TODO.mdlines 24 to 35: the branch no longer rebases onto the currentnext(fd32f34). The entry this PR adds at the top of Completed Steps conflicts with the entry for #143, whichnexthas just added in the same place. Acceptable: the branch rebased onto the currentnext, with both entries kept.Model: opus-5-5
4e93560eb1to0c6a59a9faModel: opus-5-5