fix: four more findings from the audit - #392
Merged
Merged
Conversation
Settings showed two privacy switches (Public Profile, Show Activity Status) that were local state wired to nothing, and a Delete Account button whose only outcome was a toast saying deletion is not implemented; all three are gone rather than promising something the chain cannot do. The avatar-settings hook now ignores a load that resolves after the user changed. The crypto-price hook kept its skip-cache flag in state, so refetch ran the effect twice, once bypassing the cache and once again when the flag reset; it is a ref now. Sending a DM treated a failed invite lookup as no invite and created another on every transient error; an unknown answer now skips creation.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A refetch requested while the inputs were invalid left the flag set, so the next valid run bypassed the cache. The flag is read and cleared at the top of the effect now. Also drops a doubled doc comment in the DM service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The remaining items from the audit's bug list, each pre-existing.
useAvatarSettingshad no cancellation, so a slow load for user A landing after the hook switched to user B overwrote B's settings. A request counter now drops stale results.useCryptoPricekeptskipCachein state and listed it as an effect dependency, sorefetch()ran the effect once with the bypass and again when the flag reset. The flag is a ref read once per run.getMyInviteToRecipientreturnednullboth for "no invite" and "lookup failed", so any transient query error madesendMessagecreate anotherconversationInvite(a paid write). Failure is nowundefinedand skips creation; a missing invite costs one inbox hint, a duplicate costs credits each time.Left as they are, deliberately:
hasPrivateFeedandgetLatestEpochreturn a safe default on error. Nine callers rely on the fail-soft answer and the epoch callers only compare chain against local, so a false default can delay a sync but not corrupt anything.Part of the anti-slop cleanup series (after #370–#391).
Test plan
npm run lint(zero warnings),tsc --noEmit,npm run test,npx knip,npm run buildall green locally🤖 Generated with Claude Code