Skip to content

Commit 8ee0429

Browse files
committed
chore: drop the version-param fix and TODOS.md from this PR
Staging fixed the deployment version route param independently (#6560, `z.coerce.number()`) and covers both the numeric and `active` cases in `deployments.test.ts`, so this branch's variant and its regression test are redundant. Revert the contract to staging's exactly, leaving this PR scoped to the deploy permission change. Also drop TODOS.md and rewrite the two comments that pointed at it so each one states its own condition for removal.
1 parent 9b0f176 commit 8ee0429

6 files changed

Lines changed: 9 additions & 141 deletions

File tree

TODOS.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

apps/sim/app/api/mcp/workflow-servers/[id]/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ export const PATCH = withRouteHandler(
118118
* `write` member must still be able to rename an already-public server.
119119
*
120120
* This route calls the orchestration layer directly rather than the
121-
* application use case, so the use case's gate does not apply here —
122-
* see the TODO about migrating both MCP server routes.
121+
* application use case, so `updateWorkflowMcpDeploymentServer`'s gate
122+
* does not apply here and the rule has to be repeated. Delete this copy
123+
* once the route goes through that use case.
123124
*/
124125
if (body.isPublic === true) {
125126
const [current] = await db

apps/sim/app/api/mcp/workflow-servers/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ export const POST = withRouteHandler(
120120
* `withMcpAuth('write')` covers managing the server, but a public
121121
* server skips authentication on the serve path, so publishing one is
122122
* admin-only. This route calls the orchestration layer directly rather
123-
* than the application use case, so the use case's gate does not apply
124-
* here — see the TODO about migrating both MCP server routes.
123+
* than the application use case, so `createWorkflowMcpDeploymentServer`'s
124+
* gate does not apply here and the rule has to be repeated. Delete this
125+
* copy once the route goes through that use case.
125126
*/
126127
if (
127128
increasesPublicExposure(body.isPublic, false) &&

apps/sim/lib/api/contracts/deployments.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,9 @@ export const deploymentVersionParamsSchema = z.object({
2626
version: z.coerce.number().int().positive(),
2727
})
2828

29-
/**
30-
* Route params arrive as strings, so the numeric branch must coerce — a bare
31-
* `z.number()` here makes every numeric version unreachable and leaves
32-
* `active` as the only satisfiable value. Coercion of `'active'` yields NaN,
33-
* fails `.int()`, and falls through to the literal branch, so ordering is safe.
34-
*
35-
* The numeric branch is `number | string` piped into the coercion rather than a
36-
* bare `z.coerce.number()`: a coerced member widens the union's `z.input` to
37-
* `unknown`, which would let a client pass anything at compile time and fail
38-
* only at runtime — the exact drift this schema exists to prevent.
39-
*/
4029
export const deploymentVersionOrActiveParamsSchema = z.object({
4130
id: z.string().min(1, 'Invalid workflow ID'),
42-
version: z.union([
43-
z
44-
.union([z.number(), z.string()])
45-
.transform((value) => (typeof value === 'number' ? value : Number(value)))
46-
.pipe(z.number().int().positive()),
47-
z.literal('active'),
48-
]),
31+
version: z.union([z.coerce.number().int().positive(), z.literal('active')]),
4932
})
5033

5134
export const deploymentVersionRouteParamsSchema = z.object({

apps/sim/lib/api/contracts/deployments.version-params.test.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

apps/sim/lib/core/application/deployment-permission-matrix.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ describe('deployment permission matrix', () => {
6666
* surface routed through the operation registry. The v1 REST API
6767
* (`resolveV1DeploymentWorkflow`) predates the registry and runs its own
6868
* `validateWorkspaceAccess`, resolving a workspace key to its creator — so a
69-
* workspace key can still deploy there. That gap is pre-existing and tracked
70-
* separately; do not read these assertions as covering v1.
69+
* workspace key can still deploy there. That gap is pre-existing and out of
70+
* scope here; do not read these assertions as covering v1.
7171
*/
7272
describe('deployment operations reject workspace API keys', () => {
7373
it.each([

0 commit comments

Comments
 (0)