Skip to content

Commit 7fbe648

Browse files
committed
fix: preserve empty task payloads and validation messages
1 parent 6764a08 commit 7fbe648

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎apps/webapp/app/routes/account.tokens/route.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const CreateTokenSchema = z.discriminatedUnion("action", [
167167
tokenName: z
168168
.string({ error: "You must enter a name" })
169169
.min(2, "Your name must be at least 2 characters long")
170-
.max(50),
170+
.max(50, "Your name must be 50 characters or less"),
171171
// Optional — when no RBAC plugin is installed the UI hides the
172172
// dropdown and submits no roleId; the action passes that through
173173
// and createPersonalAccessToken just doesn't write a TokenRole.

‎packages/core/src/v3/schemas/api-type.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ describe("InitializeDeploymentRequestBody", () => {
343343
});
344344

345345
describe("TriggerTaskRequestBody", () => {
346+
it("accepts a missing payload", () => {
347+
const result = TriggerTaskRequestBody.safeParse({
348+
options: {},
349+
});
350+
351+
expect(result.success).toBe(true);
352+
});
353+
346354
it("accepts application/store payload as a non-empty string", () => {
347355
const result = TriggerTaskRequestBody.safeParse({
348356
payload: "packets/payloads/file.json",

‎packages/core/src/v3/schemas/api.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const ExternalDeploymentId = z.preprocess((value) => {
289289

290290
export const TriggerTaskRequestBody = z
291291
.object({
292-
payload: z.any(),
292+
payload: z.any().optional(),
293293
context: z.any().optional(),
294294
options: z
295295
.object({
@@ -407,7 +407,7 @@ export type BatchTriggerTaskRequestBody = z.infer<typeof BatchTriggerTaskRequest
407407

408408
export const BatchTriggerTaskItem = z.object({
409409
task: z.string(),
410-
payload: z.any(),
410+
payload: z.any().optional(),
411411
context: z.any().optional(),
412412
options: z
413413
.object({

‎packages/core/src/v3/schemas/batchItemNDJSON.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ describe("concurrencyKey coercion", () => {
5858
});
5959

6060
describe("BatchTriggerTaskItem", () => {
61+
it("accepts a missing payload", () => {
62+
const result = BatchTriggerTaskItem.safeParse({
63+
task: "user-workflow-tick",
64+
options: {},
65+
});
66+
67+
expect(result.success).toBe(true);
68+
});
69+
6170
it("coerces a numeric concurrencyKey to a string", () => {
6271
const result = BatchTriggerTaskItem.safeParse({
6372
task: "user-workflow-tick",

0 commit comments

Comments
 (0)