dandanseo123 commented on code in PR #65039:
URL: https://github.com/apache/airflow/pull/65039#discussion_r3073826148


##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -75,6 +75,20 @@ const parseLogs = ({
   const logLink = taskInstance ? 
`${getTaskInstanceLink(taskInstance)}?try_number=${tryNumber}` : "";
 
   try {
+    let lineNumber = 0;
+    const lineNumbers = data.map((datum, dataIndex) => {
+      const text = typeof datum === "string" ? datum : datum.event;
+
+      if (text.includes("::group::") || text.includes("::endgroup::")) {
+        return dataIndex;

Review Comment:
   done



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.test.tsx:
##########
@@ -133,4 +133,38 @@ describe("Task log grouping", () => {
 
     await waitFor(() => expect(screen.queryByText(/Marking task as 
SUCCESS/iu)).not.toBeVisible());
   }, 10_000);
+
+  it("Has sequential line numbers with no gaps or duplicates", async () => {
+    render(
+      <AppWrapper 
initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/generate"]}
 />,
+    );
+
+    await waitForLogs();
+
+    // Expand all groups so their content lines are in the DOM
+    const summaryPre = screen.getByTestId("summary-Pre task execution logs");
+
+    fireEvent.click(summaryPre);
+    await waitFor(() => expect(screen.getByText(/starting attempt 1 of 
3/iu)).toBeVisible());
+
+    const summaryPost = screen.getByTestId("summary-Post task execution logs");
+
+    fireEvent.click(summaryPost);
+    await waitFor(() => expect(screen.queryByText(/Marking task as 
SUCCESS/iu)).toBeVisible());
+
+    // Collect all rendered line number links
+    const lineNumbers = 
[...document.querySelectorAll<HTMLAnchorElement>("a[id]")]

Review Comment:
   done



-- 
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