potiuk opened a new pull request, #74837: URL: https://github.com/apache/airflow/pull/74837
When a connection test is enqueued with `commit_on_success`, the API decides which permission to check from whether the connection exists at that moment: edit (`PUT`) for an existing connection, create (`POST`) otherwise. When the worker later reports success, `commit_to_connection_table` created the connection if missing and updated it if present. So a test enqueued for a connection ID that did not exist yet, under create permission only, could still overwrite a connection with that ID that someone else created while the test was waiting in the queue. This change records the decision made at enqueue time in a new `commit_allows_update` column on `connection_test_request`. It is set only when the connection already existed and the edit permission was checked. At commit time, a create-only test that finds an existing connection leaves it unchanged; the test request is marked `failed` with a message explaining that the tested values were not saved. Edits authorised at enqueue keep updating the connection as before. The new column needs a migration (`9cffe90fa0c0`, 3.5.0) with a `server_default` of false, so requests that are in flight during an upgrade are treated as create-only. Tests: - model: a create-only commit does not change an existing connection; an update-enabled commit still updates it; creation is unchanged - execution API: a successful create-only test that finds an existing connection leaves it unchanged and marks the test `failed` - public API: `commit_allows_update` is false for a new connection and true for an existing one with edit permission **Migration placement.** The new migration is a 3.4.0 migration (`0147_3_4_0`, `9cffe90fa0c0`, on top of `a5d7b9c13e40`) so that it can be backported to `v3-4-test`. The existing 3.5.0 migration that adds `session_id` to Job is renumbered to `0148` and now revises `9cffe90fa0c0`; its revision ID is unchanged. The `_REVISION_HEADS_MAP` entry for 3.4.0 and `migrations-ref.rst` are updated accordingly. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Opus 5 following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
