refactor(api-core): hide service runtime assembly#3870
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Summary by CodeRabbit
WalkthroughThe runtime startup path now uses a two-phase prelude and injected runtime inputs. api-core constructs Redfish pools internally, while api wires the new bootstrap contract and updates dependencies and comments. ChangesRuntime startup refactor
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ApiRun as crates/api::run
participant Bootstrap as api-core::bootstrap
participant Setup as api-core::setup
participant Pools as Redfish pools
ApiRun->>Bootstrap: start_runtime_prelude(config, logging, join_set, cancel_token)
Bootstrap-->>ApiRun: RuntimePrelude
ApiRun->>Bootstrap: start_runtime(RuntimeInputs)
Bootstrap->>Setup: start_runtime(prepared inputs, dynamic_settings)
Setup->>Pools: Create shared Redfish and NV Redfish pools
Pools-->>Setup: Pool handles
Setup-->>Bootstrap: Runtime result
Bootstrap-->>ApiRun: Runtime result
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
36180cf to
c13620d
Compare
Move dynamic-settings and Redfish setup behind the private api-core runtime. Replace CoreRunInputs/run_core with RuntimeInputs/start_runtime so the API composition crate passes prepared resources without owning service assembly. Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
c13620d to
5526c0f
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/api-core/src/setup.rs (1)
135-187: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDeprecated-config migration logic is correct; one minor logging gap.
Verified the match is exhaustive and each branch leaves
bmc_proxyin a consistent state. One nit: the(Some(_), _, Some(_))arm only warns aboutoverride_target_ipwhenoverride_target_portis simultaneously set and ignored too — the operator isn't told about the second stale field. Not blocking given the low practical impact.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/api-core/src/setup.rs` around lines 135 - 187, Update the `(Some(_), _, Some(_))` branch in `create_redfish_pool` so its warning also identifies the deprecated `site_explorer.override_target_port` when that field is present and ignored, while preserving the existing behavior for absent ports and configured `bmc_proxy`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/api-core/src/setup.rs`:
- Around line 135-187: Update the `(Some(_), _, Some(_))` branch in
`create_redfish_pool` so its warning also identifies the deprecated
`site_explorer.override_target_port` when that field is present and ignored,
while preserving the existing behavior for absent ports and configured
`bmc_proxy`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8508c479-5b3f-4cb2-b972-c4949e4ae368
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
crates/api-core/Cargo.tomlcrates/api-core/src/bootstrap.rscrates/api-core/src/lib.rscrates/api-core/src/run.rscrates/api-core/src/setup.rscrates/api/src/main.rscrates/api/src/run.rs
💤 Files with no reviewable changes (2)
- crates/api-core/src/lib.rs
- crates/api-core/src/run.rs
Reduce the public surface and clarify the boundary of carbide-api-core by keeping service runtime assembly private while exposing a narrow bootstrap interface to the carbide-api composition crate.
This is the fourth change in the series:
This PR replaces the thin run boundary adapter with RuntimeInputs and start_runtime in the existing hidden bootstrap module. Dynamic settings and Redfish client setup remain internal to api-core, alongside API construction, controller startup, listener startup, and readiness signaling.
The existing startup behavior and configuration handling are preserved. Dependencies no longer used by api-core are removed, while test-only dependencies move to dev-dependencies.
Related issues
#3851
#3860
#3864
Type of Change
Breaking Changes
Testing
Additional Notes
This PR is stacked on #3864 and should merge after it.