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 1f7396d9a39 Require explicit task_id on TypeScript mixed-lang task
handlers (#73325)
1f7396d9a39 is described below
commit 1f7396d9a39c026c8676c29d15347aa45e82d4a2
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Mon Sep 21 03:47:03 2026 +0200
Require explicit task_id on TypeScript mixed-lang task handlers (#73325)
* Require explicit task_id on TypeScript mixed-lang task handlers
The TS ADR-0001 revision made task_id optional on TaskHandler, defaulting to
the handler's function name -- symmetric with native Dag task-id defaulting,
but wrong for a mixed-language handler. Python owns the task_id in that
case,
so renaming a TypeScript function must not change which task body Airflow
matches. The Go SDK's mixed-lang ADR states the same choice for the same
reason and this brings the TypeScript stance in line with it. The native-Dag
default stays as-is, since both ends of every name are TypeScript there.
* Trim decision 3
* Update ts-sdk/adr/0001-mixed-lang-dag-interface.md
Co-authored-by: Jason(Zhe-You) Liu
<[email protected]>
---------
Co-authored-by: Jason(Zhe-You) Liu
<[email protected]>
---
ts-sdk/adr/0001-mixed-lang-dag-interface.md | 8 +++-----
ts-sdk/adr/0002-native-dag-interface.md | 3 ++-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ts-sdk/adr/0001-mixed-lang-dag-interface.md
b/ts-sdk/adr/0001-mixed-lang-dag-interface.md
index ae026a856c2..50a2a4ee325 100644
--- a/ts-sdk/adr/0001-mixed-lang-dag-interface.md
+++ b/ts-sdk/adr/0001-mixed-lang-dag-interface.md
@@ -31,11 +31,9 @@ Proposed. Revised after the review on #72047.
2. **A bundle has one registration verb and serves itself.**
`bundle.register(...)` takes Dags and
task handlers alike, in any mixture, and `await bundle.serve()` starts the
runtime over them.
`Bundle` replaces `DagRegistry`, and the free `serveDags(registry)`
function goes with it.
-3. **task_id is optional but should probably be written out here.** Most of
the time because of
- naming convention difference between python and typescript, names won't
match. Omitting it defaults
- the id to the handler's function name — `new TaskHandler(transformStep)`
binds the `"transformStep"` fn to the
- "transformStep" task. On the other hand `new TaskHandler("transform_step",
transformStep)` will bind to
- "transform_step" task.
+3. **dag_id and task_id should always be written out**, because Python owns
it. Renaming a TypeScript function must
+ not change which task body Airflow matches, so `new TaskHandler(dagId,
taskId, handler)` names
+ the pair explicitly rather than inferring either id from the handler's
function name.
4. **A handler is a plain function of its own data**, destructured by name.
`getContext()` and
`getClient()` supply the rest, so nothing the SDK injects shares a
namespace with an author's
arguments.
diff --git a/ts-sdk/adr/0002-native-dag-interface.md
b/ts-sdk/adr/0002-native-dag-interface.md
index f1ba74b4a5f..2c2a1a3df1b 100644
--- a/ts-sdk/adr/0002-native-dag-interface.md
+++ b/ts-sdk/adr/0002-native-dag-interface.md
@@ -108,7 +108,8 @@ the registration — not from `handler.name` at runtime,
which minification rena
Implementation Notes). A handler with no source name — a bare anonymous arrow
passed inline,
`dag.task(async () => 42)` — has nothing to resolve and is a compile error
until given an explicit
id. This default is for native Dags, where both ends of every name are
TypeScript; a mixed-language
-handler follows the same convention but should probably use the explicit form,
more information in ([ADR-0001](0001-mixed-lang-dag-interface.md)).
+handler names the Python-owned task explicitly and does not default from the
handler's function
+name ([ADR-0001](0001-mixed-lang-dag-interface.md), decision 3).
The `TaskSpec` also carries the task id, so it can be set alongside the other
task options: