From ae65d9f2a8926e9ff6509f487051e0530623c22c Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 17 Apr 2026 16:01:14 -0400 Subject: [PATCH] fix(repairs): stop rejecting log when broken serial already exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LogRepairRequest superRefine demanded brokenPartModelId or brokenMpn+brokenManufacturerId on every request, but the service only consumes those fields when ingesting a brand-new broken part. For serials already in Vector, the client correctly omits them — schema then false-rejected the payload. Drop the refine; the service still throws with the same message when ingest truly needs it. Co-Authored-By: Claude Opus 4.7 --- packages/shared/src/repairs.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/shared/src/repairs.ts b/packages/shared/src/repairs.ts index ef31f2c..02ce3c7 100644 --- a/packages/shared/src/repairs.ts +++ b/packages/shared/src/repairs.ts @@ -25,16 +25,8 @@ export const LogRepairRequest = z path: ['hostId'], }); } - const hasModel = - v.brokenPartModelId !== undefined || - (v.brokenMpn !== undefined && v.brokenManufacturerId !== undefined); - if (!hasModel) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Provide brokenPartModelId or both brokenMpn and brokenManufacturerId', - path: ['brokenPartModelId'], - }); - } + // Model fields are only required when the broken serial isn't already in Vector. The + // server resolves the serial before demanding them — see services/repairs.ts. }); export type LogRepairRequest = z.infer;