diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-23 09:04:17 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-23 09:04:17 +0200 |
| commit | 462184dff3eef32f01f06634305da1355ac1bec2 (patch) | |
| tree | 026ffaaeacfe152957298c985e1df77ff661b723 /internal/stats/stats_test.go | |
| parent | 667f2d3384643aa877de2eefcbad3923965bad09 (diff) | |
chore: bump version to v0.25.9v0.25.9
Code quality fixes from audit:
- Log silently discarded errors in status sinks and stats.Update call sites
- Fix json.Marshal errors silently ignored in LSP handlers
- Replace time.Sleep in tests with channel signaling (mcp) and fake clock (stats)
- Make context cancellation work in production time.Sleep sites (handlers_document, cmdentry)
- Remove init()-based provider registration from llm package; use explicit RegisterAllProviders()
- Add WaitGroup goroutine tracking to MCP server Run()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/stats/stats_test.go')
| -rw-r--r-- | internal/stats/stats_test.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/stats/stats_test.go b/internal/stats/stats_test.go index a9b3d22..47e3068 100644 --- a/internal/stats/stats_test.go +++ b/internal/stats/stats_test.go @@ -33,10 +33,17 @@ func TestUpdate_PrunesOld_ByWindow(t *testing.T) { t.Setenv("XDG_CACHE_HOME", t.TempDir()) SetWindow(2 * time.Second) ctx := context.Background() + + // Inject a fake clock so we can advance time without sleeping. + fakeNow := time.Now() + nowFunc = func() time.Time { return fakeNow } + defer func() { nowFunc = time.Now }() + if err := Update(ctx, "p", "m", 1, 1); err != nil { t.Fatal(err) } - time.Sleep(2200 * time.Millisecond) + // Advance fake time past the 2-second window so the first event is pruned. + fakeNow = fakeNow.Add(3 * time.Second) if err := Update(ctx, "p", "m", 2, 2); err != nil { t.Fatal(err) } |
