Repository navigation
Number new test identities after the highest existing one - #245
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #244. The identity picker on production showed the list starting at "Identity #50".
Root cause.
generateNextIdentityderived the next identity number fromidentities.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 existingmeta.idNumber, so duplicates or gaps can never inflate it. The hook uses it and no longer special-cases0.Existing profiles. An identity like #50 that was already created stays valid; "Reset simulator" in Settings regenerates #0 to #4.
Verification
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 spellcheckclean.🤖 Generated with Claude Code