Repository navigation
build(deps): bump sysinfo to 0.40.1 and handle its fallible constructors - #1035
jussielo-amd wants to merge 2 commits into
Conversation
sysinfo 0.40 made `System::new_with_specifics` and `Disks::new_with_refreshed_list_specifics` return `Result`, removed `Disks::list()` and renamed `Cpu::cpu_usage` to `Cpu::usage`, so the bump proposed by Dependabot cannot compile on its own. A failed disk listing now yields no mounts, which `mount_for_path` already reports as unknown free space and never treats as a reason to refuse an operation. A host collector whose `System` failed to initialise logs one warning and reports empty metrics on every tick instead of panicking. MANIFEST.md and THIRD_PARTY_NOTICES.txt are regenerated for 0.40.1. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the sysinfo dependency update and API adaptations.
No open issues 🎉
What changed in this PR
Updates sysinfo to 0.40.1 and adapts disk-space checks and dashboard host metrics to its changed APIs, replacing the version-only bump in #1024.
Changes:
- Updates the dependency, lockfile, and generated dependency records.
- Handles constructor failures by reporting unknown disk space or empty host metrics, with regression tests for both paths.
- Migrates disk iteration and CPU usage calls, and documents the host collector’s failure behavior.
| File | Description |
|---|---|
THIRD_PARTY_NOTICES.txt |
Updates the sysinfo version in license notices. |
MANIFEST.md |
Records sysinfo 0.40.1 in the dependency inventory. |
docs/architecture.md |
Documents host metrics initialization failure behavior. |
crates/rocm-dash-collectors/src/host.rs |
Handles failed initialization, updates CPU usage calls, and adds regression coverage. |
crates/rocm-core/src/disk_space.rs |
Handles failed disk enumeration, updates iteration, and tests unknown-space behavior. |
Cargo.toml |
Updates sysinfo to 0.40 while retaining linux-tmpfs. |
Cargo.lock |
Locks sysinfo to 0.40.1 with its updated checksum. |
Review effort: Balanced
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
sysinfo 0.40 enables a new `gpu` feature by default, and that code calls `statx` directly. The release and PR Linux binaries are built in a manylinux2014 container (glibc 2.17), which has no `statx`, so linking `rocmd` failed with an undefined symbol. Only CPU, memory and disk figures are used, so enable just `system` and `disk` (plus `linux-tmpfs`). The compiled sysinfo library has no `statx` reference with these features and one with the defaults. MANIFEST.md and THIRD_PARTY_NOTICES.txt drop the macOS-only crates that left the dependency graph. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
nowycondro
left a comment
There was a problem hiding this comment.
🤖 Automated review · review-code · head 78acd022
This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.
Review — no blocking findings
Full review of the whole change (small enough for a single pass: 7 files, +77/-86).
Replaces the version-only #1024 dependabot bump with the sysinfo 0.40.1 upgrade plus the source changes, narrowed feature set, and regenerated manifests it requires. No ticket named.
Blocking
None
Non-blocking
None
Decisions for the author
mounts_of(disk_space.rs) drops a failed disk enumeration silently;HostCollector::from_system(host.rs) logs a one-timetracing::warn!for the equivalent failure — non-blocking-improvement
Both correctly fail open to "unknown"/"empty", so neither is wrong, but the asymmetry means a host whereDisks::new_with_refreshed_list_specificsfails gets no diagnostic trail at all, only silent "unknown" space on every preflight check from then on.listed_mounts()is called per check rather than once at startup, so an unconditionaltracing::warn!there would be noisier than host.rs's single log — a debug-level log, or a "warn once" guard, would close the gap without reintroducing that noise. Worth confirming this was a deliberate call rather than an oversight.
Positive signals
Cargo.toml's newsysinfoentry documents why default features are off (0.40'sgpufeature callsstatx, unavailable under the manylinux2014 glibc 2.17 used for release/PR Linux binaries) directly next to the dependency line, so the next person touching this dependency doesn't rediscover the constraint the hard way.- Both new regression tests (
a_failed_disk_enumeration_reports_unknown_space_and_never_blocks,a_collector_whose_sysinfo_failed_to_initialise_reports_empty_metrics) drive the fallible-constructor path by injectingErrdirectly intomounts_of/HostCollector::from_system, which is the only way to exercise a path that cannot be induced on a real host — a clean way to get real coverage of an otherwise untestable branch.
Deployment notes
None — the dependency swap narrows sysinfo's default features (dropping gpu and its macOS-only Objective-C bridge crates: dispatch2, objc2, objc2-encode, objc2-foundation, objc2-open-directory, confirmed by the Cargo.lock/MANIFEST.md/THIRD_PARTY_NOTICES.txt diffs), and HostCollector::new() stays infallible for its two existing callers (crates/rocm-dash-tui/src/client.rs, crates/rocm-dash-daemon/src/runner.rs), so there is no API or behavior change visible to a normally-functioning host.
What this covered
Every changed file read in full against the true merge-base — git merge-base resolved to 831d5d6659665bd4199f111de5ee1f8effb3b27f (the branch's actual fork point, one commit before main gained #1025's unrelated syn bump; diffing against the PR's reported base sha f536619a would have pulled in that noise) — through the PR head 78acd0224b46b51f2076718193da7181608b8a21: Cargo.toml, Cargo.lock, MANIFEST.md, THIRD_PARTY_NOTICES.txt, crates/rocm-core/src/disk_space.rs, crates/rocm-dash-collectors/src/host.rs, docs/architecture.md. Also read: every call site of HostCollector::new() and of listed_mounts()/mounts_of() repo-wide, both files' git history (no prior relevant discussion), the SystemMetrics/Snapshot definitions backing the "empty metrics" claim, and the repo's AGENTS.md for applicable conventions (regression-test, docs-sync and architecture-doc rules — all satisfied here). Cross-checked the renamed/fallible-API claims (Cpu::cpu_usage→Cpu::usage, Disks::list removed in favor of Deref, fallible constructors, gpu joining default features) against the public sysinfo 0.40 changelog and migration notes, which corroborate them; the specific statx/glibc claim is a symbol-level check the PR describes doing itself and is indirectly corroborated by the green "Build Linux PR binaries" check.
Did not run: a separate fan-out (change was small enough for one pass covering both the code and the agent-instruction/history/prior-changes angles together); no cargo toolchain was available in this sandbox, so no local cargo test/clippy re-run — relied instead on the PR's own CI, which is green on every relevant check (clippy, build-and-test incl. ubuntu-26.04, windows-build-and-test, Test (affected crates), Build Linux PR binaries, Coverage (rocm-dash crates, ratcheted), Commit signatures + sign-off, Third-party notices current). At review time, E2E tests and E2E tests (ubuntu-26.04) were still QUEUED (not yet resolved either way); Regenerate manifests, Skill checks (skillscope) and Sphinx docs build (-W) were SKIPPED, which reads as expected path-filtering rather than a gap. Not reconciled against any discussion: the PR's only existing comment is an automated security-scan bot note reporting no findings, not human review feedback.
Not a human review. This is an automated code review; please verify findings independently before acting on them.
juhovainio
left a comment
There was a problem hiding this comment.
Looks good. I read the diff and found nothing blocking: the Cpu::usage rename and the Disks slice deref are correct, an unknown disk-space result never blocks an install, and both new failure paths have regression tests that assert the resulting state.
Three small non-blocking notes:
- The error from a failed
Diskslisting is dropped silently (inline comment). default-features = falsealso drops sysinfo's multithreaded CPU refresh (inline comment).- If sysinfo init fails, the host collector ticks empty metrics, so the dashboard shows zeros rather than "unavailable". The PR body already accepts this.
CI: everything is green except both E2E jobs, which failed in "Install native build deps" with an apt DNS failure (azure.archive.ubuntu.com). That is infrastructure, not code, and needs a rerun. This reflects a diff read plus the CI results above, not a local run.
| /// module uses. | ||
| fn listed_mounts() -> Vec<(PathBuf, u64)> { | ||
| let disks = sysinfo::Disks::new_with_refreshed_list_specifics( | ||
| mounts_of(sysinfo::Disks::new_with_refreshed_list_specifics( |
There was a problem hiding this comment.
Optional: the Err is dropped silently here. A tracing::debug! of the error would make a permanently "unknown" disk check diagnosable. Not blocking, since unknown never blocks an install.
| # Default features are off because 0.40's `gpu` feature calls `statx` directly, | ||
| # which glibc 2.17 (the manylinux2014 release build) does not provide, so the | ||
| # link fails. Only CPU, memory and disk figures are used. | ||
| sysinfo = { version = "0.40", default-features = false, features = ["system", "disk", "linux-tmpfs"] } |
There was a problem hiding this comment.
default-features = false also drops sysinfo's multithread (rayon) default, so CPU refresh becomes single-threaded. Fine for this use; just confirming it is intended.
juhovainio
left a comment
There was a problem hiding this comment.
🤖 Automated review · review-code · head 78acd0224b46b51f2076718193da7181608b8a21
Review — no blocking findings
Full review of the whole change (small enough for one worker plus independent fan-out passes: 7 files, +77/-86). Bumps sysinfo 0.39.6 → 0.40.1 and migrates rocm-core/rocm-dash-collectors to its now-fallible constructors and renamed APIs, replacing the version-only bump in #1024 that broke the build. No ticket named.
Posting as COMMENT, not an approval, for two reasons unrelated to code quality — see Deployment notes below: (1) this PR cannot currently merge cleanly (Cargo.lock conflicts with main), and (2) two self-hosted E2E CI jobs are red since the prior human approval. Neither looks like a defect in this change, but both deserve a maintainer's own look before merging.
Blocking
None.
Non-blocking
mounts_of's total-enumeration failure is dropped with no diagnostic, unlike the paired fix in the same PR —crates/rocm-core/src/disk_space.rs:242-245
TheErrarm returnsVec::new()silently.HostCollector::from_system(host.rs:30-33) logstracing::warn!for the analogousSystem::new_with_specificsfailure in this same change, butrocm-coredoesn't depend ontracing(checkedcrates/rocm-core/Cargo.toml) and already has its own precedent for this exact situation: a warn-onceeprintln!(rotation_failure_warning,crates/rocm-core/src/jsonl_store.rs:310-317). Harmless today — it correctly degrades toSpaceCheck::Unknown, which the module documents as "never block" — but a host where disk enumeration totally fails does so invisibly, indistinguishable from the expected "one mount unlisted" case.
Confidence 70 · architectural · Fix: a one-timeeprintln!in theErrarm, mirroringrotation_failure_warning.
Decisions for the author
- The
HostCollectorfailure-path test asserts 3 ofSystemMetrics's 10 fields —crates/rocm-dash-collectors/src/host.rs:95-97— non-blocking-improvement
Production code returns the wholeSystemMetrics::default()atomically, so there's no live gap, but a future edit building a partial struct could leave the other 7 fields wrong and this test would still pass.SystemMetricsdoesn't derivePartialEq, so a singleassert_eq!(m, SystemMetrics::default())isn't available as-is; author's call whether to add it for a stronger assertion. - Collapsing "total disk-enumeration failure" and "this one mount wasn't listed" into the same empty-list/
Unknownsignal — tradeoff
Both become an empty/short mount table today. Simple and consistent with the module's fail-open philosophy, but it merges two different failure classes — a persistent platform-level failure vs. the expected tmpfs/NFS gap — into one undistinguishable signal. Worth confirming that's deliberate.
Positive signals
- The fallback design (
Option<System>/mounts_of<E>generic over the error type) directly implements the fix a prior automated review suggested on the superseded #1024 (let Ok(disks) = ... else { return Vec::new() }), rather than inventing a new approach under time pressure. HostCollector::new()keeps its existing infallible public signature while absorbing the new fallibleSystem::new_with_specificsinternally — both real call sites (crates/rocm-dash-tui/src/client.rs:249,crates/rocm-dash-daemon/src/runner.rs:300) needed zero changes, confirmed by a repo-wide, ref-pinned search.- Being generic over the error type (
mounts_of<E>,from_system<E: Display>) lets both new regression tests inject a plain&stras a synthetic error instead of needing to reproduce a real platform failure — cheap, clean testability. Cargo.lock,MANIFEST.md, andTHIRD_PARTY_NOTICES.txtare mutually consistent for every removed macOS-only transitive dependency (dispatch2,objc2,objc2-encode,objc2-foundation,objc2-open-directory), cross-checked directly against the PR ref;objc2-core-foundation/objc2-io-kitare correctly retained sincedisk/systemstill need them.- The new
Cargo.tomlcomment explaining thegpufeature'sstatx/glibc 2.17 link failure is grounded in this repo's actual release pipeline (manylinux2014), not a guessed rationale, anddocs/architecture.md'shost.rsentry was updated in the same change.
Deployment notes
- This PR cannot currently merge cleanly. GitHub reports
mergeable_state: dirty;git merge-treeagainst currentmainconfirms a realCargo.lockconflict (both sides touch the samedispatch2/objc2*package-removal region) —mainhas absorbed unrelated dependency changes since this PR's merge-base. Needs a rebase and manifest/notices regeneration before it can land. - Two self-hosted E2E jobs are red on the current head, newly so since the prior human approval:
E2E tests (MI300X, current)has 8 real scenario failures (bench-load-real-serve,chat-end-to-end-local-model,serve-vllm-inference, threeserve-anthropic-*scenarios,runtime-lifecycle-activate-restart-services-succeeds), andE2E consolidated report (self-hosted)fails only because theW7900lane was cancelled and never uploaded its report. Neither touches disk/host-metrics territory this PR changes (all are vLLM/Anthropic-serving and runtime-lifecycle scenarios). Strong corroborating evidence both are pre-existing self-hosted-runner infra, not a regression here: amain-branch commit merged after this PR branched (#1066) removed the W7900 lane for precisely this reason ("has not run on pull_request or merge_group since the one-Linux-node change... sat queued behind the single runner"), and theE2E on the queueworkflow has independently failed onmainitself in the last few days. Per this repo's ownAGENTS.md§12 ("handle infrastructure flakes by rerun or maintainer escalation with evidence"), recommend a rerun after the rebase rather than treating these as blocking — but flagging here since they're new since the last approval and a maintainer should confirm.
What this covered
Every changed file read in full against the PR ref (not the shared working tree — see note below): Cargo.toml, Cargo.lock, MANIFEST.md, THIRD_PARTY_NOTICES.txt, crates/rocm-core/src/disk_space.rs, crates/rocm-dash-collectors/src/host.rs, docs/architecture.md, diffed 831d5d66…78acd022. Also read in full: every call site of HostCollector::new()/from_system and listed_mounts()/mounts_of() repo-wide (ref-pinned git grep, confirming no missed sysinfo call sites), the SystemMetrics/Snapshot definitions (confirms #[derive(Default)] backs the empty-metrics fallback), classify_space/SpaceCheck (confirms "unknown never blocks" holds), the repo's AGENTS.md, full git history of both changed source files (no prior relevant bugs/reverts in this area), and PR #1024's own review and comments (the superseded dependabot PR — its review's suggested fix is what this PR implements). Cross-checked the CI check-runs and the PR's own description (no mismatch between stated and actual scope; no ticket named).
This review ran as a driver plus independent fan-out workers (per the review-code skill); mid-run, one worker (and separately, my own earlier direct file reads) discovered that the local git checkout at /home/agent/workspace/repo is a shared working tree being swapped between branches by concurrent sibling review jobs. Every fact in this report was re-verified or originally obtained via ref-pinned commands (git show <ref>:<path>, git grep <pattern> <ref>, git diff <ref>...<ref>) that don't depend on what happens to be checked out, so the contamination is not reflected in anything above — but it's recorded here for transparency.
Did not run: no cargo toolchain available in this sandbox, so no local build/test/clippy — relied on the PR's own CI instead (see Deployment notes). Not reconciled against any discussion: the PR's existing review threads/comments were not read during the blind findings phase, per the method; only the PR description was read, at the end, per Step 9.
Not a human review. This is an automated code review; please verify findings independently before acting on them.
🤖 Automated by an AI agent
| /// block the operation. | ||
| fn mounts_of<E>(disks: Result<sysinfo::Disks, E>) -> Vec<(PathBuf, u64)> { | ||
| let Ok(disks) = disks else { | ||
| return Vec::new(); |
There was a problem hiding this comment.
Non-blocking (confidence 70, architectural/consistency): this Err arm drops a total disk-enumeration failure with no diagnostic at all, which is asymmetric with the paired fix in this same PR: HostCollector::from_system (host.rs) logs a tracing::warn! for the analogous System::new_with_specifics failure. rocm-core doesn't depend on tracing (checked crates/rocm-core/Cargo.toml), but it already has a precedent for exactly this situation — a non-fatal, "degrade and keep going" failure reported via a warn-once eprintln! (rotation_failure_warning in crates/rocm-core/src/jsonl_store.rs:310-317). Functionally this is harmless — it correctly degrades to SpaceCheck::Unknown, which the module already documents as "never block" — but a host where disk enumeration totally fails now does so invisibly, with no way to distinguish it from the expected "this one mount isn't listed" case.
Suggested fix: add a one-time eprintln!-based warning in this Err arm, mirroring rotation_failure_warning's pattern, so the degradation is at least discoverable.
| let m = c.tick(); | ||
| assert!(m.cpu_per_core_pct.is_empty(), "{m:?}"); | ||
| assert_eq!(m.memory_total_mb, 0, "{m:?}"); | ||
| assert_eq!(m.swap_total_mb, 0, "{m:?}"); |
There was a problem hiding this comment.
Decision for the author (non-blocking-improvement): this test only spot-checks 3 of SystemMetrics's 10 fields (cpu_per_core_pct, memory_total_mb, swap_total_mb). Today's production code returns the whole SystemMetrics::default() atomically on the None branch, so there's no live defect, but a future edit that builds a partial struct instead of ..Default::default() could leave cpu_overall_pct/memory_used_mb/swap_used_mb/the disk/net fields wrong and this test would still pass. SystemMetrics doesn't currently derive PartialEq, so a single assert_eq!(m, SystemMetrics::default()) isn't available as-is — your call whether a stronger whole-struct assertion (adding PartialEq) is worth it here, or whether the three-field spot-check is sufficient.
Why
sysinfo 0.40 cannot be taken by editing the version alone, which is what Dependabot's #1024 did. It changes the API in three ways this repository uses:
System::new_with_specificsandDisks::new_with_refreshed_list_specificsnow returnResult,Disks::list()is gone (Disksderefs to[Disk]instead), andCpu::cpu_usageis renamedCpu::usage. On #1024 that broke compilation ofrocm-core(E0599atdisk_space.rs), which failed every job that builds the workspace or xtask: clippy, build-and-test, coverage, both Windows jobs, the manifest regeneration and the third-party-notices gate.It also enables a new
gpufeature by default, whose code callsstatxdirectly. The release, nightly and PR Linux binaries are built in amanylinux2014container (glibc 2.17), which has nostatx, so linkingrocmdfails withundefined symbol: statx. This repository only reads CPU, memory and disk figures, so it never needed that feature.This PR replaces #1024 with the version bump, the source changes the new API requires, the narrower feature set, and regenerated manifests.
What changes
Cargo.tomlandCargo.lockmove sysinfo from 0.39.6 to 0.40.1 withdefault-features = falseand onlysystem,diskand the existinglinux-tmpfs. That removes thestatxreference and a few macOS-only crates from the dependency graph.MANIFEST.mdandTHIRD_PARTY_NOTICES.txtare regenerated withcargo xtask manifestandcargo xtask tpn.listed_mountsinrocm-core'sdisk_space.rstreats a failed disk listing as "no mounts". That leavesmount_for_pathwith nothing to match, so callers get unknown free space, which the module already treats as "never block the operation" (classify_spacemaps it toSpaceCheck::Unknown). The failure never produces an invented figure and never refuses an install.HostCollectorinrocm-dash-collectors'host.rsholds anOption<System>. If sysinfo fails to initialise it logs one warning and everytickreturns emptySystemMetrics, the same all-zero shape the dashboard already handles in its replay fixtures.HostCollector::new()stays infallible, so the daemon runner and the Windows in-process dashboard path are unchanged. Per-core CPU usage now readsCpu::usage.host.rsentry indocs/architecture.mdstates the new failure behaviour.Verification
cargo clippy --workspace --all-targets -- -D warningsis clean, and the tests of the four crates that use sysinfo orHostCollector(rocm-core,rocm-dash-collectors,rocm-dash-daemon,rocm-dash-tui) pass on Linux with 2951 tests and no failures. The full workspace suite also passed (6976 tests) on the source changes, before the feature set was narrowed.a_failed_disk_enumeration_reports_unknown_space_and_never_blocks, and making the uninitialised collector report a non-zero memory total failsa_collector_whose_sysinfo_failed_to_initialise_reports_empty_metrics. Both failure paths are driven by injecting the failed state (Errintomounts_of,ErrintoHostCollector::from_system), because neither can be induced on a real host.statxfix was checked at the symbol level: the compiled sysinfo library has one undefinedstatxreference with default features and none with the narrowed set. The actual glibc 2.17 link is exercised by the "Build Linux PR binaries" job, which is not reproduced locally.docs/architecture.mdcoverage, manifest and notices currency).scripts/smoke_local.py, which looks for its binary under the checkout's owntarget/and so did not run against the shared target directory used here. A manualrocm --versionandrocm storage --helpon the built binary ran fine.Scope
There is no user-observable change on a host where sysinfo initialises normally, so no Gherkin scenario is added; the new behaviour is a defensive path for platforms where sysinfo cannot initialise, covered by the unit tests above. Making
HostCollector::new()fallible, or collecting disk and network rates, is deliberately out of scope.docs/architecture.mdhas the matching entry. No file is added, renamed or removed; thehost.rsentry prose was updated for its new failure behaviour.tracing::warn!diagnostic, and the test asserts the resulting state (empty metrics), not the wording.