fix: Generate new idempotency key when round robin reassigning#22065
fix: Generate new idempotency key when round robin reassigning#22065joeauyeung merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
|
✅ No security or compliance issues detected. Reviewed everything up to fe6c05e. Security Overview
Detected Code Changes
Reply to this PR with |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (06/26/25)1 reviewer was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
cubic found 1 issue across 4 files. Review it in cubic.dev
React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.
| reassignedById?: number | null; | ||
| }) { | ||
| return uuidv5( | ||
| `${startTime.valueOf()}.${endTime.valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, |
There was a problem hiding this comment.
Calling valueOf() on a string will not yield the intended timestamp; if startTime or endTime are strings, valueOf() returns the string itself, not a numeric timestamp. This can lead to inconsistent idempotency keys if the input is sometimes a Date and sometimes a string. Consider normalizing to a Date before calling valueOf().
| `${startTime.valueOf()}.${endTime.valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, | |
| `${new Date(startTime).valueOf()}.${new Date(endTime).valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, |
There was a problem hiding this comment.
cubic found 1 issue across 4 files. Review it in cubic.dev
React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.
| reassignedById?: number | null; | ||
| }) { | ||
| return uuidv5( | ||
| `${startTime.valueOf()}.${endTime.valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, |
There was a problem hiding this comment.
Calling valueOf() on a string will not yield the intended timestamp; if startTime or endTime are strings, valueOf() returns the string itself, not a numeric timestamp. This can lead to inconsistent idempotency keys if the input is sometimes a Date and sometimes a string. Consider normalizing to a Date before calling valueOf().
| `${startTime.valueOf()}.${endTime.valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, | |
| `${new Date(startTime).valueOf()}.${new Date(endTime).valueOf()}.${userId}${reassignedById ? `.${reassignedById}` : ""}`, |
emrysal
left a comment
There was a problem hiding this comment.
Consistent with previous behaviour
E2E results are ready! |
* Create idempotencyKeyService * Use `idempotencyKeyService` in middleware * Use `idempotencyKeyService` in RR reassignments
* Create idempotencyKeyService * Use `idempotencyKeyService` in middleware * Use `idempotencyKeyService` in RR reassignments
What does this PR do?
Fixes round robin reassignment by generating a new idempotency key when reassigning a booking. Also introduces a
IdempotencyKeyServiceMandatory Tasks (DO NOT REMOVE)
How should this be tested?