Skip to content

refactor(client): add graphRequired option in HugeClientBuilder#718

Open
FrostyHec wants to merge 5 commits intoapache:masterfrom
FrostyHec:fix-hg-client-initialize-check
Open

refactor(client): add graphRequired option in HugeClientBuilder#718
FrostyHec wants to merge 5 commits intoapache:masterfrom
FrostyHec:fix-hg-client-initialize-check

Conversation

@FrostyHec
Copy link
Copy Markdown
Collaborator

@FrostyHec FrostyHec commented Mar 19, 2026

Purpose of the PR

Due to the logic upgrade of the HugeGraph server, certain operations (such as authentication) no longer require a specific graphspaces or graph. However, some interfaces in HugeClient are currently incompatible and still necessitate these parameters during connection initialization. Therefore, an adaptation upgrade is required. Here, a backward-compatible upgrade solution was selected.

This pull request introduces a new option to bypass required argument checks when building a HugeClientBuilder, allowing for more flexible client initialization. The main changes include updating constructors and builder methods to support the skipRequiredChecks flag, modifying validation logic, and adding unit tests to verify this new behavior.

Main Changes

Enhancements to client builder flexibility:

  • Added a new skipRequiredChecks boolean parameter to the HugeClientBuilder constructor and the corresponding HugeClient.builder static method, allowing users to bypass mandatory checks for url and graph arguments when needed.
  • Updated validation logic in both the constructor and the build() method of HugeClientBuilder to conditionally skip argument checks based on the skipRequiredChecks flag.

Testing:

  • Introduced a new test class HugeClientBuilderTest with tests to ensure that the builder behaves correctly with and without the skipRequiredChecks flag, including cases where required arguments are missing.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • add new tests.

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (typed here)

Documentation Status

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

@github-actions github-actions Bot added the client hugegraph-client label Mar 19, 2026
@imbajin imbajin requested a review from Copilot March 20, 2026 08:49
@imbajin
Copy link
Copy Markdown
Member

imbajin commented Mar 20, 2026

Also need handle the ci error
image

Copy link
Copy Markdown

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 PR adds an opt-in flag to HugeClientBuilder/HugeClient.builder(...) to bypass required url/graph argument validation, enabling more flexible client initialization flows (e.g., deferring configuration until later).

Changes:

  • Added skipRequiredChecks to HugeClientBuilder (new constructor overload + conditional validation in ctor/build).
  • Added a new HugeClient.builder(..., boolean skipRequiredChecks) overload.
  • Added a new unit test class covering skip vs non-skip behavior; minor formatting update in User.UserRole.

Reviewed changes

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

File Description
hugegraph-client/src/test/java/org/apache/hugegraph/unit/HugeClientBuilderTest.java Adds tests for the new skipRequiredChecks behavior (but currently has some issues around determinism/coverage).
hugegraph-client/src/main/java/org/apache/hugegraph/structure/auth/User.java Wraps a long generic type declaration for line-length; introduces trailing whitespace.
hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClientBuilder.java Introduces skipRequiredChecks flag and conditionally skips required argument validation.
hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java Adds a new public builder overload exposing skipRequiredChecks.

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

Comment thread hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java Outdated
Comment thread hugegraph-client/src/main/java/org/apache/hugegraph/structure/auth/User.java Outdated
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 16, 2026
@imbajin imbajin changed the title feat(client): add support for skipping required checks in HugeClientBuilder refactor(client): add graphRequired option in HugeClientBuilder Apr 18, 2026
…e graphRequired() method

- Move url/graph validation from constructor to build() for true null support
- Replace boolean constructor param with fluent .graphRequired(false) chain method
- Rename field to graphRequired (default true) for clearer semantics
- Clean up HugeClient javadoc: remove redundant class/constructor comments
- Simplify tests: remove redundant cases, use direct null params from start
@imbajin imbajin force-pushed the fix-hg-client-initialize-check branch from 9e099bc to f4a753b Compare April 18, 2026 16:21
Copy link
Copy Markdown
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

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

Merge it first, remember to apply in the hubble PR #632

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client hugegraph-client lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants