fix: ignore dimension for custom mock embeddings - #12980
Merged
anakin87 merged 2 commits intoSep 28, 2026
Merged
Conversation
Contributor
|
@carey-bk is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
anakin87
approved these changes
Sep 28, 2026
anakin87
left a comment
Member
There was a problem hiding this comment.
Thank you!
I simplified the tests a bit
anakin87
enabled auto-merge (squash)
September 28, 2026 09:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Fixes #12978.
Proposed Changes
MockTextEmbedderandMockDocumentEmbedderrejected non-positivedimensionvalues even when a fixed
embeddingorembedding_fnmade the parameter irrelevant.Validate positive dimensions only in the default deterministic mode, matching the
documented contract. Preserve mutual exclusion and vector validation, clarify the
raises documentation, and add a release note.
The regression tests cover both components, zero and negative dimensions, actual
callback invocation, invalid vectors, and serialization round trips with importable
named functions. Supplied dimension values and the serialization format are unchanged.
How did you test it?
Latest upstream base checked:
8a5406eea71a0fc19e94c4b9a5cd96df2158a45a.hatch run fmt-check: lint and formatting passed.unmodified base and 79 passed with the fix.
passed with 148 passed, 6 integration tests deselected, and mypy passed on
the four changed Python files.
Focused test command (Python 3.12, Hatch environment with the required dependencies):
hatch run python -m pytest --cov=haystack -m 'not integration' \ --disable-socket --allow-unix-socket \ test/components/embedders/test_mock_text_embedder.py \ test/components/embedders/test_mock_document_embedder.pyTests use fixed inputs and offline mocks, with network sockets disabled. No model
weights were downloaded or model APIs called.
Notes for the reviewer
This patch was fully generated with Codex. The results above are local; remote CI
has not run. In the local environment, whole-tree mypy reported the same four
unused-ignorediagnostics on the base and patched code. The full dependency/CImatrix remains unverified. Full-history
reno lintwas blocked by the shallowclone; the new note passed YAML, reStructuredText, and project hook checks.
Checklist