Fix No-DPF warning message for zero-dpu deployments#2664
Conversation
We recently started rendering a warning if none of the hosts have dpf_used_for_ingestion set, but this emits a false positive if the host has no DPU's at all. Fix that by not warning on zero-DPU hosts.
Summary by CodeRabbit
WalkthroughIn ChangesDPF Warning Condition Refinement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/api-web/src/managed_host.rs (1)
618-620: ⚡ Quick winAdd a regression test matrix for the DPF warning predicate.
This fix is correct, but it should be locked with a table-driven test covering at least:
(dpus=0, used_for_ingestion=false) -> no warning,(dpus>0, used_for_ingestion=false) -> warning,(dpus>0, used_for_ingestion=true) -> no warning.As per coding guidelines, “Prefer table-driven tests for any function that maps inputs to outputs, errors, or other observable results.”
🤖 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-web/src/managed_host.rs` around lines 618 - 620, The DPF warning predicate logic in the has_dpf_warning variable assignment needs to be covered by a table-driven regression test. Create a test function that uses a table (slice of structs or tuples) to verify the warning condition logic with at least three test cases: one where dpus is empty and dpf_used_for_ingestion is false (should not warn), one where dpus is not empty and dpf_used_for_ingestion is false (should warn), and one where dpus is not empty and dpf_used_for_ingestion is true (should not warn). Each test case should validate the boolean result of the predicate !h.dpus.is_empty() && !h.dpf_used_for_ingestion against the expected warning outcome.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/api-web/src/managed_host.rs`:
- Around line 618-620: The DPF warning predicate logic in the has_dpf_warning
variable assignment needs to be covered by a table-driven regression test.
Create a test function that uses a table (slice of structs or tuples) to verify
the warning condition logic with at least three test cases: one where dpus is
empty and dpf_used_for_ingestion is false (should not warn), one where dpus is
not empty and dpf_used_for_ingestion is false (should warn), and one where dpus
is not empty and dpf_used_for_ingestion is true (should not warn). Each test
case should validate the boolean result of the predicate !h.dpus.is_empty() &&
!h.dpf_used_for_ingestion against the expected warning outcome.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3a22b01b-dfab-4bf7-afee-f13b1e5fd15f
📒 Files selected for processing (1)
crates/api-web/src/managed_host.rs
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
We recently started rendering a warning if none of the hosts have dpf_used_for_ingestion set, but this emits a false positive if the host has no DPU's at all. Fix that by not warning on zero-DPU hosts.
Type of Change
Breaking Changes
Testing
Additional Notes