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)
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.
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`.
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}`.
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`.
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`
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)`.
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`