Repository navigation
Conversation
`main`'s "E2E tests (Strix Halo, Windows, current)" lane is permanently red on diagnose-38, and the CLI is behaving correctly -- the assertion is wrong. The step banned the substring `setx ` across the *whole* of `rocm fix fix-6-path` output, and `rocm fix <id>` prints the catalog recipe before it runs anything, so the catalog's own documented Windows command tripped the test the real (PowerShell) write was meant to prove. The documented command is also wrong on its own terms, which is the defect underneath the broken test. `setx PATH "%PATH%;<bin>"` truncates the value at 1024 characters while still exiting 0, and `%PATH%` expands to the combined user+system PATH, so pasting it writes every system entry into the user's own PATH. cb9f748 moved the real write off `setx` to `[Environment]::SetEnvironmentVariable` for exactly these reasons and left the advertised commands behind. - `fix.rs`: the `fix-6-path` recipe and `diagnose.rs`'s copy of the same plan now both document the PowerShell prepend the CLI performs -- reading and rewriting the User scope only -- with notes saying why it is not `setx`. `diagnose.rs` reuses the real write's `ps_single_quote_escape`, so an apostrophe in the bin dir cannot break the printed copy either. - diagnose-38 now asserts over the write region (the `Plan: prepend ...` line through the post-write confirmation) instead of the whole output, via `user_path_write_region`. Prose about `setx` anywhere else -- a note, a rationale, a future warning -- no longer fails the scenario, while a write that regressed to `setx` still does. Five unit tests in the e2e lib cover both directions on any platform. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
jussielo-amd
left a comment
There was a problem hiding this comment.
Review — no blocking findings
Full review of the whole change (single-pass — 4 files, 226 changed lines, small enough to read completely without fan-out). No ticket named in the PR body; fix-6-path in the title/body is the catalog recipe ID, not a tracker key.
Blocking
None
Non-blocking
diagnose.rs's half of the fix has no test coverage —crates/rocm-core/src/diagnose.rs:1041-1055
The PR's own framing is that the badsetxadvice lived in "two places" and both needed the same fix.fix.rs's half got five new unit tests plus thediagnose-38e2e scenario (which the PR reran locally and confirmed fails pre-fix/passes post-fix).diagnose.rs's half — thecheck_6_path_missingWindows suggestion, now built viaps_single_quote_escape(&bin_dir)the same way — has none: no test referencesSetEnvironmentVariableindiagnose.rs, there is nowindows_base()test fixture for this check (onlylinux_base/wsl_baseexist), andcargo test -p rocm-core --lib -- check_6_pathagainst this PR's head (cac27bd8) matches zero tests. Nothing would catch this command regressing back tosetx, or the escape being dropped/misapplied for abin_dircontaining an apostrophe — exactly the defect class the PR's own doc comment onps_single_quote_escapecalls out as "the same ROCMAI-449 bug moved from the write to the documentation." Scored non-blocking rather than blocking because the text is advisory (printed byrocm diagnose, never executed by the CLI itself) — but it is user-observable behavior this change introduces with no assertion anywhere.
Fix: add awindows_base()-style fixture and a unit test assertingcheck_6_path_missing's WindowsFix.commandscontains theSetEnvironmentVariable/GetEnvironmentVariablecall, notsetx, and that an apostrophe in a syntheticbin_dirsurvives escaped (mirroringps_single_quote_escape_doubles_every_embedded_quotebut through the real call site).
Decisions for the author
None
Positive signals
windows_path_prependandps_single_quote_escapeare shared between the planned message and the actual write (crates/rocm-core/src/fix.rs:1917,1940), so the two can't disagree the way the pre-fix code's "prepend" wording vs. append-shaped write once did — a real structural fix, not just a reworded string.user_path_write_region's test set is well-designed: it covers both directions (catalog prose containingsetxis excluded, a write regressed tosetxis still caught) plus the two "no region" edge cases (write never ran, write never confirmed) that guard against half a write vacuously satisfying the assertion.
Deployment notes
None
What this covered
Read completely: crates/rocm-core/src/fix.rs, crates/rocm-core/src/diagnose.rs, tests/e2e-cucumber/src/lib.rs, tests/e2e-cucumber/tests/e2e/diagnose_steps.rs (the full diff), plus surrounding context: run_path_export_windows/path_export_windows/windows_path_prepend and their existing unit tests, the diagnose-38/diagnose-39 feature scenarios, doctor-catalog.json, skills/rocm-doctor/reference.md, coverage-floors.toml, and the CI coverage job definition in .github/workflows/ci.yml. Diffed d4e7c751 (merge-base, matches PR's reported base)…cac27bd8 (PR head). Ran cargo test -p e2e-cucumber --lib (148 passed, including all 5 new tests) and cargo test -p rocm-core --lib plus cargo fmt --all -- --check against a worktree built from the PR head — all clean. Ran a leak scan (origin/main…PR head) — clean — and checked for merge-conflict markers — none.
Did not run: the prior-changes pass (no earlier review rounds exist on this PR to check against) and the Windows e2e scenario itself (diagnose-38 is @requires-os:windows, no Windows runner available here — matches the PR's own "Not verified" disclosure). Skill checks (skillscope) and Sphinx docs build show SKIPPED in CI but correctly so — no skill or docs files are touched by this change. Not reconciled against any discussion (fresh review, nothing to reconcile).
Why
main'sE2E tests (Strix Halo, Windows, current)lane is permanently red, and has been across every recent push run. Because the self-hosted lanes re-run on each PR, it now shows red on every open PR too — which manufactures red marks on everything we open and makes a genuine Windows regression indistinguishable from the noise.The lane reports 145 scenarios, 141 passed, 4 failed. Three are declared xfails in
tests/e2e-cucumber/expectations.tomland are tolerated. The fourth isdiagnose-38, and the CLI is behaving correctly — the test was wrong.The broken assertion
Then the CLI used PowerShell's SetEnvironmentVariable, not setx, to update the User PATHbanned the substringsetxacross the entire output ofrocm fix fix-6-path --yes. Butrocm fix <id>prints the catalog recipe before it runs anything, and thefix-6-pathrecipe's documented Windows command was literallysetx PATH "%PATH%;C:\Program Files\AMD\ROCm\<version>\bin". The step therefore tripped on the catalogue's own documentation, while the write below it was correct:The real defect underneath it
setx PATH "%PATH%;..."is bad advice, not just an awkward string:setxtruncates the value at 1024 characters while still exiting0, silently corrupting a long PATH.%PATH%expands to the combined user+system PATH, so this writes every system entry into the user PATH — a classic way to mangle someone's environment.The codebase already knew this:
fix.rscarries a doc comment warning that asetxPATH write replaces the user's real PATH, andcb9f748dmoved the actual write offsetxonto[Environment]::SetEnvironmentVariablefor exactly these reasons. It left the documented manual commands behind, in two places.What changed
crates/rocm-core/src/fix.rs— thefix-6-pathrecipe now documents the same mechanism the CLI performs:GetEnvironmentVariable(..., 'User')reads the User scope only, so nothing folds the system PATH into the user's. Two notes were added: why it is not thesetxone-liner, and that a PATH change only takes effect in NEW shells.crates/rocm-core/src/diagnose.rs— the same replacement for theformat!-built copy, against the realbin_dir. It now reuses the production write'sps_single_quote_escape(madepub(crate)), so an apostrophe in the bin dir cannot end the PowerShell string literal early in the printed copy either — the printed plan and the real write are one plan on two surfaces. The "only affects NEW shells" guidance is kept, reworded offsetx.tests/e2e-cucumber/—diagnose-38now asserts over the write region rather than the whole output, via a newuser_path_write_regionhelper: the span from thePlan: prepend ...line through the post-writeThis only takes effect in NEW shellsconfirmation. Inside that span it asserts positively on theSetEnvironmentVariablecall and negatively onsetx.Why scope it rather than just fix the catalog string? Even with the catalog corrected, a whole-output
!contains("setx ")reports on the documentation, not on what the CLI did. Any future note, rationale or warning that namessetx— including, deliberately, the one added here — would fail the scenario for no reason. The region is the only span in whichsetxmeans the regression the scenario guards against. Obtaining the region at all is what pins the plan line and the confirmation wordingcb9f748dintroduced, so the dropped third assertion is not lost.Note that the two halves are coupled: because the new note names
setxon purpose, the catalog change alone would not turn the lane green. The narrowing is what fixes it.Verified
cargo test --workspaceon any platform) cover both directions: the region excludes catalog prose namingsetx, and still catches a write regressed tosetx; plus no-region cases for "the write never ran" and "the write was never confirmed", so half a write cannot vacuously satisfy both halves.rocm fix fix-6-path --dry-runwas run from a binary built off this branch to capture the real catalog block, and the realPlan:/script lines were captured by drivingpath_export_windowsdirectly. Feeding the assembled Windows output through the realuser_path_write_region: the pre-change whole-output assertion fails, the new region assertion passes. Substituting asetxwrite into the same output: the new region assertion fails. Both checks were throwaway and are not in the diff.cac27bd8:cargo fmt --allclean;cargo test --workspace --all-targets --no-fail-fast— only the known load flakecli_progress::tests::animated_spinner_keeps_ticking_without_progress_calls, which passes in isolation on this tree;cargo clippy --workspace --all-targets -- -D warningsclean;cargo clippy --locked -p e2e-cucumber --test e2e -- -D warningsclean.setx PATH "%PATH%;...strings, and the published Doctor catalog check passes unchanged.Not verified
The Windows scenario itself was not executed.
diagnose-38is@requires-os:windowsand there is no Windows runner here, so the proof above is over output reconstructed from the real production code paths, not over a real Windows run. The Windows E2E lane on this PR is the first real execution.