Repository navigation
ROCMAI-209: extract services/log rendering and internal sandbox tool execution into services_text.rs - #757
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional Stdio import is unused on Windows and fails the configured warnings-as-errors Clippy check.
1 open issue
What changed in this PR
Continues the main.rs modularization by moving service/log rendering and sandbox-tool execution into services_text.rs, with no intended behavior change.
Changes:
- Relocates service rendering, stop/restart helpers, and 31 tests into the new module.
- Updates caller imports while preserving dispatch call sites.
- Updates module comments and architecture documentation to reflect the relocation.
Verification was limited to source and CI configuration inspection; builds and tests were not run.
| File | Description |
|---|---|
| docs/architecture.md | Documents the new module and updated caller relationships. |
| apps/rocm/src/services_text.rs | Contains relocated rendering, lifecycle helpers, and tests. |
| apps/rocm/src/service_launch.rs | Imports relocated service helpers. |
| apps/rocm/src/runtime_services.rs | Imports relocated loading and restart functions. |
| apps/rocm/src/managed_service_status.rs | Updates the test module’s service-loader import. |
| apps/rocm/src/main.rs | Registers the module and removes relocated code and tests. |
| apps/rocm/src/gpu_policy.rs | Updates caller descriptions in comments only. |
| apps/rocm/src/engine_runtime_select.rs | Updates caller descriptions in comments only. |
| apps/rocm/src/chat.rs | Imports rendering and validation helpers from the new module. |
Review effort: Balanced
9ea6873 to
ffded61
Compare
…execution into services_text.rs Signed-off-by: Jussi Elo <jussi.elo@amd.com>
ffded61 to
587f157
Compare
juhovainio
left a comment
There was a problem hiding this comment.
LGTM. Mechanical extraction into services_text.rs, no behavior change found.
- Compared removed vs added lines: moved bodies match verbatim. Differences are limited to import lists, doc-comment prose, and visibility changes on 8 fn signatures (e.g.
load_managed_serviceis nowpub(crate)). - Test count is preserved (33
#[test]moved, bodies unchanged). - Imports in chat.rs, service_launch.rs, runtime_services.rs, managed_service_status.rs and main.rs are updated; stale prose in gpu_policy.rs, engine_runtime_select.rs and docs/architecture.md is fixed, and the module map has a new entry.
dispatch()call sites are unchanged.
Nit (non-blocking): render_logs_browser_page_text narrows from pub(crate) to private. It compiles and has no outside callers, so fine, just a small non-verbatim change.
CI is green at this head (22 pass, 2 skipped).
|
Thanks for the review.
No code change, so the approved head is unchanged. |

Summary
Phase 6f-2 of the
main.rsmodularization (epic ROCMAI-27). Mechanical relocation, no behavior change: moves services/log rendering and internal sandbox tool execution out ofapps/rocm/src/main.rsinto a newapps/rocm/src/services_text.rs— the largest cluster in this 8-way split (~1170 lines of production code).struct LogBrowserEntry,const MANAGED_STOP_GRACE), both private with no external callers.dispatch()has multiple direct call sites into this cluster (render_internal_status_text,run_internal_sandbox_tool,render_service_logs_text,render_logs_browser_text,render_logs_text,render_services_text,render_services_json) — body confirmed byte-identical (independently re-verified by SHA-256), only imports changed.pub(crate)(load_managed_service,read_optional_tail_lines,read_tail_lines,render_internal_status_text,render_service_action_result,restart_internal_managed_service,run_internal_sandbox_tool,validate_service_id).render_logs_browser_page_texthas no caller outside the new module, so it narrows frompub(crate)to private. Moved bodies are otherwise unchanged.chat.rs,service_launch.rs,runtime_services.rs, andmanaged_service_status.rs's own test module.engine_runtime_select.rs's andgpu_policy.rs's own doc comments (and the matchingdocs/architecture.mdbullets) corrected, since the functions they referenced moved here.services_text::tests::shows exactly 32#[test]fns, including the stop-confirmation test added upstream since the first version of this PR, ported with the code it covers). Three tests that only incidentally call into this cluster but primarily test other modules' functions were deliberately left inmain.rs/stayed put, documented in both the new module's doc comment and the architecture-doc bullet.docs/architecture.mdupdated.Test plan
Verified locally at this head (rebased onto
mainafter #756 merged):cargo fmt --all --checkcargo clippy -p rocm --all-targets -- -D warningscargo test -p rocm— 1366 passed, 0 failed, 7 ignoredcargo doc -p rocm --no-deps --document-private-items— no unresolved link forparse_device_policymain.rsexists inservices_text.rs; none dropped or duplicatedNot re-run locally at this head: the workspace-wide build/test,
cargo xtaskchecks, the smoke script and the Windows build; CI covers them.Follows #756 (ROCMAI-215), now merged — seventh PR in the ROCMAI-86 (Phase 6f) stack.
Part of Jira ROCMAI-209 / epic ROCMAI-27.