diff --git a/backend/parsers/windmill-parser/src/asset_parser.rs b/backend/parsers/windmill-parser/src/asset_parser.rs index eab95dcd57..5a68b390ed 100644 --- a/backend/parsers/windmill-parser/src/asset_parser.rs +++ b/backend/parsers/windmill-parser/src/asset_parser.rs @@ -2787,6 +2787,12 @@ mod pipeline_annotation_tests { .materialize .unwrap(); assert_eq!(m.target_path, "main/_2026_orders"); + // One `_` per character, as the TS and CLI mirrors count them, whatever its width. + let m = parse_pipeline_annotations("-- materialize") + .for_script("f/shop/orders_𐐀") + .materialize + .unwrap(); + assert_eq!(m.target_path, "main/orders__"); } #[test] diff --git a/cli/src/commands/pipeline/localGraph.ts b/cli/src/commands/pipeline/localGraph.ts index b1dc0ebb0a..e5a228f95d 100644 --- a/cli/src/commands/pipeline/localGraph.ts +++ b/cli/src/commands/pipeline/localGraph.ts @@ -202,7 +202,7 @@ type ParsedMaterialize = NonNullable; export function withDefaultTable(m: ParsedMaterialize, scriptPath: string): ParsedMaterialize { // `/` and `.
` already name a table. if (m.target_kind !== "ducklake" || /[/.]/.test(m.target_path)) return m; - const name = (scriptPath.split("/").pop() ?? "").trim().replace(/[^A-Za-z0-9_]/g, "_"); + const name = (scriptPath.split("/").pop() ?? "").trim().replace(/[^A-Za-z0-9_]/gu, "_"); // The generated SQL names the table unquoted, so it cannot start with a digit. const table = /^[0-9]/.test(name) ? `_${name}` : name; return table ? { ...m, target_path: `${m.target_path}/${table}` } : m; diff --git a/cli/test/pipeline_local_graph_unit.test.ts b/cli/test/pipeline_local_graph_unit.test.ts index bc12bf752b..46abb9a544 100644 --- a/cli/test/pipeline_local_graph_unit.test.ts +++ b/cli/test/pipeline_local_graph_unit.test.ts @@ -1053,6 +1053,8 @@ test("withDefaultTable names an untabled DuckLake target after the script", () = expect(withDefaultTable(lakeOnly, "f/shop/orders-daily").target_path).toBe( "main/orders_daily", ); + // One `_` per character, as the Rust rule counts them, whatever its width. + expect(withDefaultTable(lakeOnly, "f/shop/orders_𐐀").target_path).toBe("main/orders__"); for (const target_path of ["main/orders", "main.orders"]) { expect( withDefaultTable({ target_kind: "ducklake", target_path }, "f/shop/x").target_path, diff --git a/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.test.ts b/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.test.ts index 47c317d8ae..81c5956185 100644 --- a/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.test.ts +++ b/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.test.ts @@ -318,5 +318,9 @@ describe('materialize without a table', () => { expect( parsePipelineAnnotations('-- materialize', 'f/shop/2026_orders').materialize?.targetPath ).toBe('main/_2026_orders') + // One `_` per character, as the Rust rule counts them, whatever its width. + expect( + parsePipelineAnnotations('-- materialize', 'f/shop/orders_𐐀').materialize?.targetPath + ).toBe('main/orders__') }) }) diff --git a/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.ts b/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.ts index e78096bb4c..e1d2e6e7e8 100644 --- a/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.ts +++ b/frontend/src/lib/components/assets/AssetGraph/parsePipelineAnnotations.ts @@ -839,7 +839,7 @@ export function forScript(ann: PipelineAnnotations, scriptPath: string): Pipelin export function materializeTargetPath(m: MaterializeSpec, scriptPath: string): string { // `/
` and `.
` already name a table. if (m.targetKind !== 'ducklake' || /[/.]/.test(m.targetPath)) return m.targetPath - const name = (scriptPath.split('/').pop() ?? '').trim().replace(/[^A-Za-z0-9_]/g, '_') + const name = (scriptPath.split('/').pop() ?? '').trim().replace(/[^A-Za-z0-9_]/gu, '_') // The generated SQL names the table unquoted, so it cannot start with a digit. return name ? `${m.targetPath}/${/^[0-9]/.test(name) ? `_${name}` : name}` : m.targetPath }