fix(authors): align author name resolution with pkc-js#53
fix(authors): align author name resolution with pkc-js#53tomcasaburi merged 4 commits intomasterfrom
Conversation
📝 WalkthroughWalkthroughThe changes refactor author name resolution across the codebase. A new type definitions file introduces PKC type aliases. Mock implementations and the compatibility layer update Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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/authors/authors.ts (1)
322-340: Log payload key still usesaddressfor a crypto name.Lines 326 and 461 label the log as
"...protocol.resolveAuthorName"but pass{ address: addr }/{ address: author?.address }. Now that the resolver argument is semantically a name, consider{ name: addr }for consistency with the updated call below and with anyone grepping logs.♻️ Proposed log-key alignment
- log("useAuthorAddress protocol.resolveAuthorName", { address: addr }); + log("useAuthorAddress protocol.resolveAuthorName", { name: addr }); return cacheResolveAuthorAddressPromise( addr, resolveAuthorNameWithProtocol(protocolClient, { name: addr }), );And equivalently around line 461:
- log("useResolvedAuthorAddress protocol.resolveAuthorName", { address: author?.address }); + log("useResolvedAuthorAddress protocol.resolveAuthorName", { name: author?.address });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/authors/authors.ts` around lines 322 - 340, The log payload is using the key address for a crypto name; update the payload key to name in the log calls so they match the resolver semantics: change the log(...) invocation inside resolveAuthorAddressNoCache (currently passing { address: addr }) to pass { name: addr }, and do the same for the other log call that uses { address: author?.address } (change to { name: author?.address }); these touches are in the functions/blocks named resolveAuthorAddressNoCache and the surrounding resolveAuthorAddress / caller that reference addr and author?.address and the shared log(...) helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/hooks/authors/authors.ts`:
- Around line 322-340: The log payload is using the key address for a crypto
name; update the payload key to name in the log calls so they match the resolver
semantics: change the log(...) invocation inside resolveAuthorAddressNoCache
(currently passing { address: addr }) to pass { name: addr }, and do the same
for the other log call that uses { address: author?.address } (change to { name:
author?.address }); these touches are in the functions/blocks named
resolveAuthorAddressNoCache and the surrounding resolveAuthorAddress / caller
that reference addr and author?.address and the shared log(...) helper.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b2ffdad9-a8df-4783-b63c-a3fb7eb96773
📒 Files selected for processing (6)
src/hooks/authors/authors.test.tssrc/hooks/authors/authors.tssrc/lib/pkc-compat.tssrc/lib/pkc-js/pkc-js-mock-content.tssrc/lib/pkc-js/pkc-js-mock.tssrc/lib/pkc-types.ts
|
Addressed the valid CodeRabbit nitpick in the latest commit by aligning the author resolver debug log payload keys with the new Locally verified after the change with |
Summary
resolveAuthorName({ name })contract.{ resolvedAuthorName }instead of masking the old bare-string/addressshape.Root Cause
useResolvedAuthorAddressstill passed an address-shaped payload into author-name resolution while the current pkc-js API expects a name-shaped payload. The local mocks mirrored the stale shape, so the mismatch did not fail tests or type-checking.Verification
yarn type-checkyarn buildyarn test src/hooks/authors/authors.test.tsyarn prettierFull hook/store coverage still could not complete locally because the existing accounts hook suite runs out of memory before finishing.
Note
Medium Risk
Touches author address/name resolution and its caching/compat layer; incorrect normalization or fallback selection could break crypto-name display/resolution paths. Changes are type-backed and covered by updated unit tests, reducing risk.
Overview
Aligns author-name resolution with the current
pkc-jscontract by passing{ name }toresolveAuthorNameand normalizing the newer{ resolvedAuthorName }return shape (while keeping a legacy fallback toresolveAuthorAddress).Updates the local pkc mocks and
authorshook tests to use the typedresolveAuthorNameAPI, and introducespkc-js-derived types inpkc-types.tsto catch future contract drift at compile time. Also tightens internal PR-creation docs to require ready-for-review PRs (no drafts).Reviewed by Cursor Bugbot for commit 2c0ad35. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Refactor
Tests