fix: IVF nearest-partition serialization test returns a different class ID - #2564
fix: IVF nearest-partition serialization test returns a different class ID#2564vsag-bot wants to merge 1 commit into
Conversation
Signed-off-by: vsag-bot <276218163+vsag-bot@users.noreply.github.com> Assisted-by: Codex:gpt-5.6-sol
|
/label status/waiting-for-review |
|
AI PR state: Automatic merging is disabled. A maintainer performs the final merge. |
Merge Protections🟢 All 3 merge protections satisfied — ready to merge. Show 3 satisfied protections🟢 Require kind label
🟢 Require version label
🟢 Require linked issue for feature/bug PRs
|
LHT129
left a comment
There was a problem hiding this comment.
The fix correctly addresses the root cause: the serialization test was comparing ClassifyDatas results (which internally uses ef_search=10) against KnnSearch with ef_search=20. Different search breadths in approximate HGraph search can legitimately return different partition IDs, making the test flaky rather than indicating a serialization defect.
Changes review:
-
Basic Test (
ivf_nearest_partition_test.cpp:53-56): Aligningef_searchfrom 20 to 10 so the KnnSearch comparison matches the internalClassifyDatasconfiguration. The added comment is helpful since the choice of 10 is non-obvious. -
Serialize Test (
ivf_nearest_partition_test.cpp:96-97): Replacing the per-element KnnSearch loop with a directClassifyDatascomparison is the correct approach — it tests that serialization preserves classification behavior using identical inputs and settings, which is what the test should verify.
The changes are minimal (4 additions, 18 deletions), focused, and correct. No issues found.
Summary
Corrected the flaky IVF nearest-partition tests to compare equivalent approximate searches and validate classification preservation across serialization.
Root Cause
The serialization test compared ClassifyDatas using ef_search=10 with a restored HGraph queried using ef_search=20. Approximate searches with different breadths can legitimately return different partition IDs, with numerical and platform differences affecting how often this appears; serialization was not shown to be defective.
Changes
Validation
make asan COMPILE_JOBS=4 EXTRA_DEFINED="-DDOWNLOAD_DIR=$VSAG_THIRDPARTY_DOWNLOAD_DIR": passed - Built the complete ASan/UBSan unit-test binary using the local dependency cache.ASAN_OPTIONS=detect_leaks=0 ./build/tests/unittests "[IVFNearestPartition]" -r compact: passed - Both focused tests passed with 2,004 assertions.50 repeated post-fix serialization test runs: passed - All independently trained and serialized cases passed.git diff --check && clang-format-15 --dry-run --Werror src/algorithm/ivf/ivf_nearest_partition_test.cpp: passed - Diff and formatting checks passed with clang-format 15.0.7.Residual Risks
Base branch:
mainFixes #2561
Prepared by
vsag-botafter automatic effort ordering and AI repairability preflight.