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

   # TS SDK: serialize a native Dag to Dag JSON
   
   - **Depends on the PR for `feature/ts-sdk/dag-cycle-detection` getting 
merged first** (only the last commit is new here).
   - **Diff for early review**: 
https://github.com/jason810496/airflow/compare/feature/ts-sdk/dag-cycle-detection...feature/ts-sdk/serialize-native-dag
   - **next**: `feature/ts-sdk/answer-dag-parse-request`
   
   ## Why
   
   A Dag declared in TypeScript has to reach the Dag processor as the same Dag 
JSON a Python Dag produces, so the scheduler reads it without knowing which 
language declared it.
   
   ## How
   
   - Reimplemented per language against 
`airflow-core/src/airflow/serialization/schema.json`, as 
`airflow-core/adr/lang-sdk/0004-dag-parsing.md` sets out. Byte-parity with 
Python is not the goal; what has to hold is that `DagSerialization.from_dict` 
rebuilds the same Dag.
   - A conformance harness builds the same fixtures with both SDKs and compares 
field by field, then pushes the TypeScript output back through Airflow's own 
deserializer.
   - Only a schedule that maps to a stock timetable can be serialized. Anything 
else names a Python object a bundle cannot point at, and is rejected rather 
than written into a Dag that fails to deserialize.
   
   Two behaviours were derived from Airflow rather than assumed, both pinned by 
the conformance fixtures: a nested group records its **local** `_group_id`, and 
a group edge expands to the group's **roots and leaves** in the task graph 
while also being recorded on the group object.
   
   ## What
   
   - `src/coordinator/serde.ts`, covering the Dag spec, each task and its spec, 
both kinds of edge, and the task-group tree.
   - Six conformance Dags, including nested groups and group edges, validated 
against the schema and deserialized by `DagSerialization`.
   
   Needs the core-side version negotiation for the parse payload before it can 
be relied on across SDK versions.
   
   ---
   
   ##### 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