This is an automated email from the ASF dual-hosted git repository.
jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4616b88380c TS-SDK: inherit the Dag queue when a task passes queue
undefined (#76123)
4616b88380c is described below
commit 4616b88380cd0bec638a910314c0423d35c10c90
Author: Anurag-S1ngh <[email protected]>
AuthorDate: Sat Oct 31 22:45:00 2026 +0530
TS-SDK: inherit the Dag queue when a task passes queue undefined (#76123)
withDagQueue treated a present queue key as a named queue, but an undefined
value serializes to nothing, so the task ran on the default queue. Treat
undefined as unset, as the SDK does for other optional fields.
---
ts-sdk/src/coordinator/serde.ts | 2 +-
ts-sdk/tests/coordinator/serde.test.ts | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ts-sdk/src/coordinator/serde.ts b/ts-sdk/src/coordinator/serde.ts
index b6938fa81d6..982b21bc0e3 100644
--- a/ts-sdk/src/coordinator/serde.ts
+++ b/ts-sdk/src/coordinator/serde.ts
@@ -230,7 +230,7 @@ export function serializeDag(
* field is.
*/
function withDagQueue(spec: object, dagQueue: string | undefined): object {
- if (dagQueue === undefined || "queue" in spec) return spec;
+ if (dagQueue === undefined || ("queue" in spec && spec.queue !== undefined))
return spec;
return { ...spec, queue: dagQueue };
}
diff --git a/ts-sdk/tests/coordinator/serde.test.ts
b/ts-sdk/tests/coordinator/serde.test.ts
index df508ec2871..f47c52625bf 100644
--- a/ts-sdk/tests/coordinator/serde.test.ts
+++ b/ts-sdk/tests/coordinator/serde.test.ts
@@ -182,6 +182,14 @@ describe("serializeDag", () => {
expect(tasks.get("heavy")?.["queue"]).toBe("typescript_large");
});
+ it("inherits the Dag's queue when a task passes an undefined queue", () =>
{
+ const dag = new Dag("d", { queue: "typescript" });
+ place(dag, "one", [], { queue: undefined });
+
+ const tasks = taskMap(serializeDag(dag, "", ".") as Json);
+ expect(tasks.get("one")?.["queue"]).toBe("typescript");
+ });
+
it("writes no queue when neither the Dag nor the task names one", () => {
expect(taskVar(serializeWith({}))).not.toHaveProperty("queue");
});