Claude Opus 5.5 · Balanced

dual-storage-architecture-grafana-codex

Grafana · Go · L · 300–799 lines · 4 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
5 of 9
Comments published
5
Comments matching a bug
5
Comments not matching
0
Cost of this PR
$0.859

Published comments (5)

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

Legacy writes use request context that is cancelled when the handler returns — The apiserver cancels `ctx` once `Create` returns, so `Legacy.Create` usually gets a cancelled context and the legacy write is silently lost. Detach it with `context.WithoutCancel(ctx)` before `WithTimeoutCause`, and do the same in `Update`, `Delete` and `DeleteCollection`.

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

Legacy update recomputes from raw objInfo instead of reusing storage result — Passing the raw `objInfo` makes legacy recompute the update against its own possibly stale object, so the stores can diverge or fail on a resourceVersion conflict. Wrap it as the removed code did, with `&updateWrapper{upstream: objInfo, updated: res}`, before calling `Legacy.Update`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:165-166

Async legacy DeleteCollection timing recorded as unified-storage metric — Legacy latency and errors get mixed into the unified-storage metrics. Call `recordLegacyDuration` instead of `recordStorageDuration` here.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete success metric uses object name instead of kind as label — Each deleted object `name` creates its own metric series, causing unbounded cardinality and mislabeled data. Pass `options.Kind` like every other `recordStorageDuration` call.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:43-46

Storage create failure recorded as legacy error in metrics — `Storage.Create` failures show up as legacy errors, so unified-storage error metrics undercount them. Call `recordStorageDuration(true, ...)` instead of `recordLegacyDuration`. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:127-130`

Gold bugs found (5)

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.

Gold bugs missed (4)

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