Skip to content

feat(api-web): support exact health-alert filtering on managed-host page#3489

Open
RajMandaliya wants to merge 5 commits into
NVIDIA:mainfrom
RajMandaliya:feat/health-alert-exact-filter
Open

feat(api-web): support exact health-alert filtering on managed-host page#3489
RajMandaliya wants to merge 5 commits into
NVIDIA:mainfrom
RajMandaliya:feat/health-alert-exact-filter

Conversation

@RajMandaliya

Copy link
Copy Markdown
Contributor

Addresses #3429.

Problem

The existing health-alerts-filter on the managed-host page only
supports a binary toggle — "healthy" / "unhealthy" — checking whether
health_probe_alerts is empty or not. It never matches against a
specific alert. Operators affected by the same alert (e.g. a specific
BMC or sensor issue) have to manually inspect each host individually to
find others affected by it.

Fix

  • Extends the filter to also support exact matching against
    HealthProbeAlert.id.
  • The filter dropdown is now dynamically populated with every distinct
    alert ID currently active across machines, following the same
    pattern already used for the vendor/model/GPU filters.
  • Existing URL query-param persistence (?health-alerts-filter=...)
    required no changes — it already worked generically.
  • Added a clear "No machines match the selected filters." message for
    the zero-results case, which previously rendered an empty table with
    no explanation, for any filter.

Testing

  • Added two new tests: one confirming exact-match filtering returns
    only the host with the matching alert (not a healthy host), and one
    confirming the empty-state message renders when nothing matches.
  • Full carbide-api-web test suite passes (39 tests), including after
    merging in a large upstream main update (482 files) to make sure
    nothing regressed.

RajMandaliya and others added 4 commits July 8, 2026 12:58
Keeping Pace with original repo
The existing health-alerts-filter only supported a binary healthy/
unhealthy toggle, checking whether health_probe_alerts was empty or
not -- it never matched against a specific alert ID. Extends the
filter to also support exact matching against HealthProbeAlert.id,
with the dropdown dynamically populated from every distinct alert ID
currently active across machines (same pattern already used for the
vendor/model/GPU filters).

Also adds a clear empty-state message ('No machines match the
selected filters.') for the zero-results case, which previously
rendered an empty table with no explanation for any filter.

Addresses NVIDIA#3429.

Signed-off-by: RajMandaliya <rajmandaliya2249@gmail.com>
@RajMandaliya RajMandaliya requested a review from a team as a code owner July 14, 2026 17:09
@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2836e2b2-9ad6-44af-9ce8-2ac20ba31b45

📥 Commits

Reviewing files that changed from the base of the PR and between fb98783 and 70b4bec.

📒 Files selected for processing (2)
  • crates/api-web/src/tests/managed_host.rs
  • crates/api-web/templates/managed_host_individual_table.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/api-web/src/tests/managed_host.rs

Summary by CodeRabbit

  • New Features

    • Health filtering now includes all alert types detected across managed hosts, shown as selectable options in the Health dropdown.
    • Added support for filtering managed hosts by a specific health alert ID.
  • Bug Fixes

    • Added an empty-state message when no managed hosts match the selected filters.
    • Ensures the selected health-alert filter remains correctly applied and reflected in the interface.
  • Tests

    • Added integration tests covering health-alert filtering behavior for managed-host listings.

Walkthrough

The managed-host view now discovers available health alert IDs, filters hosts by matching alert IDs, renders dynamic filter options, and displays an explicit empty state when no hosts match.

Changes

Managed host health-alert filtering

Layer / File(s) Summary
Health alert collection and filtering
crates/api-web/src/managed_host.rs, crates/api-web/templates/managed_host_show.html
The endpoint collects sorted health alert IDs, filters hosts by matching alert IDs, passes them to the template, and renders dynamic filter options.
Empty filtered-result rendering and validation
crates/api-web/templates/managed_host_individual_table.html, crates/api-web/src/tests/managed_host.rs
The host table displays an empty-state row when no hosts match, with integration coverage for matching and unmatched health-alert filters.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant show_html
  participant managed_host_show_html
  Browser->>show_html: request health-alerts-filter
  show_html->>show_html: collect alert IDs and filter hosts
  show_html->>managed_host_show_html: render hosts and dynamic alert IDs
  managed_host_show_html-->>Browser: filtered table and filter options
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: exact health-alert filtering on the managed-host page.
Description check ✅ Passed The description is directly aligned with the implemented exact filtering, dynamic dropdown, empty state, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@crates/api-web/src/tests/managed_host.rs`:
- Around line 377-399: The managed-host filter test should also verify that the
dynamic health-alert option is rendered and selected. In the test around the
response body assertions, confirm that the body contains the
IntrusionSensorTriggered option with its selected state, while preserving the
existing host-row assertions.

In `@crates/api-web/templates/managed_host_individual_table.html`:
- Around line 25-27: Update the empty-state row in the hosts table, using the
surrounding maintenance-mode condition, to render colspan="11" in maintenance
mode and colspan="12" otherwise. Replace the current fixed colspan="15" while
preserving the existing no-hosts message and row structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 944d2729-bf88-45b4-bc80-e085acb031c0

📥 Commits

Reviewing files that changed from the base of the PR and between b2ab553 and fb98783.

📒 Files selected for processing (4)
  • crates/api-web/src/managed_host.rs
  • crates/api-web/src/tests/managed_host.rs
  • crates/api-web/templates/managed_host_individual_table.html
  • crates/api-web/templates/managed_host_show.html

Comment thread crates/api-web/src/tests/managed_host.rs
Comment thread crates/api-web/templates/managed_host_individual_table.html
- Match empty-state colspan to actual table column count (12 normally,
  11 in maintenance mode) instead of a fixed 15.
- Strengthen the exact-filter test to assert the dynamic alert ID
  actually renders as the selected dropdown option, not just that
  filtering excludes/includes the right hosts.

Signed-off-by: RajMandaliya <rajmandaliya2249@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant