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)

highbugpkg/apiserver/rest/dualwriter_mode3.go:100-105

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.

highbugpkg/apiserver/rest/dualwriter_mode3.go:50-57

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.

highbugpkg/apiserver/rest/dualwriter_mode3.go:134-141

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.

mediumbugpkg/apiserver/rest/dualwriter_mode3_test.go:27-76

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`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:45

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`

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

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.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:166

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`.

Gold bugs found (7)

mediumThe legacy DeleteCollection goroutine records its duration with recordStorageDuration instead of recordLegacyDuration, misattributing legacy latency and errors to the storage metric.
mediumDelete's success path records the storage metric with the object name in the kind label instead of options.Kind, creating per-object series and inconsistent labels.
mediumOn storage Create/Update failure the duration is recorded with recordLegacyDuration, attributing unified-store errors to the legacy metric.
highMode 3 legacy writes now run in background goroutines derived from the request context, which is cancelled when the request completes, so legacy writes can be cancelled and legacy storage falls out of sync.
highLegacy.Update now receives the original objInfo instead of a wrapper carrying the object stored in unified storage, so legacy recomputes the update and can diverge.
mediumThe Mode 3 tests never wait for or assert the asynchronous legacy writes, and legacy and storage share one mock, so removing the legacy calls would not fail them.
highDualWriterMode3.Delete now returns on any unified-storage error, including NotFound, before deleting from legacy, so objects that exist only in legacy can no longer be deleted.

Gold bugs missed (2)

highIndependent per-request goroutines remove ordering between legacy writes to the same resource, so legacy can end up with an older version or a resurrected object.
mediumMode 3 legacy-storage write errors (create/update/delete/delete-collection) are no longer logged after moving to async goroutines; only a duration metric with an error flag is recorded.