Skip to content

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

chore: add clickhouse-js size restriction on insert tests (#12670)

Steffen Schmitz9bd55a690d6f
diff --git a/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts b/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
index c658d181a3..a6a924f73c 100644
--- a/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
+++ b/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
@@ -79,4 +79,42 @@ describe("ClickHouse insert string edge cases", () => {
},
);
});
+
+ describe("Invalid string length on oversized JSON payload", () => {
+ maybeIt(
+ "should throw 'Size of JSON object' when input exceeds clickhouse byte limit",
+ async () => {
+ const hugeString = "x".repeat(300 * 1024 * 1024);
+
+ const event = createEvent({
+ project_id: projectId,
+ input: hugeString,
+ });
+
+ await expect(createEventsCh([event])).rejects.toThrow(
+ /Size of JSON object/,
+ );
+ },
+ );
+
+ maybeIt(
+ "should throw 'Invalid string length' when input exceeds V8 string limit",
+ async () => {
+ // V8 max string length is ~536_870_888 chars on 64-bit systems.
+ // A 512 MB input string causes JSON.stringify to exceed that limit
+ // when it serialises the full event row.
+ const hugeString = "x".repeat(300 * 1024 * 1024);
+
+ const event = createEvent({
+ project_id: projectId,
+ input: hugeString,
+ output: hugeString,
+ });
+
+ await expect(createEventsCh([event])).rejects.toThrow(
+ /Invalid string length/,
+ );
+ },
+ );
+ });
});