Skip to content

fix(alerts): align timeline client with API contract - #37

Merged
jingxiang-z merged 4 commits into
mainfrom
fix/alert-timeline-contract
Aug 6, 2026
Merged

fix(alerts): align timeline client with API contract#37
jingxiang-z merged 4 commits into
mainfrom
fix/alert-timeline-contract

Conversation

@jingxiang-z

@jingxiang-z jingxiang-z commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Checklist

Summary by CodeRabbit

  • New Features
    • Added API endpoints for platform information, node-removal policies, and available commands.
    • Enhanced alert timelines with summary, node, describe, and options views; filtering, sorting, pagination, and richer details.
    • Added JSON output with aggregate counts, pagination data, incidents, timestamps, metadata, and status information.
  • Bug Fixes
    • Improved validation for timeline filters, sorting, states, and pagination.
    • Preserved aggregate counts and normalized pagination across output modes.
  • Documentation
    • Updated CLI workflows and documented alert timeline filter options in the CLI and SDK guides.

Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

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: 0b2dc08a-ba67-4c2e-a088-9d30e44853a9

📥 Commits

Reviewing files that changed from the base of the PR and between 4c63d15 and 784a3b3.

📒 Files selected for processing (3)
  • cmd/nvfleetint/alert.go
  • cmd/nvfleetint/alert_test.go
  • docs/CLI.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/nvfleetint/alert_test.go

📝 Walkthrough

Walkthrough

The OpenAPI specification adds four operations. The alert timeline SDK and CLI add filtering, sorting, pagination, enriched response fields, aggregate preservation, JSON normalization, table output, and validation.

Changes

External API specification

Layer / File(s) Summary
New API operations
api/openapi/openapi.yaml
Adds GET /v1/info, GET and PUT /v1/node_removal_policy, and GET /v2/commands with request, response, and error declarations.

Alert timeline expansion

Layer / File(s) Summary
Timeline contracts and response fields
nvfleetint/alert.go
Adds timeline enums, filters, sorting, pagination options, aggregate counts, node metadata, alert details, and incident data.
SDK request and response handling
nvfleetint/alert.go, nvfleetint/alert_test.go
Maps options to API parameters, adds filter-option retrieval, preserves aggregate data, decodes enriched responses, copies incident slices, and validates options.
CLI commands, output, and documentation
cmd/nvfleetint/alert.go, cmd/nvfleetint/alert_test.go, docs/CLI.md, docs/SDK.md
Replaces timeline with summary, node, and options; forwards filters and pagination; normalizes JSON; updates tables; and documents filter options.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as nvfleetint CLI
  participant SDK as nvfleetint.Client
  participant API as Alert Timeline API
  CLI->>SDK: Submit timeline options
  SDK->>API: Send filters, sorting, and pagination
  API-->>SDK: Return timeline data and aggregates
  SDK-->>CLI: Return typed timeline response
Loading

Possibly related PRs

Suggested reviewers: ooolafhu, moyaz-nvidia, emilyzhangbg

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: updating the alerts timeline client to match the API contract.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/alert-timeline-contract

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@cmd/nvfleetint/alert.go`:
- Around line 322-333: Normalize pagination once in the shared --all handling
before branching into impacted-node and node-alert timeline output, converting
API page 0 to CLI page 1 for both modes. Reuse the normalized pagination in the
node-alert JSON path instead of passing result directly, and add coverage for
--all --output json node alerts.

In `@nvfleetint/alert.go`:
- Around line 522-529: Update validateDescribeAlertTimelineOptions to reject
pagination values outside the supported 1..100 range before requests are sent:
validate opts.Page when provided and opts.PageSize when provided, while
preserving the existing page/page-size dependency and order validation behavior.
🪄 Autofix

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: f6b9a48a-cc8f-45c7-b07b-b60ec97c7a2b

📥 Commits

Reviewing files that changed from the base of the PR and between 383c4ce and 55c020f.

⛔ Files ignored due to path filters (1)
  • internal/generated/fleetapi/client.gen.go is excluded by !**/generated/**
📒 Files selected for processing (5)
  • api/openapi/openapi.yaml
  • cmd/nvfleetint/alert.go
  • cmd/nvfleetint/alert_test.go
  • nvfleetint/alert.go
  • nvfleetint/alert_test.go

Comment thread cmd/nvfleetint/alert.go
Comment thread nvfleetint/alert.go
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
@jingxiang-z jingxiang-z self-assigned this Aug 6, 2026
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@docs/SDK.md`:
- Around line 65-71: Update the GetAlertTimelineFilterOptions example in
docs/SDK.md to provide a defined context, using context.Background() directly or
declaring ctx before the call, and add any required context import shown by the
document’s conventions.
🪄 Autofix

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: 95f3a326-705d-4776-bde8-7992816a41cf

📥 Commits

Reviewing files that changed from the base of the PR and between b725e2f and 4c63d15.

📒 Files selected for processing (6)
  • cmd/nvfleetint/alert.go
  • cmd/nvfleetint/alert_test.go
  • docs/CLI.md
  • docs/SDK.md
  • nvfleetint/alert.go
  • nvfleetint/alert_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • nvfleetint/alert_test.go

Comment thread docs/SDK.md
@coderabbitai coderabbitai Bot mentioned this pull request Aug 6, 2026
4 tasks
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
@jingxiang-z
jingxiang-z merged commit 320436f into main Aug 6, 2026
4 checks passed
@jingxiang-z
jingxiang-z deleted the fix/alert-timeline-contract branch August 6, 2026 19:33
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.

3 participants