Skip to content

refactor build parameter of hgraph tests#997

Merged
inabao merged 1 commit into
mainfrom
refactor-hgraph-pram
Aug 1, 2025
Merged

refactor build parameter of hgraph tests#997
inabao merged 1 commit into
mainfrom
refactor-hgraph-pram

Conversation

@inabao

@inabao inabao commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Refactor HGraph tests to consolidate build parameters into a struct, simplify function signatures, and update all test invocations accordingly.

Enhancements:

  • Introduce HGraphBuildParam struct to encapsulate HGraph build parameters with defaults
  • Change GenerateHGraphBuildParametersString to accept HGraphBuildParam instead of multiple separate arguments
  • Update all HGraph test cases to construct and use HGraphBuildParam when generating build parameter strings

@inabao inabao self-assigned this Jul 31, 2025
@inabao
inabao requested a review from wxyucs as a code owner July 31, 2025 03:32
@inabao inabao added the kind/improvement Optimizations, UX polish, or minor improvements 性能优化、体验打磨或细节改良 label Jul 31, 2025
@inabao
inabao requested a review from jiaweizone as a code owner July 31, 2025 03:32
@inabao inabao added the version/0.16 1. Add SINDI 2. Extend HGraph 1. 新增SINDI 2. 扩展 HGraph label Jul 31, 2025
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

@sourcery-ai

sourcery-ai Bot commented Jul 31, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR replaces the long argument list for building HGraph test parameters with a dedicated HGraphBuildParam struct, updates the GenerateHGraphBuildParametersString interface and implementation to use this struct, and refactors all test call sites accordingly.

File-Level Changes

Change Details Files
Introduce HGraphBuildParam struct to encapsulate build parameters
  • Add new struct with fields for metric_type, dim, quantization_str, thread_count, extra_info_size, data_type, graph_type, graph_storage, support_remove, use_attr_filter, store_raw_vector, support_duplicate
  • Provide constructor for required fields and default values for others
tests/test_hgraph.cpp
Refactor GenerateHGraphBuildParametersString to accept the struct
  • Change function signature to take const HGraphBuildParam&
  • Update formatting logic to read parameters from the struct
  • Remove old overload and individual parameter list
tests/test_hgraph.cpp
Update all test call sites to use HGraphBuildParam
  • Instantiate build_param with metric, dim, quantization_str before calling generator
  • Adjust fields on build_param for custom settings (e.g., support_remove, use_attr_filter)
  • Replace previous GenerateHGraphBuildParametersString calls with the new struct-based usage
tests/test_hgraph.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey @inabao - I've reviewed your changes - here's some feedback:

  • The new HGraphBuildParam struct currently relies on a free function to serialize itself—consider moving GenerateHGraphBuildParametersString into a member like toString() to encapsulate serialization and simplify the API.
  • There’s a lot of repetitive build_param setup in the tests; adding helper functions or chainable builder methods (e.g. withSupportRemove(), withGraphType()) would DRY up the boilerplate and make individual tests more concise.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new HGraphBuildParam struct currently relies on a free function to serialize itself—consider moving GenerateHGraphBuildParametersString into a member like toString() to encapsulate serialization and simplify the API.
- There’s a lot of repetitive build_param setup in the tests; adding helper functions or chainable builder methods (e.g. withSupportRemove(), withGraphType()) would DRY up the boilerplate and make individual tests more concise.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
@inabao
inabao force-pushed the refactor-hgraph-pram branch from 1eeafa3 to 7be57dd Compare July 31, 2025 08:39
@codecov

codecov Bot commented Jul 31, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #997      +/-   ##
==========================================
- Coverage   91.83%   91.67%   -0.17%     
==========================================
  Files         294      294              
  Lines       17069    17069              
==========================================
- Hits        15676    15648      -28     
- Misses       1393     1421      +28     
Flag Coverage Δ
cpp 91.67% <ø> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 92.51% <ø> (ø)
datacell 91.10% <ø> (-0.82%) ⬇️
index 90.68% <ø> (+0.13%) ⬆️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 288fe51...7be57dd. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wxyucs wxyucs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@inabao
inabao merged commit 077faaf into main Aug 1, 2025
28 of 30 checks passed
@inabao
inabao deleted the refactor-hgraph-pram branch August 1, 2025 06:00
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

LHT129 pushed a commit to LHT129/vsag that referenced this pull request Apr 16, 2026
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
LHT129 pushed a commit that referenced this pull request May 11, 2026
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
Sia-Sheerland pushed a commit to Sia-Sheerland/vsag that referenced this pull request Jun 26, 2026
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: Sia Sheerland <x1075956441x@163.com>

Signed-off-by: Sia Sheerland <x1075956441x@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Optimizations, UX polish, or minor improvements 性能优化、体验打磨或细节改良 module/testing size/L version/0.16 1. Add SINDI 2. Extend HGraph 1. 新增SINDI 2. 扩展 HGraph

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants