github-actions[bot] opened a new pull request, #72190: URL: https://github.com/apache/airflow/pull/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 6171e2bf9922f21db4729062356eb28963bec978) Co-authored-by: Jyun-An Chen <[email protected]> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
