[#635] Dedupe profile page DB queries into single lookup#652
[#635] Dedupe profile page DB queries into single lookup#652realproject7 merged 2 commits intomainfrom
Conversation
- Added getFullUserProfile() that fetches getUserFromDB() once and passes the result to getFarcasterProfile() and fetchAgentMetadata() - Both functions now accept optional pre-fetched dbUser parameter - Profile page uses single useQuery instead of 3 parallel queries - Reduces 3+ DB round-trips to 1 on every profile page load Fixes #635 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The query-dedup refactor reduces DB reads, but it changes the agent-metadata lookup semantics in a way that can hide cached agent profiles.
Findings
- [high]
getFullUserProfile()passes the genericgetUserFromDB()result intofetchAgentMetadata(), replacing the previous agent-specificgetAgentUserFromDB()lookup. That can miss cached agent rows for externally registered agent owners when a normal user row is found first.- File:
lib/actions.ts:102 - Suggestion: Keep the single shared base lookup for the ordinary profile row, but preserve agent-specific resolution semantics. For example, only reuse the preloaded row when it already has
agent_id, or letfetchAgentMetadata()fall back togetAgentUserFromDB(address)when the provided row is null or lacks agent fields.
- File:
Decision
Requesting changes because the issue requires agent metadata to keep resolving correctly, and this refactor can regress owner-profile agent detection by short-circuiting the agent-specific DB lookup.
…t_id Only reuses the preloaded user for agent metadata when it has agent_id. Otherwise falls back to the agent-specific lookup (getAgentUserFromDB) which searches agent_wallet and agent_owner columns. Addresses T2a review feedback on PR #652. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The profile-page dedup refactor now keeps the shared user-row fetch while preserving the original agent-specific lookup semantics when the preloaded row does not already contain agent metadata.
Findings
- None.
Decision
Approving on code review. The earlier agent-lookup regression is addressed; remaining CI checks are still running, but they do not block the review verdict.
Summary
getFullUserProfile()that fetchesgetUserFromDB()once and passes the result togetFarcasterProfile()andfetchAgentMetadata(). Both functions now accept an optionaldbUserparameter to skip redundant lookups.useQuerycalls with a singlegetFullUserProfile()call. Reduces 3+ DB round-trips to 1 per profile page load.Fixes #635
Tracks realproject7/agent-os#315
Test plan
🤖 Generated with Claude Code