Skip to content

[v3-3-test] Remove the unreachable 404 from the create Variable endpoint (#71245) - #72190

Merged
vincbeck merged 1 commit into
v3-3-testfrom
backport-6171e2b-v3-3-test
Aug 28, 2026
Merged

vincbeck merged 1 commit into
v3-3-testfrom
backport-6171e2b-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

The branch guards a read-back of the row Variable.set() upserted moments earlier
through the same session, so it cannot be reached. It exists only to narrow a type:
SQLAlchemy 2 declares Session.scalar() as returning Optional, and a raise is what
convinces mypy the value is not None.

Paying for that with an HTTP status is the problem. A 404 on a create endpoint tells
a caller the variable they just created was not found, which left the endpoint
choosing between publishing a response it can never return and leaving its spec
incomplete. Asking the session for exactly one row states the same invariant where
it belongs — in the query — so neither control flow nor a status code is needed to
express it.
(cherry picked from commit 6171e2b)

Co-authored-by: Jyun-An Chen jun930436@gmail.com

…int (#71245)

The branch guards a read-back of the row Variable.set() upserted moments earlier
through the same session, so it cannot be reached. It exists only to narrow a type:
SQLAlchemy 2 declares Session.scalar() as returning Optional, and a raise is what
convinces mypy the value is not None.

Paying for that with an HTTP status is the problem. A 404 on a create endpoint tells
a caller the variable they just created was not found, which left the endpoint
choosing between publishing a response it can never return and leaving its spec
incomplete. Asking the session for exactly one row states the same invariant where
it belongs — in the query — so neither control flow nor a status code is needed to
express it.
(cherry picked from commit 6171e2b)

Co-authored-by: Jyun-An Chen <jun930436@gmail.com>
@vincbeck
vincbeck merged commit 3610b80 into v3-3-test Aug 28, 2026
97 of 98 checks passed
@vincbeck
vincbeck deleted the backport-6171e2b-v3-3-test branch August 28, 2026 12:47
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
…int (#71245) (#72190)

The branch guards a read-back of the row Variable.set() upserted moments earlier
through the same session, so it cannot be reached. It exists only to narrow a type:
SQLAlchemy 2 declares Session.scalar() as returning Optional, and a raise is what
convinces mypy the value is not None.

Paying for that with an HTTP status is the problem. A 404 on a create endpoint tells
a caller the variable they just created was not found, which left the endpoint
choosing between publishing a response it can never return and leaving its spec
incomplete. Asking the session for exactly one row states the same invariant where
it belongs — in the query — so neither control flow nor a status code is needed to
express it.
(cherry picked from commit 6171e2b)

Co-authored-by: Jyun-An Chen <jun930436@gmail.com>
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
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 type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants