fix(db): refuse a fraction for an integer column at the request boundary

Every integer column is bigint on Postgres. SQLite stored a fraction sent
to one (a packing quantity of 1.5, a budget item for 2.5 days, an id of
3.5) as a REAL, while Postgres rounded it in a statement MikroORM renders
and refused it with a 500 in a Kysely statement, so the engines held
different data for the same request.

The request schemas of those fields now take whole numbers only, and
INTCOL (tests/unit/contracts/integer-columns.test.ts) holds the class: it
reads the integer columns from the entities and fails on any DTO field or
inline MCP tool field of that name that takes any number.
This commit is contained in:
Maurice
2026-11-17 21:02:25 +01:00
parent 563fef0521
commit e22210aca8
15 changed files with 337 additions and 77 deletions
+5 -5
View File
@@ -283,15 +283,15 @@ export const reservationPositionsRequestSchema = z.object({
// day_plan_position is optional on the wire: the legacy route never
// validated position items, and an absent value binds NULL (clears the
// stored position) — pinned by the server integration suite (RESV-006).
positions: z.array(z.object({ id: z.number(), day_plan_position: z.number().optional() })),
day_id: z.union([z.number(), z.string()]).nullable().optional(),
positions: z.array(z.object({ id: z.number().int(), day_plan_position: z.number().optional() })),
day_id: z.union([z.number().int(), z.string()]).nullable().optional(),
});
export type ReservationPositionsRequest = z.infer<typeof reservationPositionsRequestSchema>;
export const accommodationCreateRequestSchema = z.object({
place_id: z.union([z.number(), z.string()]),
start_day_id: z.union([z.number(), z.string()]),
end_day_id: z.union([z.number(), z.string()]),
place_id: z.union([z.number().int(), z.string()]),
start_day_id: z.union([z.number().int(), z.string()]),
end_day_id: z.union([z.number().int(), z.string()]),
check_in: z.string().nullable().optional(),
check_in_end: z.string().nullable().optional(),
check_out: z.string().nullable().optional(),