fix(sync): compare retry status metadata (#1141)

* fix(sync): compare retry status metadata

* fix(sync): compare status fields directly

---------

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
Isaac Sanchez-Hawkins
2026-05-08 15:12:08 +03:00
committed by GitHub
co-authored by Isaac Sanchez
parent 4b65a16b12
commit 47fc6a4606
2 changed files with 28 additions and 4 deletions
+13 -4
View File
@@ -47,6 +47,18 @@ const getStatusMessage = (status: SessionStatus | undefined): string | null => {
return typeof message === 'string' ? message : null
}
const getStatusNumberField = (status: SessionStatus | undefined, field: 'attempt' | 'next'): number | null => {
const value = (status as Record<string, unknown> | undefined)?.[field]
return typeof value === 'number' ? value : null
}
const areStatusesEquivalent = (left: SessionStatus | undefined, right: SessionStatus | undefined): boolean => {
return left?.type === right?.type
&& getStatusMessage(left) === getStatusMessage(right)
&& getStatusNumberField(left, 'attempt') === getStatusNumberField(right, 'attempt')
&& getStatusNumberField(left, 'next') === getStatusNumberField(right, 'next')
}
type StatusCandidate = {
status: SessionStatus
sessionUpdatedAt: number
@@ -114,10 +126,7 @@ export const areStatusMapsEquivalent = (
}
const leftStatus = left[key]
const rightStatus = right[key]
if (leftStatus?.type !== rightStatus?.type) {
return false
}
if (getStatusMessage(leftStatus) !== getStatusMessage(rightStatus)) {
if (!areStatusesEquivalent(leftStatus, rightStatus)) {
return false
}
}