Skip to content

Number new test identities after the highest existing one - #245

Merged
soamdesai-tfh merged 1 commit into
mainfrom
soam/next-identity-number
Sep 15, 2026
Merged

soamdesai-tfh merged 1 commit into
mainfrom
soam/next-identity-number

Conversation

@soamdesai-tfh

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #244. The identity picker on production showed the list starting at "Identity #50".

Root cause. generateNextIdentity derived the next identity number from identities.length. While a browser still held duplicated rows (five more per reload before #244 shipped), pressing "+" minted "Identity #50" (and similar). The dedupe in #244 then healed the copies but kept that legitimately created identity, so it sits at the top of the list.

Fix. A small pure helper, nextIdentityNumber, returns one past the highest existing meta.idNumber, so duplicates or gaps can never inflate it. The hook uses it and no longer special-cases 0.

Existing profiles. An identity like #50 that was already created stays valid; "Reset simulator" in Settings regenerates #0 to #4.

Verification

  • New tests/next-identity-number.test.ts: empty list, contiguous list, duplicated list, gaps, and a stray high number. pnpm test: 30/30.
  • pnpm typecheck, pnpm lint, pnpm run spellcheck clean.

🤖 Generated with Claude Code

The "+" button took the next identity number from the length of the
identity list. While a browser held duplicated rows (5 per reload before
the dedupe fix), that produced identities such as "Identity #50", which
then sat at the top of the picker after the duplicates were healed.

Derive the next number from the highest existing identity number instead,
so duplicates or gaps can never skew it, and cover it with unit tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
worldcoin-simulator Ready Ready Preview Sep 15, 2026 8:48pm UTC

Request Review

@soamdesai-tfh
soamdesai-tfh merged commit 41dc49d into main Sep 15, 2026
10 checks passed
@soamdesai-tfh
soamdesai-tfh deleted the soam/next-identity-number branch September 15, 2026 20:49

This branch was successfully deployed

1 active deployment
Preview — 96ee5b9e Deployed Sep 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant