Skip to content

Fix #62414: Remove spurious blank lines in filtered task log download#64235

Merged
bbovenzi merged 4 commits into
apache:mainfrom
bennyc0de:main
Apr 2, 2026
Merged

Fix #62414: Remove spurious blank lines in filtered task log download#64235
bbovenzi merged 4 commits into
apache:mainfrom
bennyc0de:main

Conversation

@bennyc0de
Copy link
Copy Markdown
Contributor

@bennyc0de bennyc0de commented Mar 25, 2026

Problem

When a log level or source filter was active in the Task Instance Logs view, downloading the logs produced an empty or nearly-empty file.

The root cause: renderStructuredLog returns an empty string ("") for each log line that doesn't match the active filter. The getLogString function in Logs.tsx was joining all parsed lines with "\n" — including those empty strings. This meant that if filtered-out lines appeared at the start (or throughout) the log, the downloaded file would be filled with blank lines, or appear empty when all lines were filtered out.

Solution

Filter out empty strings before joining:

  • const getLogString = () => getParsedLogs().join("\n");
  • const getLogString = () => getParsedLogs().filter((line) => line !== "").join("\n");
    This ensures the downloaded file contains only lines that passed the active filter, with no spurious blank lines. A new test file logDownloadContent.test.ts covers the key cases: all lines filtered out, no leading newlines when early lines are excluded, and correct inclusion of lines that match the filter.
    Closes: Logs downloaded as empty file when filtering by log level #62414

BEFORE:
image

AFTER:
image


Was generative AI tooling used to co-author this PR?
  • Yes

Generated-by: [Claude Sonnet 4.6] following the guidelines


@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Mar 25, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Mar 25, 2026
@bbovenzi
Copy link
Copy Markdown
Contributor

Can you please update the PR description with the problem and solution? Ideally with screenshots. Also, tag the relevant github issue if there is one

@bennyc0de
Copy link
Copy Markdown
Contributor Author

Can you please update the PR description with the problem and solution? Ideally with screenshots. Also, tag the relevant github issue if there is one

Hi, sorry about that I had accidentally commented out the body of the description. Now you have an explanation and some screenshots detailing the problem and fix.

bennyc0de and others added 2 commits March 30, 2026 22:17
…wnload

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.
Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
@bennyc0de
Copy link
Copy Markdown
Contributor Author

Hi @bbovenzi — the Helm, PROD image, and Kubernetes CI jobs are failing on this PR, but my changes are limited to Logs.tsx (a frontend TypeScript file). The failures don't reproduce locally and appear unrelated to the change. Could you re-trigger them, or let me know if there's something I'm missing?

@kaxil kaxil requested a review from Copilot April 2, 2026 00:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks

@pierrejeambrun pierrejeambrun added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label Apr 2, 2026
@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.1 milestone Apr 2, 2026
@bbovenzi bbovenzi merged commit 32ac564 into apache:main Apr 2, 2026
84 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Apr 2, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

github-actions Bot pushed a commit that referenced this pull request Apr 2, 2026
…log download (#64235)

* Fix #62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

Backport successfully created: v3-2-test

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-2-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Apr 2, 2026
… task log download (apache#64235)

* Fix apache#62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
bbovenzi pushed a commit that referenced this pull request Apr 6, 2026
…log download (#64235) (#64640)

* Fix #62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 8, 2026
…log download (#64235) (#64640)

* Fix #62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…log download (#64235) (#64640)

* Fix #62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…log download (#64235) (#64640)

* Fix #62414: Remove spurious blank lines in filtered task log download

When log level or source filters were applied, renderStructuredLog returned
empty strings for dropped lines. Joining those with newlines still
inserted blank lines, often at the start of the downloaded file.

* Fix prek formatting in Logs.tsx and logDownloadContent.test.ts

Reformats getLogString arrow function to stay within line length limit,
and fixes object key ordering (content before continuation_token) in
test fixtures to match Prettier's alphabetical sorting.
(cherry picked from commit 32ac564)

Co-authored-by: Bernardo Gunzburger Lopes <130933290+bennyc0de@users.noreply.github.com>
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-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logs downloaded as empty file when filtering by log level

4 participants