Skip to content

Commit f286cbd

Browse files
d-csclaude
andcommitted
fix(webapp): preserve 422 wire-contract for past-date reschedules
Hoisting `parseDelay` to the route layer (for the buffer-side patch to encode an absolute Date into the snapshot) inadvertently shifted the "past date" / unparseable-delay error from 422 → 400. Pre-PR that validation lived inside `RescheduleTaskRunService.call` (throws `ServiceValidationError("Invalid delay: …")` → 422); SDK consumers keying retry / error-classification logic on 422 would have seen a silent drift. Return 422 with the same `Invalid delay: <input>` message shape the service produced. Validation outcome is unchanged (past dates still rejected); only the status code aligns back with pre-PR behaviour. Devin follow-up on PR #3756. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6d881e7 commit f286cbd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/webapp/app/routes/api.v1.runs.$runParam.reschedule.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,17 @@ export async function action({ request, params }: ActionFunctionArgs) {
4444
// its PG-side flow; for the buffer-side patch we encode the same
4545
// wall-clock value so the drainer's engine.trigger sees the intended
4646
// delayUntil after materialisation.
47+
//
48+
// Wire-compat: pre-PR the validation happened inside
49+
// `RescheduleTaskRunService.call` (rescheduleTaskRun.server.ts:14-18),
50+
// which throws `ServiceValidationError("Invalid delay: …")` on
51+
// undefined and surfaces as 422. Mirror that status + message shape
52+
// here so existing SDK consumers keying retry/classification logic
53+
// on 422 don't see a behavioural drift now that the parse is hoisted
54+
// to the route layer.
4755
const delayUntil = await parseDelay(body.data.delay);
4856
if (!delayUntil) {
49-
return json({ error: "Invalid delay value" }, { status: 400 });
57+
return json({ error: `Invalid delay: ${body.data.delay}` }, { status: 422 });
5058
}
5159

5260
try {

0 commit comments

Comments
 (0)