Migration · Data · · 4 min read
Counting to 1.24 million
I proposed finishing our Auth0 migration within 2026. Finishing meant proving it: two traps nearly made the numbers lie, and one question changed how we checked.
By Yuhang Lian, software engineer in Dublin
I proposed that we finish the Auth0 migration within 2026. The last stretch was not moving users. It was proving that all 1.24 million of them were in the right state, and cleaning up about 2.4 million identity records that no longer belonged to anyone. A final sweep found 4,164 users that had fallen between the earlier sweeps.
Trap 1: the search that stops at 1,000
Auth0's user search uses page-based pagination, and it stops returning results after the first 1,000 matches without an error. A broad query happily returned exactly 1,000 users and looked finished. The fix was checkpoint pagination, or splitting queries into date ranges small enough that none could reach the cap.
Trap 2: the flag that lied
Accounts had a flag saying they had been migrated. For some account types it could not be trusted, and a single failed user could keep a whole account from being marked complete. Our earlier sweeps started from that flag, which is how users slipped between them. So I stopped trusting it and checked each user against the source database.
Proving it, the other way round
Then came the question that mattered: how do we prove everyone moved? Instead of counting migrated users, I started from every live user in our database, 1,235,873 of them, and looked each one up in a fresh Auth0 export, by id and then by email.
live users 1,235,873
found by id 1,235,424
found by email only 65
not found 384 → each explained or looked up by hand
never migrated 0Almost all of the 384 had a clear reason: the migrator had confirmed them in Auth0 and the record was gone later, they were renamed duplicates, or we had left them out on purpose. The last three I looked up by hand. I announced the migration done on 20 November.
What I took from it
- If an API can truncate silently, assume it does. Check the count, not just the absence of errors.
- Summary flags are claims. Verify against the source of truth before acting on them.
- Prove completeness from the other side: start from everything that should exist, not from what you processed.
- Bulk scripts start as a dry run, and a second pair of eyes sees the plan before production does.