Skip to content

Commit 00fcb7c

Browse files
d-csclaude
andcommitted
fix(webapp): reschedule past-date status is 400 not 422 to match pre-PR wire shape
My previous "preserve 422 wire-contract" commit got the pre-PR behaviour wrong: the route's catch block (lines 156-159) has always converted `ServiceValidationError` to status **400**, not 422. `ServiceValidationError`'s default of 422 is what the class throws, but this specific route narrows that to 400 in the catch. Switch the hoisted validation to 400 with the same `Invalid delay: <input>` message shape the service produced. SDK consumers keying retry/classification on 400 see no drift; 422-keying consumers were never receiving 422 from this endpoint to begin with. Devin follow-up on the previous reschedule wire-contract fix on PR #3756 — Devin was right that the pre-PR shape was 400, I read the ServiceValidationError default rather than the route's actual conversion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f286cbd commit 00fcb7c

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ export async function action({ request, params }: ActionFunctionArgs) {
4545
// wall-clock value so the drainer's engine.trigger sees the intended
4646
// delayUntil after materialisation.
4747
//
48-
// Wire-compat: pre-PR the validation happened inside
48+
// Wire-compat: pre-PR the validation lived inside
4949
// `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.
50+
// which throws `ServiceValidationError("Invalid delay: …")`. The
51+
// route's catch block below converts that to status **400** (not
52+
// 422 — `ServiceValidationError` defaults to 422 but this route's
53+
// catch block has always returned 400). Mirror that 400 + message
54+
// shape here so SDK consumers keying retry/classification logic on
55+
// 400 see no behavioural drift now that the parse is hoisted to the
56+
// route layer.
5557
const delayUntil = await parseDelay(body.data.delay);
5658
if (!delayUntil) {
57-
return json({ error: `Invalid delay: ${body.data.delay}` }, { status: 422 });
59+
return json({ error: `Invalid delay: ${body.data.delay}` }, { status: 400 });
5860
}
5961

6062
try {

0 commit comments

Comments
 (0)