You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Andrushika (via GitHub)" <gi...@apache.org> on 2026/08/07 06:35:49 UTC

[PR] Make copied task log text match the on-screen format [airflow]

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

   ## 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, so the small rotate animation is gone.
   
   
   https://github.com/user-attachments/assets/42058be2-ecad-48e5-90aa-a90f2bc1eaf2
   
   
   related: #71156
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5)
   
   Generated-by: Claude Code (Fable 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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763585513


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -143,7 +149,7 @@ export const TaskLogContent = ({
         getRowText: (index) => {
           const entry = visibleItems[index]?.entry;
 
-          return entry ? getEntryText(entry) : "";
+          return entry ? getEntryText(entry, expandedGroups) : "";

Review Comment:
   You are right, in the latest code, I simply edit timestamp here instead of the timezone props. Thanks for pointing that out!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3760642811


##########
airflow-core/src/airflow/ui/src/components/renderStructuredLog.tsx:
##########
@@ -216,9 +218,9 @@ const renderStructuredLogImpl = ({
     return "";
   }
 
-  if (Boolean(timestamp) && showTimestamp) {
+  if (timestamp !== undefined && Boolean(timestamp) && showTimestamp) {
     if (renderingMode === "text") {
-      elements.push(`[${timestamp}] `);
+      elements.push(`[${formatTimestamp?.(timestamp) ?? timestamp}] `);

Review Comment:
   This can become `"" ?? timestamp` and won't always fallkback onto the raw timestamp. Let's 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3749791053


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -143,7 +149,7 @@ export const TaskLogContent = ({
         getRowText: (index) => {
           const entry = visibleItems[index]?.entry;
 
-          return entry ? getEntryText(entry) : "";
+          return entry ? getEntryText(entry, expandedGroups) : "";

Review Comment:
   I think we can edit the timestamp here and not have to drill down the timezone props so much.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763585513


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -143,7 +149,7 @@ export const TaskLogContent = ({
         getRowText: (index) => {
           const entry = visibleItems[index]?.entry;
 
-          return entry ? getEntryText(entry) : "";
+          return entry ? getEntryText(entry, expandedGroups) : "";

Review Comment:
   You are right, in the latest code, I simply edit timestamp here instead of using timezone props across `useLogs` and `parseLogs`. Thanks for pointing that out!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763585513


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -143,7 +149,7 @@ export const TaskLogContent = ({
         getRowText: (index) => {
           const entry = visibleItems[index]?.entry;
 
-          return entry ? getEntryText(entry) : "";
+          return entry ? getEntryText(entry, expandedGroups) : "";

Review Comment:
   You are right, in the latest code, I only process the raw timestamp here instead of props through `useLogs` and `parseLogs`. Thanks for pointing that out!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763588645


##########
airflow-core/src/airflow/ui/src/components/renderStructuredLog.tsx:
##########
@@ -216,9 +218,9 @@ const renderStructuredLogImpl = ({
     return "";
   }
 
-  if (Boolean(timestamp) && showTimestamp) {
+  if (timestamp !== undefined && Boolean(timestamp) && showTimestamp) {
     if (renderingMode === "text") {
-      elements.push(`[${timestamp}] `);
+      elements.push(`[${formatTimestamp?.(timestamp) ?? timestamp}] `);

Review Comment:
   Since the timezone props path has been removed and the original code no longer exists, no further changes are needed here.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #71270:
URL: https://github.com/apache/airflow/pull/71270#issuecomment-5285286400

   Ci failures appear unrelated.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763585513


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -143,7 +149,7 @@ export const TaskLogContent = ({
         getRowText: (index) => {
           const entry = visibleItems[index]?.entry;
 
-          return entry ? getEntryText(entry) : "";
+          return entry ? getEntryText(entry, expandedGroups) : "";

Review Comment:
   You are right, in the latest code, I only process the raw timestamp here instead of timezone props through `useLogs` and `parseLogs`. Thanks for pointing that out!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71270:
URL: https://github.com/apache/airflow/pull/71270#discussion_r3763588645


##########
airflow-core/src/airflow/ui/src/components/renderStructuredLog.tsx:
##########
@@ -216,9 +218,9 @@ const renderStructuredLogImpl = ({
     return "";
   }
 
-  if (Boolean(timestamp) && showTimestamp) {
+  if (timestamp !== undefined && Boolean(timestamp) && showTimestamp) {
     if (renderingMode === "text") {
-      elements.push(`[${timestamp}] `);
+      elements.push(`[${formatTimestamp?.(timestamp) ?? timestamp}] `);

Review Comment:
   Since this props path is removed, I think no further changes are needed here.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on PR #71270:
URL: https://github.com/apache/airflow/pull/71270#issuecomment-5213454444

   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.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #71270:
URL: https://github.com/apache/airflow/pull/71270#issuecomment-5285303561

   ### Backport failed to create: v3-3-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/31734935612'> Run details </a>
   
   Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   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](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-3-test</td>
           <td><a href="https://github.com/apache/airflow/commit/28f00cc58301806a43ad5cf3ad63f6b466548645"><img src='https://img.shields.io/badge/Commit-28f00cc-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   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:
   
   ```bash
   cherry_picker --continue
   ```
   
   If you don't have cherry-picker installed, see the [installation guide](https://github.com/apache/airflow/blob/main/dev/README.md#how-to-backport-pr-with-cherry-picker-cli).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Make copied task log text match the on-screen format [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #71270:
URL: https://github.com/apache/airflow/pull/71270


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org