Repository navigation
Make the Variable value non-nullable in the Execution API - #76007
Merged
Merged
Conversation
uranusjr
requested review from
amoghrajesh,
ashb and
jason810496
as code owners
October 30, 2026 04:48
uranusjr
force-pushed
the
execution-api-non-null-values
branch
2 times, most recently
from
October 30, 2026 05:05
ab22f41 to
8b13815
Compare
uranusjr
commented
Oct 30, 2026
kaxil
reviewed
Nov 1, 2026
uranusjr
force-pushed
the
execution-api-non-null-values
branch
from
November 5, 2026 09:30
07d99ab to
e5fc219
Compare
kaxil
reviewed
Nov 5, 2026
kaxil
approved these changes
Nov 5, 2026
A successful Variable read never carries a null value: a missing Variable is a 404. The Execution API and supervisor schema still typed the value as nullable, so generated clients got a nullable type. Type the value as str in VariableResponse/VariablePostBody and in the supervisor schema's VariableResult/PutVariable. Version 2027-02-28 of both carries the change. An older client or runtime that sets a Variable to null keeps storing the string "None", as before. Setting a Variable to None from the Task SDK is now deprecated. It still stores "None", but emits RemovedInAirflow4Warning. The task and asset state store read endpoints now return 404 for a stored JSON null, so a successful read never carries null. Writers already reject null.
Downgrading to an older supervisor schema version re-validates against Cadwyn's generated copies of the models, so isinstance checks against the head classes fail there. Check the kind discriminator instead, and run the test for both 2026-10-30, which the Java SDK pins, and the current 2027-02-28.
The supervisor schema migrator runs request converters on the raw wire dict before validating, so a PutVariable from a 2026-10-30 runtime with no value key was also turned into "None" instead of failing validation. Only convert when the key is present and null. Replace the downgrade test that passed with or without the version change with tests that pin it: a real value from an older runtime is kept, a missing value is still rejected, and only the 2026-10-30 PutVariable accepts a null value. Do the same for the Execution API: add an old-version PUT of a real value that must be stored unchanged, and drop the GET tests, which repeat the head-version tests and don't exercise this version change.
Python's default filters hide a DeprecationWarning raised from a Dag module, so the RemovedInAirflow4Warning never reached the task log. Warn with a new DeprecatedVariableNoneValueWarning instead, a FutureWarning like DeprecatedImportWarning, which is shown by default and still points at the caller's line.
The test only checked PutVariable, so dropping the VariableResponse instruction from the supervisor version change still passed, even though the 2026-10-30 VariableResult the Java SDK receives would then be non-nullable. Run it for both models.
The deprecation tests passed with any stacklevel. Check that the warning is attributed to the caller's line, not the SDK's own module.
The supervisor no longer accepts a null Variable value, so a plain-JS setVariable(key, null) produced a frame it couldn't decode. It never replied, and the call only failed at the 30s request timeout with a generic error. Throw a TypeError up front instead, as the task state store already does for invalid values.
A Variable can no longer hold a null value, so null from getVariable only means the key is missing.
uranusjr
force-pushed
the
execution-api-non-null-values
branch
from
November 6, 2026 03:39
694c5ed to
0a79ac1
Compare
uranusjr
enabled auto-merge (squash)
November 6, 2026 03:40
Open
2 tasks done
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.
Identified while reviewing #75920.
A successful Variable read never carries a null value.
Variable.getraisesKeyErrorwhen nothing is found, and the route turns that into a 404. The Execution API and supervisor schema still typed the value asstr | None, so every generated client got a nullable type. This changes the Variable value's type to non-nullable in both, under version2027-02-28, so null only means "not found". Clients pinned to an older Execution API or supervisor schema version can still send null, which keeps storing"None"as before.The Task SDK allowed
Variable.set(key, None), but the None was stringified into"None"before being sent through the wire, so reading the Variable back returns the string"None", notNone. This now emits a deprecation warning; behavior is unchanged. The warning is aFutureWarningsubclass, as in #55881, because Python's default filters hide aDeprecationWarningraised from a Dag module, and Dag authors would never see it. Coreairflow.models.Variable.set(key, None)called outside a task is not changed.The Go and TypeScript SDKs follow the in-repo supervisor schema, so their generated models now type the Variable value as a plain string, and their clients drop the handling for a null or non-string value. Their move to
2027-02-28and Airflow 3.5.0 already happened in #75387. The Java SDK pins a published schema version and is unchanged; it will move in a follow-up once2027-02-28is published.