Uh oh!
There was an error while loading. Please reload this page.
[v3-3-test] Remove the unreachable 404 from the create Variable endpoint (#71245) - #72190
Merged
Conversation
…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>
pierrejeambrun
marked this pull request as ready for review
August 28, 2026 09:04
pierrejeambrun
requested review from
bugraoz93, choo121600, ephraimbuddy, henry3260, jason810496, pierrejeambrun, rawwar and shubhamraj-git
as code ownersAugust 28, 2026 09:04
henry3260
approved these changes
Aug 28, 2026
vincbeck
approved these changes
Aug 28, 2026
ContributorAuthor
Hi maintainer, this PR was merged without a milestone set.
|
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 freeto 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.
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