Skip to content

Accept deadline UUIDs in serialized Dag schema - #70579

Closed
rapsealk wants to merge 2 commits into
apache:mainfrom
rapsealk:fix/serialized-dag-deadline-schema
Closed

Accept deadline UUIDs in serialized Dag schema#70579
rapsealk wants to merge 2 commits into
apache:mainfrom
rapsealk:fix/serialized-dag-deadline-schema

Conversation

@rapsealk

@rapsealkrapsealk commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

A Dag with a DeadlineAlert is serialized with its deadline as a list of encoded alert dicts — the shape DagSerialization.to_dict validates against serialization/schema.json. SerializedDagModel.write_dag then calls _generate_deadline_uuids, which rewrites that list into UUIDv7 strings before persisting. The data actually stored in serialized_dag.data therefore no longer conforms to the schema that describes it, and anything validating the stored row raises jsonschema.ValidationError.

jsonschema.exceptions.ValidationError: ['019fa7db-318a-710c-ace6-4c2edb33f573'] is not valid under any of the given schemas
Failed validating 'anyOf' in schema['allOf'][0]['properties']['dag']['properties']['deadline']

This adds list[str] to the deadlineanyOf so the schema covers the post-rewrite shape alongside the pre-rewrite one, and documents the relationship on _generate_deadline_uuids.

Split out of #66269 at review request — that PR mixed this fix with an example Dag and a type-stub fix.

Verification

  • New regression test test_serialized_dag_with_deadline_passes_schema_validation fails with ValidationError on main and passes with this change.
  • airflow-core/tests/unit/models/test_serialized_dag.py (76 passed) and airflow-core/tests/unit/serialization/ (503 passed) are green.
  • prek static checks pass.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines


Important

🛠️ Maintainer triage note for @rapsealk · by @potiuk · 2026-08-13 12:55 UTC

Helpful heads-up from the maintainers — please address before this PR can be reviewed:

  • Pre-commit / static checks. See docs.

Full list of what we check: Pull Request quality criteria.

The ball is in your court — you've been assigned to this PR. Fix the above, then mark it Ready for review.

Automated triage — may be imperfect; a maintainer takes the next look.

A Dag with a DeadlineAlert is serialized with its deadline as a list of
encoded alert dicts, which is the shape `to_dict` validates against the
JSON schema. `SerializedDagModel.write_dag` then rewrites that list to
UUIDv7 strings before persisting, so the data actually stored in
`serialized_dag.data` no longer conforms to the schema that describes it
— anything validating the stored row raises a ValidationError.
@rapsealkrapsealk changed the title feat: Accept deadline UUIDs in serialized Dag schemaAccept deadline UUIDs in serialized Dag schemaJul 28, 2026
@ferruzzi

Copy link
Copy Markdown
Contributor

I'm about to merge #70148 which covers the same issue.

@rapsealk
rapsealk deleted the fix/serialized-dag-deadline-schema branch August 17, 2026 22:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@rapsealk@ferruzzi