Skip to content

Report the board model on Windows, not just the vendor - #243

Merged
BlivionIaG merged 2 commits into
fetchcord:masterfrom
nyannoying1337:fix/windows-board-name
Sep 11, 2026
Merged

BlivionIaG merged 2 commits into
fetchcord:masterfrom
nyannoying1337:fix/windows-board-name

Conversation

@nyannoying1337

Copy link
Copy Markdown
Contributor

From the Discord list - the "prefer board name when system product is vendor-only" item, adapted to how upstream actually collects this.

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 looks like Windows being the odd one out rather than a deliberate choice.

That costs twice over:

  • The host cycle's top_line and app_id are both motherboard, so the cycle's title and large_text are a vendor name and say nothing about the actual hardware.
  • It's also the string get_component_id matches against, so only the vendor's own pattern can ever hit. The board-model patterns already sitting in motherboards.json ((?i)tuf, (?i)Z370XP SLI, (?i)H310M A 2.0, ...) are unreachable on Windows.

Including Product matches the Linux shape:

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 are tests for both directions. Given how much of the tracker is "Unknown motherboard", making more of the existing table reachable seemed worth it on its own.

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.

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.
@nyannoying1337 nyannoying1337 mentioned this pull request Sep 11, 2026
Keeps both test classes: master's warn-once coverage and this branch's
board identification tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WB6HG4WLukGEjhcq8FZJ7A
@BlivionIaG
BlivionIaG merged commit 5b8a5b8 into fetchcord:master Sep 11, 2026
12 checks passed
cursor Bot pushed a commit to nyannoying1337/FetchCord that referenced this pull request Sep 11, 2026
Align with fetchcord#243 so the host cycle still gets a board-model string for
id matching when NativeProvider wins over the PowerShell command.

Co-authored-by: BlivionIaG <BlivionIaG@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Sep 11, 2026
* Read Windows system info natively instead of via PowerShell

Follow-up to #245, where the stated goal was to use fastfetch where native
is not implemented yet and keep it as the fallback. This starts that on
Windows, and orders the providers accordingly.

On Windows the CommandProvider shells out once per field. Each of those is
a PowerShell start-up, and the fan-out across the command table dominates
the time to first presence. Reading the same values from the registry costs
a few milliseconds and needs nothing installed.

Adds fetchers under fetch_cord/native/Windows/ for os, kernel, cpu,
motherboard, host and mem, alongside the existing packages one. Each returns
exactly what its PowerShell command returned, so the values stay
interchangeable:

  os           Microsoft Windows 11 Pro    (Win32_OperatingSystem.Caption)
  kernel       10.0.26100                  (Win32_OperatingSystem.Version)
  cpu          Intel(R) Core(TM) i7-...    (Win32_Processor.Name)
  motherboard  ASUSTeK COMPUTER INC.       (Win32_BaseBoard.Manufacturer)
  host         PRIME B760-PLUS D4          (Win32_BaseBoard.Product)
  mem          12.40 GB / 31.92 GB         (same format as the command)

Providers are now ordered native, fastfetch, commands on every platform.
That is safe because a native fetcher returns None when it is not confident
rather than guessing - an unreadable registry key, or firmware boilerplate
like "To Be Filled By O.E.M." - so Fetch.snapshot's existing gap-filling
hands the field straight to fastfetch. Native coverage can then grow one
field at a time without any platform losing detail it has today. Nothing
changes on Linux or macOS, where no native fetchers exist yet.

Two details worth knowing:

- The registry's ProductName still reads "Windows 10 Pro" on Windows 11, so
  the build number decides the release and the name is corrected to match
  what WMI reports.
- Firmware placeholders are reported as absent rather than shown.

Also fixes native fetch() stringifying None into the literal "None", which
was harmless while packages was the only fetcher.

Tests fake the registry at the fetcher boundary, so all of them run on a
non-Windows CI runner. One asserts the native path makes no subprocess
calls, keeping "this adds no dependencies" verifiable rather than a claim.

* Make the registry fake a real context manager

fake_registry was annotated -> MagicMock but returned patch(...), which is
a _patch object. Only used as a context manager, so make it one with
@contextmanager and type it Iterator[MagicMock].

Caught by CI's "mypy fetch_cord tests" - the suite is type checked too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WB6HG4WLukGEjhcq8FZJ7A

* Join board vendor and product in native motherboard fetch

Align with #243 so the host cycle still gets a board-model string for
id matching when NativeProvider wins over the PowerShell command.

Co-authored-by: BlivionIaG <BlivionIaG@users.noreply.github.com>

---------

Co-authored-by: nyannoying1337 <nikkumaruseru@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BlivionIaG <BlivionIaG@users.noreply.github.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