fix: HGraph dirty-vector search dereferences an empty result heap - #2802
fix: HGraph dirty-vector search dereferences an empty result heap#2802vsag-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
|
AI PR state: Automatic merging is disabled. A maintainer performs the final merge. |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Require linked issue for feature/bug PRs
|
LHT129
left a comment
There was a problem hiding this comment.
Thanks for this fix. The change is clean and correct.
Summary of the fix:
- Three call sites in
hgraph.cpp(KnnSearch,RangeSearch,SearchWithRequest) now guardresult->Top()withnot result->Empty()when descending route graph layers, preventing dereference of an empty result heap caused by non-finite distance filtering (e.g. all-NaN queries). - A regression test in
hgraph_add_test.cppexercises the all-NaN query path and verifies the search returns an empty result set rather than crashing.
Review notes:
- The fix is minimal and surgical — exactly what a bug fix should be.
- When all route graph layers return empty,
search_param.epretains its initial value (entry_point_id_), which is already validated againstINVALID_ENTRY_POINTbefore the loop. This is correct fallback behavior. - The test case is well-scoped: deterministic, self-contained, and directly targets the reported crash path.
- No correctness, performance, or security concerns found.
|
AI PR CI recovery
No repair is needed. The failed Aarch64 functional-test shard appears randomized/transient; rerunning the same workflow is safe and useful. Reasoning: |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## 0.18 #2802 +/- ##
==========================================
+ Coverage 91.43% 91.53% +0.09%
==========================================
Files 332 332
Lines 19796 19799 +3
==========================================
+ Hits 18101 18123 +22
+ Misses 1695 1676 -19
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
@vsag-bot This PR remains labeled status/ai-working, but Build with TSAN and Test Aarch64 (functests) are still failing and there has been no update since August 28. Please inspect the current failures and continue advancing the PR. |
Summary
HGraph now retains its valid entry point when an upper-layer search returns no finite candidates, preventing empty-heap dereferences.
Root Cause
Non-finite distance filtering can leave route-search result heaps empty, but HGraph unconditionally called Top() while descending graph layers.
Changes
Validation
clang-format --dry-run --Werror src/algorithm/hgraph.cpp src/algorithm/hgraph_add_test.cpp: passed - Changed C++ files conform to formatting rules.cmake --build build-ai-fix --target unittests --parallel 4: passed - ASan/UBSan unit-test target built successfully.ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 UBSAN_OPTIONS=halt_on_error=1 ./build-ai-fix/tests/unittests 'HGraph search handles an empty route result': passed - 3 assertions passed.ASAN_OPTIONS=detect_leaks=0:halt_on_error=0 UBSAN_OPTIONS=halt_on_error=0 ./build-ai-fix/tests/functests '(PR) HGraph Search with Dirty Vector': passed - 283 assertions passed with no sanitizer diagnostics.Residual Risks
Base branch:
0.18Fixes #2801
Prepared by
vsag-botafter automatic effort ordering and AI repairability preflight.