fix(accounts): enrich local account comment authors#64
Conversation
📝 WalkthroughWalkthroughAdds a ChangesAuthor identity enrichment in account comment hooks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/hooks/accounts/accounts.ts (1)
441-448: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueOptional: address/shortAddress could diverge if a stored author has a stale
shortAddressbut noaddress.Because
...accountComment.authoris spread after the computedshortAddressbutaddressis then force-set from the account, a cached author carrying ashortAddress(withoutaddress) would keep its staleshortAddresswhileaddressis overwritten with the account's. In the current enrichment scenario (missing identity) this is unlikely, but moving the forcedshortAddressafter the comment spread—alongsideaddress—keeps the pair consistent.♻️ Keep address/shortAddress consistent
author: { ...accountAuthor, - ...(accountShortAddress ? { shortAddress: accountShortAddress } : {}), ...accountComment.author, address: accountAuthor.address, + ...(accountShortAddress ? { shortAddress: accountShortAddress } : {}), },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/hooks/accounts/accounts.ts` around lines 441 - 448, The author merge in accounts.ts can leave address and shortAddress inconsistent when accountComment.author already contains a stale shortAddress. Update the author composition in the enrichment logic so the account-derived address and shortAddress are applied together after spreading accountComment.author, using the same source object or fallback logic in the relevant merge block inside the accounts hook. Keep the final author object construction in sync by ensuring the forced address assignment and the shortAddress override are adjacent and derived from the current accountAuthor values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/hooks/accounts/accounts.ts`:
- Around line 441-448: The author merge in accounts.ts can leave address and
shortAddress inconsistent when accountComment.author already contains a stale
shortAddress. Update the author composition in the enrichment logic so the
account-derived address and shortAddress are applied together after spreading
accountComment.author, using the same source object or fallback logic in the
relevant merge block inside the accounts hook. Keep the final author object
construction in sync by ensuring the forced address assignment and the
shortAddress override are adjacent and derived from the current accountAuthor
values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a3c5b9c3-bc9d-4dfa-9b3b-b5543eb2a5a1
📒 Files selected for processing (6)
README.mdllms-full.txtllms.txtpackage.jsonsrc/hooks/accounts/accounts.test.tssrc/hooks/accounts/accounts.ts
Summary
useAccountCommentanduseAccountCommentswhen the comment belongs to the selected account.useAccountCommentindexes, matching the existing list-index behavior.0.1.20so the publish-on-merge workflow can publish this fix for downstream apps.Verification
yarn prettieryarn buildyarn type-checkyarn testyarn test:coveragevitestregression run for account-comment author restoration and invalid indexesyarn llms:generateNotes
node scripts/verify-hooks-stores-coverage.mjscurrently fails against broad pre-existing hook/store coverage gaps outside this change; the full coverage test run passes.Note
Low Risk
Scoped account-hook presentation fix with no store mutation; behavior is gated on account ownership and missing author address.
Overview
Local account comments from
useAccountCommentanduseAccountCommentsnow get authoraddressandshortAddressfrom the active account when a cached entry belongs to that account but is missingauthor.address. Existing per-comment author fields (e.g. display name) are kept; comments that already have an author address are unchanged. Enrichment is read-time only—nothing is written back to the accounts store.useAccountCommentignores invalidcommentIndexvalues (negative or non-integer), consistent with list indexing elsewhere.Package version is 0.1.20; README/LLM docs note the author backfill behavior. Tests cover restoration and invalid indexes.
Reviewed by Cursor Bugbot for commit 0c3f756. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes