Repository navigation
ROCMAI-210: extract update-surfaces rendering into update_cmd.rs and fold automation-proposal/daemon rendering into automations.rs - #752
Conversation
There was a problem hiding this comment.
🔵 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
68af477 to
e4acb85
Compare
…fold automation-proposal/daemon rendering into automations.rs Signed-off-by: Jussi Elo <jussi.elo@amd.com>
e4acb85 to
0716f6c
Compare
… 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>
|
Rebased onto Also pushed a docs follow-up: the Re-ran clippy ( |
juhovainio
left a comment
There was a problem hiding this comment.
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 unqualifieduse crate::x::{...}form should includeupdate_cmd.rs.- The PR description ends with a "Generated with Claude Code" footer, which AGENTS.md section 11 asks to avoid.
scripts/smoke_local.pywasn't run (disclosed in the PR). Nit: a moved test has a redundantrocm_core::AutomationEventRecordqualification.
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.
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>
|
Thanks for the review. Addressing the rest of it:
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 |
Summary
Phase 6f-3 of the
main.rsmodularization (epic ROCMAI-27). Mechanical relocation, no behavior change, split across two destinations:apps/rocm/src/update_cmd.rs— therocm updatecommand'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, plusupdate_should_preview_or_apply(interleaved in the same span and part of the same cluster).apps/rocm/src/automations.rs— that file's own doc comment already anticipated this ("Render/policy helpers remain in the crate root... reached throughcrate::"), 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.rsandtherock_version_proptests.rsimport from the relocated modules.ROLLBACK_RECOVERY_HINTstays inmain.rsbecauseruntimes_cmd.rsandruntime_install_finalize.rsalso use it;runtimes_cmd.rschanges only in a module-doc comment that named the old location ofapply_runtime_update.render_automations_text's production call site frommain.rsorphaned severalrocm_coreimports, which are removed in this change (confirmed unused by grep, not removed speculatively).dispatch()is byte-identical tomain's (SHA-256 of the function body).update_cmd.rs, 4 to a new test module inautomations.rs, which had none); none are added or removed.docs/architecture.md: a newupdate_cmd.rsentry and a rewrittenautomations.rsentry;update_cmd.rsadded to the modules reached through unqualified re-imports;update_cmd.rs(which defines no types) replacesautomations.rs(which now ownsProposalKind) as the example of mechanical relocation; and the stale references toapply_runtime_update/append_update_activate_summarynow point atupdate_cmd.rs.Test plan
cargo clippy --workspace --all-targets -- -D warningscargo fmt --all -- --checkcargo xtask manifest --checkcargo xtask check-crate-edgescargo xtask lychee(thedocs-linkscheck)cargo test --workspace --no-fail-fast— 4731 passed, 0 failed, 17 ignoredpython scripts/smoke_local.py --profile debug --skip-builddispatch()body hash matchesmain'sPart of Jira ROCMAI-210 / epic ROCMAI-27.