fix: align custom IDs in array-built indexes - #422
Merged
ASuresh0524 merged 2 commits intoSep 26, 2026
Merged
Conversation
ASuresh0524
added a commit
that referenced
this pull request
Sep 26, 2026
`Type Check with ty` fails on main itself, so every PR opened against it inherits a red check for code it never touched. #420, #421 and #422 are each blocked this way, on files none of them modify. Reproduced with CI's exact invocation (`ty check packages/leann-core/src apps tests`, ty pinned to 0.0.17) against a pristine checkout: 5 diagnostics, the same 5 CI reports. - Three `# type: ignore[...]` comments use mypy codes ty does not recognise, so it treats them as blanket suppressions, finds nothing suppressed, and reports them unused. Removed, which is ty's own suggested fix. - `tests/test_chrome_history_reader.py` assigns attributes onto bare `types.ModuleType` stubs when llama_index is absent. Those are genuine `unresolved-attribute` errors. The stubs now come from a helper returning `Any`. A suppression comment would not do: CI type-checks with no project dependencies installed while a developer machine has llama_index, so an ignore would be needed in one environment and flagged unused in the other. Annotating the variables as `Any` is also insufficient -- the assignment narrows the type straight back to `ModuleType`. ty now passes. ruff is unchanged at 17 pre-existing findings, none new, and the 14 tests in the two touched files pass. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
3 tasks
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.
Context
build_index_from_arrays()accepts IDs alongside precomputed embeddings. A caller can also useadd_text()to supply the passages those embeddings belong to. In that combination,add_text()gives the passages sequential IDs, while the array build sends the caller's IDs to the vector backend. A search can find the vectors but cannot resolve their text from the passage store. The build itself completes, which makes the empty search results hard to trace.For example, two
add_text()calls followed bybuild_index_from_arrays(path, ["doc-a", "doc-b"], embeddings)used to write passage IDs0and1while indexing the vectors asdoc-aanddoc-b.Change
Verification
Fixes #424.