refactor: extract semantic index crate - #318
Draft
luca-ctx wants to merge 1 commit into
Draft
Conversation
Port approved C2 source 64e1d7cc41b35d1bad04df6839e94c5f30a879d9 (stable patch fbc6e8c435100df361652e017d2427200a5d162d) onto public main 5120024 after merged C1. Preserve current C1 model ownership and the merged PR #313/#314 behavior while moving semantic projection, Flat-F32 persistence and recovery, and precomputed-vector query behind the ctx-semantic-index boundary.
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.
Base and provenance
5120024f74621bb8932fd28c8ee111d9ee8d5be2(currentorigin/main, after merged C1 in PR refactor: extract semantic model boundary #316)64e1d7cc41b35d1bad04df6839e94c5f30a879d9fbc6e8c435100df361652e017d2427200a5d162d3de11cea7529d139cee894b9f2bafd203ea5ba1eThis ports only C2 onto merged C1. It does not replay the old S1/C1 train.
What changes
Adds
ctx-semantic-indexas the single production owner of:The CLI keeps composition and policy adapters. It obtains source/query embeddings through the existing model/runtime path and passes vectors into the index.
ctx-semantic-modelremains the sole owner of model acquisition, runtime loading, E5 identity/projection, and embedding execution.Behavior preservation
data_root/search/semantic.#[test]markers before and after (305 remain in CLI, 60 move to the index crate).SemanticQueryPin::searchas&[f32].ctx-history-index -> ctx-semantic-indexdependency.CLOC and dependencies
Pinned
scc 3.7.0:ctx-semantic-indexctx-history-core,ctx-history-index,ctx-semantic-modelanyhow,fs2,memmap2,rusqlite,serde,serde_json,sha2,thiserror,uuidtempfilectx-semantic-index; removes directmemmap2; test builds usetest-supportctx-history-refresh, CLI reverse imports, model acquisition/loading/embed execution, in-crateSemanticBatchEmbedderimplementationsThe dependency boundary test checks the exact Bazel closure, reverse paths, frozen model-contract imports, forbidden runtime capabilities, and absence of the old CLI authority.
Cargo, Bazel, release, and SBOM parity
ctx-semantic-model.Cargo.lock:25c9eb9fbf8b76ef6de35c020116c60e594de37dMODULE.bazel.lock:64d40d338f1bbe6db017114730454c7f10c7ef22Governed validation
All commands ran through
ctx-build-governorand the repository wrappers.Focused Bazel result: 17/17 expanded targets passed. The index unit target passed 60/60 tests; CLI units passed 1,331 with 3 ignored.
Cargo all-features passed 60/60 plus doc tests; no-default, workspace all-features, and clippy were clean. Offline dependency trees were also checked for all six release triples.
Supplemental result: 11/11 passed.
The affected selector chose
//:cibecause graph and lock inputs changed, then passed all 123 targets. The separate explicit broad CI run also passed all 123 targets.An independent read-only adversarial review reported no P0-P3 findings.
Rollback
Revert the single integration commit/PR. This change does not migrate or rename persisted data and does not alter the semantic format, so rollback restores compile-time ownership without a data conversion or store reset.
Residual concerns
Draft only; do not merge before independent review.