KamoCRM

Stop parsing the org id straight back into a rounded number

Fixkamo-internal
Shipped
15 ஆகஸ்ட், 2026 அன்று 7:58 PM UTC
Author
kamo
Commit
b301337

SecurityService now sends ids past Number.MAX_SAFE_INTEGER as strings so they survive JSON.parse. That was being undone one line into the client: OrganizationDTOSchema typed id as z.union([z.coerce.number(), z.coerce.bigint(), z.string()]), and a zod union takes the first branch that matches -- so coerce.number won, turned the exact string back into a lossy double, and the org id was truncated again before anything downstream saw it. Same ordering bug on OrgFeatureBase.id. String first, uncoerced. A number in that position now only comes from a service still sending one, where the value is already rounded and nothing can recover it. Organization.id widens to number | string to match, as app/types/avatar.ts already does for the same reason. Callers should compare and key on String(org.id) -- LabelManager already does, preferring getOrgIdString() and refusing to fall back to an id that is not a safe integer.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing