GLM-5.3 Flash · 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
9
Comments matching a bug
7
Comments not matching
2
Cost of this PR
$0.195

Published comments (9)

highbugpkg/apiserver/rest/dualwriter_mode3.go:154-158

Legacy DeleteCollection skipped when unified storage delete fails — After a partial unified deletion, objects removed from unified storage keep their legacy rows, so the stores diverge and a rollback resurrects them. Run `d.Legacy.DeleteCollection` asynchronously even when `d.Storage.DeleteCollection` errors, as before.

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

Async legacy write derives timeout from cancellable request context, aborting immediately — The apiserver cancels the request context right after the handler returns, so the spawned goroutine's legacy write aborts with `context canceled` and mode 3 never records to legacy storage. Derive the timeout from `context.WithoutCancel(ctx)` and avoid reusing request-scoped validation closures.

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

Mode 3 async legacy update drops updateWrapper, causing stale legacy writes — Without `updateWrapper`, the legacy store recomputes the update against its own possibly stale object, silently diverging from unified storage — and backfill propagates that. Wrap `res` in `updateWrapper` alongside `objInfo`, as modes 1 and 2 do.

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

Mode 3 Delete no longer falls through to legacy delete on NotFound — Objects that exist only in legacy storage are never removed: the client gets a 404 while the legacy copy survives and resurrects the object after a rollback. Fall through to `d.Legacy.Delete` when `apierrors.IsNotFound(err)`.

mediumbugpkg/apiserver/rest/dualwriter_mode3_test.go:63-77

Mode 3 tests never assert the legacy-storage write actually happens — The legacy mock expectation is never asserted, so the tests pass even if `d.Legacy.Create` is removed or always fails. Wait for the goroutine and assert the call (e.g. via `AssertExpectations`), including a case with a pre-canceled parent context.

mediumbugpkg/tests/apis/playlist/playlist_test.go:132-144

Mode 3 dual-write tests never verify the legacy write — Because `doPlaylistTests` reads everything through unified storage, a broken or failing legacy write is invisible and these subtests pass regardless. Verify the legacy side directly, for example by querying legacy storage after each write.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:45

Create(): storage error path records metric as legacy instead of storage — Storage create failures are counted in the legacy metric, inflating its error rate while the storage metric under-reports. Record with `d.recordStorageDuration` here, matching the success path. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:127-131` - `pkg/apiserver/rest/dualwriter_mode3.go:129-129` - `pkg/apiserver/rest/dualwriter_mode3.go:128-129`

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete() passes object name instead of options.Kind to storage duration metric — Passing `name` puts object names in the same label other call sites fill with `options.Kind`, breaking per-kind metric aggregation. Use `options.Kind` here too.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:166

DeleteCollection goroutine records legacy latency with recordStorageDuration — Legacy delete-collection latency and errors land in the storage metric, which over-reports while the legacy metric stays empty. Call `d.recordLegacyDuration` instead.

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.