Claude Sonnet 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
3 of 3
Comments published
4
Comments matching a bug
3
Comments not matching
1
Cost of this PR
$0.945

Published comments (4)

highbugpkg/storage/unified/resource/search.go:216

TotalDocs reads index cache map without lock while event goroutine writes it — A watch event during startup can make `BuildIndex` write the `bleveBackend.cache` map while `TotalDocs` iterates it, causing a fatal concurrent map access that crashes the process. Take `b.cacheMu.RLock()` inside `TotalDocs`, or compute the count before starting the `handleEvent` goroutine.

mediumbugpkg/storage/unified/search/bleve.go:85-90

Parallel init workers race on shared err and batch counter in search.go — With the lock gone from `BuildIndex`, the `errgroup` workers in `searchSupport.init` race on the shared `err` and `totalBatchesIndexed`, so one worker can overwrite another's error with nil and hide a failed build. Use a goroutine-local `err` from `s.build(...)` and an atomic or mutex-guarded counter.

mediumbugpkg/storage/unified/search/bleve.go:137-139

Concurrent BuildIndex calls for the same key are no longer serialised — Concurrent builds for one `NamespacedResource` can now collide: file-backed builds fail or corrupt each other in `bleve.New`, and in-memory builds silently overwrite the cached index. Serialize builds per key, or re-check `b.cache` under `cacheMu` before building, and publish the index only once.

mediumbugpkg/server/module_server_test.go:35-38

Unconditional postgres skip removes coverage of resource server startup path — Skipping postgres unconditionally leaves the changed startup path (`NewResourceServer` now calling `Init`, search init before the watcher) untested there, so postgres failures would go unnoticed. Find the Drone failure cause, such as the fixed 500ms sleep or DB host config; if a skip is unavoidable, limit it to Drone.

Gold bugs found (3)

mediumBuildIndex now locks only the final cache assignment, so concurrent callers for the same uncached key all build the same expensive index in parallel and the last one overwrites the others.
highThe new startup log calls TotalDocs, which iterates the index cache without a lock, after the event goroutine that can add indexes has started, so a concurrent map read and write can crash the process.
mediumThe PR skips the storage-server module integration test on postgres instead of fixing the failure, removing coverage of the new eager initialization on postgres.

Gold bugs missed (0)

None.