Skip to content

ROCMAI-210: extract update-surfaces rendering into update_cmd.rs and fold automation-proposal/daemon rendering into automations.rs - #752

Merged
jussielo-amd merged 3 commits into
mainfrom
rocmai-210-update-automations
Oct 29, 2026
Merged

jussielo-amd merged 3 commits into
mainfrom
rocmai-210-update-automations

Conversation

@jussielo-amd

@jussielo-amd jussielo-amd commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Phase 6f-3 of the main.rs modularization (epic ROCMAI-27). Mechanical relocation, no behavior change, split across two destinations:

  1. New file apps/rocm/src/update_cmd.rs — the rocm update command's rendering/activation logic: render_update_text, append_update_surfaces, apply_runtime_update, append_update_activate_summary, select_runtime_update_source, select_installed_update_runtime, plus update_should_preview_or_apply (interleaved in the same span and part of the same cluster).
  2. Folded into the existing apps/rocm/src/automations.rs — that file's own doc comment already anticipated this ("Render/policy helpers remain in the crate root... reached through crate::"), now rewritten since they live here: render_automations_text, ProposalKind, proposal_kind/proposal_plain_summary/proposal_plain_reason/proposal_status_label/proposal_bool_argument, fallback_tool_for_automation_action, automation_event_plain_summary, audit_event_plain_summary, watcher_last_check/watcher_plain_name/watcher_plain_trigger/watcher_plain_action/watcher_policy_note/watcher_mode_plain_label, render_daemon_text.
  • chat.rs and therock_version_proptests.rs import from the relocated modules. ROLLBACK_RECOVERY_HINT stays in main.rs because runtimes_cmd.rs and runtime_install_finalize.rs also use it; runtimes_cmd.rs changes only in a module-doc comment that named the old location of apply_runtime_update.
  • Removing render_automations_text's production call site from main.rs orphaned several rocm_core imports, which are removed in this change (confirmed unused by grep, not removed speculatively).
  • dispatch() is byte-identical to main's (SHA-256 of the function body).
  • 9 tests move with the code (5 to update_cmd.rs, 4 to a new test module in automations.rs, which had none); none are added or removed.
  • docs/architecture.md: a new update_cmd.rs entry and a rewritten automations.rs entry; update_cmd.rs added to the modules reached through unqualified re-imports; update_cmd.rs (which defines no types) replaces automations.rs (which now owns ProposalKind) as the example of mechanical relocation; and the stale references to apply_runtime_update/append_update_activate_summary now point at update_cmd.rs.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo xtask manifest --check
  • cargo xtask check-crate-edges
  • cargo xtask lychee (the docs-links check)
  • cargo test --workspace --no-fail-fast — 4731 passed, 0 failed, 17 ignored
  • python scripts/smoke_local.py --profile debug --skip-build
  • dispatch() body hash matches main's

Part of Jira ROCMAI-210 / epic ROCMAI-27.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Dependency #750's merge status and the reported build/test results remain independently unverified, so maintainer confirmation is needed.

No open issues 🎉

What changed in this PR

Continues the main.rs modularization by relocating update and automation rendering into focused modules, preserving existing behavior and dispatch wiring.

Changes:

  • Extracts update reporting, runtime selection, and activation into update_cmd.rs.
  • Moves automation/proposal and daemon rendering into automations.rs, updating callers and imports.
  • Relocates nine existing tests and updates the architecture documentation.
File Description
docs/​architecture.md Documents module responsibilities and updates cross-references.
apps/​rocm/​src/​update_cmd.rs Houses update logic and five relocated tests.
apps/​rocm/​src/​therock_version_proptests.rs Points property tests at the relocated selector.
apps/​rocm/​src/​main.rs Removes relocated helpers and tests; updates module imports.
apps/​rocm/​src/​chat.rs Imports renderers from their new modules.
apps/​rocm/​src/​automations.rs Houses automation and daemon rendering plus four relocated tests.

Review effort: Balanced

