fix(alerts): align timeline client with API contract - #37
Conversation
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe 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. ChangesExternal API specification
Alert timeline expansion
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
internal/generated/fleetapi/client.gen.gois excluded by!**/generated/**
📒 Files selected for processing (5)
api/openapi/openapi.yamlcmd/nvfleetint/alert.gocmd/nvfleetint/alert_test.gonvfleetint/alert.gonvfleetint/alert_test.go
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
cmd/nvfleetint/alert.gocmd/nvfleetint/alert_test.godocs/CLI.mddocs/SDK.mdnvfleetint/alert.gonvfleetint/alert_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- nvfleetint/alert_test.go
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
Description
Checklist
git commit -s) per the Contributing Guidelines.Summary by CodeRabbit