guan404ming commented on issue #69288:
URL: https://github.com/apache/airflow/issues/69288#issuecomment-5161675825
▎ How should the coordinator know that this TypeScript object is only
registering handlers and should not be serialized?
I'd prefer to avoid a mode string on Dag and make the distinction type-level
instead:
```ts
// native: TS owns schedule + dependencies, gets serialized
const pipeline = new Dag({ dagId: "sales_pipeline", schedule: "@daily" });
pipeline.task("extract", { run: extractFn, spec: { retries: 3 } });
// handler-only: a reference to a Python-owned Dag, never serialized
const external = Dag.external("sales_pipeline");
external.task("transform", { run: transformFn });
```
- The type returned by `Dag.external()` simply doesn't have
schedule/spec/dependency fields, so "TypeScript does not own this Dag" is
enforced at compile time rather than ignored at runtime.
- The coordinator needs no flag check: Dag instances serialize; external
refs only register (dagId, taskId) → handler.
- This keeps the single authoring interface — new Dag() remains the only way
to author a Dag, and .task() feels identical on both. Handler-only is binding,
not authoring.
- Compared to a registerHandlers("id", { extract: fn }) map, the .task()
form still has room for a per-task args schema to validate the resolved input
object.
--
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]