Skip to content

Make copied task log text match the on-screen format - #71270

Merged
bbovenzi merged 4 commits into
apache:mainfrom
Andrushika:log-copy-onscreen-format
Aug 13, 2026
Merged

Make copied task log text match the on-screen format#71270
bbovenzi merged 4 commits into
apache:mainfrom
Andrushika:log-copy-onscreen-format

Conversation

@Andrushika

@Andrushika Andrushika commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Why

Follow up PR for #71156.
Copied logs should match what the user sees on the screen. The rebuilt virtualized rows used the raw download format, so one copy could mix two timestamp formats and drop the group marker.

What

The copy rebuild now formats timestamps in the selected timezone, same as the screen. Group headers keep their marker, and it follows the expand state ( / ) in both native copy and rebuilt text.
The marker is now a real character that switches with state (this change keeps our code cleaner in handling copy event), so the small rotate animation is gone.

2026-08-07.2.22.46.mov

related: #71156


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5)

Generated-by: Claude Code (Fable 5) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Aug 7, 2026
@Andrushika

Copy link
Copy Markdown
Contributor Author

TBH... I don't really like the approach in this PR, but it is the minimal and fastest change for the target.

We intercept the copy event and rebuild the text ourselves. So the rebuild has to know about every visual element, like the marker and the timestamp format. If someone adds a new element to the log view one day, for example a badge in front of error lines or an inline link to the failed task, and forgets the copy path, it drifts again. The test in this PR compares rebuilt lines with the real copy text of mounted rows, so it catches the current elements, but the approach is still brittle by nature.

I think the better way is to make renderStructuredLog produce one neutral token list first, and then render the same tokens to JSX for the screen and to plain text for copy. The two outputs cannot drift because they come from the same source. But that is a big change and touches search, ANSI and i18n. So I would like to hear opinions from maintainers first. If that direction sounds right, I would like to merge this one as an interim fix and do the refactor in a follow-up PR.

@Andrushika
Andrushika force-pushed the log-copy-onscreen-format branch from e9b45cb to ee3d9c9 Compare August 7, 2026 06:44
Comment thread airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx Outdated
Comment thread airflow-core/src/airflow/ui/src/components/renderStructuredLog.tsx Outdated
Users expect copying logs to yield exactly what the screen shows.
The clipboard rebuild for rows the virtualizer unmounted previously
emitted the raw download format, so one copy could mix two timestamp
formats and drop the group expand marker. The group marker now also
follows the expand state (collapsed / expanded) in both the DOM and
the rebuilt text. Follow-up to review feedback on apache#71156; the log
download keeps raw source timestamps.
Timestamp formatting belongs at the selection reconstruction boundary so downloads retain source timestamps and log parsing stays independent of UI timezone state.
@Andrushika
Andrushika force-pushed the log-copy-onscreen-format branch from 77deb61 to b51b610 Compare August 12, 2026 04:20
The clipboard fix should not alter shared text rendering because downloaded logs use the same path.
@bbovenzi bbovenzi added this to the Airflow 3.3.2 milestone Aug 13, 2026
@bbovenzi bbovenzi added the backport-to-v3-3-test Backport to v3-3-test label Aug 13, 2026
@bbovenzi

Copy link
Copy Markdown
Contributor

Ci failures appear unrelated.

@bbovenzi
bbovenzi merged commit 28f00cc into apache:main Aug 13, 2026
86 of 87 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-3-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 28f00cc v3-3-test

This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

dabla pushed a commit to dabla/airflow that referenced this pull request Aug 14, 2026
* Make copied task log text match the on-screen format

Users expect copying logs to yield exactly what the screen shows.
The clipboard rebuild for rows the virtualizer unmounted previously
emitted the raw download format, so one copy could mix two timestamp
formats and drop the group expand marker. The group marker now also
follows the expand state (collapsed / expanded) in both the DOM and
the rebuilt text. Follow-up to review feedback on apache#71156; the log
download keeps raw source timestamps.

* Remove unnecessary comment

* UI: Keep copied log timestamps aligned with the screen

Timestamp formatting belongs at the selection reconstruction boundary so downloads retain source timestamps and log parsing stays independent of UI timezone state.

* UI: Preserve existing task log download formatting

The clipboard fix should not alter shared text rendering because downloaded logs use the same path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants