Skip to content

Make report-id optional for cluster reports get#926

Open
geowa4 wants to merge 1 commit into
openshift:masterfrom
geowa4:claude/cluster-report-optional-id-ixqpq0
Open

Make report-id optional for cluster reports get#926
geowa4 wants to merge 1 commit into
openshift:masterfrom
geowa4:claude/cluster-report-optional-id-ixqpq0

Conversation

@geowa4

@geowa4 geowa4 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The cluster reports get subcommand previously required the --report-id flag. It is now optional: when omitted, the latest report for the cluster is fetched and returned.

When --report-id is not provided, a message is written to standard error indicating that the latest report will be searched for and returned. If the cluster has no reports, a corresponding message is written to standard error and the command exits without error.

Claude-Session: https://claude.ai/code/session_011kSv6MRg3ccFMw8rpy12YE

Summary by CodeRabbit

  • New Features

    • The cluster reports get command now returns the latest report automatically when --report-id is not provided.
    • Added clearer help text and an example showing how to fetch the newest report for a cluster.
  • Bug Fixes

    • Improved handling when no reports are available, with clearer messaging.
    • The command now skips incomplete report entries and selects the most recently created valid report.

The `cluster reports get` subcommand previously required the `--report-id`
flag. It is now optional: when omitted, the latest report for the cluster
is fetched and returned.

When `--report-id` is not provided, a message is written to standard error
indicating that the latest report will be searched for and returned. If the
cluster has no reports, a corresponding message is written to standard error
and the command exits without error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011kSv6MRg3ccFMw8rpy12YE
@openshift-ci openshift-ci Bot requested review from Tafhim and sam-nguyen7 June 24, 2026 20:40
@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: geowa4
Once this PR has been reviewed and has the lgtm label, please assign makdaam for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 90f0d110-c54a-4ffa-8490-e605c7195c0f

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc60dd and 86f9c80.

📒 Files selected for processing (4)
  • cmd/cluster/reports/get.go
  • cmd/cluster/reports/get_test.go
  • docs/README.md
  • docs/osdctl_cluster_reports_get.md

Walkthrough

osdctl cluster reports get now accepts an omitted --report-id. When absent, it lists reports for the cluster, selects the newest by CreatedAt, and fetches that report. The help text, validation, and docs were updated to match.

Changes

Cluster report get fallback

Layer / File(s) Summary
Command contract and docs
cmd/cluster/reports/get.go, cmd/cluster/reports/get_test.go, docs/README.md, docs/osdctl_cluster_reports_get.md
--report-id is documented and validated as optional, and the command docs describe returning the latest cluster report when it is omitted.
Report lookup and fetch path
cmd/cluster/reports/get.go
run() resolves a missing report ID by listing cluster reports, skipping incomplete entries, selecting the newest CreatedAt, logging status to stderr, and calling GetReport.

Sequence Diagram(s)

sequenceDiagram
  participant "run()" as run
  participant latestReportID as latestReportID
  participant backplaneClient as backplaneClient
  participant "os.Stderr" as stderr
  run->>latestReportID: resolve reportID when o.reportID is empty
  latestReportID->>backplaneClient: ListReports(ctx)
  backplaneClient-->>latestReportID: reports
  latestReportID-->>run: latest reportId or ""
  run->>stderr: write status messages
  run->>backplaneClient: GetReport(clusterID, reportID)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making report-id optional for cluster reports get.
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.
Stable And Deterministic Test Names ✅ Passed Changed test names are static (TestNewCmdGet, TestGetOptions_Validation, and fixed subtest titles like valid options). No dynamic data appears in titles.
Test Structure And Quality ✅ Passed The new tests are simple unit tests, not Ginkgo specs, and they match existing sibling test patterns; no resource cleanup or timeout issues apply.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR changes CLI/docs plus a plain unit test, with no MicroShift-incompatible APIs or assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The PR only changes a cobra command, a unit test, and docs; no Ginkgo e2e tests or SNO-sensitive multi-node assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed Only CLI/report-fetching code, tests, and docs changed; no manifests, controllers, or scheduling/topology constraints were introduced.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added; the change only adds stderr notices and normal Cobra command output.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changed tests are unit tests using testing only, with no IPv4 or external-connectivity assumptions.
No-Weak-Crypto ✅ Passed Changed files only add report lookup logic; no weak crypto, custom crypto, or secret/token comparisons appear in the PR.
Container-Privileges ✅ Passed Only CLI/docs files were changed, and a repo-wide search found no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed New stderr messages are generic; no passwords, tokens, PII, hostnames, or customer data are logged in the changed files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@geowa4: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

2 participants