Skip to content

Address review comments.#1134

Open
ImalshaD wants to merge 1 commit into
wso2:masterfrom
ImalshaD:idp_address_review_comments_on_#1078
Open

Address review comments.#1134
ImalshaD wants to merge 1 commit into
wso2:masterfrom
ImalshaD:idp_address_review_comments_on_#1078

Conversation

@ImalshaD

@ImalshaD ImalshaD commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR addresses review comments on:

This pull request refactors how API errors are handled in the ServerConfigManagementService for compatibility settings. Instead of using a private error handler, it now consistently uses static utility methods from CompatibilitySettingUtil, which improves code clarity and allows for more precise HTTP status codes in error responses. Additionally, a new utility method is introduced for building API errors when the HTTP status is known up front.

Error handling improvements:

  • Replaced calls to the private handleCompatibilitySettingsError method with the static handleCompatibilitySettingsException methods from CompatibilitySettingUtil, ensuring consistent error handling throughout ServerConfigManagementService. [1] [2] [3] [4]
  • Enhanced error responses for invalid input and missing setting groups by specifying HTTP status codes (BAD_REQUEST, NOT_FOUND) directly in the new utility method. [1] [2]

Utility method additions and improvements:

  • Added a new overloaded handleCompatibilitySettingsException method in CompatibilitySettingUtil to support error handling when the HTTP status is known up front and there is no underlying exception.
  • Simplified the includeData method in CompatibilitySettingUtil for more concise error message formatting.

These changes improve maintainability and make error handling more robust and expressive.

Copilot AI review requested due to automatic review settings June 3, 2026 18:34
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c32e4b63-372e-4edf-b14f-4a619bbe52aa

📥 Commits

Reviewing files that changed from the base of the PR and between 67763ce and d86584a.

📒 Files selected for processing (2)
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/core/ServerConfigManagementService.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/function/CompatibilitySettingUtil.java

📝 Walkthrough

Summary

This PR implements review feedback from PR #1078 by standardizing error handling in the compatibility settings API endpoints.

Changes

ServerConfigManagementService

  • Replaced private exception handling with static utility methods (CompatibilitySettingUtil.handleCompatibilitySettingsException) for consistent error mapping across all compatibility-settings endpoints
  • Enhanced validation error responses with specific HTTP status codes:
    • Invalid input now returns BAD_REQUEST (400)
    • Missing setting groups now returns NOT_FOUND (404)
  • Updated exception handling in getCompatibilitySettings, patchCompatibilitySettings, and getCompatibilitySettingsByGroup methods

CompatibilitySettingUtil

  • Added new overloaded handleCompatibilitySettingsException method that accepts a known HTTP status, error code enum, and optional data to build API errors without requiring an underlying exception
  • Simplified the includeData helper method to use a single return expression while maintaining the same formatting logic

Impact

Standardizes error responses across compatibility-settings endpoints with appropriate HTTP status codes and consistent error handling patterns, improving API consistency and error clarity.

Walkthrough

This pull request standardizes exception handling in the compatibility-settings configuration endpoints. A new overload of handleCompatibilitySettingsException in CompatibilitySettingUtil accepts an HTTP status code and error enum directly, enabling error responses to be built without requiring an underlying exception object. The ServerConfigManagementService methods—getCompatibilitySettings, patchCompatibilitySettings, and getCompatibilitySettingsByGroup—are then refactored to use this new utility directly, with explicit status codes (BAD_REQUEST for invalid input, NOT_FOUND for missing groups) and corresponding error codes. A minor helper method simplification is also included.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Address review comments' is vague and does not clearly convey what changes were made in the pull request. Use a more descriptive title that summarizes the main change, such as 'Standardize compatibility settings error handling with utility methods' or 'Refactor compatibility settings error handling to use CompatibilitySettingUtil'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly explains the purpose, goals, and approach with specific references to the changes made, though it does not follow the full template structure.
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.

@wso2-engineering wso2-engineering 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.

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: 3

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

Note

Copilot was unable to run its full agentic suite in this review.

Centralizes compatibility-settings error handling in CompatibilitySettingUtil and updates service code to use the shared utility methods, including new support for creating APIErrors when the HTTP status is known without an underlying exception.

Changes:

  • Added an overload in CompatibilitySettingUtil to build APIError from an explicit Response.Status.
  • Updated ServerConfigManagementService to call CompatibilitySettingUtil directly and removed a redundant private wrapper.
  • Simplified message formatting logic in includeData(...).

Reviewed changes

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

File Description
components/.../function/CompatibilitySettingUtil.java Adds a new handleCompatibilitySettingsException(Status, ...) overload and simplifies data inclusion formatting.
components/.../core/ServerConfigManagementService.java Switches callers to the utility methods and removes an unnecessary local helper.

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

Comment on lines +216 to +217
ErrorResponse errorResponse = getErrorBuilder(errorEnum, data).build(LOG, errorEnum.description());
return new APIError(status, errorResponse);
Comment on lines +212 to +214
public static APIError handleCompatibilitySettingsException(Response.Status status,
Constants.ErrorMessage errorEnum,
String data) {
@ImalshaD

ImalshaD commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Integration Test run at the fork:
https://github.com/ImalshaD/product-is/actions/runs/26905173612

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