fix(tinyplace): switch active handle across multiple purchased identities#4216
Conversation
…ties Users who own more than one purchased handle could only ever see the first one as their active handle, with no way to switch. Two causes: - The profile header read identities[0] on the GraphQL path instead of the primary-flagged identity. - No RPC existed to change which handle is primary. The tiny.place SDK already exposes registry.assign_primary (one primary per wallet, signer-authenticated). Expose it as openhuman.tinyplace_registry_assign_primary, fix the header to render the primary identity (pickPrimary, not [0]), and add a 'Make active' control to each non-primary handle in the owned-handles list that promotes it and refetches so the change is reflected across the app. Closes tinyhumansai#4198
|
Warning Review limit reached
More reviews will be available in 43 minutes and 33 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
Comment |
…te test mock
ProfilesSection passed a GqlProfile `Identity[]` to `pickPrimary`, which was
typed for the directory `OwnedIdentity[]` (index-signature shape) — TS2345.
`pickPrimary` only reads `primary`/`[0]`, so make it generic over
`{ primary?: boolean }` to accept both. Also complete the `assignPrimary` mock
identity (was missing required Identity fields — TS2740) by spreading
`minimalIdentity` like the sibling mocks.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d0d618664
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <Button | ||
| variant="secondary" | ||
| size="sm" | ||
| disabled={switchingHandle !== null} | ||
| onClick={() => void handleSetActive(id.username)}> |
There was a problem hiding this comment.
Preserve fallback identities for active switching
When graphql.user returns null or a non-402 error, useMyIdentity intentionally falls back to directory.reverse, which can return multiple owned handles, but that path stores only the selected identity and AgentProfileCard derives ownedIdentities as an empty array for source: 'directory'. As a result, users who own multiple purchased identities but have no GraphQL profile (or hit the documented GraphQL fallback) never see this newly added "Make active" control and still cannot switch their active handle.
Useful? React with 👍 / 👎.
Summary
Users who own more than one purchased handle could only ever see the first identity as their active handle, with no way to switch (#4198). Two root causes:
profile.identities[0].usernameon the GraphQL path (ProfilesSection.tsx) instead of the primary-flagged identity.Fix
The tiny.place SDK already exposes
registry.assign_primary(name)(one primary per wallet, signer-authenticated — clears the flag on the wallet's other names). This PR:openhuman.tinyplace_registry_assign_primary(manifest.rshandler +schemas.rsregistration). Anti-spoof: the owning wallet is proven by the signer-attached signature, never from params.registry.assignPrimary(name)to the invoke client.ProfilesSection.tsx): renders the header frompickPrimary(identities)(not[0]), and adds a Make active control to every non-primary handle in the owned-handles list that promotes it and refetches, so the new active handle is reflected across feed / profile / directory.Tests
registry_assign_primary_rejects_blank_name(param validation before any client work).invokeApiClient.test.ts:assignPrimarymarshals the correct RPC.ProfilesSection.test.tsx: header shows the primary (not[0]) handle with multiple identities; clicking Make active callsassignPrimaryand refetches.Closes #4198