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

   - related ADR: `ts-sdk/adr/0001-mixed-lang-dag-interface.md` (decision 5), 
`airflow-core/adr/lang-sdk/0007-taskflow-across-language-boundary.md`
   - **Depends on `feature/ts-sdk/task-handler-class` get merged first** (only 
the last commit is new here).
   - **Diff for early review**: 
https://github.com/jason810496/airflow/compare/feature/ts-sdk/task-handler-class...feature/ts-sdk/taskflow-arg-folding
   - **next**: `feature/ts-sdk/taskflow-xcom-args`
   
   ## Why
   
   A Python Dag calls a `@task.stub` task TaskFlow-style, but the handler was 
called with nothing,
   so the call site was decoration and its values had to be hardcoded in the 
handler or re-fetched from XCom.
   
   ## How
   
   - Consume `ti_context.arg_bindings` at the dispatch site and hand it to the 
handler as its parameter.
   - Names bind by folding on both sides, lowercased with underscores removed.
     That is the Go SDK's rule (`strings.ToLower(strings.ReplaceAll(name, "_", 
""))`), so one Python signature binds identically in either SDK,
     and neither needs a rename declared for ordinary snake_case.
   - The bound object is a `Proxy` so folding happens per read. The SDK sees 
Python's names and cannot know which spelling a handler will
     destructure, so no guess at a TypeScript name is ever materialized. A null 
prototype means a Python argument named `toString` binds like any
     other, and one that was not passed misses rather than resolving to a 
function.
   - `in` folds like a read. `Object.keys` and rest destructuring yield 
Python's names, since there are no TypeScript-side names to enumerate.
   - An unmatched name logs rather than throws: a destructuring default such as 
`{ runId = "manual" }` is a legitimate miss and nothing can tell
     one from a typo, so the warning names both the requested name and what the 
call delivered. A failing task reports the same list.
   - Two Python names that fold to one token fail the task before the handler 
runs, naming both.
     An XCom-backed binding fails the same way for now, with the `getXCom` call 
to write instead; the next PR resolves those.
     Anything else the SDK cannot honour fails rather than being dropped, 
because an unbound argument reaches the handler as `undefined`
     and corrupts its output instead of stopping it.
   
   ---
   
   ##### 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