Skip to content

Decode state store vals through backend; treat null as missing - #76009

Merged
uranusjr merged 5 commits into
apache:mainfrom
astronomer:execution-api-store-guard
Nov 4, 2026
Merged

uranusjr merged 5 commits into
apache:mainfrom
astronomer:execution-api-store-guard

Conversation

@uranusjr

@uranusjr uranusjr commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Split out of #76007.

A state store value can never be JSON null, because every writer rejects it: the Execution API and public API put bodies, and the Task SDK setters. This makes that part of the BaseStoreBackend contract and has the Execution API read endpoints rely on it.

The docstrings of BaseStoreBackend.get and set now state that the value is never the JSON null. The new get_value and aget_value methods decode what get and aget return, and treat both a missing key and a stored JSON null as None. They are not abstract, so existing backends keep working, and a backend that stores values natively rather than as JSON strings can override them to skip the round trip.

The task and asset state store read endpoints in the Execution API now read through get_value. A custom backend configured with [state_store] backend that hands back a null therefore gets a 404 like a missing key, instead of a 200 with {"value": null}.

The public API endpoints are unchanged, since they read the metastore directly rather than the configurable backend, and nothing can write null there. The Execution API spec stays JsonValue, so there is no version change.

@uranusjr uranusjr added this to the Airflow 3.5.0 milestone Oct 30, 2026
@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:task-sdk labels Oct 30, 2026
Every writer rejects a null state store value, but the task and asset
read endpoints would still return a 200 with null if a backend handed
one back. Treat a stored JSON null the same as a missing key, so a
successful read always carries a value.
@uranusjr uranusjr changed the title Return 404 for a stored null in the state store read endpoints Decode state store vals through backend; treat null as missing Oct 30, 2026
@uranusjr
uranusjr force-pushed the execution-api-store-guard branch from fee21ff to 6af7480 Compare October 30, 2026 05:39
@uranusjr
uranusjr requested a review from potiuk as a code owner October 30, 2026 05:39
@uranusjr
uranusjr requested a review from kaxil November 2, 2026 04:22
@uranusjr
uranusjr merged commit 4495e92 into apache:main Nov 4, 2026
77 checks passed
@uranusjr
uranusjr deleted the execution-api-store-guard branch November 4, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants