From e2d2f7a40d9a01f92ad58795b08fa86d9f6e6187 Mon Sep 17 00:00:00 2001 From: gouyt13clear Date: Thu, 19 Nov 2026 16:29:16 +0800 Subject: [PATCH] docs: cover the remaining 0.9 breaking changes in the migration guide The 0.8 to 0.9 section now lists, next to the int64 IDs and index format 2, what only the release notes mentioned: HNSW-routed IVF indexes no longer write a .hnsw sidecar, load raises rabitqlib.FormatError (a RuntimeError and ValueError subclass), the index classes are plain extension classes (pybind11 TypeError, no inspect.signature), and an invalid argument may be reported before a wrong state. The release notes add the ceil_log2 fix from #247. --- docs/docs/python_migration.md | 30 ++++++++++++++++++++++++++---- docs/docs/releases/unreleased.md | 2 ++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/docs/python_migration.md b/docs/docs/python_migration.md index e6bacb61..ebf8187f 100644 --- a/docs/docs/python_migration.md +++ b/docs/docs/python_migration.md @@ -189,7 +189,29 @@ spelling `"innerproduct"` raises `ValueError` on the index classes and in `rabitqlib.quant`: use `"ip"`, which every release accepts and the `metric` properties return. And `cp.final_assignment` reads back as a string, as described above. -0.9 also changes behavior that no warning can announce: `search` and `add` return -`int64` IDs with `-1` instead of `2**32 - 1` for a missing result, `save` writes index -format 2, which releases up to 0.8 cannot read, and `load` restores the seed. See the -[0.9 notes](releases/unreleased.md). +0.9 also changes behavior that no warning can announce: + +- `search` and `add` return `int64` IDs, with `-1` instead of `2**32 - 1` for a missing + result. +- `save` writes index format 2, which releases up to 0.8 cannot read, and `load` + restores the seed of such a file. Files from earlier releases still load, without a + recorded seed. +- An `IvfIndex` with HNSW routing stores the routing graph in the index file, so `save` + no longer writes a `.hnsw` sidecar. A sidecar left by an earlier save is not + removed; the new file does not use it. +- `load` raises the new `rabitqlib.FormatError` for a truncated, corrupt, mismatched or + unsupported file. It subclasses `RuntimeError`, which these errors raised before, and + `ValueError`; `rabitqlib.quant.FormatError` is now the same class. A file that cannot + be opened, or the missing sidecar of an earlier file, still raises a plain + `RuntimeError`. The messages for damaged files change, so match the exception class + rather than its text. +- The index classes are the extension's own classes, without Python wrappers. A wrong + argument raises pybind11's `TypeError`, which lists the supported signatures, instead + of messages such as `IvfIndex() got an unexpected keyword argument 'x'`, and + `inspect.signature()` no longer works on their constructors and methods; `help()` and + the type stubs describe them. +- A call with both an invalid argument and the wrong state may report the argument + first, for example `ValueError` instead of `RuntimeError` for `nprobe=0` on an + untrained index. + +See the [0.9 notes](releases/unreleased.md) for every change. diff --git a/docs/docs/releases/unreleased.md b/docs/docs/releases/unreleased.md index 88833cb6..1b5379d0 100644 --- a/docs/docs/releases/unreleased.md +++ b/docs/docs/releases/unreleased.md @@ -123,3 +123,5 @@ Four differences are not renames: `HnswIndex::add` uses every CPU unless `num_th - `QuantizedGraph::seed()`, `ef_construction()` and `initialization()`. - `symqg::QGInitialization` moves from `qg_builder.hpp` to `rabitqlib/index/symqg/types.hpp`, which `qg.hpp`, and through it `qg_builder.hpp`, includes. - The vendored hnswlib adds `saveIndex(std::ostream&)` and `loadIndex(std::istream&, size_t bytes, ...)`; the path overloads are unchanged. + +- `rabitqlib::ceil_log2` in `rabitqlib/utils/tools.hpp` shifts a `size_t`, so an input of 2^32 or more is no longer undefined on 64-bit Windows, where `unsigned long` has 32 bits (#247). The library does not call it.