Claude Opus 5.5 · Heavy
unified-storage-performance-optimizations-grafana-codex
Grafana · Go · S · 30–99 lines · 5 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 2 of 3
- Comments published
- 4
- Comments matching a bug
- 2
- Comments not matching
- 2
- Cost of this PR
- $1.820
Published comments (4)
Concurrent BuildIndex calls can build the same key and overwrite the cache — Concurrent `getOrCreateIndex` callers (Search and the watch goroutine) can build one key at once, so `b.cache[key] = idx` silently drops documents written to the replaced index, and file-backed builds race on one `bleve.New(dir)` directory. Deduplicate builds per key with a lock or singleflight in `getOrCreateIndex`/`BuildIndex`, re-checking the cache first. **Also found in:** - `pkg/storage/unified/search/bleve.go:96-104`
Failed Init leaks the lifecycle backend and the search watch goroutine — Call `s.cancel()` and stop the lifecycle hooks, e.g. via `s.Stop`, before returning the error.
NewResourceServer now blocks on and fails from synchronous Init — Callers that build the server during wiring and expect `Init` to run later now get slow or failed construction, since lifecycle `Init`, the search index build and watcher startup all run in `NewResourceServer`. Keep the constructor free of init work and leave it to the existing `Init` path.
Postgres skip masks a startup race from the fixed 500ms sleep — Since `NewResourceServer` now builds the search index synchronously, startup can exceed the fixed `time.Sleep(500ms)` on CI, and the skip only hides that race. Drop the skip and poll `http://localhost:3001/metrics` until it responds or times out, e.g. with `require.Eventually`.