fix(logfiles): apply ignore rules to first search of a log file - #3580
Merged
Conversation
The ignore rules expiry for a log file without a recorded search state was evaluated against the current time instead of the recorded search timestamp. A rule with an expire time in the past was then not applied to the file, even though the whole unsearched file history may contain the ignored errors, and previously ignored errors surfaced as false failures. This contradicted the documented add_ignore_rule contract (a rule expires only when there are no yet to be searched log messages created before the expire time). Use the recorded timestamp as is - a file that was not searched yet has timestamp 0.0, so no rule is expired for it. Also fix a comment typo.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes ignore-rule expiry behavior during the first search of a log file in utils.logfiles, ensuring rules are evaluated against the recorded search timestamp (including 0.0 for “never searched yet”) rather than the current time. This aligns the implementation with the documented add_ignore_rule contract and prevents previously-ignored historical errors from resurfacing as false failures.
Changes:
- Fix ignore-rule selection in
search_cluster_logs()to use the recorded search timestamp as-is (so first search uses0.0and doesn’t prematurely expire rules). - Add a regression test covering “first search applies ignore rules even if skip_after is in the past; subsequent searches expire the rule”.
- Fix a small comment typo in
_search_log_lines’s signature comment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
framework_tests/test_logfiles.py |
Adds a regression test to validate ignore-rule behavior on first vs. subsequent log searches. |
cardano_node_tests/utils/logfiles.py |
Uses the recorded search timestamp (including 0.0) when applying ignore-rule expiry; fixes a comment typo. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ignore rules expiry for a log file without a recorded search state was evaluated against the current time instead of the recorded search timestamp. A rule with an expire time in the past was then not applied to the file, even though the whole unsearched file history may contain the ignored errors, and previously ignored errors surfaced as false failures. This contradicted the documented add_ignore_rule contract (a rule expires only when there are no yet to be searched log messages created before the expire time).
Use the recorded timestamp as is - a file that was not searched yet has timestamp 0.0, so no rule is expired for it.
Also fix a comment typo.