@jussielo-amd
jussielo-amd force-pushed the rocmai-210-update-automations branch from 68af477 to e4acb85 Compare October 29, 2026 06:28
Base automatically changed from rocmai-214-gpu-policy to main October 29, 2026 06:35
…fold automation-proposal/daemon rendering into automations.rs

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd force-pushed the rocmai-210-update-automations branch from e4acb85 to 0716f6c Compare October 29, 2026 06:35
@jussielo-amd
jussielo-amd marked this pull request as ready for review October 29, 2026 06:55
@jussielo-amd
jussielo-amd requested a review from a team as a code owner October 29, 2026 06:55
… structure

update_cmd.rs defines no types, so it is dispatch-adjacent with no owned
types rather than "owns private types". Reword the update_cmd.rs and
automations.rs entries to describe how the modules are laid out today
instead of what moved out of main.rs, give automations.rs's re-import in
the form main.rs actually uses, and point runtimes_cmd.rs's module doc at
update_cmd.rs, where apply_runtime_update now lives.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd

Copy link
Copy Markdown
Collaborator Author

Rebased onto main now that #750 has merged, so this PR now targets main directly and the dependency note is gone from the description. The rebase conflicts were limited to the main.rs import comment and docs/architecture.md; dispatch() is still byte-identical to main's.

Also pushed a docs follow-up: the update_cmd.rs entry in docs/architecture.md now says it owns no types (it defines none), the update_cmd.rs and automations.rs entries describe the current layout, and the runtimes_cmd.rs module doc points at update_cmd.rs, where apply_runtime_update now lives.

Re-ran clippy (-D warnings), fmt, the manifest and crate-edge checks, the link check and the full workspace tests on the new head; results are in the description.

@juhovainio juhovainio 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.

No blocking issues from my read. The moved function bodies and the 9 moved tests look textually identical to their originals apart from the pub(crate) widening the move requires. This is a diff-only read, not a CI or runtime check.

Non-blocking:

  • docs/architecture.md (inline comment): the list of modules allowed the unqualified use crate::x::{...} form should include update_cmd.rs.
  • The PR description ends with a "Generated with Claude Code" footer, which AGENTS.md section 11 asks to avoid.
  • scripts/smoke_local.py wasn't run (disclosed in the PR). Nit: a moved test has a redundant rocm_core::AutomationEventRecord qualification.

One question: render_daemon_text (the rocm daemon --status summary) moves into automations.rs, which is slightly beyond ROCMAI-210's literal "update-surfaces + automation-proposal rendering" scope. It's documented in the PR, so fine by me if that's intended.

Comment thread docs/architecture.md Resolved
main.rs re-imports update_cmd's items unqualified, so the "limited to" list
in the module-organization section has to name it. Also: update_cmd.rs, which
defines no types, replaces automations.rs (now owning ProposalKind) as the
example of mechanical relocation; the runtimes_cmd.rs entry points at
update_cmd.rs for apply_runtime_update; the update_cmd.rs module doc names
all three shared test fixtures; and a moved test drops a redundant
rocm_core:: qualification.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Addressing the rest of it:

  • Footer: removed from the description.
  • Redundant qualification: dropped the rocm_core:: prefix on AutomationEventRecord in the moved test (ca15f9a); it already resolves through use super::*.
  • scripts/smoke_local.py: now run against this head and passing; the description's test plan is updated.
  • render_daemon_text scope: intentional. It sat directly after the automation-proposal rendering in main.rs and has no other natural home in this split, so it moved with that cluster rather than becoming a one-function module; the description and the automations.rs entry in docs/architecture.md both call it out. If you would rather keep this PR to the literal ticket scope, say so and I'll split it into its own change.

While re-reading the doc I also saw a few older inaccuracies that this PR did not introduce and that I have left alone to keep it focused: the "limited to" list on that same line also omits gpu_policy.rs, managed_service_status.rs, runtime_install_finalize.rs, runtimes_cmd.rs and uninstall_plan.rs, the reader list in the runtimes_cmd.rs entry is incomplete, and the module comment at the top of driver_install.rs still describes automations.rs as owning no types. Happy to sweep those in a separate docs change.

@jussielo-amd
jussielo-amd added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 85f0468 Oct 29, 2026
24 checks passed
@jussielo-amd
jussielo-amd deleted the rocmai-210-update-automations branch October 29, 2026 11:20
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.

3 participants