dbed7105b738bd5a2196dc3a4e06bb2af96e3324
The old allocateSequenceNumber blindly incremented a counter in RegistrySequence, which drifted out of sync when entries were deleted or moved between companies — producing wrong numbers (e.g., #6 for the first entry of a company). New approach: - Uses pg_advisory_xact_lock inside a Prisma interactive transaction to serialize concurrent allocations - Always queries the actual MAX sequence from KeyValueStore entries (the source of truth) before allocating the next number - Takes MAX(actual entries, counter) + 1 so the counter can never produce a stale/duplicate number - Upserts the counter to the new value for consistency - Also adds recalculateSequence to DELETE handler so the counter stays in sync after entry deletions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pre-launch hardening: Address Book type sort, Hot Desk proportions, TVA calculator, ROADMAP Phase 4B
Description
No description provided
Languages
TypeScript
98.7%
PLpgSQL
0.4%
Shell
0.3%
Dockerfile
0.2%
CSS
0.2%
Other
0.1%