From 730739a5c067882628a7fb2aab1fea9eb79c39a0 Mon Sep 17 00:00:00 2001 From: Wanjohi Date: Wed, 2 Sep 2026 16:29:03 +0300 Subject: [PATCH] fix(nesdoctor): fall back to the SoC name on Apple Silicon, and print raw probes The macOS arm added in the previous commit did not change anything -- the runner still reported `gpu=unknown`. Checked rather than assumed, which is the only reason it is known. Two possible causes and no way to choose between them from here: either the `system_profiler SPDisplaysDataType` parsing is wrong, or that machine is a headless virtual Mac with no display adapter to enumerate at all, in which case `unknown` was the correct answer and there is nothing to fix. The second is likely and the first is not ruled out. So, rather than guessing again: on an arm64 Mac the GPU *is* the SoC, so the chip name is a true and useful answer even with no display attached. `sysctl -n machdep.cpu.brand_string` works headless and yields "Apple M1 (integrated)". Intel Macs get no fallback, because there the GPU may be integrated or discrete and a guess would be wrong rather than coarse. And the CI step now dumps the **raw** output of each platform's probes -- `system_profiler`, `Get-CimInstance Win32_VideoController`, `Get-PSDrive`, `df -Pk`, `/sys/class/drm` -- into its own log group. A field that comes back empty can then be told apart from a parser that is wrong, which is exactly the distinction that cost this round trip. All of it is `|| true`: the step exists for looking, and a probe that misbehaves on a runner must never fail a release. --- .github/workflows/release-nesdoctor.yml | 23 +++++++++++++++++++++++ apps/nesdoctor/src/sys.rs | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/.github/workflows/release-nesdoctor.yml b/.github/workflows/release-nesdoctor.yml index 9bb12c4f..f1c54ca6 100644 --- a/.github/workflows/release-nesdoctor.yml +++ b/.github/workflows/release-nesdoctor.yml @@ -130,6 +130,29 @@ jobs: echo "::group::${{ matrix.target }} — JSON" cat "$RUNNER_TEMP/probe.json" 2>/dev/null || echo "(no json written)" echo "::endgroup::" + # The raw output of the platform probes, so a field that comes back + # empty can be told apart from a parser that is wrong. `gpu=unknown` + # on the macOS runner could be either, and guessing which cost a + # round trip. + echo "::group::${{ matrix.target }} — raw platform probes" + case "${{ runner.os }}" in + macOS) + system_profiler SPDisplaysDataType 2>&1 | head -40 || true + sysctl -n machdep.cpu.brand_string 2>&1 || true + df -Pk 2>&1 | head -20 || true + ;; + Windows) + powershell -NoProfile -Command \ + "Get-CimInstance Win32_VideoController | Format-List Name,AdapterCompatibility,AdapterRAM" 2>&1 | head -30 || true + powershell -NoProfile -Command \ + "Get-PSDrive -PSProvider FileSystem | Format-Table Name,Free,Used" 2>&1 | head -20 || true + ;; + Linux) + df -Pk 2>&1 | head -20 || true + ls -l /sys/class/drm/ 2>&1 | head -20 || true + ;; + esac + echo "::endgroup::" - name: Package shell: bash diff --git a/apps/nesdoctor/src/sys.rs b/apps/nesdoctor/src/sys.rs index c87800aa..ccdf9082 100644 --- a/apps/nesdoctor/src/sys.rs +++ b/apps/nesdoctor/src/sys.rs @@ -293,6 +293,27 @@ fn gpus() -> Vec { }); } } + // Fallback for Apple Silicon, where the GPU *is* the SoC. + // + // The CI runner is a headless virtual Mac and still reported + // `gpu=unknown` after the parser above was added, which means either + // the parser is wrong or that machine genuinely has no display adapter + // to enumerate. Both are plausible and the second is likely, so rather + // than guess: on an arm64 Mac the integrated GPU is part of the chip, + // so the chip name is a true and useful answer even with no display + // attached. + if gpus.is_empty() && cfg!(target_arch = "aarch64") { + if let Some(soc) = sh("sysctl", &["-n", "machdep.cpu.brand_string"]) { + let soc = soc.trim(); + if !soc.is_empty() { + gpus.push(Gpu { + name: format!("{soc} (integrated)"), + vendor: Some("Apple".into()), + render_node: None, + }); + } + } + } return gpus; } #[cfg(not(any(target_os = "linux", windows, target_os = "macos")))]