Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcp-server/.synced-from
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9c6599eacc0a3eb3e71b6142af70c321e6fa13f5
df194b0317d172e6f5a3941dab0484549dd757e1
8 changes: 4 additions & 4 deletions mcp-server/src/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,20 @@ export const isoDateString = () =>
.refine(
(value) =>
matchesIsoDate(value) || matchesIsoDateTime(value, DATE_TIME, true),
{ message: 'Expected an ISO 8601 date or date-time' }
{ error: 'Expected an ISO 8601 date or date-time' }
);

/**
* `expiresAfter` is stricter than the query bounds: the actions routes declare
* it `z.string().datetime()` (`CreateActionSchema` in
* it `z.iso.datetime()` (`CreateActionSchema` in
* packages/api/src/api/actions/actions.validation.ts), which requires a UTC
* timestamp and refuses a date on its own or a numeric offset.
*/
export const isoDateTimeString = () =>
z
.string()
.refine((value) => matchesIsoDateTime(value, UTC_DATE_TIME, false), {
message: 'Expected a UTC ISO 8601 date-time',
error: 'Expected a UTC ISO 8601 date-time',
});

/**
Expand Down Expand Up @@ -147,4 +147,4 @@ const UUID_V4 =
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

export const uuidV4 = () =>
z.string().regex(UUID_V4, { message: 'Expected a UUID' });
z.string().regex(UUID_V4, { error: 'Expected a UUID' });
6 changes: 3 additions & 3 deletions mcp-server/src/tools/context/get-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const zodSchema = z
if (test_id) {
if (!instance_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'test_id requires instance_id',
path: ['instance_id'],
});
Expand All @@ -98,7 +98,7 @@ const zodSchema = z
if (instance_id) {
if (!run_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message:
'instance-level context requires run_id when test_id is omitted',
path: ['run_id'],
Expand All @@ -108,7 +108,7 @@ const zodSchema = z
}
if (!run_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
// The only message a caller that passed nothing gets, so it names
// every level rather than the one it fell through to.
message:
Expand Down
8 changes: 4 additions & 4 deletions mcp-server/src/tools/evidence/create-evidence-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,28 @@ const zodSchema = z
const forSession = value.sessionId || value.attachmentId;
if (forSession && (value.instanceId || value.testId)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'send sessionId and attachmentId, or instanceId and testId',
path: ['sessionId'],
});
} else if (forSession) {
if (!value.sessionId || !value.attachmentId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'a session needs both sessionId and attachmentId',
path: [value.sessionId ? 'attachmentId' : 'sessionId'],
});
}
if (value.attemptIndex !== undefined || value.artifactName) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'attemptIndex and artifactName are for CI tests',
path: ['attemptIndex'],
});
}
} else if (!value.instanceId || !value.testId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'send instanceId and testId, or sessionId and attachmentId',
path: ['instanceId'],
});
Expand Down
2 changes: 1 addition & 1 deletion mcp-server/src/tools/identifierSchemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describe('ISO date inputs', () => {
}
);

// The actions routes declare expiresAfter z.string().datetime(), so a date on
// The actions routes declare expiresAfter z.iso.datetime(), so a date on
// its own or a numeric offset is refused where a date bound would take it.
it.each(['2026-01-01', '2026-01-01T00:00:00+02:00', 'January 1, 2026'])(
'rejects %s as expiresAfter',
Expand Down
2 changes: 1 addition & 1 deletion mcp-server/src/tools/integrations/link-jira-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const zodSchema = z
.superRefine((val, ctx) => {
if (val.includeContextInComment === false && !val.comment?.trim()) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'comment is required when includeContextInComment is false',
path: ['comment'],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const searchText = (
return length >= 1 && length <= SEARCH_MAX_LENGTH;
},
{
message: `Expected 1 to ${SEARCH_MAX_LENGTH} characters after trimming`,
error: `Expected 1 to ${SEARCH_MAX_LENGTH} characters after trimming`,
}
);

Expand Down
10 changes: 5 additions & 5 deletions mcp-server/src/tools/runs/add-attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const zodSchema = z
return new Set(names).size === names.length;
},
{
message: 'two traces share a name, so they cannot be told apart',
error: 'two traces share a name, so they cannot be told apart',
}
)
.describe(
Expand All @@ -169,7 +169,7 @@ const zodSchema = z
.superRefine((value, ctx) => {
if (!value.sessionId === !value.runId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'send sessionId or runId, not both and not neither',
path: ['sessionId'],
});
Expand All @@ -179,14 +179,14 @@ const zodSchema = z
);
if (value.sessionId && target) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: `${target} is for CI runs; a session has no spec, test or machine`,
path: [target],
});
}
const problem = runTargetProblem(value);
if (value.runId && problem) {
ctx.addIssue({ code: z.ZodIssueCode.custom, message: problem });
ctx.addIssue({ code: 'custom', message: problem });
}
if (value.runId && !problem) {
const level = runTargetLevel(value);
Expand All @@ -196,7 +196,7 @@ const zodSchema = z
);
if (refused) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: `A ${refused.type} cannot be attached at the ${level} level. Allowed: ${allowed.join(', ')}`,
path: ['attachments'],
});
Expand Down
2 changes: 1 addition & 1 deletion mcp-server/src/tools/sessions/create-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const zodSchema = z.strictObject({
return new Set(names).size === names.length;
},
{
message: 'two traces share a name, so they cannot be told apart',
error: 'two traces share a name, so they cannot be told apart',
}
)
.describe(
Expand Down
14 changes: 7 additions & 7 deletions mcp-server/src/tools/share/create-share-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ const zodSchema = z
val.attempt !== undefined
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message:
'session_id cannot be sent with run_id, instance_id, test_id or attempt',
path: ['session_id'],
});
}
if (val.purpose !== 'report') {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'a session can be shared with purpose "report" only',
path: ['purpose'],
});
Expand All @@ -82,36 +82,36 @@ const zodSchema = z
}
if (val.test_id && !val.instance_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'test_id requires instance_id',
path: ['instance_id'],
});
}
if (val.instance_id && !val.run_id && !val.test_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'instance_id requires run_id (spec file) or test_id (test)',
path: ['run_id'],
});
}
if (!val.run_id && !val.instance_id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message:
'provide session_id (session), run_id (run), run_id + instance_id (spec file), or instance_id + test_id (test)',
path: ['run_id'],
});
}
if (val.attempt !== undefined && !(val.instance_id && val.test_id)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'attempt requires a single test (instance_id + test_id)',
path: ['attempt'],
});
}
if (val.attempt !== undefined && val.purpose === 'report') {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: 'custom',
message: 'attempt is only valid with purpose "fix"',
path: ['attempt'],
});
Expand Down
Loading