Repository navigation
Conversation
|
1 potential issue found:
↑ Select any checkbox above to have Indent auto-fix the issue
All CI checks passed on
Select any unchecked box below to run or rerun that agent. Found issues (1)Full resultsIndent Review Agent
|
| defer r.saveMu.Unlock() | ||
| if r.meta.PushDeviceID == "" { | ||
| r.meta.PushDeviceID = uuid.NewString() | ||
| if err := r.userLogin.Save(ctx); err != nil { |
There was a problem hiding this comment.
🟡 Bug · Push registration saves user-login metadata concurrently with the sync loop's unlocked map writes
userLogin.Save marshals the whole UserLoginMetadata, including the HiddenRooms map, but saveMu only serializes saves against each other. The sync loop in chatsync.go mutates NextBatch, RoomStateVersion and HiddenRooms without holding it. RegisterPushNotifications runs on a separate goroutine, so a first registration, or any registration that refreshes credentials via saveMeta, can overlap a sync write. That can hit Go's fatal concurrent map iteration and map write and crash the bridge. It can also persist a sync cursor that the sync loop later rolls back in memory. Guard all r.meta access with one mutex, or clone the metadata under the lock before marshaling.
Ref: pkg/connector/chatsync.go lines ~103 and ~200-208.
Found by Indent Review Agent
The bridge can now register wrapper-provided FCM tokens using Reddit Android 2026.41.0's
RegisterMobilePushTokenGraphQL operation and sender ID933360113277. Registration persists a separate device ID, reuses it when the FCM token rotates, and retries once after refreshing expired Reddit credentials.The APK exposes general Reddit notification registration with no chat-only filter. Document the chat notification types for receiver-side filtering and the separate token-health acknowledgement flow. Account notification preferences are unchanged.
Live checks verified authentication with a web-minted chat token and recognition of the persisted operation using deliberately incomplete requests. Successful token binding, FCM delivery, health-check acknowledgements, and logout deregistration remain unverified with a real receiving relay; health-check handling is not implemented in this registration callback.
Validation on the branch based on
main:go test -race ./...go vet ./...andstaticcheck ./...go build ./cmd/redditandgit diff --checkRelated to PLAT-39279: Reverse Reddit local push notifications.