From 437e5f15194246c2eabbb114c5243910d087acfa Mon Sep 17 00:00:00 2001 From: Nick Marcel <17437302+nyannoying1337@users.noreply.github.com> Date: Fri, 11 Sep 2026 02:20:41 +0200 Subject: [PATCH] Report the board model on Windows, not just the vendor The Windows motherboard command selects Manufacturer only, so the value is a bare vendor - "ASUSTeK COMPUTER INC." on my machine. Linux already returns board_vendor + board_name, so this is Windows being the odd one out rather than a deliberate choice. That costs twice over. The host cycle's title and large_text are both the motherboard field, so the cycle shows a vendor name and nothing about the actual hardware. And it's the string get_component_id matches against, so only the vendor's own pattern can ever hit - the board-model patterns already in motherboards.json are unreachable on Windows. Include Product, matching the Linux shape. On my box: before: 'ASUSTeK COMPUTER INC.' after: 'ASUSTeK COMPUTER INC. PRIME B760-PLUS D4' and a TUF board now resolves to the TUF app id instead of the generic ASUS one. The vendor is still in the string, so anything that matched before still matches - there's a test for both directions. Not addressed here: the `host` field (BaseBoard Product on Windows) is collected every snapshot but no cycle in fetchcord_conf.yml references it, so it's a PowerShell call for nothing. Happy to either wire it up or drop it in a follow-up, whichever you'd prefer. --- fetch_cord/resources/fetchcord_cmds.yml | 7 +++- tests/test_more.py | 51 +++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/fetch_cord/resources/fetchcord_cmds.yml b/fetch_cord/resources/fetchcord_cmds.yml index 7066b1c..19408de 100644 --- a/fetch_cord/resources/fetchcord_cmds.yml +++ b/fetch_cord/resources/fetchcord_cmds.yml @@ -105,8 +105,13 @@ commands: Darwin: | sysctl -n hw.model motherboard: + # Manufacturer on its own is just a vendor ("ASUSTeK COMPUTER INC."), + # which is all the host cycle had to show and all the id table had to + # match on. Linux already reports board_vendor + board_name; do the + # same here. Product is dropped when empty so the value never gains a + # trailing space. Windows: | - Get-CimInstance -ClassName Win32_BaseBoard | Select-Object Manufacturer | ForEach-Object {$_.Manufacturer} + Get-CimInstance -ClassName Win32_BaseBoard | ForEach-Object { ($_.Manufacturer, $_.Product | Where-Object { $_ }) -join ' ' } Linux: &motherboard_sh | cat /sys/devices/virtual/dmi/id/board_vendor /sys/devices/virtual/dmi/id/board_name | xargs Darwin: | diff --git a/tests/test_more.py b/tests/test_more.py index 9b4f020..4df1acc 100644 --- a/tests/test_more.py +++ b/tests/test_more.py @@ -528,6 +528,57 @@ def test_fastfetch_provider_empty(self, mock_run: MagicMock) -> None: self.assertEqual(FastfetchProvider().fetch(), {}) +class TestBoardIdentification(unittest.TestCase): + """The Windows board string has to carry the model, not just the vendor.""" + + def test_windows_motherboard_command_reports_vendor_and_product(self) -> None: + from fetch_cord.config import Config + + windows = Config("fetchcord_cmds.yml")["commands"]["motherboard"]["Windows"] + + self.assertIn("Manufacturer", windows) + self.assertIn("Product", windows) + + def test_all_platforms_report_a_board_model(self) -> None: + """Linux already returned board_vendor + board_name; match it.""" + from fetch_cord.config import Config + + commands = Config("fetchcord_cmds.yml")["commands"]["motherboard"] + + self.assertIn("board_name", commands["Linux"]) + self.assertIn("Product", commands["Windows"]) + + @patch("builtins.print") + def test_board_model_can_reach_a_more_specific_id(self, _print: MagicMock) -> None: + """A vendor-only string can only ever match the vendor's own entry. + + With the board model present, boards that have their own Discord app + (TUF here) resolve to it instead of the generic vendor one. + """ + from fetch_cord.fetch import get_component_id, get_infos + + ids = get_infos("motherboards") + + vendor_only = get_component_id("asustek computer inc.", ids) + with_board = get_component_id("asustek computer inc. tuf gaming b550m", ids) + + self.assertNotEqual(vendor_only, with_board) + + @patch("builtins.print") + def test_vendor_still_matches_when_the_model_is_unknown( + self, _print: MagicMock + ) -> None: + """Adding the model must not cost us the vendor fallback.""" + from fetch_cord.fetch import get_component_id, get_infos + + ids = get_infos("motherboards") + + self.assertEqual( + get_component_id("asustek computer inc.", ids), + get_component_id("asustek computer inc. prime b760-plus d4", ids), + ) + + class TestInfoExtras(unittest.TestCase): def test_first_text_fallback(self) -> None: from fetch_cord.info import _first_text