Repository navigation
ROCMAI-848: remove the duplicate engine inventory table, the dead rocmd helpers and missing_packaged_engine_reason - #880
Conversation
main.rs's engine_inventory() and bridge_snapshot.rs's builtin_engine_inventory() were two identical const fn tables of the built-in engine ids and summaries. The bridge snapshot's engine list now reads engine_inventory(), the table that rocm examine and rocm update already use, and the duplicate is deleted. The main.rs test that checks the serve --engine possible values against the inventory now compares against the surviving table, so it covers every reader instead of only the bridge snapshot's copy. The bridge_snapshot.rs module doc and the docs/architecture.md entry no longer say the two tables are kept separate. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
… call common::find_engine_plugin_binary was compiled only under cfg(test) and called by nothing except its own test, so the helper, its test and the three test-only imports it needed are removed. supervise_service called daemon_binary_path() and discarded the result. That function only reads the current executable path and checks sibling files, with no writes or other side effects, so the call did nothing and is removed along with its import. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
missing_packaged_engine_reason has returned None for every engine since serving was limited to Lemonade and vLLM, so the three branches that acted on its answer never ran: resolve_engine_binary_path never bailed on it, and the two sites in the examine report never printed an "unavailable reason" row or a "note:" line. They fall through to the arms that already ran, so the rendered output and the engine resolution are unchanged. The function, its test and the dead branches are removed. No engine is currently deferred, so a real rule would only add user-visible text with no use; one can be introduced when an engine is actually deferred. The engine_ipc.rs and examine_report_text.rs module docs, the docs/architecture.md entries and the focused test list in docs/testing.md no longer name it. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Removes dead/duplicated engine-inventory and “missing packaged engine” logic from rocm/rocmd, and updates docs/tests to align with the single remaining inventory source.
Changes:
- Consolidated
rocmbuilt-in engine inventory to usemain.rs::engine_inventory()and removed the duplicate table frombridge_snapshot.rs. - Deleted dead
rocmdtest-only plugin-discovery helper/test and removed a no-opdaemon_binary_path()call. - Removed
missing_packaged_engine_reasonand its unreachable branches, updating related docs.
| File | Description |
|---|---|
| docs/testing.md | Removes the deleted test from the “focused test list”. |
| docs/architecture.md | Updates module inventory documentation to reflect the removed helpers/tables. |
| apps/rocmd/src/supervise.rs | Removes unused import and a no-op call. |
| apps/rocmd/src/common.rs | Deletes test-only helper and its test that only exercised it. |
| apps/rocm/src/main.rs | Removes missing_packaged_engine_reason and updates the --engine help sync test to use engine_inventory(). |
| apps/rocm/src/examine_report_text.rs | Removes unreachable output branches and drops the removed symbol import. |
| apps/rocm/src/engine_ipc.rs | Removes unreachable bail-out branch and drops the removed symbol import. |
| apps/rocm/src/bridge_snapshot.rs | Switches to engine_inventory() and removes the duplicate inventory table. |
Review effort: Lite
nowycondro
left a comment
There was a problem hiding this comment.
🤖 Automated review (Claude Code) · 2bab02e
This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.
Review — no blocking findings
Full review of the whole change (3 commits, 8 files, +32/-133).
Implements ROCMAI-848 (Phase 8.1-H step 2 of 7, items 8/9/10) in full — the ticket's scope (consolidate the duplicate engine-inventory table, delete the dead rocmd test-only helper and no-op call, delete the always-None missing_packaged_engine_reason) matches the three commits exactly, and the PR's "Completes ROCMAI-848" claim holds.
Blocking
None
Non-blocking
None
Decisions for the author
None
Positive signals
- The two previously-duplicated engine-inventory tables were verified byte-for-byte identical (
bridge_snapshot.rs's deletedbuiltin_engine_inventory()vs.main.rs's survivingengine_inventory()— same three(id, summary)tuples), so the consolidation is a genuine no-op, not just an assumed one. - The
serve --enginehelp-sync test was repointed at the survivingengine_inventory()rather than dropped, so it now covers every reader of the table instead of only the deleted copy — a widening of coverage through the refactor, not a narrowing. - Deleting the
rocmd-sidefind_engine_plugin_binarytest helper does not drop real coverage: that helper and its test were the only reference todiscover_engine_plugins/platform_engine_plugin_binary_nameanywhere in therocmdcrate, so no production path inrocmdloses test coverage (plugin-binary resolution for therocmbinary is a separate, untouched function inengine_ipc.rs).
Deployment notes
- No CI check-runs exist yet for this head commit (
get_check_runsreturns 0; the only status is a passing Read-the-Docs preview build) — the required Rust gates (build-and-test, clippy, coverage, e2e-cucumber) have not reported one way or the other as of this review. Don't read this report as a substitute for green CI. coverage-floors.tomlwas not touched even though two tests were deleted alongside the dead code they covered (missing_packaged_engine_reason_has_no_deferred_first_party_engines,engine_plugin_discovery_finds_runtime_binary). The ticket's own rule only requires a re-bless commit message if one turns out to be needed, and the deleted branches were unreachable (hence uncovered) lines, so the net effect on the floor is plausibly a wash or slight improvement — but this wasn't run here, so letcargo xtask coveragebe the actual gate before merging rather than assuming it clears.
What this covered
Every file in the diff read in full (apps/rocm/src/{bridge_snapshot,engine_ipc,examine_report_text,main}.rs, apps/rocmd/src/{common,supervise}.rs, docs/architecture.md, docs/testing.md), via three independent fan-out passes: (1) the rocm-crate engine-inventory/dead-branch cluster, (2) the rocmd/docs cluster, (3) repo-wide impact analysis (grep for the three removed symbol names across the whole tree, tests/e2e-cucumber/ for any dependency on the removed output strings, git history for the removed symbols, and CI/check status) plus an agent-instruction (AGENTS.md) adherence check. All three passes, plus my own direct verification of the inventory-table equality and the rocmd coverage question, came back clean. Reviewed against base a537f1a9281264a7f4cdd85e9fe757c529e76ec5 → head 2bab02e7b6519fe47cc99ad3398285c3acddfa6b.
Did not run: cargo test/cargo clippy/cargo xtask coverage locally (no Rust toolchain in this environment) — correctness of the removed-branch claims was established by reading the call sites and control flow directly rather than by executing them. History and prior-review passes found nothing: the removed functions have a clean, well-documented lineage (missing_packaged_engine_reason traced to "Limit serving engines to Lemonade and vLLM (#79)", matching the PR's stated rationale) with no pending-reuse markers in any of the ~30 other open PRs checked. Not reconciled against the two existing Copilot review comments on this PR (both are grammar nitpicks on a doc comment, already surfaced there).
🤖 Generated with Claude Code
juhovainio
left a comment
There was a problem hiding this comment.
The change reads correctly to me: the removed branches in engine_ipc.rs and examine_report_text.rs were unreachable because the stub always returned None, so examine output should be unchanged, and the diff stays within ROCMAI-848's items 8-10 and its doc list.
I'm requesting changes for one reason: there are no CI results on this head commit. Only the Read the Docs check has reported. There is no clippy, test, coverage, commit-signatures or e2e result, and the PR description says the tests, cargo xtask checks and coverage floors were not run. The ticket asks for the existing tests to show examine output is unchanged, so that evidence is still missing. Please get the workflows running (or run the gate locally and paste the results) and I'll take another look.
Two smaller things:
- Two tests were deleted along with the code they covered. Please confirm
cargo xtask coveragestill passes againstcoverage-floors.toml; if a floor does drop, say so in the commit rather than re-blessing silently. - Small wording nit in
docs/architecture.md(inline).
I did not check that the deleted table is identical to main.rs's engine_inventory(), since that table is not in the diff; I'm taking the ticket's word on that.
| - [`automations.rs`](../apps/rocm/src/automations.rs) — mechanical relocation, owns private types (Phase 6f, ROCMAI-210): the `rocm automations` dispatch handler (`automations()`) plus the `rocm automations` status report it prints (`render_automations_text`), the `ProposalKind` classification that report renders through (`proposal_kind`, `fallback_tool_for_automation_action`, `proposal_plain_summary`, `proposal_plain_reason`), the small plain-language label helpers (`proposal_status_label`, `proposal_bool_argument`, `automation_event_plain_summary`, `audit_event_plain_summary`, `watcher_mode_plain_label`, `watcher_last_check`, `watcher_plain_name`, `watcher_plain_trigger`, `watcher_plain_action`, `watcher_policy_note`), and the unrelated `rocm daemon --status` summary (`render_daemon_text`). `render_automations_text` and `render_daemon_text` are `pub(crate)`: [`main.rs`](../apps/rocm/src/main.rs)'s `dispatch()` calls `render_daemon_text` directly (re-imported alongside `automations` via `use crate::automations::{automations, render_daemon_text};`; `render_automations_text` has no `dispatch()` call site of its own, reached only through `automations()` above, now local to this file), and [`chat.rs`](../apps/rocm/src/chat.rs)'s deterministic tool summaries call both. Every other item in this list, including `watcher_policy_note` (called from `automations()`'s `Enable` arm and from `render_automations_text`, both in this same file), has no caller outside this module and stays private. The cluster's regression tests live in this module's own `mod tests`, reaching the shared `test_paths` fixture through `crate::tests::` the same way other mechanically relocated modules do. | ||
| - [`bootstrap.rs`](../apps/rocm/src/bootstrap.rs) — a further-extracted variant of full domain extraction: it owns its clap command enum (`BootstrapCommand`) and dispatch function too, rather than leaving them in [`main.rs`](../apps/rocm/src/main.rs). | ||
| - [`bridge_snapshot.rs`](../apps/rocm/src/bridge_snapshot.rs) — mechanical relocation, no owned types: the host snapshot behind the internal bridge surface (`build_codex_bridge_snapshot`, `build_codex_bridge_gpu_snapshot`, `builtin_codex_bridge_engine_inventory`) and the table of built-in engine ids it derives the engine list from (`builtin_engine_inventory`, a separate table from `main.rs`'s `engine_inventory`; the two are not merged). All four are `pub(crate)`: [`main.rs`](../apps/rocm/src/main.rs)'s `dispatch()` calls `build_codex_bridge_snapshot` through a re-import, [`chat.rs`](../apps/rocm/src/chat.rs)'s internal MCP tools reach the first three as `crate::<name>` through the same re-import, and a `main.rs` test checks `--engine`'s help against `builtin_engine_inventory`. It has no tests of its own. | ||
| - [`bridge_snapshot.rs`](../apps/rocm/src/bridge_snapshot.rs) — mechanical relocation, no owned types: the host snapshot behind the internal bridge surface (`build_codex_bridge_snapshot`, `build_codex_bridge_gpu_snapshot`, `builtin_codex_bridge_engine_inventory`) and derives the engine list from `main.rs`'s `engine_inventory`, the single table of built-in engine ids that `rocm examine`, `rocm update` and the `--engine` help test read as well. All three are `pub(crate)`: [`main.rs`](../apps/rocm/src/main.rs)'s `dispatch()` calls `build_codex_bridge_snapshot` through a re-import, [`chat.rs`](../apps/rocm/src/chat.rs)'s internal MCP tools reach them as `crate::<name>` through the same re-import. It has no tests of its own. |
There was a problem hiding this comment.
Nit: the edited sentence now runs "the host snapshot behind the internal bridge surface (...) and derives the engine list from main.rs's engine_inventory", and "derives" has no clear subject (the snapshot doesn't derive anything; the module does). Something like "...surface (...), whose engine list is derived from main.rs's engine_inventory, the single table of built-in engine ids that ..." would read cleanly.
There was a problem hiding this comment.
Reworded in 091d923: the sentence now says the host snapshot behind the internal bridge surface is one "whose engine list is derived from main.rs's engine_inventory", so the subject of "derived" is clear.
There was a problem hiding this comment.
Already addressed in 091d923, pushed after this comment: the bridge_snapshot entry now reads "..., whose engine list is derived from main.rs's engine_inventory, the single table of built-in engine ids that rocm examine, rocm update and the --engine help test read as well." I checked the claim against the code: bridge_snapshot.rs, examine_report_text.rs, update_cmd.rs and the serve_engine_help_lists_match_engine_inventory test all read engine_inventory().
…engine-code Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Correct 'help read too' to 'help reads too' in the bridge_snapshot module doc, and reword the bridge_snapshot entry in docs/architecture.md so the engine list's origin has a clear subject: 'whose engine list is derived from main.rs's engine_inventory'. Wording only, no code change. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
Pushed 091d923 (main merged in, plus the two wording fixes from review), which starts the full CI lanes on this head; before this push only the docs build had run because no workflow had triggered for the branch. I also ran the checks locally and put the results in the description: fmt, clippy, |
…engine-code Signed-off-by: Jussi Elo <jussi.elo@amd.com> # Conflicts: # docs/architecture.md
|
Pushed 56424ef, which merges |
juhovainio
left a comment
There was a problem hiding this comment.
Looks good. The three removals are each behavior-neutral:
- The two engine tables were identical at the base commit.
bridge_snapshotand the--enginehelp sync test now readengine_inventory, so one sync test covers every reader. missing_packaged_engine_reasonreturnedNoneunconditionally, so the three branches that acted on it were unreachable.- In
rocmd,find_engine_plugin_binarywascfg(test)-only and thedaemon_binary_path()call discarded its result. Therocm_engine_protocoldependency and crate edges are unaffected.
No references to the removed names remain in docs, README, skills, tests or e2e features, and CI is green. One cosmetic nit inline.
Non-blocking, outside the diff: the comment in tests/e2e-cucumber/features/examine.feature still says render_engine_inventory_text_with_paths lives in main.rs.
| //! crate root — `with_sigpipe_ignored`, `device_policy_name`, | ||
| //! `missing_packaged_engine_reason` — stay in `main.rs` and are reached | ||
| //! crate root — `with_sigpipe_ignored` and `device_policy_name` — stay in | ||
| //! `main.rs` and are reached |
There was a problem hiding this comment.
Nit: this rewrap leaves a short orphan line (main.rs and are reached). Reflowing the paragraph would tidy it.
There was a problem hiding this comment.
Reflowed the paragraph so the short orphan line is gone (0db18a4).
…pointer Reflow the paragraph in the engine_ipc.rs module doc whose earlier rewrap left a short orphan line. In examine.feature, the comment on examine-14 named main.rs as the home of render_engine_inventory_text_with_paths; it and append_examine_engine_inventory both live in examine_report_text.rs, so say that. Comments only, no code change. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
Thanks for the approval. Pushed 0db18a4, which changes comments only: it reflows the |
Signed-off-by: Jussi Elo <jussi.elo@amd.com> # Conflicts: # docs/architecture.md
Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Signed-off-by: Jussi Elo <jussi.elo@amd.com>
|
Merged |
Resolved the conflicts in examine_report_text.rs and docs/architecture.md by taking main's split (the model catalog renderer now lives in model_catalog_text.rs) and re-applying this branch's removal of missing_packaged_engine_reason there, including its call in the per-engine support listing. Signed-off-by: Jussi Elo <jussi.elo@amd.com>

Why
A closing audit of the modularization work found three pieces of dead or duplicated code in the
rocmandrocmdbinaries that the move-only changes could not carry.main.rsandbridge_snapshot.rseach held an identicalconst fntable of the built-in engine ids and summaries.rocmdkept a helper that was compiled only undercfg(test)and called only by its own test, plus a call whose result was discarded. Andmissing_packaged_engine_reasonreturnedNonefor every engine, yet three call sites still branched on its answer. This is part of the follow-up work from that audit. Completes ROCMAI-848.What changes
Three commits, one per item, so each can be reviewed or dropped on its own. After them come a merge of
origin/mainand a wording-only commit that answers the review nits.The first keeps one engine table.
builtin_codex_bridge_engine_inventoryinbridge_snapshot.rsnow readsmain.rs'sengine_inventory(), the table thatrocm examineandrocm updatealready use, andbuiltin_engine_inventoryis deleted. The two tables were identical at this PR's base commit (1b06c9e): the body ofbuiltin_engine_inventoryinbridge_snapshot.rsand the body ofengine_inventory()inmain.rshash to the same value when extracted withgit showand compared (three(id, summary)tuples forlemonade,vllmandaim, byte for byte), so the consolidation cannot change what the bridge snapshot reports. Themain.rstest that checks theserve --enginepossible values against the inventory now compares against the surviving table, so it covers every reader instead of only the bridge snapshot's copy. Thebridge_snapshot.rsmodule doc and thedocs/architecture.mdentry no longer say the two tables are kept separate. The separaterocmd_engine_inventoryinrocmdis untouched:rocmdcannot depend onrocm, so that table is a different case and not part of this item.The second deletes
common::find_engine_plugin_binaryfromrocmd, which existed only undercfg(test)and was used only by its own test, together with that test and the three test-only imports it needed. It also removes thelet _ = daemon_binary_path();line insupervise_service. That function only reads the current executable path and checks sibling files, with no writes or other side effects, so the line did nothing, and its import goes with it. Therocmcrate's own privatefind_engine_plugin_binaryinengine_ipc.rsis a different function and is untouched.The third deletes
missing_packaged_engine_reason. It has returnedNonefor every engine since serving was limited to Lemonade and vLLM, so the three branches that acted on its answer never ran:resolve_engine_binary_path_with_pathsnever bailed on it, and the two sites in the examine report never printed anunavailable reason=row or anote:line. They fall through to the arms that already ran today, so the engine resolution and the rendered output are unchanged. The function, its test and the dead branches are removed, and the module docs ofengine_ipc.rsandexamine_report_text.rs, thedocs/architecture.mdentries and the focused test list indocs/testing.mdno longer name it. Giving it a real rule instead was considered and rejected: no engine is deferred, so a rule would only add user-visible text with no use, and one can be introduced when an engine is actually deferred.The branch has since been brought up to date with
origin/mainby signed merge commits (no rebase, so the history of the three commits and the earlier review stay intact), and one further commit,docs: fix the wording nits from review, fixes two review nits: "help read too" is now "help reads too" in thebridge_snapshot.rsmodule doc, and thebridge_snapshot.rsentry indocs/architecture.mdnow says the module's engine list "is derived frommain.rs'sengine_inventory" instead of a clause with no subject. The latest merge oforigin/main(which brought in the change that moved the engine runtime and env-root helpers intoengine_install_env.rs) had one conflict, indocs/architecture.md: main added theengine_install_env.rsentry directly above theengine_ipc.rsentry this PR rewords. It was resolved by keeping both, main's new entry and this PR'sengine_ipc.rsentry without themissing_packaged_engine_reasonclause; no code conflicted, and none of the code main's change touched calls the symbols this PR removes.Verification
Run locally on the merged tip (the latest merge of
origin/main; the test count is unchanged at 1639 after that merge, and the coverage figures below were measured before it):cargo fmt --all --check: clean.cargo clippy -p rocm -p rocmd --all-targets -- -D warnings: clean.cargo test -p rocm -p rocmd --no-fail-fast: 1639 passed, 0 failed, 9 ignored across the nine test binaries.cargo test -p rocm advised_commands: 20 passed, 1 ignored.examine_report_text,engine_ipc,engine_inventoryandserve_enginepass, includingexamine_engine_inventory_*,render_engine_inventory_text_*,engine_plugin_discovery_*andserve_engine_help_lists_match_engine_inventory. None of them was edited by this PR except the help-sync test, which now reads the surviving table.cargo xtask manifest --checkandcargo xtask check-crate-edges: both pass.rocmandrocmdonorigin/mainagainst this tip differs by exactly the two tests this PR deletes (missing_packaged_engine_reason_has_no_deferred_first_party_engines, andengine_plugin_discovery_finds_runtime_binaryinrocmd;engine_ipc::tests::engine_plugin_discovery_finds_runtime_binaryinrocmis a different test and is still there). Nothing else was added or lost.cargo llvm-cov --no-cfg-coverage --locked -p rocm -p rocmdaftercargo llvm-cov clean --workspace, onorigin/mainand on this tip:rocm83.67% (52018 of 62169 lines) on main and 83.68% (51994 of 62131) here;rocmd83.20% (7715 of 9273) on main and 83.15% (7687 of 9245) here. Both movements are well inside the 0.2 point tolerance, and both crates sit far above their committed floors (77.13 forrocm, 75.36 forrocmd), so no floor is breached and nothing was re-blessed. These come from a two-package run rather than the workspace-widecargo xtask coverage, so the absolute figures are not the ones that command prints; the comparison between main and this tip is like for like. The workspace-widecargo xtask coverageis left to CI.apps/,crates/,docs/,skills/and the top-level markdown finds nothing left except the unrelated privatefind_engine_plugin_binaryinengine_ipc.rs. A leak scan of the diff againstorigin/mainand a conflict-marker grep are clean.Each surviving examine path is the arm that already ran, so the argument that the examine output is unchanged rests on reading the three call sites together with the unchanged examine tests passing, not on a before and after run of the binary.
Not run
cargo xtask coverageover the whole workspace,scripts/smoke_local.py, thetests/e2e-cucumbersuite and the Windows lane were not run locally; CI carries them and starts fresh with the push of the merge commit.Overlaps and scope
Open PRs #826 and #857 touch
main.rsand #854 touchesengine_ipc.rs(#836, #838 and #872 have merged and are already part of the merge oforigin/mainhere), so a conflict is likely for whichever lands second; the edits here are small and local, and thedocs/architecture.mdlines they touch are different from those. No user-visible behavior changes, so no new scenario is needed: the branches removed from the examine report were unreachable, and the existing examine tests, which render both the engine inventory and the per-engine adapter rows, are unchanged by this PR and are the ones that would show a difference if the output moved.