Skip to content

Fix issue in saving and loading tenant-conf#13872

Open
dushaniw wants to merge 4 commits into
wso2:masterfrom
dushaniw:granular-scopes
Open

Fix issue in saving and loading tenant-conf#13872
dushaniw wants to merge 4 commits into
wso2:masterfrom
dushaniw:granular-scopes

Conversation

@dushaniw

Copy link
Copy Markdown
Contributor

With the fix introduced in #13837, there will be a new field added in tenant-conf.json by portal customized users. This PR will preserve the new field when overrding tenant-conf.json via updates to Scope Assignments in admin portal.

@wso2-engineering wso2-engineering Bot left a comment

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.

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

  • The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
  • Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.

✅ Before merging this pull request:

  • Review all AI-generated comments for accuracy and relevance.
  • Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1
#### Log Improvement Suggestion No: 2

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dushaniw, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 51 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 45566a8a-4ff2-4d5e-b0c4-7d6d728c3e8b

📥 Commits

Reviewing files that changed from the base of the PR and between 7ca4b87 and 3f537e5.

📒 Files selected for processing (3)
  • components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
  • components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
  • components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/utils/mappings/SystemScopesMappingUtil.java
📝 Walkthrough

Walkthrough

A new REST API scope field SupportedModels is introduced via a constant in APIConstants, and scope merge logic in APIUtil.mergeTenantConfScopes is updated to preserve this field from existing scope mappings when overlapping entries do not include it.

Changes

REST API Scope Supported Models Configuration

Layer / File(s) Summary
REST API scope supported models configuration
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java, components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
REST_API_SCOPE_SUPPORTED_MODELS constant is added to APIConstants. The mergeTenantConfScopes method is refactored to iterate over merged scopes and preserve the SupportedModels field from existing mappings when a scope name matches and the new entry does not include that field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix issue in saving and loading tenant-conf' is vague and doesn't specify which issue or what aspect of tenant-conf handling is being fixed. Use a more specific title such as 'Preserve SupportedModels field when updating tenant-conf scopes' to clearly convey the main change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the context and purpose of the PR, relating it to a previous fix and specifying that it preserves a new field in tenant-conf.json during scope updates.
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 unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

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.

Pull request overview

This PR fixes tenant-conf scope merge behavior so that custom portal-specific scope metadata (specifically SupportedModels) is not lost when scope-role mappings are overridden via the Admin Portal Scope Assignments flow.

Changes:

  • Update APIUtil.mergeTenantConfScopes(...) to preserve SupportedModels from existing tenant-conf entries when the incoming role-mapping payload omits it.
  • Introduce a new constant for the SupportedModels JSON key in APIConstants.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java Enhances scope merge logic to retain SupportedModels during scope-role mapping updates.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java Adds a constant for the SupportedModels field used by the merge logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 12, 2026
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