You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pierrejeambrun (via GitHub)" <gi...@apache.org> on 2026/09/16 12:54:57 UTC

[PR] Default the TypeScript task id to the handler function name [airflow]

pierrejeambrun opened a new pull request, #73243:
URL: https://github.com/apache/airflow/pull/73243

   Updates the TypeScript SDK interface ADRs to make the task id optional.
   
   - **Native Dag ([ADR-0002](https://github.com/apache/airflow/blob/main/ts-sdk/adr/0002-native-dag-interface.md))** — `dag.task(handler)` now defaults the task id to the handler's function name (`dag.task(extract)` → task `"extract"`); the id is resolved from the handler's *source* name at pack time (not `handler.name` at runtime, which esbuild minifies), so a bare anonymous arrow is a compile error until given an explicit id.
   - **Mixed-language handler ([ADR-0001](https://github.com/apache/airflow/blob/main/ts-sdk/adr/0001-mixed-lang-dag-interface.md))** — the id is likewise optional, but writing it out stays the recommendation: a handler binds to a Python-owned task whose id rarely matches a TypeScript name because of naming-convention differences.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Default the TypeScript task id to the handler function name [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #73243:
URL: https://github.com/apache/airflow/pull/73243#discussion_r4026853802


##########
ts-sdk/adr/0002-native-dag-interface.md:
##########
@@ -90,6 +92,24 @@ One statement per task, with each ref named, is the form to write. Nesting the c
 shorthand for a two-task chain, not the general shape: a Dag of twenty tasks reads as twenty flat
 statements, never as a twenty-deep expression.
 
+### Omitting the task id
+
+A native task defaults its id to the handler's function name, so a named handler needs none:
+
+```ts
+const extract = dag.task(async function extract(): Promise<number> {
+  return 42;
+});
+// task id "extract"
+```
+
+The id comes from the handler's *source* name, resolved when the bundle is packed and written into
+the registration — not from `handler.name` at runtime, which minification renames (see

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Default the TypeScript task id to the handler function name [airflow]

Posted by "roykoand (via GitHub)" <gi...@apache.org>.
roykoand commented on code in PR #73243:
URL: https://github.com/apache/airflow/pull/73243#discussion_r4026554350


##########
ts-sdk/adr/0002-native-dag-interface.md:
##########
@@ -90,6 +92,24 @@ One statement per task, with each ref named, is the form to write. Nesting the c
 shorthand for a two-task chain, not the general shape: a Dag of twenty tasks reads as twenty flat
 statements, never as a twenty-deep expression.
 
+### Omitting the task id
+
+A native task defaults its id to the handler's function name, so a named handler needs none:
+
+```ts
+const extract = dag.task(async function extract(): Promise<number> {
+  return 42;
+});
+// task id "extract"
+```
+
+The id comes from the handler's *source* name, resolved when the bundle is packed and written into
+the registration — not from `handler.name` at runtime, which minification renames (see
+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 follow the same convention but should probably use the explicit form, more information in ([ADR-0001](0001-mixed-lang-dag-interface.md)).

Review Comment:
   ```suggestion
   handler follows the same convention but should probably use the explicit form, more information in ([ADR-0001](0001-mixed-lang-dag-interface.md)).
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Default the TypeScript task id to the handler function name [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #73243:
URL: https://github.com/apache/airflow/pull/73243


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Default the TypeScript task id to the handler function name [airflow]

Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on code in PR #73243:
URL: https://github.com/apache/airflow/pull/73243#discussion_r4026292029


##########
ts-sdk/adr/0002-native-dag-interface.md:
##########
@@ -90,6 +92,24 @@ One statement per task, with each ref named, is the form to write. Nesting the c
 shorthand for a two-task chain, not the general shape: a Dag of twenty tasks reads as twenty flat
 statements, never as a twenty-deep expression.
 
+### Omitting the task id
+
+A native task defaults its id to the handler's function name, so a named handler needs none:
+
+```ts
+const extract = dag.task(async function extract(): Promise<number> {
+  return 42;
+});
+// task id "extract"
+```
+
+The id comes from the handler's *source* name, resolved when the bundle is packed and written into
+the registration — not from `handler.name` at runtime, which minification renames (see

Review Comment:
   Could we also add the example of user explicitly setting the taskId, it would be set on the `TaskSpec` like Go SDK (though I still updating the ADR, couldn't point the link to it right away). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org