From 82a40e303a86db2ba2a3f776094b13165033be47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ha=C5=82as?= Date: Thu, 30 Jul 2026 08:32:53 +0200 Subject: [PATCH] feat: unified index API, Vamana/DiskANN index, structured stats and schema introspection Release v0.5.0 highlights: - ZVecIndexParams with createIndex() unified API (forHnsw/forFlat/forIvf/forVamana/forInvert/forHnswRabitq) - Vamana (DiskANN) index and HNSW-RaBitQ quantized index support - ZVecCollectionOptions with createWith()/openWith(), ZVecCollectionStats, ZVecFieldSchema - ZVecVectorQuery/ZVecGroupByVectorQuery query objects, queryWithReranker() - CrazyGoat\ZVec namespace with PSR-4 autoloading (global aliases kept for BC) - MIGRATION.md guide for deprecated APIs (removal scheduled for v0.6.0) - Memory leak regression tests, reranker edge-case coverage, exception isolation tests - Fixed platform-specific test failures on macOS (installer tests, RaBitQ skip) --- CHANGELOG.md | 13 ++++++- tests/test_hnsw_rabitq_index.phpt | 5 ++- tests/test_installer_lib_name.phpt | 4 +- tests/test_installer_platform.phpt | 4 +- tests/test_installer_resolve_asset_name.phpt | 39 ++++++++------------ 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bda6ace..ceb70f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.0] - 2026-07-30 + +### Fixed + +- **Platform-specific test failures on macOS** + - `test_installer_platform.phpt` — `platformLabel()` returns "macOS arm64" on Darwin; test now accepts the `macOS` prefix instead of requiring `PHP_OS_FAMILY` verbatim + - `test_installer_lib_name.phpt` — switched to `--EXPECTF--` with `%s` wildcards (`.dylib` vs `.so`) + - `test_installer_resolve_asset_name.phpt` — unified platform-identifier and architecture assertions to produce identical output on Linux and macOS + - `test_hnsw_rabitq_index.phpt` — now skips on non-Linux-x86_64 platforms (RaBitQ is supported on Linux x86_64 only) + ### Added - **DOC-006: Complete README.md update with all missing features and sections** (#65) @@ -1062,7 +1072,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- -[Unreleased]: https://github.com/alibaba/zvec-php/compare/v0.4.11...HEAD +[Unreleased]: https://github.com/crazy-goat/php-zvec/compare/v0.5.0...HEAD +[0.5.0]: https://github.com/crazy-goat/php-zvec/compare/v0.4.10...v0.5.0 [0.4.11]: https://github.com/crazy-goat/php-zvec/compare/v0.4.10...v0.4.11 [0.4.10]: https://github.com/alibaba/zvec-php/compare/v0.4.9...v0.4.10 [0.4.9]: https://github.com/alibaba/zvec-php/compare/v0.4.8...v0.4.9 diff --git a/tests/test_hnsw_rabitq_index.phpt b/tests/test_hnsw_rabitq_index.phpt index febb3fe..da5e094 100644 --- a/tests/test_hnsw_rabitq_index.phpt +++ b/tests/test_hnsw_rabitq_index.phpt @@ -1,7 +1,10 @@ --TEST-- HNSW RaBitQ index: create, insert with dim >= 64, optimize, query --SKIPIF-- - + --FILE-- ---EXPECT-- -PASS: libName returns 'libzvec_ffi.so' (expected 'libzvec_ffi.so') +--EXPECTF-- +PASS: libName returns '%s' (expected '%s') PASS: libName is a valid filename PASS: libName has correct prefix PASS: All libName tests completed diff --git a/tests/test_installer_platform.phpt b/tests/test_installer_platform.phpt index d6bac05..59d499c 100644 --- a/tests/test_installer_platform.phpt +++ b/tests/test_installer_platform.phpt @@ -9,7 +9,9 @@ use CrazyGoat\ZVec\Installer; $label = Installer::platformLabel(); -if (str_contains($label, PHP_OS_FAMILY)) { +$osMatch = str_contains($label, PHP_OS_FAMILY) + || (PHP_OS_FAMILY === 'Darwin' && str_contains($label, 'macOS')); +if ($osMatch) { echo "Platform label contains OS family: PASS\n"; } else { echo "FAIL: Platform label missing OS family\n"; diff --git a/tests/test_installer_resolve_asset_name.phpt b/tests/test_installer_resolve_asset_name.phpt index 0912a68..75bba25 100644 --- a/tests/test_installer_resolve_asset_name.phpt +++ b/tests/test_installer_resolve_asset_name.phpt @@ -32,28 +32,21 @@ if ($result === null) { } echo "PASS: Asset name contains 'libzvec_ffi'\n"; - // Platform-specific checks - if ($os === 'Linux') { - if (str_contains($result, 'ubuntu') || str_contains($result, 'alpine')) { - echo "PASS: Linux asset name contains distro identifier\n"; - } else { - echo "FAIL: Linux asset name missing distro identifier\n"; - exit(1); - } - if (str_contains($result, $arch)) { - echo "PASS: Linux asset name contains architecture\n"; - } else { - echo "FAIL: Linux asset name missing architecture\n"; - exit(1); - } - } elseif ($os === 'Darwin') { - if (str_contains($result, 'darwin')) { - echo "PASS: macOS asset name contains 'darwin'\n"; - } else { - echo "FAIL: macOS asset name missing 'darwin'\n"; - exit(1); - } + // Platform-specific checks (uniform output across platforms) + $identifierOk = ($os === 'Linux' && (str_contains($result, 'ubuntu') || str_contains($result, 'alpine'))) + || ($os === 'Darwin' && str_contains($result, 'darwin')); + if (!$identifierOk) { + echo "FAIL: Asset name missing platform identifier\n"; + exit(1); + } + echo "PASS: Asset name contains platform identifier\n"; + + $expectedArch = $os === 'Darwin' && $arch === 'arm64' ? 'aarch64' : $arch; + if (!str_contains($result, $expectedArch)) { + echo "FAIL: Asset name missing architecture\n"; + exit(1); } + echo "PASS: Asset name contains architecture\n"; } echo "PASS: All resolveAssetName tests completed\n"; @@ -62,6 +55,6 @@ echo "PASS: All resolveAssetName tests completed\n"; PASS: resolveAssetName returns '%s' PASS: Asset name ends with .tar.gz PASS: Asset name contains 'libzvec_ffi' -PASS: Linux asset name contains distro identifier -PASS: Linux asset name contains architecture +PASS: Asset name contains platform identifier +PASS: Asset name contains architecture PASS: All resolveAssetName tests completed