Skip to content

Fix IBM Schematics API compatibility issue#1006

Merged
pragya811 merged 2 commits into
mainfrom
ibm_jenkins_fix
Jun 24, 2026
Merged

Fix IBM Schematics API compatibility issue#1006
pragya811 merged 2 commits into
mainfrom
ibm_jenkins_fix

Conversation

@pragya811

Copy link
Copy Markdown
Member

Type of change

Note: Fill x in []

  • bug
  • enhancement
  • documentation
  • dependencies

Description

The list_locations() method was removed from IBM Schematics SDK. Replace dynamic location discovery with hardcoded known IBM Cloud regions. Fixes AttributeError: 'SchematicsV1' object has no attribute 'list_locations'

For security reasons, all pull requests need to be approved first before running any automated CI

Assisted-by: Cursor

The list_locations() method was removed from IBM Schematics SDK.
Replace dynamic location discovery with hardcoded known IBM Cloud regions.
Fixes AttributeError: 'SchematicsV1' object has no attribute 'list_locations'
@pragya811 pragya811 self-assigned this Jun 23, 2026
@pragya811 pragya811 added the bug Something isn't working label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced IBM Schematics workspace discovery to better handle regional availability and service behavior changes.
    • Improved resilience by skipping regions that are unavailable or inaccessible during workspace retrieval.
    • Added clearer failure reporting when workspace discovery cannot complete across regions.
  • Deprecations
    • Location listing support for IBM Schematics was removed, and attempting it now results in an explicit “not available” error.

Walkthrough

get_supported_locations() now raises NotImplementedError because the IBM Schematics location listing call is unavailable. get_all_workspaces() now iterates a fixed region list, configures the Schematics endpoint per region, and collects workspaces while skipping regions that fail.

Changes

IBM Schematics region discovery refactor

Layer / File(s) Summary
Deprecate location lookup and fetch workspaces by region
cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py
get_supported_locations() raises NotImplementedError instead of calling list_locations(). get_all_workspaces() uses a hardcoded known_regions list, sets the schematics service URL per region, gathers workspaces by region, and raises RuntimeError only if every region attempt fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing IBM Schematics API compatibility.
Description check ✅ Passed The description accurately describes the SDK compatibility fix and the hardcoded region approach.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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: 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 `@cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py`:
- Around line 54-62: The exception handling in the loop that iterates through
known_regions silently ignores all failures and returns an empty resources_list,
which downstream code interprets as "no workspaces found" rather than a genuine
failure. Add logging for each caught exception to track partial failures,
maintain a counter or flag to track whether any region query succeeded, and
after the loop completes, check if no regions were successfully queried and
raise an exception instead of returning the empty resources_list. This ensures
the calling code can distinguish between legitimate "no workspaces" and actual
connectivity or authentication issues that prevented any region from being
checked.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0d236c55-d756-4ef3-a573-358ac3a0fae4

📥 Commits

Reviewing files that changed from the base of the PR and between 64f03dd and 8868c53.

📒 Files selected for processing (1)
  • cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py

@ebattat ebattat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/approve

- Track failed regions instead of silently ignoring all errors
- Raise RuntimeError if ALL regions fail (prevents silent failures)
- Include detailed error messages for debugging
- Addresses CodeRabbit review feedback

Co-authored-by: Cursor <cursoragent@cursor.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.

♻️ Duplicate comments (1)
cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py (1)

62-76: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Surface partial region failures before returning.

If one region succeeds and another fails, failed_regions is discarded and callers receive partial workspace data as if it were complete. At minimum log these failures before return; preferably catch the IBM SDK API exception type rather than blind Exception. This is the still-relevant partial-failure part of the previous review.

#!/bin/bash
# Description: verify available IBM SDK exception types and existing logger conventions before narrowing/logging.
# Expected: identify the SDK API exception import to use here and the project's preferred logger pattern.
rg -nP -C3 'ApiException|ibm_cloud_sdk_core|logging|getLogger|logger' --glob '*.py'
🤖 Prompt for 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.

In `@cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py`
around lines 62 - 76, The partial-failure handling in the Schematics workspace
listing still drops information when some regions succeed and others fail. In
the region-loop around the exception handling and the final return in the
workspace listing function, surface any collected failed_regions before
returning partial resources by logging them with the project’s existing logger
pattern, and then keep returning the successful results. Also narrow the broad
except Exception as exc to the IBM SDK API exception type used elsewhere in this
module if available, so the failure tracking in failed_regions is more precise.

Source: Linters/SAST tools

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

Duplicate comments:
In `@cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py`:
- Around line 62-76: The partial-failure handling in the Schematics workspace
listing still drops information when some regions succeed and others fail. In
the region-loop around the exception handling and the final return in the
workspace listing function, surface any collected failed_regions before
returning partial resources by logging them with the project’s existing logger
pattern, and then keep returning the successful results. Also narrow the broad
except Exception as exc to the IBM SDK API exception type used elsewhere in this
module if available, so the failure tracking in failed_regions is more precise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0bc7c433-90fb-4464-b7df-cc8900b10388

📥 Commits

Reviewing files that changed from the base of the PR and between 8868c53 and 6e6a6dc.

📒 Files selected for processing (1)
  • cloud_governance/common/clouds/ibm/developer_tools/schematic_operations.py

@pragya811 pragya811 merged commit 1af042c into main Jun 24, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Cloud-Governance project Jun 24, 2026
@pragya811 pragya811 deleted the ibm_jenkins_fix branch June 24, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

2 participants