luc-pimentel opened a new pull request, #75569: URL: https://github.com/apache/airflow/pull/75569
A Dag that a language SDK serializes reaches Airflow as serialized-Dag JSON, so the id checks in the Task SDK's constructors never run on it. A TypeScript, Go or Java Dag with a dag id, task id or task group id that is too long or made of other characters is stored as is; on Postgres the 250-character columns turn that into a database error instead of an import error. The SDKs' pack-time warnings say the server will reject such ids, and it did not. `validate_serialized_dag` now applies the Task SDK's rules: 250 characters and `[\w.-]` for the dag id and task ids, 200 characters and `[\w-]` for each task group's own id, raising `DeserializationError`, which the Dag processor records as an import error against the file. Only Dags from language SDKs pass through this function, so Python Dags are untouched, and the `..` rule stays where the Task SDK has it, on connection and run ids. Compared with #73923, the task group ids come from the deserialized task group tree rather than a walk over the raw children, and the rules match the Task SDK rather than core's `validate_key`, so ids with `..` that Python Dags carry today keep loading. Tested with a packed TypeScript bundle declaring five Dags (valid, task id of 260 characters, task id `has space!`, dag id of 260 characters, dag id with spaces) parsed by `airflow dag-processor`: before, all five were stored; after, the valid one loads and the file gets one import error naming each of the other four. Unit tests cover each id kind, too long and with other characters, plus the ids the SDK accepts. closes: #73800 related: #73923 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes - Claude Code (claude-fable-5-1) Generated-by: Claude Code (claude-fable-5-1) 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]
