Skip to content

fix: remove duplicated error message for cloud console#915

Closed
feichashao wants to merge 2 commits intoopenshift:mainfrom
feichashao:cloud-console-debug
Closed

fix: remove duplicated error message for cloud console#915
feichashao wants to merge 2 commits intoopenshift:mainfrom
feichashao:cloud-console-debug

Conversation

@feichashao
Copy link
Copy Markdown
Contributor

@feichashao feichashao commented Mar 31, 2026

What type of PR is this?

  • fix (Bug Fix)
  • feat (New Feature)
  • docs (Documentation)
  • test (Test Coverage)
  • chore (Clean Up / Maintenance Tasks)
  • other (Anything that doesn't fit the above)

What this PR does / Why we need it?

The backplane cloud console error message is duplicated, removing the formatted one and keep the raw response.

Before:

ERRO[0008] failed to get cloud console for cluster xxxxxxx: failed to assume role with isolated backplane flow: failed to fetch arn sequence: error from backplane: 
 Status Code: 403
 Message: no pending or approved access request:
consider running the following command to create one:
ocm-backplane accessrequest create (response body: {"statusCode":403,"message":"no pending or approved access request:\nconsider running the following command to create one:\nocm-backplane accessrequest create"})

After:

./ocm-backplane cloud console xxxxxx
ERRO[0010] failed to get cloud console for cluster xxxxxxx: failed to assume role with isolated backplane flow: failed to fetch arn sequence:
Status: 403 Forbidden
Response body: {"statusCode":403,"message":"no pending or approved access request:\nconsider running the following command to create one:\nocm-backplane accessrequest create"} 

Which Jira/Github issue(s) does this PR fix?

  • Related Issue #
  • Closes #

Special notes for your reviewer

Unit Test Coverage

Guidelines

  • If it's a new sub-command or new function to an existing sub-command, please cover at least 50% of the code
  • If it's a bug fix for an existing sub-command, please cover 70% of the code

Test coverage checks

  • Added unit tests
  • Created jira card to add unit test
  • This PR may not need unit tests

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR
  • Backward compatible

/label tide/merge-method-squash

Summary by CodeRabbit

  • Documentation

    • Added comprehensive macOS setup guide for configuring Podman on Apple Silicon with Rosetta support to ensure x86_64 compatibility when running the backplane console container.
  • Bug Fixes

    • Enhanced error message formatting for API error responses to improve user feedback clarity.

@openshift-ci openshift-ci Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 31, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 646bff9b-44ab-405d-af92-fe3a03cd6312

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd7c3b and 998c825.

📒 Files selected for processing (1)
  • docs/macOS.md

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

Simplified non-200 error handling in QueryConfig.getIsolatedCredentials, updated the corresponding test expectation, and added a new macOS guide for configuring Podman/Rosetta for running the backplane console locally.

Changes

Cohort / File(s) Summary
Error handling & test
cmd/ocm-backplane/cloud/common.go, cmd/ocm-backplane/cloud/common_test.go
Removed response body restoration and utils.TryPrintAPIError in non-200 GetAssumeRoleSequence handling; now returns a formatted error with response.Status and trimmed body. Adjusted test expectation capitalization from "response body:" to "Response body:".
Documentation (macOS)
docs/macOS.md
Added a new macOS-specific guide describing Podman upgrade, enabling Rosetta/x86_64 in ~/.config/containers/containers.conf, resetting/recreating Podman machine (warning about data loss), and verification steps for Rosetta support.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

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

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

@openshift-ci openshift-ci Bot requested review from a7vicky and xiaoyu74 March 31, 2026 03:54
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 31, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feichashao

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 31, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.91%. Comparing base (59c1c29) to head (1cd7c3b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #915      +/-   ##
==========================================
- Coverage   53.93%   53.91%   -0.02%     
==========================================
  Files          88       88              
  Lines        6656     6651       -5     
==========================================
- Hits         3590     3586       -4     
+ Misses       2596     2595       -1     
  Partials      470      470              
Files with missing lines Coverage Δ
cmd/ocm-backplane/cloud/common.go 55.83% <100.00%> (-0.38%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if readErr == nil {
response.Body = io.NopCloser(strings.NewReader(bodyStr))
}
apiErr := utils.TryPrintAPIError(response, false)
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.

looks removing TryPrintAPIError here makes this path inconsistent with the rest of the CLI as I can see most other cli commands rely on TryPrintAPIError as the standard way to parse and present bp-api errors.

IIUC, the original intent (from PR #825) was to improve visibility for non-JSON responses (e.g. infra errors like 502), which is a valid. However, removing TryPrintAPIError means we lose the structured/clean formatting for the common case (JSON errors from bp-api).

Would it make sense to keep TryPrintAPIError for JSON responses, and only fall back to raw response body when parsing fails (non-JSON)? WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. I will make a card for this instead as it requires some efforts to carefully change and test.

@feichashao feichashao closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants