Skip to content

test(chroma): assert the HNSW defaults rather than a threshold arithmetic - #2159

Merged
igorls merged 1 commit into
MemPalace:developfrom
amorphous-dreams:fix/hnsw-defaults-followup
Aug 11, 2026
Merged

test(chroma): assert the HNSW defaults rather than a threshold arithmetic#2159
igorls merged 1 commit into
MemPalace:developfrom
amorphous-dreams:fix/hnsw-defaults-followup

Conversation

@joshuafontany

Copy link
Copy Markdown
Contributor

Follow-up to the review on #2107.

The HNSW default tests assert what a created collection carries: batch_size and sync_threshold land on fresh metadata at chromadb's own documented values, through both ChromaBackend creation paths. The relationship they assert reads batch_size <= sync_threshold — what chromadb permits — in both tests that check it.

Their docstrings state the same ground: the values are chromadb's own defaults, so a collection this backend creates indexes on the same terms as one chromadb creates itself, and sync_threshold=2 reads as a value chromadb's own parameter validation rejects.

_hnsw_creation_metadata(options) is the single place hnsw_space resolves, so get_collection() holds no second copy of that resolution. The option's path to a created collection is unchanged.

Write amplification belongs to the benchmark suite, where it can measure I/O.

tests/test_backends.py: 91 passed. Backend/palace selection: 593 passed, 16 skipped.

…etic

test_hnsw_write_defaults_bound_index_rewrites divided a hypothetical
corpus size by the configured sync_threshold and read the quotient as a
count of full on-disk index rewrites. It measured no writes, no
compactions, no persistence calls and no rewritten bytes, so it asserted
arithmetic on a constant rather than a property of the implementation.
The metadata tests already cover the defaults, and a write-amplification
regression wants I/O measurement under the benchmark suite.

Two neighbouring docstrings carried the same reasoning in prose and now
state what holds: the values are chromadb's own documented defaults, so a
collection this backend creates indexes on the same terms as one chromadb
creates itself, and sync_threshold=2 reads as a value chromadb's own
parameter validation rejects.

The threshold relationship now reads batch_size <= sync_threshold, which
is what chromadb permits.

_hnsw_creation_metadata(options) reads hnsw_space directly, so
get_collection's local copy of that resolution had no reader; removing it
leaves the option's path to a created collection unchanged.

tests/test_backends.py: 91 passed. Backend/palace selection: 593 passed,
16 skipped.

@igorls igorls left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wave 3 minimal for 3.7.0: LGTM. Docs/tests/tiny fix only.

@igorls
igorls merged commit 1c6fad7 into MemPalace:develop Aug 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants