DeepSeek V4.1 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 Haiku 5.5.

Gold bugs found
6 of 9
Comments published
7
Comments matching a bug
6
Comments not matching
1
Cost of this PR
$0.335

Published comments (7)

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

Async legacy update reuses raw objInfo instead of persisted object — For patch-based infos the two stores now diverge, and a non-idempotent `UpdatedObject` can fail or write a different object to legacy. Wrap `objInfo` in `updateWrapper{updated: res}` as the pre-PR code did.

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

Backgrounded legacy writes inherit request context and are cancelled — Because the request-scoped `ctx` is cancelled when the handler returns, the backgrounded legacy write aborts and the object is never persisted to LegacyStorage. Detach the context with `context.WithoutCancel(ctx)` or keep the write on the request path; the same pattern repeats in `Delete`, `Update` and `DeleteCollection`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:129

Update error path records storage latency in legacy metric — A unified-storage failure is counted in the legacy metric even though the legacy update never ran. Use `recordStorageDuration(true, ...)`; `Create` has the identical mistake. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3.go:43-48` - `pkg/apiserver/rest/dualwriter_mode3.go:45-45`

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:166

DeleteCollection legacy delete records to storage metric — Legacy latency and errors land in the unified-storage metric, so the legacy metric never gets a sample for this method. Use `recordLegacyDuration`, as the other legacy goroutines do.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete records storage duration with object name as kind label, unbounded metric cardinality — The object `name` fills the `kind` label of `WithLabelValues(isError, mode, name, method)`, creating a new Prometheus series for every deleted object and inflating memory without bound. Pass `options.Kind`.

mediumbugpkg/apiserver/rest/dualwriter_mode3.go:106

Delete success metric passes object name as the kind label — The object name becomes the `kind` label, giving a new series per deleted object and nonsense delete metrics. Pass `options.Kind`; also pass the request-scoped `log` instead of `d.Log` to `klog.NewContext`.

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

TestMode3_Create never verifies the asynchronous legacy write — Deleting the legacy goroutine, making legacy `Create` always fail, or dropping the 10s timeout would leave this test green. Synchronize on the legacy call and assert its expectations. **Also found in:** - `pkg/apiserver/rest/dualwriter_mode3_test.go:215-241`

Gold bugs found (6)

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.

Gold bugs missed (3)

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.