sreecharan-desu opened a new pull request, #77791:
URL: https://github.com/apache/airflow/pull/77791

   closes: #48887
   
   The current check only printed the newest Execution API schema, so a route 
change or an edit to an already released version file went through without any 
diff. An older Task SDK keeps calling the version it shipped with, so that kind 
of edit can break it silently.
   
   This saves a normalized OpenAPI snapshot per Execution API version under 
`airflow-core/tests/unit/api_fastapi/execution_api/openapi_snapshots/`. 
`test_released_versions_frozen.py` compares each released version with its 
snapshot and fails with the paths and schemas that changed. The new prek hook 
`update-execution-api-version-snapshots` only rewrites snapshots for unreleased 
versions and refuses to touch released ones. `generate_execution_api_schema.py` 
can now print one version or all of them.
   
   One question for Ash before this goes further: "released" here means the 
version date is today or earlier. The other option is everything up to the 
`API_VERSION` of the last Task SDK release, which would stop a version from 
freezing just because its date passed. Happy to switch. The snapshots also add 
about 2.2 MB of JSON. If that is too much, storing a hash per version is the 
smaller fallback, at the cost of a less useful failure message.
   
   How I tested
   
   ```
   cd airflow-core
   uv run --no-sync --frozen pytest 
tests/unit/api_fastapi/execution_api/test_released_versions_frozen.py
   11 passed, 1 warning in 7.68s
   
   uv run --project scripts --frozen pytest 
scripts/tests/ci/prek/test_generate_execution_api_schema.py 
scripts/tests/ci/prek/test_update_execution_api_version_snapshots.py
   21 passed in 0.11s
   ```
   
   Then I removed 
`schema(TITerminalStatePayload).field("rendered_map_index").didnt_exist` from 
`versions/v2025_04_28.py` to check the test catches it:
   
   ```
   FAILED ...::test_released_openapi_schema_matches_snapshot[2025-04-11] - 
Failed: Released Execution API version 2025-04-11 no longer matches 
openapi_snapshots/v2025_04_11.json.
   schema changed: TITerminalStatePayload
   1 failed, 10 passed, 1 warning in 7.77s
   ```
   
   ![released schema 
check](https://raw.githubusercontent.com/sreecharan-desu/airflow/pr-assets/pr-assets/48887.gif)
   
   ---
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: an AI coding assistant, reviewed and tested by me, following 
[the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   used an AI coding assistant to help with parts of this, but i went through 
every change myself, understand the code and tested it locally.
   


-- 
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]

Reply via email to