Claude Opus 5.5 · Heavy

anonymous-add-configurable-device-limit-grafana-codex

Grafana · Go · M · 100–299 lines · 6 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
1 of 2
Comments published
3
Comments matching a bug
1
Comments not matching
2
Cost of this PR
$2.146

Published comments (3)

highbugpkg/services/anonymous/anonimpl/impl.go:144-148

Device cache entry persists after failed tagging, bypassing the device limit — Later requests from that device within 29 minutes hit `localCache`, get a nil error and pass, so `ErrDeviceLimitReached` is enforced only once. Remove the cache entry when `CreateOrUpdateDevice` fails, or set it only after the call succeeds. **Also found in:** - `pkg/services/anonymous/anonimpl/client.go:44-50`

highbugpkg/services/anonymous/anonimpl/anonstore/database.go:52-53

Wire provider ProvideAnonDBStore now needs an unprovided int64 — `pkg/server/wire.go` still registers `ProvideAnonDBStore` and binds it to `anonstore.AnonStore`, but nothing provides an `int64`, so wire generation and the server build fail. Remove that provider and its `Bind` from wire.go, or keep a wire-compatible constructor that reads the limit from `*setting.Cfg`.

highbugpkg/services/anonymous/anonimpl/anonstore/database.go:108-118

Device limit check and insert are not atomic, so concurrent requests can exceed it — Tagging now runs on every request, so concurrent new devices can all read a `CountDevices` result below `deviceLimit` and all insert, exceeding the limit. Run the count and insert atomically, for example in one transaction or as a single conditional INSERT.

Gold bugs found (1)

hightagDeviceUI caches the device key before CreateOrUpdateDevice; when the store returns ErrDeviceLimitReached the entry stays, so the next request from the same device skips the limit check and authenticates for up to 29 minutes.

Gold bugs missed (1)

highThe new auth.anonymous device_limit setting has no entry in conf/defaults.ini, so the GF_AUTH_ANONYMOUS_DEVICE_LIMIT environment override is ignored and the limit stays 0.