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/05 07:25:47 UTC
[PR] Fix copying task logs dropping rows that scrolled out of view [airflow]
Andrushika opened a new pull request, #71156:
URL: https://github.com/apache/airflow/pull/71156
## Why
Native copy only serializes mounted DOM. When a selection spans virtualized task log rows, rows that scrolled out of view are missing.
## What
Rebuild missing selected rows from parsed log data with the same plain-text rendering as log download. Keep native copy for single-row, fully mounted, and multi-range selections.
stacked on: #71148
related: #68846
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Codex (GPT-5)
Generated-by: Codex (GPT-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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3723259376
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
We are mixing selecting by renderingMode. In order for that to work best, we will need to harmonize the two modes more such as the timestamp format and any additional elements we add like group header ▶
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3731657810
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
I think a user is expecting their copy to be what they see on the screen. So yes the timestamp and the arrow marker.
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #71156:
URL: https://github.com/apache/airflow/pull/71156
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3723261731
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
This can be done in a separate 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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on PR #71156:
URL: https://github.com/apache/airflow/pull/71156#issuecomment-5206465101
Rebased. Thanks for reviewing!
I guess we can merge this first and I'll create follow up PR for unifying copy format.
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3727930954
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
Make sense. I'll open a follow-up PR to handle this case.
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3728182212
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
One point I want to check: do we want the rebuilt text to match what the screen shows? Currently the copied log row can come from either JSX text or plain text, for example (the main difference is the timestamp):
JSX:
```
[2026-08-05 15:59:48] INFO - line 0001 | lorem ipsum dolor sit amet consectetur adipiscing elit | payload=1
```
plain text:
```
[2026-08-05T07:59:48.737536Z] INFO - line 0001 | lorem ipsum dolor sit amet consectetur adipiscing elit | payload=1
```
So I think we need to choose one of them for copy formatting. In this PR, when the user selects partial first and last rows, that text can only come from the DOM, so the rebuilt middle rows need to move toward the screen format, not the other way around.
BTW, I prefer to keep the ▶ marker in the copied group headers for readability. wdyt?
--
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] Fix copying task logs dropping rows that scrolled out of view [airflow]
Posted by "Andrushika (via GitHub)" <gi...@apache.org>.
Andrushika commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3728182212
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" | "line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
One point I want to check: do we want the rebuilt text to match what the screen shows? Currently the copied log row can come from either JSX text or plain text, for example (the main difference is the timestamp):
JSX:
```
[2026-08-05 15:59:48] INFO - line 0001 | lorem ipsum dolor sit amet consectetur adipiscing elit | payload=1
```
plain text:
```
[2026-08-05T07:59:48.737536Z] INFO - line 0001 | lorem ipsum dolor sit amet consectetur adipiscing elit | payload=1
```
So I think we need to choose one of them for copy formatting. In this PR, when the user selects partial first and last rows, that text can only come from the DOM, so the rebuilt middle rows need to move toward the screen format, not the other way around.
In the follow-up PR, I plan to let the text pipeline take an optional timestamp formatter (download keeps the raw ISO timestamps), and keep the ▶ marker in the copied group headers for readability. wdyt?
--
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