feat(host): populate OS name on macOS via sw_vers #134
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/macos-osinfo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Follow-up to VA-133. That change added macOS backends for
host::sysinfoandhost::cpuinfo, so the agent Overview now shows kernel, CPU, memory, uptime, and load on a Mac. One field stayed blank: OS. The OverviewosNameis derived fromhost::osinfo(pretty_name/name), andosinfostill returned a default snapshot on macOS, soosNamewas null.This adds a macOS
osinfobackend.How
snapshot()gains a macOS arm that reads product name/version/build fromsw_versand the per-machineIOPlatformUUIDfromioreg -rd1 -c IOPlatformExpertDevice(matching the identifier the C agent reports). The raw-to-OsInfoshaping is a pureosinfo_from_macos(), and theIOPlatformUUIDline extraction is a pureparse_ioplatform_uuid(); both are unit-tested off-macOS.pretty_name(which feedsosName) is composed as"<name> <version> (<build>)", dropping missing parts, and falls back to a literal"macOS"whensw_versyields nothing, so the OS field is never blank on a Mac.Testing
Pure helpers gated
cfg(any(target_os = "macos", test)), so they compile and run underteston Linux. 11host::osinfolib tests pass; clippy--deny warningsand fmt clean on the Linux box. Thesw_vers/ioregprocess shells are macOS-only and need a native build to confirm live values; validated end to end on an Intel Mac against the dev stack alongside the rest of the Overview (kernel/CPU/memory/uptime/load already confirmed from VA-133).