Skip to content

fix: Sort interfaces before passing index. - #36

Open
mchromin wants to merge 1 commit into
mainfrom
idxsort
Open

fix: Sort interfaces before passing index.#36
mchromin wants to merge 1 commit into
mainfrom
idxsort

Conversation

@mchromin

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 19, 2025 14:19

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 fixes an issue where network interfaces weren't being sorted naturally before applying index-based selection, which could lead to incorrect interface selection when interface names don't sort lexicographically (e.g., "eth1", "eth9", "eth10").

Key Changes:

  • Added a natural_key function to properly sort interface names using natural sorting (treating numeric portions as integers)
  • Updated _filter_interfaces_info to sort interfaces before applying index-based selection
  • Added comprehensive test coverage for the natural sorting functionality

Reviewed Changes

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

File Description
mfd_network_adapter/network_adapter_owner/base.py Introduced natural_key function and integrated natural sorting into interface filtering logic
tests/unit/test_mfd_network_adapter/test_network_adapter_owner/test_network_owner_base.py Added tests verifying natural sorting behavior and index-based filtering with non-lexicographic interface names

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

Comment thread mfd_network_adapter/network_adapter_owner/base.py Outdated
@mfd-intel-bot

Copy link
Copy Markdown
Contributor

We don't publish DEVs .whl.
To build .whl, run 'pip install git+https://intel/mfd-network-adapter@idxsort'

Signed-off-by: Mateusz Chrominski <mateusz.chrominski@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.

3 participants