Skip to content

Add serialized Dag version diff engine#1591

Closed
ephraimbuddy wants to merge 1 commit into
mainfrom
dag-version-diff-core
Closed

Add serialized Dag version diff engine#1591
ephraimbuddy wants to merge 1 commit into
mainfrom
dag-version-diff-core

Conversation

@ephraimbuddy

Copy link
Copy Markdown

Adds the shared engine that computes an observed-state diff between two stored serialized Dag versions. Dag authors and operators need a reliable way to understand how two stored versions differ without downloading serialized payloads or manually comparing implementation details.

This is the foundation of a three-part stack; the REST API endpoint and the airflow dags versions diff CLI command follow in separate PRs that build on this engine. It intentionally ships with no runtime caller yet — it is fully exercised by unit tests.

What it does

  • build_serialized_dag_diff — pure, deterministic, bounded diff over two serialized payloads. Normalizes task/schedule/dependency/metadata state, converts legacy schema shapes (v1/v2 → v3), keys order-insensitive collections, categorizes each change (task, dependency, schedule, param, asset, callback, deadline, metadata, provenance) and its impact, and emits digests plus optional raw values.
  • get_dag_version_diff — DB-facing wrapper that loads two DagVersions, assembles provenance, and classifies optional source/values data as available, redacted, or unavailable.
  • Malformed legacy payloads and missing historical data degrade to an unavailable result instead of failing the whole request.

Testing

  • 32 unit tests, including a @pytest.mark.db_test class covering get_dag_version_diff end-to-end: observed-state diff, not-found handling, version-number validation, and the values/source status plumbing (available, redacted, unavailable-when-code-missing).
  • prek (ruff, mypy, license, no-new-AirflowException) clean.

No newsfragment: the engine has no user-facing surface on its own; user-facing notes ship with the API and CLI PRs.


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

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


Drafted-by: Claude Code (Opus 4.8) (no human review before posting)

Dag authors and operators need a reliable way to understand how two stored
Dag versions differ without downloading serialized payloads or manually
comparing implementation details. This adds the shared comparison engine
that later API and CLI surfaces build on.

Historical serialized Dags can use different schema shapes, so comparisons
normalize task, schedule, dependency, and metadata state before calculating
changes. Malformed legacy payloads and missing historical data degrade to
unavailable results instead of failing the whole request.
@ephraimbuddy

Copy link
Copy Markdown
Author

Superseded — opened against apache/airflow instead: apache#69864


Drafted-by: Claude Code (Opus 4.8) (no human review before posting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant