pierrejeambrun opened a new pull request, #67639:
URL: https://github.com/apache/airflow/pull/67639
**Stacked on top of #67564 — only the second commit (\`Apply note in one
shot...\`) is in this PR's scope; the first commit will disappear once #67564
merges.**
Today the Clear dialogs (single-run and bulk, both for Dag Runs and
Task Instances) issue two requests on confirm: first ``POST .../clear``
to actually clear, then a follow-up ``PATCH .../dagRuns/{run_id}`` /
``PATCH .../taskInstances/...`` to attach the note the user typed in
the dialog. The two calls race (the note can land before the clear
finishes invalidating queries) and the second one's failure can leave
a cleared run/TI with a stale note.
## Summary
- **Backend:** ``DAGRunClearBody`` gains a ``note: str | None`` field
(max length 1000). After the clear succeeds in ``clear_dag_run``,
if ``note`` is set we apply it to the cleared run with the same
``dag_run.note = (text, user_id)`` / ``dag_run_note.content = …``
shape that ``patch_dag_run`` already uses.
``ClearTaskInstancesBody`` already carries this field and already
applies it via ``_patch_task_instance_note`` in the same
transaction — that side is unchanged.
- **Semantics** mirror the bulk-update / patch convention:
- ``note=None`` (the default, or omitted entirely) → leave the
existing note untouched.
- any string value (including ``""``) → replace the existing note
with that value.
- dry-run never writes.
- **UI:** ``ClearRunDialog``, ``ClearTaskInstanceDialog`` and
``useBulkClearDagRuns`` pass ``note`` directly in the clear body
(only when it changed) and drop their secondary ``patchDagRun`` /
``patchTaskInstance`` calls. Bulk clear of TIs already followed
this pattern.
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.7)
Generated-by: Claude Code (Opus 4.7) 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]