Skip to content

Collapse the bare/_at/_read three-entry-point split in openmpi.rs and driver_install.rs - #705

Merged
jussielo-amd merged 3 commits into
ROCm:mainfrom
jussielo-amd:chore/690-collapse-os-release-entry-points
Oct 19, 2026
Merged

jussielo-amd merged 3 commits into
ROCm:mainfrom
jussielo-amd:chore/690-collapse-os-release-entry-points

Conversation

@jussielo-amd

Copy link
Copy Markdown
Collaborator

What

PR #675 added an OsRelease-aware _read seam (install_hint_for_read, build_driver_install_plan_read, plan_for_os_release_read) alongside the existing bare-text and _at functions in crates/rocm-core/src/openmpi.rs and apps/rocm/src/driver_install.rs, leaving three entry points per builder: a bare-text function (test-only), an _at function (path-aware, the real implementation), and a _read function (OsRelease-aware).

Now that tests can construct OsRelease::found(text) directly and call the _read seam, the bare-text middle layer is redundant. This migrates every bare-text test call site to the _read seam and deletes the two now-unreferenced bare functions.

  • apps/rocm/src/driver_install.rs: migrated all 33 call sites of build_driver_install_plan to build_driver_install_plan_read, using a small #[cfg(test)] os_release_found helper (since rocm_core::hardware_root::OsRelease::found is pub(crate) inside rocm-core and not visible from this crate's tests). Deleted the now-dead build_driver_install_plan.
  • crates/rocm-core/src/openmpi.rs: migrated all 12 call sites of install_hint_for to install_hint_for_read using crate::hardware_root::OsRelease::found. Deleted the now-dead install_hint_for.
  • docs/testing.md: updated a passage that described the now-deleted bare functions as currently-existing test helpers.
  • The _at functions are untouched — they remain the real implementation both _read and any other path-aware caller route through.

This is a pure test/internal-API cleanup with no behavior change.

Fixes #690

Verification

  • cargo build --workspace --all-targets, cargo test --workspace --all-targets, cargo clippy --workspace --all-targets -- -D warnings, and python scripts/smoke_local.py all pass.
  • Every existing test in both files passes with its assertions unchanged (confirmed by diffing test output before/after the migration) — this is a pure refactor, so no test's expected value needed to change.
  • cargo xtask coverage passes with no floor regression; coverage-floors.toml is untouched.
  • Leak scan of the diff against origin/main is clean.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reported verification could not be independently confirmed because the repository checkout was unavailable.

1 open finding
What changed in this PR

Completes #690 by removing redundant test-only wrappers and using the existing OsRelease-aware entry points.

Changes:

  • Migrates driver-install and OpenMPI tests without changing their assertions.
  • Deletes bare-text wrappers while preserving _at implementations.
  • Updates testing documentation and related comments.
File Description
docs/​testing.md Documents direct use of _read test entry points.
crates/​rocm-core/​src/​openmpi.rs Migrates hint tests and removes the bare-text wrapper.
apps/​rocm/​src/​driver_install.rs Migrates planner tests and adds an OsRelease fixture helper.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/testing.md Outdated
@jussielo-amd
jussielo-amd marked this pull request as ready for review October 16, 2026 12:48
@jussielo-amd
jussielo-amd requested a review from a team as a code owner October 16, 2026 12:48

@tomastola tomastola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: the migration is mechanical, every assertion is unchanged, _read delegates to _at, and a grep of the head finds no remaining references to the deleted functions. CI is green.

Two stale comments, non-blocking. The first is an inline suggestion on openmpi.rs:935. The second is outside the diff, so GitHub can't take it inline: crates/rocm-core/src/openmpi.rs:1510-1512, in the doc comment on a_fallback_reads_malformed_line_names_the_fallback_path. It says malformed-line tests "went through either the bare, hardcoded-/etc functions or OsRelease::found", but the bare functions no longer exist. Suggest: "Every malformed-line test before this one went through [crate::hardware_root::OsRelease::found] (which hardcodes /etc/os-release), so ...".

Comment thread crates/rocm-core/src/openmpi.rs Outdated
jussielo-amd and others added 3 commits October 19, 2026 09:51
…nt split

PR ROCm#675 added an OsRelease-aware `_read` seam alongside the existing
bare-text and `_at` functions in driver_install.rs and openmpi.rs. That
left three entry points per builder, with the bare-text ones kept only
because tests had no OsRelease of their own to construct.

Now that tests can build `OsRelease::found(text)` directly, migrate the
33 build_driver_install_plan call sites and 12 install_hint_for call
sites to their _read equivalents, and delete the two now-unreferenced
bare functions. The _at functions are untouched; they remain the real
implementation both _read and any other path-aware caller route
through. No behavior change.

Fixes ROCm#690

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Addresses a review comment: a bare backtick path bypasses link
validation, so a moved or deleted target would go unnoticed.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Co-authored-by: Tomas Saaristola <144015745+tomastola@users.noreply.github.com>
Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd force-pushed the chore/690-collapse-os-release-entry-points branch from b1eaede to 152478d Compare October 19, 2026 09:52
@jussielo-amd
jussielo-amd added this pull request to the merge queue Oct 19, 2026
Merged via the queue into ROCm:main with commit 4cd8963 Oct 19, 2026
30 of 31 checks passed
@jussielo-amd
jussielo-amd deleted the chore/690-collapse-os-release-entry-points branch October 19, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapse the bare/_at/_read three-entry-point split in openmpi.rs and driver_install.rs

3 participants