Skip to content

fix: IVF nearest-partition serialization test returns a different class ID - #2564

Open
vsag-bot wants to merge 1 commit into
antgroup:mainfrom
vsag-bot:codex/ai-fix-2561-04a43293
Open

fix: IVF nearest-partition serialization test returns a different class ID#2564
vsag-bot wants to merge 1 commit into
antgroup:mainfrom
vsag-bot:codex/ai-fix-2561-04a43293

Conversation

@vsag-bot

Copy link
Copy Markdown
Collaborator

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

  • Compare ClassifyDatas results directly before and after serialization using identical inputs and settings.
  • Align the basic direct-router check with ClassifyDatas' ef_search=10 configuration.
  • Kept .vsag-ai-fix-progress.json valid and untracked.

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

  • The exact x86/MKL CI image was unavailable locally.
  • LeakSanitizer was disabled during runtime tests because the local ptrace environment prevents its process inspection; AddressSanitizer and UBSan instrumentation remained enabled.

Base branch: main

Fixes #2561

Prepared by vsag-bot after automatic effort ordering and AI repairability preflight.

Signed-off-by: vsag-bot <276218163+vsag-bot@users.noreply.github.com>
Assisted-by: Codex:gpt-5.6-sol
@vsag-bot vsag-bot added the created-by-AI The issue is found and created by AI Agent label Jul 28, 2026
@vsag-bot vsag-bot added the kind/bug Bug fixes, defects, or unexpected behavior 修复程序错误、缺陷或异常行为 label Jul 28, 2026
@vsag-bot

vsag-bot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/label status/waiting-for-review
/waiting-on reviewer
/request-review @jiaweizone
/request-review @wxyucs
/request-review @inabao

@vsag-bot

vsag-bot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

AI PR state: status/ai-working
Current owner: @vsag-bot
Reason: checks concluded failure
Head: 43ea063

Automatic merging is disabled. A maintainer performs the final merge.

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 3 merge protections satisfied — ready to merge.

Show 3 satisfied protections

🟢 Require kind label

  • label~=^kind/

🟢 Require version label

  • label~=^version/

🟢 Require linked issue for feature/bug PRs

  • body~=(?im)(?:^|[\s\-\*])(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s+(?:#\d+|[\w.\-]+/[\w.\-]+#\d+|https?://github\.com/[\w.\-]+/[\w.\-]+/issues/\d+)

@LHT129 LHT129 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.

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:

  1. Basic Test (ivf_nearest_partition_test.cpp:53-56): Aligning ef_search from 20 to 10 so the KnnSearch comparison matches the internal ClassifyDatas configuration. The added comment is helpful since the choice of 10 is non-obvious.

  2. Serialize Test (ivf_nearest_partition_test.cpp:96-97): Replacing the per-element KnnSearch loop with a direct ClassifyDatas comparison 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.

@vsag-bot vsag-bot added status/ai-working The AI agent owns the next action and removed status/waiting-for-ci Waiting for CI; the AI agent handles failures labels Jul 28, 2026
@vsag-bot vsag-bot added status/waiting-for-ci Waiting for CI; the AI agent handles failures and removed status/ai-working The AI agent owns the next action labels Jul 29, 2026
@vsag-bot vsag-bot added status/ai-working The AI agent owns the next action status/waiting-for-ci Waiting for CI; the AI agent handles failures and removed status/waiting-for-ci Waiting for CI; the AI agent handles failures status/ai-working The AI agent owns the next action labels Jul 29, 2026
@vsag-bot vsag-bot added status/ai-working The AI agent owns the next action and removed status/waiting-for-ci Waiting for CI; the AI agent handles failures labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-AI The issue is found and created by AI Agent kind/bug Bug fixes, defects, or unexpected behavior 修复程序错误、缺陷或异常行为 size/S status/ai-working The AI agent owns the next action version/1.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug](ci): IVF nearest-partition serialization test returns a different class ID

2 participants