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