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

   # TS SDK: resolve an omitted task id at pack time
   
   - **Depends on the PR for `feature/ts-sdk/dag-schema-codegen` getting merged 
first** (only the last commit is new here).
   - **Diff for early review**: 
https://github.com/jason810496/airflow/compare/feature/ts-sdk/dag-schema-codegen...feature/ts-sdk/default-task-id-at-pack-time
   - **next**: `feature/ts-sdk/order-only-edges`
   
   ## Why
   
   A native task should default its id to the handler's function name, but that 
name only exists before esbuild renames it. Reading `handler.name` at run time 
returns the minified name, and `keepNames` would wrap every function in the 
bundle to protect the handful that need it.
   
   ## How
   
   - An esbuild `onLoad` hook rewrites `dag.task(extract)` into 
`dag.task("extract", extract)` before minification, so the id is fixed in 
source.
   - The transform is deliberately conservative. `dag.task(computedId, 
handler)` and `dag.task(handler, spec)` are syntactically identical, so it 
rewrites only the three shapes it can prove are handlers and leaves everything 
else exactly as written.
   - A genuinely anonymous handler is reported by the SDK when the Dag is read, 
where the argument's type is known. Packing runs the bundle to read its 
manifest, so it still fails the pack.
   
   ## What
   
   - `src/cli/task-id.ts`: a scanner that skips strings, templates, comments 
and regex literals, plus the plugin `airflow-ts-pack` installs.
   - `dag.task(handler, spec?)` overload, and `taskId` on `TaskSpec` for a 
handler that has no name to take one from.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code Opus 5 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to