Split out of #29 (items 4 and 5 of that issue), so each change stays small. Behaviour must not change; the unit tests from #99 cover the thresholds, statistics and health states this touches.
Problem, on next
The median is written twice in src/main.js: HostState.medianLatency() and the median in AppState's summary statistics.
HostState.averageLatency(), minLatency(), maxLatency() and medianLatency() each filter the history again.
The latency colour thresholds (50, 100, 200, 500ms) are written out in both latencyHex() and latencyClass(), so changing one can leave the figure and the sparkline disagreeing.
Numbers written inline that belong with the other settings in CONFIG: the health thresholds in AppState.healthStatus() (10, 4, 1000ms, 3), the debug log cap (1000 entries), the gateway probe timeout (1500ms), the recovery probe's count of targets (4) and interval, the resize delay (100ms), and the sorting cadence in tick() (second round, then every tenth).
Definition of done
One median function, used by both.
A target's min, max, average and median come from one pass over its history (or one filtered list), not four.
The colour thresholds are defined once; latencyHex() and latencyClass() both read that one definition.
The numbers above live in CONFIG with short names in the existing style, each read where it was written inline. No new module, no other refactor.
Existing tests pass unchanged; add a test only where a moved value is not already covered.
make check passes; TODO.md updated in the same commit; commit title ends (closes #102).
Model: opus-5-5
Split out of https://git.eeqj.de/sneak/netwatch/issues/29 (items 4 and 5 of that issue), so each change stays small. Behaviour must not change; the unit tests from https://git.eeqj.de/sneak/netwatch/pulls/99 cover the thresholds, statistics and health states this touches.
## Problem, on `next`
- The median is written twice in `src/main.js`: `HostState.medianLatency()` and the median in `AppState`'s summary statistics.
- `HostState.averageLatency()`, `minLatency()`, `maxLatency()` and `medianLatency()` each filter the history again.
- The latency colour thresholds (50, 100, 200, 500ms) are written out in both `latencyHex()` and `latencyClass()`, so changing one can leave the figure and the sparkline disagreeing.
- Numbers written inline that belong with the other settings in `CONFIG`: the health thresholds in `AppState.healthStatus()` (10, 4, 1000ms, 3), the debug log cap (1000 entries), the gateway probe timeout (1500ms), the recovery probe's count of targets (4) and interval, the resize delay (100ms), and the sorting cadence in `tick()` (second round, then every tenth).
## Definition of done
- One median function, used by both.
- A target's min, max, average and median come from one pass over its history (or one filtered list), not four.
- The colour thresholds are defined once; `latencyHex()` and `latencyClass()` both read that one definition.
- The numbers above live in `CONFIG` with short names in the existing style, each read where it was written inline. No new module, no other refactor.
- Existing tests pass unchanged; add a test only where a moved value is not already covered.
- `make check` passes; `TODO.md` updated in the same commit; commit title ends ` (closes #102)`.
Model: opus-5-5
clawbot
self-assigned this 2026-10-04 03:43:24 +02:00
Done in #108: one function computes the min, max, median and average for both a row and the summary, the color limits are one table in CONFIG that both color functions read, and the other numbers the issue lists are CONFIG entries. Nothing the page shows changes. The footer's color legend still writes the limits out as text; the PR says so, with three judgement calls.
Model: opus-5-5
Done in https://git.eeqj.de/sneak/netwatch/pulls/108: one function computes the min, max, median and average for both a row and the summary, the color limits are one table in `CONFIG` that both color functions read, and the other numbers the issue lists are `CONFIG` entries. Nothing the page shows changes. The footer's color legend still writes the limits out as text; the PR says so, with three judgement calls.
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.
Split out of #29 (items 4 and 5 of that issue), so each change stays small. Behaviour must not change; the unit tests from #99 cover the thresholds, statistics and health states this touches.
Problem, on
nextsrc/main.js:HostState.medianLatency()and the median inAppState's summary statistics.HostState.averageLatency(),minLatency(),maxLatency()andmedianLatency()each filter the history again.latencyHex()andlatencyClass(), so changing one can leave the figure and the sparkline disagreeing.CONFIG: the health thresholds inAppState.healthStatus()(10, 4, 1000ms, 3), the debug log cap (1000 entries), the gateway probe timeout (1500ms), the recovery probe's count of targets (4) and interval, the resize delay (100ms), and the sorting cadence intick()(second round, then every tenth).Definition of done
latencyHex()andlatencyClass()both read that one definition.CONFIGwith short names in the existing style, each read where it was written inline. No new module, no other refactor.make checkpasses;TODO.mdupdated in the same commit; commit title ends(closes #102).Model: opus-5-5
Done in #108: one function computes the min, max, median and average for both a row and the summary, the color limits are one table in
CONFIGthat both color functions read, and the other numbers the issue lists areCONFIGentries. Nothing the page shows changes. The footer's color legend still writes the limits out as text; the PR says so, with three judgement calls.Model: opus-5-5