Repository navigation
Go SDK: generate DagSpec and TaskSpec from the serialization schema - #73936
Merged
Merged
Conversation
henry3260
force-pushed
the
go-sdk-generate-dag-task-spec
branch
4 times, most recently
from
September 30, 2026 07:00
88e774b to
b619adf
Compare
henry3260
marked this pull request as ready for review
September 30, 2026 07:01
henry3260
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl and
potiuk
as code owners
September 30, 2026 07:01
henry3260
removed request for
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jscheffl and
potiuk
September 30, 2026 07:02
jason810496
reviewed
Sep 30, 2026
jason810496
left a comment
Member
There was a problem hiding this comment.
Nice! Thanks for the PR, LGTM overall, I just compared this with my previous work #67155 using Claude.
3 tasks
henry3260
force-pushed
the
go-sdk-generate-dag-task-spec
branch
4 times, most recently
from
September 30, 2026 12:16
3b9fb19 to
33cc533
Compare
The two structs a Dag author fills in describe the same attributes airflow-core's Dag serialization schema declares, and Python owns that schema. Hand-maintained, they drift from it in silence: a property added, renamed or retyped there leaves a Go-authored Dag serializing a shape core no longer means, and nothing says so. The schema is the serialized shape rather than the authoring one, so generation cannot take it whole. It requires the paths and task lists the bundle fills in, types a moment in time and a duration as a number of seconds, carries a serialized timetable where an author writes a schedule, and names none of the values a trigger rule may take. Those are decisions about the SDK's surface, and the shape tables record each one with the reason it was made, so that the next property to appear on the Python side is a review question rather than an accident. Anything not listed generates, which is what keeps a new property from vanishing.
henry3260
force-pushed
the
go-sdk-generate-dag-task-spec
branch
from
September 30, 2026 12:18
33cc533 to
4bfb7c8
Compare
2 tasks
1 task done
1 task done
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
airflow.DagSpecandairflow.TaskSpecdescribe the attributesairflow-core/src/airflow/serialization/schema.jsondeclares, and Python owns that schema.Hand-maintained, they drift from it in silence: a property added or retyped there leaves a
Go-authored Dag serializing a shape core no longer means.
Decision 12 of ADR 8,
on top of #73767, following what
pkg/execution/genmodelsalready does for the supervisor schema.What
go:generateongo-sdk/airflow/spec.go:internal/genspecrewrites the Python-owned schema intothe authoring shape,
go-jsonschemawrites the committedairflow/spec.gen.go, andgenspec -licenserestores the Apache header so regeneration is idempotent.scripts/ci/prek/check_go_sdk_spec_drift.pyfails when the committed file differs.The schema is the serialized shape, so
internal/genspec/authoring.goholds three tables, eachentry with its reason: exclusions (
fileloc,tasks,ui_color, derivedhas_on_*_callbackflags, anything with no Go authoring type yet), type overrides (
time.Time,time.Duration,intwhere the schema declares a number), and injection ofScheduleover the serializedtimetable. A property not excluded generates, so one added on the Python side surfaces in reviewrather than vanishing. Injecting rather than hand-writing keeps every field in one struct
declaration, which is what lets
TaskSpecimplement the sealedTaskOption. A field is a pointer where theGo zero value is something an author could mean and the schema does not say it is already the
default: a scalar whose schema default is not the zero value, the rule
genmodelsapplies, and aboolean with no schema default at all, whose real default comes from Airflow config and can be true.
TriggerRulestays hand-written, since the schema typestrigger_ruleas a plain string;TestTriggerRuleConstantsMatchPythonis its tripwire against Airflow's enum. The Apache-headerinsertion
genmodels/gencarried moves tointernal/genlicensefor both generators, leavingmodels.gen.gounchanged.Was generative AI tooling used to co-author this PR?