This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new d486547dc45 [v3-4-test] TS SDK: Reject a blank queue in Dag and task
specs (#75573) (#75605)
d486547dc45 is described below
commit d486547dc451265cb084be8e7fcf253df3098bfa
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Oct 26 04:47:21 2026 +0000
[v3-4-test] TS SDK: Reject a blank queue in Dag and task specs (#75573)
(#75605)
(cherry picked from commit 054d093651d44b3c3f21e110b47a324bddaa7193)
Co-authored-by: Guan-Ming Chiu
<[email protected]>
---
.../authoring-and-scheduling/language-sdks/typescript.rst | 2 +-
ts-sdk/src/sdk/dag.ts | 9 +++++++++
ts-sdk/tests/sdk/dag.test.ts | 14 ++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst
b/airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst
index 7a5699dcb13..4b80ea9dce1 100644
--- a/airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst
+++ b/airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst
@@ -221,7 +221,7 @@ it out for a Dag that only runs when triggered. A cron
schedule runs in UTC.
Every task of the Dag runs on the Node.js coordinator, so it needs a queue that
:ref:`queue_to_coordinator <typescript-sdk/coordinator-config>` sends there.
Set ``queue`` once on the Dag and
-each task inherits it. A task's own ``queue`` wins over the Dag's.
+each task inherits it. A task's own ``queue`` wins over the Dag's. A ``queue``
that is set cannot be blank.
Order-only dependencies
~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/ts-sdk/src/sdk/dag.ts b/ts-sdk/src/sdk/dag.ts
index bffb4e77b2b..adf41236edd 100644
--- a/ts-sdk/src/sdk/dag.ts
+++ b/ts-sdk/src/sdk/dag.ts
@@ -111,6 +111,7 @@ export interface DagSpec extends GeneratedDagFields {
* A native Dag's tasks are executed by the Node coordinator, which the
* deployment's `queue_to_coordinator` maps a queue to, so this is what
* routes them there. `queue` on a {@link TaskSpec} wins for that task.
+ * A `queue` that is set cannot be blank.
*/
readonly queue?: string;
}
@@ -1122,6 +1123,7 @@ export class Dag {
}
spec[key] = value[key];
}
+ rejectBlankQueue(spec["queue"], `Dag "${this.dagId}" task "${taskId}"`);
return spec as TaskSpec;
}
@@ -1540,6 +1542,13 @@ function validateDagSpec(dagId: string, spec: DagSpec):
void {
throw new Error(`Unknown option "${String(key)}" in the spec for Dag
"${dagId}"`);
}
}
+ rejectBlankQueue(value["queue"], `Dag "${dagId}"`);
+}
+
+function rejectBlankQueue(queue: unknown, owner: string): void {
+ if (typeof queue === "string" && queue.trim() === "") {
+ throw new Error(`queue in the spec for ${owner} must not be blank`);
+ }
}
/**
diff --git a/ts-sdk/tests/sdk/dag.test.ts b/ts-sdk/tests/sdk/dag.test.ts
index 96cbe4b3ae9..b608f394426 100644
--- a/ts-sdk/tests/sdk/dag.test.ts
+++ b/ts-sdk/tests/sdk/dag.test.ts
@@ -403,6 +403,20 @@ describe("Dag", () => {
expect(dag.taskIds).toEqual([]);
});
+ it.each(["", " "])("rejects the blank queue %j in the Dag spec", (queue) => {
+ expect(() => new Dag("example_dag", { queue })).toThrowError(
+ 'queue in the spec for Dag "example_dag" must not be blank',
+ );
+ });
+
+ it.each(["", " "])("rejects the blank queue %j in the task spec", (queue) =>
{
+ const dag = new Dag("example_dag", { queue: "typescript" });
+ expect(() => dag.task("transform", async () => undefined, { queue
})).toThrowError(
+ 'queue in the spec for Dag "example_dag" task "transform" must not be
blank',
+ );
+ expect(dag.taskIds).toEqual([]);
+ });
+
it.each([
["null", null],
["an array", []],