Skip to content

fix: update get_messages_additional method to correctly filter number…#8

Open
adrianlasota wants to merge 1 commit into
mainfrom
filtering_issue
Open

fix: update get_messages_additional method to correctly filter number…#8
adrianlasota wants to merge 1 commit into
mainfrom
filtering_issue

Conversation

@adrianlasota

Copy link
Copy Markdown
Contributor

This pull request refactors the get_messages_additional method in mfd_dmesg/base.py to improve type annotations, command construction logic, and test coverage. The changes enhance code clarity, ensure correct command execution, and add a dedicated test for command construction.

Type annotation improvements:

  • Updated type hints for service_name, expected_return_codes, and additional_greps parameters in get_messages_additional to use more precise and modern Python type annotations, improving code readability and static analysis.

Command construction and logic changes:

  • Changed the construction of the shell command in get_messages_additional so that tail -n {lines} is applied before filtering with grep, ensuring the correct subset of log lines is processed. The redundant final tail was removed. [1] [2]

Testing enhancements:

  • Added a new test test_get_messages_additional_command_check in tests/unit/test_mfd_dmesg/test_base.py to verify that the correct shell command is executed when filtering by service name and line count, increasing confidence in the command construction logic.

@mfd-intel-bot

Copy link
Copy Markdown

We don't publish DEVs .whl.
To build .whl, run 'pip install git+https://github.com/intel/mfd-dmesg@filtering_issue'

Comment thread .github/workflows/check_code_standard.yml Fixed
Comment thread .github/workflows/check_pr_format.yml Fixed
Comment thread .github/workflows/dependency_review.yml Fixed
Comment thread .github/workflows/main.yml Fixed
Comment thread .github/workflows/pull_request.yml Fixed
Comment thread .github/workflows/run_tests.yml Fixed
@intel intel deleted a comment from mfd-intel-bot May 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 Dmesg.get_messages_additional() to adjust how the dmesg shell pipeline is constructed (moving tail earlier), modernizes type annotations, and adds a unit test to verify the constructed command when service_name and lines are provided.

Changes:

  • Refactors get_messages_additional() command construction and tightens its type annotations.
  • Adds a unit test asserting the exact command issued for service_name + lines.
  • Minor formatting cleanup in mfd_dmesg/constants.py.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

File Description
mfd_dmesg/base.py Refactors get_messages_additional() typing and changes pipeline ordering to apply tail before greps.
tests/unit/test_mfd_dmesg/test_base.py Adds a unit test to validate the executed shell command for get_messages_additional().
mfd_dmesg/constants.py Adjusts import formatting (whitespace).

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

Comment thread mfd_dmesg/base.py
Comment thread mfd_dmesg/base.py
Comment thread mfd_dmesg/base.py
Comment thread tests/unit/test_mfd_dmesg/test_base.py
@adrianlasota adrianlasota force-pushed the filtering_issue branch 4 times, most recently from dd6bb90 to 107ccd5 Compare June 8, 2026 11:36
… of lines

Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
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.

4 participants