From a93b33a6a39c2dc360042fd2cde6c41a74336d65 Mon Sep 17 00:00:00 2001 From: Xiangyu Wang Date: Fri, 16 Oct 2026 16:13:16 +0800 Subject: [PATCH] fix(hgraph): isolate INT8 analyzer assertions on 1.0 Backport the observer gate from #3095 and verify construction does not record analyzer queries. Signed-off-by: Xiangyu Wang Assisted-by: Codex:GPT-6 --- src/algorithm/hgraph/hgraph_mci_test.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/algorithm/hgraph/hgraph_mci_test.cpp b/src/algorithm/hgraph/hgraph_mci_test.cpp index 678e5f21af..41cfffe7d7 100644 --- a/src/algorithm/hgraph/hgraph_mci_test.cpp +++ b/src/algorithm/hgraph/hgraph_mci_test.cpp @@ -110,6 +110,11 @@ class Int8QueryCheckingHGraph : public vsag::HGraph { int64_t k, const std::string& parameters, const vsag::FilterPtr& filter) const override { + // Build also calls this override from MCI workers. Catch2 assertions and the + // query counter are only safe here once the serial analyzer checks begin. + if (not inspect_queries) { + return vsag::HGraph::KnnSearch(query, k, parameters, filter); + } REQUIRE(query->GetFloat32Vectors() == nullptr); REQUIRE(query->GetInt8Vectors() != nullptr); const auto dim = static_cast(query->GetDim()); @@ -124,6 +129,7 @@ class Int8QueryCheckingHGraph : public vsag::HGraph { return vsag::HGraph::KnnSearch(query, k, parameters, filter); } + bool inspect_queries{false}; std::vector expected_vectors; mutable uint64_t queries{0}; }; @@ -1626,7 +1632,8 @@ TEST_CASE("HGraph analyzer sends only typed INT8 query buffers", "[ut][hgraph][m ->Int8Vectors(index.expected_vectors.data()) ->Owner(false); REQUIRE(index.Build(dataset).empty()); - index.queries = 0; + REQUIRE(index.queries == 0); + index.inspect_queries = true; vsag::AnalyzerParam analyzer_params(common.allocator_.get()); analyzer_params.base_sample_size = total; analyzer_params.topk = 3;