MiniMax M3 · 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
5 of 9
Comments published
7
Comments matching a bug
5
Comments not matching
2
Cost of this PR
$0.450

Published comments (7)

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:161-167

DeleteCollection legacy goroutine records duration under wrong metric name — The async legacy goroutine after a unified-store `DeleteCollection` records its latency under the storage histogram, polluting dashboards. Call `d.recordLegacyDuration(err != nil, mode3Str, options.Kind, method, startLegacy)` instead.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:161-167

DeleteCollection legacy goroutine uses storage duration recorder — The legacy `DeleteCollection` goroutine records latency via `d.recordStorageDuration`, attributing Legacy timings to the unified-storage series. Switch to `d.recordLegacyDuration` so the storage/legacy split stays accurate.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:45

Mode3 Create: storage error recorded to legacy metric — Create's storage-error branch writes into the legacy metric via `d.recordLegacyDuration`, misattributing a UnifiedStorage failure. Use `d.recordStorageDuration(true, mode3Str, options.Kind, method, startStorage)` so dashboards see the failure on the correct series.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:129

recordLegacyDuration used instead of recordStorageDuration on storage Update error — Update's storage-error branch calls `d.recordLegacyDuration` for a Storage failure. Use `d.recordStorageDuration(true, mode3Str, options.Kind, method, startStorage)` to keep the storage/legacy split faithful.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete success path logs object name instead of resource kind — Delete's success branch passes `name` where `options.Kind` is expected, putting object identity under the kind label. Replace `name` with `options.Kind` so per-kind dashboards group correctly.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:119-144

Mode3 Update dispatching to Legacy asynchronously breaks prior sync guarantee — `DualWriterMode3.Update` previously called `Legacy.Update` synchronously with an `updateWrapper`; now it fires a goroutine using unwrapped `objInfo`, so callers can't rely on read-after-update from Legacy. Revert to synchronous legacy update or document the new async guarantee.

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

TestMode3_Create does not assert the legacy Create was actually invoked — `TestMode3_Create` registers a `legacyStoreMock.Create` expectation but never verifies it was met, so removing the legacy goroutine would still pass. Add `m.AssertExpectations(t)` so the dual-write contract is actually enforced. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3_test.go:189-241` - `pkg/apiserver/rest/dualwriter_mode3_test.go:297-355`

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

Gold bugs missed (4)

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