fix(documents): tighten cross-port test + refine paths + signing-details coverage

Three follow-ups from Task 9 code review:
1. Cross-port isolation test now explicitly asserts the other-port
   file's id is absent from the aggregated result (previously only
   checked .length > 0, which would pass even with leakage).
2. Refine errors now carry path fields so frontend field-level error
   display can target the right form input (matches createDocumentSchema
   pattern in the same validators module).
3. Add a service-composition test for the signing-details route's
   workflow+signers+events shape — closes the coverage gap for the
   thin Promise.all combinator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 12:13:27 +02:00
parent dec54806cb
commit c9f0bdc687
3 changed files with 97 additions and 6 deletions

View File

@@ -106,10 +106,14 @@ export const listDocumentsSchema = baseListQuerySchema
})
.refine(
(q) => !(q.folderId !== undefined && (q.entityType !== undefined || q.entityId !== undefined)),
{ message: 'folderId is mutually exclusive with entityType/entityId' },
{
message: 'folderId is mutually exclusive with entityType/entityId',
path: ['folderId'],
},
)
.refine((q) => Boolean(q.entityType) === Boolean(q.entityId), {
message: 'entityType and entityId must be provided together',
path: ['entityType'],
});
export const uploadSignedSchema = z.object({

View File

@@ -31,10 +31,14 @@ export const listFilesSchema = baseListQuerySchema
})
.refine(
(q) => !(q.folderId !== undefined && (q.entityType !== undefined || q.entityId !== undefined)),
{ message: 'folderId is mutually exclusive with entityType/entityId' },
{
message: 'folderId is mutually exclusive with entityType/entityId',
path: ['folderId'],
},
)
.refine((q) => Boolean(q.entityType) === Boolean(q.entityId), {
message: 'entityType and entityId must be provided together',
path: ['entityType'],
});
export type UploadFileInput = z.infer<typeof uploadFileSchema>;