Skip to content

Commit fec258f

Browse files
committed
Reproduced split unicode error
1 parent 59a31e9 commit fec258f

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"title": "❜ 𝐒 𝐏𝗈𝗌𝗍 . . . 𝐍𝖾𝗐 𝐂𝗈𝗇𝗍𝖾𝗇𝗍 ꒰ ⚔️ ꒱ 𝐒𝐋 ❜ 𝐔𝐋\n\n꒰ ❤️ ꒱ 𓃊 𝐋𝗲𝗮𝘃𝗲 𝖺 𝗹𝗶𝗸𝗲 𝖺𝗇\ud835"
3+
}

internal-packages/clickhouse/src/taskRuns.test.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { clickhouseTest } from "@internal/testcontainers";
22
import { z } from "zod";
33
import { ClickhouseClient } from "./client/client.js";
44
import { getTaskRunsQueryBuilder, insertRawTaskRunPayloads, insertTaskRuns } from "./taskRuns.js";
5+
import { readFile } from "node:fs/promises";
56

67
describe("Task Runs V2", () => {
78
clickhouseTest("should be able to insert task runs", async ({ clickhouseContainer }) => {
@@ -395,4 +396,93 @@ describe("Task Runs V2", () => {
395396
);
396397
}
397398
);
399+
400+
clickhouseTest(
401+
"should be able to insert task runs with invalid output",
402+
async ({ clickhouseContainer }) => {
403+
const client = new ClickhouseClient({
404+
name: "test",
405+
url: clickhouseContainer.getConnectionUrl(),
406+
logLevel: "debug",
407+
});
408+
409+
const insert = insertTaskRuns(client, {
410+
async_insert: 0, // turn off async insert for this test
411+
});
412+
413+
const output = await readFile(`${__dirname}/fixtures/bad-clickhouse-output.json`, "utf-8");
414+
415+
const [insertError, insertResult] = await insert([
416+
{
417+
environment_id: "env_1234",
418+
environment_type: "DEVELOPMENT",
419+
organization_id: "org_1234",
420+
project_id: "project_1234",
421+
run_id: "run_1234",
422+
friendly_id: "friendly_1234",
423+
attempt: 1,
424+
engine: "V2",
425+
status: "PENDING",
426+
task_identifier: "my-task",
427+
queue: "my-queue",
428+
schedule_id: "schedule_1234",
429+
batch_id: "batch_1234",
430+
created_at: Date.now(),
431+
updated_at: Date.now(),
432+
completed_at: undefined,
433+
tags: ["tag1", "tag2"],
434+
output: JSON.parse(output),
435+
error: {
436+
type: "BUILT_IN_ERROR",
437+
name: "Error",
438+
message: "error",
439+
stackTrace: "stack trace",
440+
},
441+
usage_duration_ms: 1000,
442+
cost_in_cents: 100,
443+
task_version: "1.0.0",
444+
sdk_version: "1.0.0",
445+
cli_version: "1.0.0",
446+
machine_preset: "small-1x",
447+
is_test: true,
448+
span_id: "span_1234",
449+
trace_id: "trace_1234",
450+
idempotency_key: "idempotency_key_1234",
451+
expiration_ttl: "1h",
452+
root_run_id: "root_run_1234",
453+
parent_run_id: "parent_run_1234",
454+
depth: 1,
455+
_version: "1",
456+
},
457+
]);
458+
459+
expect(insertError).toBeNull();
460+
expect(insertResult).toEqual(expect.objectContaining({ executed: true }));
461+
expect(insertResult?.summary?.written_rows).toEqual("1");
462+
463+
const query = client.query({
464+
name: "query-task-runs",
465+
query: "SELECT * FROM trigger_dev.task_runs_v2",
466+
schema: z.object({
467+
environment_id: z.string(),
468+
run_id: z.string(),
469+
}),
470+
params: z.object({
471+
run_id: z.string(),
472+
}),
473+
});
474+
475+
const [queryError, result] = await query({ run_id: "run_1234" });
476+
477+
expect(queryError).toBeNull();
478+
expect(result).toEqual(
479+
expect.arrayContaining([
480+
expect.objectContaining({
481+
environment_id: "env_1234",
482+
run_id: "run_1234",
483+
}),
484+
])
485+
);
486+
}
487+
);
398488
});

0 commit comments

Comments
 (0)