Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(comments): increase content character limit to 3,000 (#4577)

marliessophie4bac94e3fc98
diff --git a/fern/apis/server/definition/comments.yml b/fern/apis/server/definition/comments.yml
index 59577e5ef7..9abb469255 100644
--- a/fern/apis/server/definition/comments.yml
+++ b/fern/apis/server/definition/comments.yml
@@ -58,7 +58,7 @@ types:
docs: The id of the object to attach the comment to. If this does not reference a valid existing object, an error will be thrown.
content:
type: string
- docs: The content of the comment. May include markdown. Currently limited to 500 characters.
+ docs: The content of the comment. May include markdown. Currently limited to 3000 characters.
authorUserId:
type: optional<string>
docs: The id of the user who created the comment.
diff --git a/packages/shared/src/features/comments/types.ts b/packages/shared/src/features/comments/types.ts
index 00f67e52f2..756bf146b2 100644
--- a/packages/shared/src/features/comments/types.ts
+++ b/packages/shared/src/features/comments/types.ts
@@ -1,5 +1,7 @@
import { z } from "zod";
+const MAX_COMMENT_LENGTH = 3000;
+
const COMMENT_OBJECT_TYPES = [
"TRACE",
"OBSERVATION",
@@ -9,7 +11,7 @@ const COMMENT_OBJECT_TYPES = [
export const CreateCommentData = z.object({
projectId: z.string(),
- content: z.string().trim().min(1).max(500),
+ content: z.string().trim().min(1).max(MAX_COMMENT_LENGTH),
objectId: z.string(),
objectType: z.enum(COMMENT_OBJECT_TYPES),
});
diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.yml
index 1b84a034c8..c64495c8de 100644
--- a/web/public/generated/api/openapi.yml
+++ b/web/public/generated/api/openapi.yml
@@ -2389,7 +2389,7 @@ components:
type: string
description: >-
The content of the comment. May include markdown. Currently limited
- to 500 characters.
+ to 3000 characters.
authorUserId:
type: string
nullable: true
diff --git a/web/src/__tests__/comments.servertest.ts b/web/src/__tests__/comments.servertest.ts
index a70d546db3..e08e2e4894 100644
--- a/web/src/__tests__/comments.servertest.ts
+++ b/web/src/__tests__/comments.servertest.ts
@@ -84,6 +84,76 @@ describe("Create and get comments", () => {
);
}
});
+
+ it("should fail to create comment if content is empty", async () => {
+ try {
+ const traceResponse = await makeZodVerifiedAPICall(
+ PostTracesV1Response,
+ "POST",
+ "/api/public/traces",
+ {
+ name: "trace-name",
+ projectId: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",
+ },
+ );
+
+ const { id: traceId } = traceResponse.body;
+
+ await makeZodVerifiedAPICall(
+ z.object({
+ message: z.string(),
+ error: z.array(z.object({})),
+ }),
+ "POST",
+ "/api/public/comments",
+ {
+ content: "",
+ objectId: traceId,
+ objectType: "TRACE",
+ projectId: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",
+ },
+ );
+ } catch (error) {
+ expect((error as Error).message).toBe(
+ `API call did not return 200, returned status 400, body {\"message\":\"Invalid request data\",\"error\":[{\"code\":\"too_small\",\"minimum\":1,\"type\":\"string\",\"inclusive\":true,\"exact\":false,\"message\":\"String must contain at least 1 character(s)\",\"path\":[\"content\"]}]}`,
+ );
+ }
+ });
+
+ it("should fail to create comment if content is larger than 3000 characters", async () => {
+ try {
+ const traceResponse = await makeZodVerifiedAPICall(
+ PostTracesV1Response,
+ "POST",
+ "/api/public/traces",
+ {
+ name: "trace-name",
+ projectId: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",
+ },
+ );
+
+ const { id: traceId } = traceResponse.body;
+
+ await makeZodVerifiedAPICall(
+ z.object({
+ message: z.string(),
+ error: z.array(z.object({})),
+ }),
+ "POST",
+ "/api/public/comments",
+ {
+ content: "a".repeat(3001),
+ objectId: traceId,
+ objectType: "TRACE",
+ projectId: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",
+ },
+ );
+ } catch (error) {
+ expect((error as Error).message).toBe(
+ `API call did not return 200, returned status 400, body {\"message\":\"Invalid request data\",\"error\":[{\"code\":\"too_big\",\"maximum\":3000,\"type\":\"string\",\"inclusive\":true,\"exact\":false,\"message\":\"String must contain at most 3000 character(s)\",\"path\":[\"content\"]}]}`,
+ );
+ }
+ });
});
describe("GET /api/public/comments API Endpoint", () => {