Skip to content

Comments

fix(client): Adapt client graphSpace method to 1.7.0 server#712

Closed
sadwitdastreetz wants to merge 2 commits intoapache:masterfrom
sadwitdastreetz:hubble-client
Closed

fix(client): Adapt client graphSpace method to 1.7.0 server#712
sadwitdastreetz wants to merge 2 commits intoapache:masterfrom
sadwitdastreetz:hubble-client

Conversation

@sadwitdastreetz
Copy link
Contributor

Purpose of the PR

  • The original /profile endpoint (used to fetch detailed configurations of all GraphSpaces in one call) has been removed in the latest 1.7.0 server, causing the listProfile method to fail.

Main Changes

  1. Logic Refactoring: Replaced the single REST call to /profile with a "List-then-Get" pattern (fetching the name list first, then retrieving details for each entry).
  2. Prefix Filtering: Implemented in-memory filtering logic using startsWith(prefix) to maintain consistency with the legacy API behavior.

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

…t/get logic

Remove reliance on the removed '/profile' endpoint && Implement manual aggregation by listing all GraphSpaces and fetching details individually.
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 13, 2026
@github-actions github-actions bot added the client hugegraph-client label Feb 13, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adapts the GraphSpaceAPI.listProfile() method to work with HugeGraph server 1.7.0, which removed the /profile endpoint. The implementation changes from a single server-side filtered API call to a "list-then-get" pattern with client-side filtering.

Changes:

  • Replaced single /profile endpoint call with list() followed by get() for each graph space
  • Implemented client-side prefix filtering using startsWith()
  • Removed unused LinkedHashMap import

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

for (Object entry : results) {
profiles.add(JsonUtil.fromJson(JsonUtil.toJson(entry), Map.class));
for (String name : names) {
if (name.startsWith(prefix)) {
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The prefix parameter can be null (as seen in GraphSpaceManager.listProfile() which calls this method with null), but this code calls name.startsWith(prefix) without checking if prefix is null first. This will cause a NullPointerException. Consider using StringUtils.isEmpty(prefix) to handle null/empty prefix cases - when prefix is null or empty, all names should be included in the result.

Suggested change
if (name.startsWith(prefix)) {
if (StringUtils.isEmpty(prefix) || name.startsWith(prefix)) {

Copilot uses AI. Check for mistakes.
Comment on lines 72 to 83
public List<Map<String, Object>> listProfile(String prefix) {
String profilePath = joinPath(this.path(), "profile");
Map<String, Object> params = new LinkedHashMap<>();
params.put("prefix", prefix);
RestResult result = this.client.get(profilePath, params);
List<Map> results = result.readList(Map.class);
List<String> names = this.list();
List<Map<String, Object>> profiles = new ArrayList<>();
for (Object entry : results) {
profiles.add(JsonUtil.fromJson(JsonUtil.toJson(entry), Map.class));
for (String name : names) {
if (name.startsWith(prefix)) {
GraphSpace space = this.get(name);
Map<String, Object> profileMap = JsonUtil.fromJson(JsonUtil.toJson(space), Map.class);
profiles.add(profileMap);
}
}

return profiles;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The new implementation performs N+1 API calls (one list() call plus one get() call for each matching graph space), which could impact performance when there are many graph spaces. While this is necessary due to the removal of the /profile endpoint in server 1.7.0, consider documenting this performance characteristic in a code comment to inform future developers, especially if this method is called frequently or with many graph spaces.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client hugegraph-client size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant