junyeong0619 opened a new pull request, #66022:
URL: https://github.com/apache/airflow/pull/66022

   Airflow 3 removed direct ORM access from tasks, which means the old
   `Variable.all()` no longer works. This PR adds `Variable.list()` as the
   proper replacement, going through the Execution API like 
`get`/`set`/`delete` do.
   
   closes: #61166
   
   ## What
   
   - Add `Variable.list(prefix=None)` classmethod to the Task SDK
   - Add `GET /variables?prefix=` endpoint to the Execution API
   - Register the new endpoint as API version `2026-04-28`
   
   ## How
   
   Follows the exact same layered architecture as the existing `Variable.get()`:
   
   | Layer | `get` | `list` |
   |---|---|---|
   | Public API | `Variable.get()` | `Variable.list()` |
   | Execution bridge | `_get_variable()` | `_list_variables()` |
   | Comms request | `GetVariable` | `GetVariables` |
   | Comms response | `VariableResult` | `VariablesResult` |
   | Shared handler | `handle_get_variable()` | `handle_get_variables()` |
   | SDK client | `VariableOperations.get()` | `VariableOperations.list()` |
   | Execution API route | `GET /variables/{key}` | `GET /variables?prefix=` |
   
   The list endpoint uses `SessionDep` + SQLAlchemy `select()` directly,
   consistent with all other list endpoints in the Execution API
   (`dag_runs`, `task_instances`, `xcoms`, etc.).
   
   Secret masking is applied per-variable, same as `get`.
   All three supervisor types (TaskRunnerSupervisor, triggerer, DFP) are 
updated.
   
   ## Testing
   
   - 
`airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_variables.py`
 — `TestGetVariables`: 4 cases (all, prefix, no-match, empty DB)
   - `task-sdk/tests/task_sdk/definitions/test_variables.py` — 
`TestVariableList`: 3 parametrized cases (all, with-prefix, empty)
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Sonnet 4.6
   
   Generated-by: Claude Sonnet 4.6 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]

Reply via email to