test(rpc): cover hardware discovery conversions - #4060
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughAdds comprehensive tests for hardware discovery conversion boundaries, including compatibility handling, parsing and validation, nested discovery data, inventory mappings, and NVLink conversions in both directions. ChangesHardware discovery conversion coverage
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full_review, thanks! |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/rpc/src/model/hardware_info.rs (1)
1054-1068: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the
#[allow(deprecated)]LLDP helpers. Both helpers suppress a lint the repo enforces as an error and depend on the deprecatedip_addressfield; verify the conversion still targets that field and, if required, scope/document the allow rather than leaving it broad. As per coding guidelines: "avoid#[allow(...)]".
crates/rpc/src/model/hardware_info.rs#L1054-L1068: justify or migraterpc_lldpoff the deprecatedip_addressfield; narrow the allow if the field is genuinely needed.crates/rpc/src/model/hardware_info.rs#L1096-L1106: apply the same treatment toproject_rpc_lldp, which reads the deprecatedip_addressfield.🤖 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/rpc/src/model/hardware_info.rs` around lines 1054 - 1068, Consolidate the deprecated LLDP handling in rpc_lldp and project_rpc_lldp: verify both helpers still construct the deprecated ip_address field, migrate to the replacement field when available, or retain a narrowly scoped, documented allow only around the required field usage. Remove the broad helper-level #[allow(deprecated)] attributes and apply the same treatment at both sites in crates/rpc/src/model/hardware_info.rs:1054-1068 and 1096-1106.Source: Coding guidelines
🤖 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/rpc/src/model/hardware_info.rs`:
- Around line 1054-1068: Consolidate the deprecated LLDP handling in rpc_lldp
and project_rpc_lldp: verify both helpers still construct the deprecated
ip_address field, migrate to the replacement field when available, or retain a
narrowly scoped, documented allow only around the required field usage. Remove
the broad helper-level #[allow(deprecated)] attributes and apply the same
treatment at both sites in crates/rpc/src/model/hardware_info.rs:1054-1068 and
1096-1106.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e181c600-d177-40d0-87ba-024116aef2ca
📒 Files selected for processing (1)
crates/rpc/src/model/hardware_info.rs
Exercise the RPC hardware-discovery conversion surface through direction-specific table-driven cases. Cover sparse, populated, invalid, compatibility, and nested projection behavior without changing production code. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
#4060 added comprehensive RPC hardware-discovery conversion tests using the original three-field `NvmeDevice`. #3717 independently added the optional `size_mb` and `pci_path` fields. Its tested branch did not contain #4060. When #3717 was subsequently squash-merged after #4060, Git combined the changes without a textual conflict, but the resulting test struct initializers were incomplete. This caused `make verify` to fail while compiling the `carbide-rpc` library tests. Update the RPC and model fixtures with representative NVMe capacity and PCI-path values. Include both fields in the test projections so the existing tests verify that they survive RPC-to-model and model-to-RPC conversion. ## Related issues #4060 #3717 ## Type of Change - [ ] **Add** - New feature or capability - [ ] **Change** - Changes in existing functionality - [x] **Fix** - Bug fixes - [ ] **Remove** - Removed features or deprecated functionality - [ ] **Internal** - Internal changes (refactoring, tests, docs, etc.) ## Breaking Changes - [ ] **This PR contains breaking changes** ## Testing - [x] Unit tests added/updated - [ ] Integration tests added/updated - [ ] Manual testing performed - [ ] No testing required (docs, internal refactor, etc.) ## Additional Notes Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
Summary
hardware_info.rs.Coverage
Production code in
crates/rpc/src/model/hardware_info.rs:The model-feature RPC suite grows from 117 to 128 tests. The new coverage is organized as 11 table-driven tests with 29 named cases.
The six remaining uncovered production lines are
Some(Err(error))arms behind nested converters that are currently infallible. The surrounding optional and successful paths are covered directly.Validation
cargo test -p carbide-rpc --features model hardware_info::tests --libcargo test -p carbide-rpc --features model --libcargo test -p carbide-rpc --all-features --libcargo make format-nightlycargo make clippycargo make carbide-lintsCloses #4037