fix(python): preserve API state on failed operations - #102
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request improves error handling and state consistency in alayalite. Specifically, it ensures that delete_collection and delete_index validate disk operations before modifying the client's internal maps, avoids using mutable default arguments in Index.init, and ensures that failed fit operations do not leave the index or collection in a corrupted state. The review feedback highlights an issue where a failed fit operation can leave orphaned RocksDB files on disk, and suggests explicitly cleaning up the rocksdb_path directory and handling exceptions during database closure to prevent masking the original error.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
IndexParamsstate between independently createdIndex()instances.IndexandCollectionretryable after failed first-fit / first-insert paths instead of leaving half-initialized Python API state behind.Clientdisk-delete preconditions before mutating in-memory maps, and normalizeIndex.insert()list inputs through the same numpy path as search APIs.Test plan
git diff --checktimeout 60s .venv/bin/pytest -qtimeout 60s .venv/bin/ruff check python scripts toolsgit commit