Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep clusters order in envclusters openapi #5277

Conversation

uucloud
Copy link
Contributor

@uucloud uucloud commented Nov 7, 2024

What's the purpose of this PR

The order of clusters in the API openapi/v1/apps/{appId}/envclusters was disrupted due to the use of HashSet. Changing it to LinkedHashSet resolves this issue.

Which issue(s) this PR fixes:

Fixes #5276

Brief changelog

Fix: ensure clusters order in envClusters open api

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added global search functionality for values within the system.
    • Introduced REST template client connection pool configuration.
    • Implemented limits and whitelists for namespaces per app ID and cluster.
    • Added a cache record statistics function for the ConfigService.
    • Enhanced the RefreshAdminServerAddressTask with dynamic time interval configuration.
    • Enforced value length limits for AppId-level configuration items.
  • Bug Fixes
    • Resolved issues with duplicate comments and blank lines in configuration management.
    • Fixed missing items in the published namespace link.
    • Ensured correct order of clusters in the envClusters open API.
  • Refactor
    • Standardized Kebab style in configuration files and aligned database field lengths for ClusterName and NamespaceName.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 7, 2024
Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 45cf718 and 4a05bee.

📒 Files selected for processing (2)
  • CHANGES.md (1 hunks)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java (2 hunks)
 ___________________________
< Loving your code to bits. >
 ---------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

The changes in the pull request involve a modification to the BeanUtils class, specifically within the toPropertySet method. The type of the set variable has been changed from HashSet to LinkedHashSet, which ensures that the order of insertion is preserved when converting a list of objects into a set of property values. Additionally, updates were made to the CHANGES.md file to reflect various new features, fixes, and enhancements in Apollo version 2.4.0.

Changes

File Path Change Summary
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java Changed type of set variable from HashSet to LinkedHashSet in toPropertySet method.
CHANGES.md Updated for Apollo version 2.4.0 with new features, fixes, and enhancements.

Assessment against linked issues

Objective Addressed Explanation
Ensure order of clusters in OpenAPI response (#5276) The change does not address the issue of cluster order in OpenAPI response.

Possibly related PRs

Suggested labels

size:S, lgtm

Suggested reviewers

  • nobodyiam

Poem

🐇 In the garden where rabbits play,
A change was made just the other day.
A set now keeps its order neat,
Like carrots lined up, a tasty treat!
With hops and jumps, we cheer with glee,
For every change brings joy, you see! 🌼

Tip

You can make CodeRabbit's review more strict using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting in your project's settings in CodeRabbit to assertive to make CodeRabbit's nitpick more issues in your PRs.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Nov 7, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.30%. Comparing base (d886164) to head (29b90dd).
Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5277      +/-   ##
============================================
+ Coverage     51.20%   51.30%   +0.09%     
- Complexity     2097     2109      +12     
============================================
  Files           393      393              
  Lines         12438    12449      +11     
  Branches       1229     1232       +3     
============================================
+ Hits           6369     6387      +18     
+ Misses         5681     5673       -8     
- Partials        388      389       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@uucloud uucloud force-pushed the fix/ensure-cluster-order-in-envclusters-api branch from 29b90dd to 45cf718 Compare November 7, 2024 12:40
@uucloud
Copy link
Contributor Author

uucloud commented Nov 7, 2024

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
CHANGES.md (1)

22-22: LGTM, but consider adding more context.

The changelog entry correctly documents the fix and links to the PR. However, it could be more helpful to users if it included the specific problem it addresses.

Consider expanding the entry to:

-* [Fix: ensure clusters order in envClusters open api](https://github.com/apolloconfig/apollo/pull/5277)
+* [Fix: ensure consistent cluster order (default,cluster1,cluster2) in envClusters open api](https://github.com/apolloconfig/apollo/pull/5277)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 29b90dd and 45cf718.

📒 Files selected for processing (2)
  • CHANGES.md (1 hunks)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java

@uucloud uucloud force-pushed the fix/ensure-cluster-order-in-envclusters-api branch from 45cf718 to 4a05bee Compare November 7, 2024 12:50
@uucloud uucloud changed the title fix: ensure clusters order in envclusters openapi fix: keep clusters order in envclusters openapi Nov 8, 2024
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 9, 2024
@nobodyiam nobodyiam merged commit a90fb6b into apolloconfig:master Nov 9, 2024
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

获取App的环境,集群信息的openapi中集群顺序被重排了
2 participants