Skip to content

fix(logfiles): report search failures instead of losing findings - #3585

Merged
mkoura merged 1 commit into
masterfrom
logfiles_search_error_reporting
Aug 3, 2026
Merged

fix(logfiles): report search failures instead of losing findings#3585
mkoura merged 1 commit into
masterfrom
logfiles_search_error_reporting

Conversation

@mkoura

@mkoura mkoura commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

When the search retry on log rotation was exhausted, the raised FileNotFoundError aborted the whole log check. Findings that were already collected for other regexes, log files or searches were lost, expect_errors raised the raw exception instead of the assembled report, and the exception in the cluster manager teardown skipped the test stop cleanup.

Report the failure as an error entry instead - per log file in the expected messages check and in the cluster logs search, and per search in the framework and supervisord log searches. The failed search is still reported loudly (as a check failure), it just cannot discard the other findings anymore.

find_msgs_in_logs deliberately keeps propagating the failure - the caller needs the matching lines and an empty result would be misread as "no matches".

Also modernize the expect_errors / expect_messages return annotations to tp.Generator.

When the search retry on log rotation was exhausted, the raised
FileNotFoundError aborted the whole log check. Findings that were
already collected for other regexes, log files or searches were lost,
expect_errors raised the raw exception instead of the assembled report,
and the exception in the cluster manager teardown skipped the test stop
cleanup.

Report the failure as an error entry instead - per log file in the
expected messages check and in the cluster logs search, and per search
in the framework and supervisord log searches. The failed search is
still reported loudly (as a check failure), it just cannot discard the
other findings anymore.

find_msgs_in_logs deliberately keeps propagating the failure - the
caller needs the matching lines and an empty result would be misread
as "no matches".

Also modernize the expect_errors / expect_messages return annotations
to tp.Generator.
@mkoura
mkoura requested a review from saratomaz as a code owner August 3, 2026 16:41
@mkoura
mkoura requested review from Copilot and removed request for saratomaz August 3, 2026 16:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the log-search utilities to report repeated log-rotation search failures as aggregated error entries (instead of raising and aborting the entire log check), ensuring previously collected findings aren’t lost. It also adds regression tests around this behavior and updates related documentation/type annotations.

Changes:

  • Catch exhausted rotation-retry FileNotFoundError in error-aggregating log searches and convert it into error entries (per log file / per search as appropriate).
  • Add framework tests that force permanent “rotated during search” behavior and assert failures are reported, not raised.
  • Update find_msgs_in_logs docstring and modernize expect_errors / expect_messages return type annotations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
framework_tests/test_logfiles.py Adds fixtures and tests asserting search failures are reported as error entries rather than aborting log checks.
cardano_node_tests/utils/logfiles.py Implements failure-to-error aggregation for several log searches; updates docstrings and context-manager type annotations.
Suppressed comments (1)

cardano_node_tests/utils/logfiles.py:1028

  • Same typing issue as expect_errors: tp.Generator[None] is invalid at runtime in this module (no postponed evaluation of annotations), so importing logfiles.py will fail. Use the full Generator[None, None, None] parameters (or Iterator[None]).
def expect_messages(regex_pairs: list[tuple[str, str]]) -> tp.Generator[None]:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cardano_node_tests/utils/logfiles.py
@mkoura
mkoura merged commit 198df39 into master Aug 3, 2026
4 checks passed
@mkoura
mkoura deleted the logfiles_search_error_reporting branch August 3, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants