DeepSeek V4 Pro · 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 Opus 5.5.

Gold bugs found
7 of 11
Comments published
7
Comments matching a bug
7
Comments not matching
0
Cost of this PR
$1.290

Published comments (7)

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

Mode3 Delete skips legacy fallback on unified-storage NotFound — Objects that exist only in legacy storage (created before mode-3 migration) can no longer be deleted and will resurface on rollback. Restore the old `apierrors.IsNotFound(err)` fallback that still calls `d.Legacy.Delete` before returning.

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

Async legacy write may be canceled before writing to legacy storage — The mode-3 invariant (write to both stores) is silently broken when the request context cancels before `LegacyStorage.Create` finishes. Use a parent not tied to request cancellation, e.g. `context.WithoutCancel(ctx)`, so only the 10s timeout cancels the legacy write; the same pattern exists in `Delete`, `Update`, and `DeleteCollection`.

highbugpkg/apiserver/rest/dualwriter_mode3.go:139

Mode3 legacy update passes raw objInfo causing divergent writes — When the two stores are out of sync the legacy write diverges or conflicts instead of converging. Wrap the storage result as before with `&updateWrapper{upstream: objInfo, updated: res}`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete passes object name instead of options.Kind to storage metric — The metric's `kind` label (metrics.go:23) gets polluted with arbitrary object names instead of the resource kind. Pass `options.Kind`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:45

Storage failures recorded in legacy duration histogram in Create and Update — This pollutes the legacy duration histogram with storage errors and leaves the storage histogram missing its error observations. Change `Create` and `Update` to call `d.recordStorageDuration(true, mode3Str, options.Kind, method, startStorage)`. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:127-130`

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:166

DeleteCollection legacy duration mislabeled as storage duration — Legacy-store failures and timeouts are mislabeled as unified-storage durations. Change to `d.recordLegacyDuration(err != nil, mode3Str, options.Kind, method, startLegacy)`.

mediumbugpkg/apiserver/rest/dualwriter_mode3_test.go:30-65

TestMode3_Create never asserts async legacy Create — The test would still pass if `d.Legacy.Create` were removed or broken. Add synchronization for the async legacy write and assert it was invoked (e.g., wait for the goroutine and call `m.AssertExpectations`, or use a done channel/atomic spy), rather than only asserting the storage result. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3_test.go:299-345`

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 (4)

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.
mediumTestMode3_Get and TestMode3_List share one mock.Mock between the legacy and storage mocks with identical method names, so they would still pass if Mode 3 read from LegacyStorage instead of Storage.
mediumThe new Mode 3 playlist integration subtests set DualWriterDesiredModes to Mode3, but SetDualWritingMode defaults a fresh key to Mode1 and only handles Mode1<->Mode2 transitions, so the subtests silently run in Mode1 and Mode3 cannot be enabled through configuration.