Repository navigation
fix(index): build the vector schema from the provider's width (G4) - #123
Merged
Merged
Conversation
The dense build failed with "Cannot cast to FixedSizeList(384): value at index 0
has length 768" on a table declared 384-d with zero rows. The cast was a symptom.
Root cause: `LanceDBManager._open_or_create_table` read the stored width from a
sample ROW, and the migration helpers used `table = table or self.table`. An
empty LanceDB table is falsy, so on an empty table `self.table` (not yet
assigned) raised AttributeError, the broad handler treated that as "table not
found", and the dimension check never ran.
Contract (new `src/core/indexing/dim_contract.py`):
- a provider declares its output width (`embedding_dim` / `provider_name`);
- the schema is built from that width;
- an empty table with another width is rebuilt (no rows to lose);
- a non-empty table with another width refuses loudly: provider name and both
numbers (`EmbeddingDimMismatch`), never a silent 768->384 resize;
- `LanceDBWriter` no longer pads or truncates a vector.
The schema width is read from the SCHEMA, not from a data row.
Retries: `bounded_attempts` replaces the open-ended "embed error -> idle-unload
-> restart" loop on the llama branch: 3 batch attempts, one revive, two single
attempts, then `EmbedderUnavailable` with provider and last error (BLOCKED).
Red-first test: `test_embed_batch_raises_blocked_instead_of_restart_loop`.
External endpoints: `MSCODEBASE_EMBEDDER_PROVIDER` pins the provider. With it
set, the background scanner and the :8080 dimension probe are disabled, so
LM Studio / llama-server only answer when named. `auto` keeps the old order.
Smoke: the query vector comes from the active provider and its width is checked
against the table schema before search; an empty vector table falls back to the
text index (shipped default stays text-only). No `--dense` flag was added.
Measured (night 12->13.11.2026, temp data root):
provider onnx:multilingual-e5-small-int8, dim 384
7307 chunks, fixed_size_list<float>[384], 2210.8 s, 73.3 MB
smoke_e2e --project . with MSCODEBASE_DENSE_OFF=false:
PASSED (4 checks), step 4 = vector, provider=onnx, dim=384, results=3
Gates: pytest -m "not integration and not benchmark" 2570 passed / 10 skipped
(was 2560; +10 new, none lost), ruff OK, text-only smoke PASSED.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Bring the G4 embedding-width contract onto the post-merge main (G1/G2/G3/G4
docs, Goal 2 install/data/docs work). AGENT_DIARY.md conflict resolved by
keeping every dated entry.
Audit in the same pass:
- stale_detector: a dependency pin (`onnxruntime==1.27.0`) was compared with
the project version (3.5.0) and reported as doc drift on ru/zh
SYSTEM_REQUIREMENTS, where the pin is correct. Versions preceded by
`=`/`@`/`~`/`>`/`<`/`^`/`!` are now skipped as pins, not project versions.
Guard: tests/test_stale_detector_versions.py (2 cases; the positive control
proves a real drift is still reported). The guard's negative control was
re-proved and re-pinned (reason recorded in pin_log.json) -> ALL PROVEN (3).
- Diary records the merge hashes, the new test bar and the audit results.
Gates on this branch with the merge applied:
pytest tests/ -m "not integration and not benchmark"
-> 2607 passed, 9 skipped (was 2560/10)
ruff_gate -> OK
smoke_e2e --project . -> PASSED (4 checks, step 4 = text, shipped default)
stale_detector -> Docs appear up to date
check_docs_vs_installer -> 155 flags, 0 problems
check_docs_vs_config -> 66 variables, 0 problems
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.
Merge branch 'main' into fix/g4-embedding-dim-contract
Bring the G4 embedding-width contract onto the post-merge main (G1/G2/G3/G4
docs, Goal 2 install/data/docs work). AGENT_DIARY.md conflict resolved by
keeping every dated entry.
Audit in the same pass:
onnxruntime==1.27.0) was compared withthe project version (3.5.0) and reported as doc drift on ru/zh
SYSTEM_REQUIREMENTS, where the pin is correct. Versions preceded by
=/@/~/>/</^/!are now skipped as pins, not project versions.Guard: tests/test_stale_detector_versions.py (2 cases; the positive control
proves a real drift is still reported). The guard's negative control was
re-proved and re-pinned (reason recorded in pin_log.json) -> ALL PROVEN (3).
Gates on this branch with the merge applied:
pytest tests/ -m "not integration and not benchmark"
-> 2607 passed, 9 skipped (was 2560/10)
ruff_gate -> OK
smoke_e2e --project . -> PASSED (4 checks, step 4 = text, shipped default)
stale_detector -> Docs appear up to date
check_docs_vs_installer -> 155 flags, 0 problems
check_docs_vs_config -> 66 variables, 0 problems