Claude Sonnet 5.5 · Heavy
dual-storage-architecture-grafana-codex
Grafana · Go · L · 300–799 lines · 4 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
- 6 of 9
- Comments published
- 7
- Comments matching a bug
- 6
- Comments not matching
- 1
- Cost of this PR
- $2.209
Published comments (7)
Async legacy create uses request context that is cancelled on handler return — The request `ctx` is cancelled when the handler returns, so the legacy `Create` (and the Update, Delete and DeleteCollection goroutines) can abort midway and desync the stores. Derive the timeout context from `context.WithoutCancel(ctx)`.
Async legacy Update reuses consumed objInfo instead of stored result — Legacy recomputes the object from its own old state instead of writing what `Storage.Update` produced, so the stores can diverge. Wrap `objInfo` and the stored result `res` in an `updateWrapper` before starting the goroutine.
Mode3 Create test does not verify the asynchronous legacy write — The tests still pass if the goroutine calling `Legacy.*` is removed, because they only assert on the storage result. Wait with `assert.Eventually` or a channel signaled from the mock, and register legacy expectations in the Delete and DeleteCollection cases.
Delete drops enriched logger from context and labels metric by object name — The context logger loses the name, kind and method values, and labeling the metric with `name` creates a new series per object. Pass `log` to `klog.NewContext` and use `options.Kind` in `recordStorageDuration`.
Object name passed as kind label to recordStorageDuration in Delete — Each distinct object name passed to `recordStorageDuration` creates a new Prometheus series, causing unbounded cardinality and memory growth. Pass `options.Kind`, as the other calls do.
Create records storage failure with legacy duration metric — Storage failures in `Create` and `Update` are counted under `recordLegacyDuration`, which skews both metrics and hides storage errors. Use `recordStorageDuration` in both places. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:126-131` - `pkg/apiserver/rest/dualwriter_mode3.go:129-129`
Legacy DeleteCollection duration recorded as storage metric — Legacy latency and errors from `DeleteCollection` get mixed into the storage metrics. Call `recordLegacyDuration` instead of `recordStorageDuration`.