Skip to content

Commit 2d67f9e

Browse files
committed
fix(webapp): keep the V1 rejection on the queues API routes
The dashboard-side cleanup dropped the engine-version failure arm from the queue presenters, which also removed the 400 that GET /api/v1/queues and GET /api/v1/queues/:queueParam returned for engine V1 projects. Restore that rejection in the two API route handlers so v3 clients still get a clean 4xx, while the dashboard keeps the simplified presenter result and page. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent dd75022 commit 2d67f9e

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

apps/webapp/app/routes/api.v1.queues.$queueParam.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type QueueItem, type RetrieveQueueParam, RetrieveQueueType } from "@tri
33
import { z } from "zod";
44
import { QueueRetrievePresenter } from "~/presenters/v3/QueueRetrievePresenter.server";
55
import { createLoaderApiRoute } from "~/services/routeBuilders/apiBuilder.server";
6+
import { determineEngineVersion } from "~/v3/engineVersion.server";
67

78
const SearchParamsSchema = z.object({
89
type: RetrieveQueueType.default("id"),
@@ -24,6 +25,15 @@ export const loader = createLoaderApiRoute(
2425
},
2526
},
2627
async ({ params, searchParams, authentication }) => {
28+
// v3 (engine V1) has no V2 queues to retrieve, so old clients get a clean 400.
29+
const engineVersion = await determineEngineVersion({
30+
environment: authentication.environment,
31+
});
32+
33+
if (engineVersion === "V1") {
34+
return json({ error: "engine-version" }, { status: 400 });
35+
}
36+
2737
const input: RetrieveQueueParam =
2838
searchParams.type === "id"
2939
? params.queueParam

apps/webapp/app/routes/api.v1.queues.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { toOffsetLimitQueueListPagination } from "~/presenters/v3/queueListPagination.server";
99
import { logger } from "~/services/logger.server";
1010
import { createLoaderApiRoute } from "~/services/routeBuilders/apiBuilder.server";
11+
import { determineEngineVersion } from "~/v3/engineVersion.server";
1112
import { ServiceValidationError } from "~/v3/services/baseService.server";
1213

1314
const SearchParamsSchema = z.object({
@@ -30,6 +31,15 @@ export const loader = createLoaderApiRoute(
3031
const service = new QueueListPresenter(searchParams.perPage);
3132

3233
try {
34+
// v3 (engine V1) has no V2 queues to list, so old clients get a clean 400.
35+
const engineVersion = await determineEngineVersion({
36+
environment: authentication.environment,
37+
});
38+
39+
if (engineVersion === "V1") {
40+
return json({ error: "engine-version" }, { status: 400 });
41+
}
42+
3343
const result = await service.call({
3444
environment: authentication.environment,
3545
page: searchParams.page ?? 1,

0 commit comments

Comments
 (0)