docs/tests: pin concurrency contract across Python, C, and Go#114
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the documentation and adds tests to clarify and verify the concurrency model of ordvec across its Python, Go, and C APIs, establishing a read-concurrent, mutation-exclusive contract. In the Go test suite, a potential issue was identified where calling t.Fatalf on a Close failure could prematurely terminate the test while background worker goroutines are still running, which can be resolved by using t.Errorf instead.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
52ceff2 to
75cb0bd
Compare
Review Summary by QodoDocument and test concurrency contract across Python, C, and Go
WalkthroughsDescription• Document read-concurrent, mutation-exclusive concurrency contract across Python, C, and Go • Add deterministic Python concurrent search test with ThreadPoolExecutor • Add Go smoke test for concurrent Search/Info racing with Close • Clarify input array mutation restrictions in all language bindings Diagramflowchart LR
A["Concurrency Contract"] --> B["Python Docs"]
A --> C["C ABI Docs"]
A --> D["Go Package Docs"]
A --> E["README"]
B --> F["Python Test"]
D --> G["Go Test"]
F["Python Test"] -.-> H["ThreadPoolExecutor concurrent searches"]
G["Go Test"] -.-> I["Concurrent Search/Info with Close"]
File Changes1. ordvec-python/python/ordvec/__init__.py
|
There was a problem hiding this comment.
Pull request overview
This PR documents the read-concurrent, mutation-exclusive threading contract across user-facing docs and adds concurrency-focused tests for Python and Go bindings.
Changes:
- Adds concurrency/threading guidance to README, Python package docs, C ABI docs, and Go package docs.
- Adds Python coverage for concurrent
RankQuant.search_asymmetriccalls on shared read-only inputs. - Adds a Go smoke test for concurrent
Search/Infobehavior aroundClose.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Adds top-level threading/concurrency contract summary. |
ordvec-python/python/ordvec/__init__.py |
Updates Python package threading docs. |
ordvec-python/tests/test_rank_quant.py |
Adds concurrent read-only search_asymmetric regression coverage. |
ordvec-go/doc.go |
Adds Go package documentation for concurrent use and Close. |
ordvec-go/ordvec_test.go |
Adds Go concurrency smoke test around Search, Info, and Close. |
docs/c-api.md |
Expands C ABI threading documentation for search/info/free and borrowed buffers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
75cb0bd to
157e825
Compare
Signed-off-by: Nelson Spence <nelson@projectnavi.ai>
Signed-off-by: Nelson Spence <nelson@projectnavi.ai>
d1c0ce2 to
8cc9ae2
Compare
|
Rebased #114 onto current Changes:
Validation:
The prior coverage failure on the pre-remediation run was an Intel SDE download 403 before tests ran ( |
|
/agentic_review |
Summary
RankQuant.search_asymmetriccalls against shared read-only inputs.Search/Infocalls racing withClose, including post-closeErrClosedbehavior.Deferred Follow-Up
Opened #113 for optional
safe_copy=Trueinput isolation for GIL-releasing Python methods. This PR does not add API, locking, lease/refcount, or input-copy behavior.Validation
cargo fmt --all --checkcargo testcargo test -p ordvec-fficargo clippy --workspace --all-targets -- -D warningscargo build -p ordvec-ffi --releasego test ./...python -m maturin develop --manifest-path ordvec-python/Cargo.tomlattempted on system Python; blocked becausematurinis not installed thereuv run --with maturin==1.13.3 --with pytest==9.0.3 --with numpy==2.4.6 ...to runmaturin developandpytest ordvec-python/testsin one temporary envGOTOOLCHAIN=go1.26.3 go test -race ./...Note: the local
/usr/bin/goreportsgo1.26.3-X:nodwarf5and fails even a trivial race build (go test -race -run '^$' errors) withruntime/race: package testmain: cannot find package. For the race validation above, I forced the official upstreamgo1.26.3toolchain throughGOTOOLCHAIN=go1.26.3; the repo race tests then passed.