Repository navigation
fix(diagnose): align fix-5-amdgpu-load's needs_reboot with the FixRecipe catalog - #450
Conversation
…ipe catalog diagnose.rs computed needs_reboot conditionally on whether a modprobe blacklist entry was found, while the fix.rs catalog always said true for the same fix-id -- rocm diagnose and rocm fix could disagree for the same machine. Make diagnose's value unconditional, matching the catalog and every other checker's pattern, and add a structural guard plus regression tests pinning both the blacklisted and non-blacklisted cases (ROCm#418). Signed-off-by: Jussi Elo <jussi.elo@amd.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The no-blacklist path now incorrectly requires a reboot, and the claimed structural guard covers only one fix ID.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Aligns diagnose metadata for fix-5-amdgpu-load with the static fix catalog and adds regression checks.
Changes:
- Makes
needs_rebootunconditional. - Adds catalog-parity and rendering tests.
- Updates related comments.
| File | Description |
|---|---|
crates/rocm-core/src/diagnose.rs |
Changes reboot behavior and adds tests. |
crates/rocm-core/src/fix.rs |
Adds a catalog-parity assertion helper. |
tests/e2e-cucumber/tests/e2e/diagnose_steps.rs |
Updates test commentary. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
format_flags's doc comment linked to two cfg(test)-only helper functions from a normally-compiled function, producing unresolved rustdoc links. Render them as code text, and reword to not imply blanket drift coverage for every fix-id -- these are targeted regression tests for the fix-ids that have one, not a general guard. Addresses review feedback on ROCm#450. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
🔴 Automated review · pr-review-watcher · 0d96764 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. SummaryMakes 🚫 Blocking (must fix before merge)None. Non-blocking
|
juhovainio
left a comment
There was a problem hiding this comment.
Copilot already reviewed this one and I re-checked its two still-open points against the surrounding code -- both hold up, so I won't repeat them: the no-blacklist path may now be factually claiming "requires reboot" when it isn't true, and the new assert_needs_reboot_matches_the_catalog helper only guards fix-5, not every fix-id (you've replied to both already, and the second point mirrors the existing assert_plan_matches_the_catalog_copy helper's same characteristic, so that one reads more like a known, accepted limitation than a gap).
Two more things worth resolving before merge:
Issue #418 asked for a decision, and I don't think this PR makes one. It says explicitly: "This needs a decision, not just picking one side to match the other" and "Decide which value is semantically correct for each case." What's shipped here aligns diagnose.rs to the catalog by precedent (matches #413, matches every other checker's literal) -- it doesn't argue that unconditional-true is actually correct for the no-blacklist path. The real reasoning only shows up reactively, in your reply to the Copilot comment, and even there it's framed as "a legitimate accuracy-vs-consistency call a maintainer may want to weigh in on" -- which is the issue's own question, still open. If consistency really is the right call here (plausible -- a static catalog can't do live blacklist probing without a much bigger change), it'd be worth saying that reasoning in the PR description or as a comment at the needs_reboot: true line itself, so the next person doesn't have to go digging through review comments to find out this was a deliberate tradeoff and not an oversight.
The output change here doesn't have e2e coverage or a stated reason why not. The rendered flags: line for fix-5 now says "requires reboot" in a case where it didn't before -- that's user-observable CLI output, which AGENTS.md asks to be covered by a Gherkin scenario, or to say explicitly in the PR text why it's unit-test-only. The two new diagnose.rs tests are solid, but they're not that, and the PR body doesn't explain the gap. One sentence added to the test plan (e.g. "not blacklisted" isn't a scenario the e2e lane can deterministically reproduce, so it's unit-tested only) would close this cleanly.
Smaller thing, not blocking: since diagnose.rs is now unconditionally true, the two new tests both pin the same value -- the "not blacklisted" one only proves the old conditional is gone, it doesn't independently exercise a different expected answer for that case the way #418's phrasing ("pin the expected value for both... cases") seems to have had in mind. Worth a beat if you're already touching this file for the decision above.
|
Addressed the two outstanding review threads in 84a4e3a:
Left both threads open for @juhovainio to confirm the reasoning holds. |
Reviewer asked for the accuracy tradeoff to be documented at the call site, not just in a review reply -- add a comment at the needs_reboot assignment, and correct diagnose_steps.rs's comment attributing assert_needs_reboot_matches_the_catalog to diagnose.rs (it's defined in fix.rs, only called from diagnose.rs's tests). Signed-off-by: Jussi Elo <jussi.elo@amd.com>
84a4e3a to
cdfd1a4
Compare
|
🔴 Automated review · pr-review-watcher · cdfd1a4 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. SummaryMakes 🚫 Blocking (must fix before merge)None. Non-blocking
|
Extend the catalog-parity guard beyond fix-5-amdgpu-load with a fix.rs-side test pinning the known needs_reboot:true set, drop a redundant hardcoded assert in the shared test helper, and correct two comments (one pointing at the wrong module, one overstating the no-blacklist over-warning by ignoring the Secure Boot sub-case). Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
🔴 Automated review · pr-review-watcher · d046a96 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. SummaryMakes 🚫 Blocking (must fix before merge)None. Non-blocking
|
juhovainio
left a comment
There was a problem hiding this comment.
Both points from my earlier review are resolved:
- The
needs_rebootsemantic question (#418 asked which value is correct, not just alignment) now has a reasoned answer, both as a code comment at theneeds_reboot: trueassignment and as a dedicated PR-body section: follows PR #413's precedent ofdiagnose.rsconforming to thefix.rscatalog, matches every other checker's hardcoded-literal pattern, and avoids adding live-state probing to therocm fixpath. The accepted cost (over-warn in the no-blacklist case, never under-warn) is stated plainly rather than left implicit. - The missing-Gherkin-scenario point now has an explicit justification in the PR body: the
flags:line depends on live host state thatdiagnose.featurealready documents the e2e lane can't pin deterministically, with the two newrocm-coreunit tests as the stated alternative coverage (one of which would have failed under the old conditional logic).
CI is green across the board. Approving.


Summary
fix-5-amdgpu-loadhad two independently-maintained sources forneeds_reboot: the staticFixRecipecatalog (fix.rs, alwaystrue) anddiagnose.rs'scheck_5_amdgpu_blacklisted(conditional on whether a modprobe blacklist entry was found).rocm diagnoseandrocm fix fix-5-amdgpu-loadcould report differentneeds_rebootvalues for the same underlying condition.check_5_amdgpu_blacklistedwas the only checker indiagnose.rsthat computedneeds_rebootfrom live state instead of a hardcoded literal matching its catalog counterpart -- every other fix-id'sFix.needs_rebootis a fixed literal.diagnose.rs's value unconditionaltrue, matching the catalog and the pattern of every other checker. This follows the same direction PR fix(diagnose): unify remediation flag wording with rocm fix #413 used to resolve the identical drift class forfix-9-igpu-dgpu'sauto_applicable.assert_needs_reboot_matches_the_cataloginfix.rs, mirroring the existingassert_plan_matches_the_catalog_copy) so any future drift between the two sources fails a test rather than only being visible by eyeballingrocm diagnosevsrocm fixoutput.fix.rs'sformat_flagsdoc comment, and an e2e test comment indiagnose_steps.rs), since it's now closed.Fixes #418
Why unconditional
trueis correct for the no-blacklist path too#418asked for a decision on which value is semantically correct here, not just alignment between the two sources. This PR resolves it in favor of the catalog's statictrue, for three reasons:fix-9-igpu-dgpu'sauto_applicable--diagnose.rsconforms to thefix.rscatalog, not the reverse.Fix.needs_rebootindiagnose.rsis already a hardcoded literal matching itsFixRecipecounterpart;fix-5was the only one computing it from live state on just one side, which is what caused the drift.fix.rs's catalog is a static, compile-time table with no access to liveExaminationstate. Making it conditional to match the diagnose-side precision would mean adding live blacklist probing to therocm fix <id>command path itself -- a materially bigger change than this focused drift fix.The tradeoff this accepts: in the no-blacklist path, the remediation is just
sudo modprobe amdgpu, which doesn't actually require a reboot, so the unconditionaltrueover-warns in that one case. The dangerous direction --rocm diagnosetelling a user no reboot is needed whilerocm fixsays one is -- is exactly what this closes; the residual cost is limited to over-warning, never under-warning. This reasoning is now also captured as a code comment at theneeds_reboot: trueassignment indiagnose.rs.Test coverage for the user-observable output change (AGENTS.md section 3)
This changes
rocm diagnose's renderedflags:line forfix-5-amdgpu-loadin the no-blacklist case, which is user-observable CLI output. It isn't covered by a Gherkin scenario, for the same reasontests/e2e-cucumber/features/diagnose.featurealready documents for this whole file:rocm diagnose's top match depends on live host state (here,amdgpu_loaded/amdgpu_blacklisted_in), which the e2e lane doesn't control deterministically, so no scenario can pin a specific fix-id's exactflags:line through that surface. The catalog-side flags (viarocm fix <id> --dry-run) have no such dependency and are already covered deterministically bydiagnose-20. Coverage for this fix-id's exactneeds_rebootbehavior in both the blacklisted and non-blacklisted cases therefore lives in the two newrocm-coreunit tests instead, per the "state the gap, cover at another CI level" allowance.Test plan
diagnose.rs(fix_5_amdgpu_load_needs_reboot_matches_catalog_when_blacklisted/..._when_not_blacklisted) pinFix.needs_reboot, the catalog-parity check, and the exact renderedflags:line for both scenarios -- the second one is the one that would have failed under the old conditional logic.cargo test --workspace --all-targets --exclude e2e-cucumber-- all passing.cargo clippy -p rocm-core --all-targets -- -D warningsandcargo fmt -p rocm-core -- --check-- clean.