Claude Opus 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
- 7 of 9
- Comments published
- 7
- Comments matching a bug
- 7
- Comments not matching
- 0
- Cost of this PR
- $3.891
Published comments (7)
Mode3 Delete skips legacy deletion when unified storage returns NotFound — Objects that exist only in legacy storage, such as unmigrated ones, now fail to delete with NotFound, and their legacy copy is never removed. Restore the `apierrors.IsNotFound` tolerance so `Delete` still proceeds to legacy storage.
Background legacy writes are cancelled when the request context ends — The apiserver cancels the request `ctx` once the handler returns, so the legacy `Create` (and the same goroutines in `Update`, `Delete` and `DeleteCollection`) is often aborted midway, and legacy storage silently drifts. Derive the timeout context from `context.WithoutCancel(ctx)` instead.
Mode3 Update sends raw objInfo to legacy, letting legacy store a different object — Legacy now applies the update to its own old copy and can store a different object than the one unified storage returned. Wrap `objInfo` in an `updateWrapper` holding `res` before calling `Legacy.Update`, as Mode2 still does.
Mode3 Create/Update tests never verify the background legacy write ran — If the legacy write broke or disappeared, this test would still pass, since it never waits for the background goroutine or calls `m.AssertExpectations`. Use `assert.Eventually` on `m.AssertCalled` for the legacy `Create` before the test ends, and do the same in `TestMode3_Update`.
Storage.Create failure is recorded in the legacy duration metric — This adds a fake error to the legacy histogram and drops the real one from the storage histogram, since `startStorage` timed the unified `Storage.Create` call. Call `recordStorageDuration(true, ...)` instead of `recordLegacyDuration`. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:127-130` - `pkg/apiserver/rest/dualwriter_mode3.go:129-129`
Delete success path records object name instead of kind in metric label — Passing the object `name` as the label makes its cardinality unbounded and inconsistent with every other call, including the error path just above. Pass `options.Kind` to `recordStorageDuration` instead.
Legacy DeleteCollection duration recorded as storage metric — Every `DeleteCollection` logs two storage samples and no legacy sample, since this goroutine times `d.Legacy.DeleteCollection`. Switch the call to `recordLegacyDuration`.