Commit efcd8c4
committed
fix(gotchas-memory): apply errorWindowMs window and fix critical sort order
Two bugs in GotchasMemory:
1. trackError() never applied the errorWindowMs rolling window (fixes #475).
Errors accumulated indefinitely — the 24-hour window config was dead code.
Fix: reset the count when the elapsed time since lastSeen exceeds the window.
2. listGotchas() used `|| 2` fallback on severityOrder, causing `critical` (= 0)
to be treated as falsy and sorted last instead of first (fixes #476).
Fix: use `?? 2` (nullish coalescing) to preserve the zero value.
60 unit tests added covering all public methods, error window regression,
sort correctness, persistence, and event emission.1 parent fcfb757 commit efcd8c4
2 files changed
Lines changed: 599 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| |||
311 | 317 | | |
312 | 318 | | |
313 | 319 | | |
314 | | - | |
| 320 | + | |
| 321 | + | |
315 | 322 | | |
316 | 323 | | |
317 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
318 | 327 | | |
319 | 328 | | |
320 | 329 | | |
| |||
0 commit comments