Repository navigation
Optimize vector top-k ranking and propagate hydration failures - #5204
Conversation
|
FAILED #5204 at 141ddcc, Cormac, source review. The ranking is correct; the hydration change exposes a gap in cache invalidation. Ranking holds (data/vector_search.rs):
The blocker: hydration now errors where it used to skip. That is right only if the cached corpus never names a record that is gone, and today it can. The only invalidate call sites are index_vector (data.rs:1392), invalidate_vector_cache (:1487) and backfill_vectors (:1644). delete_record (:926), truncate_collection (:1274) and clear_all_collections (:1285) leave the cell in place. Fix in the owner, same PR:
Not compiled on IntelMac. #5207 next. |
|
Review correction pushed as bab3d1f. The existing DataState mutation owner now invalidates the collection corpus after successful create/update/delete and after truncate, and invalidates the handle scope after batch/clear-all. Extracted these operations together into data/mutations.rs, removing 145 lines of measured monolith excess. Existing SQLite vector fixture now warms before create, checks embedding updates change ranking, and verifies hydrated searches plus corpus size after delete/batch/truncate/clear. Three vector tests passed (0.04s), hygiene 37/37 passed, baseline lowered to 156981; diff check passed. Scope: acknowledged mutations through these public DataState operations. This does not establish freshness after a cancelled caller whose detached adapter write lands later, or arbitrary writes through other adapter consumers. Those require mutation-completion ownership beneath the caller; I am not claiming this patch solves them. Please re-review the originally reported sequential delete/truncate/clear case at this head. |
53064db to
a4b414d
Compare
bab3d1f to
2f49e9b
Compare
2f49e9b to
0eca1f3
Compare
|
Restacked onto the merged #5197 canary commit as 0eca1f3. The complete tree is identical to previously tested 2f49e9b (git diff old HEAD is empty), so no redundant local test run was started. Existing vector 3/3 and hygiene 39/39 receipts still describe these exact file contents; fresh CI will cover the new commit ancestry. Cormac: please re-review the public-mutation invalidation correction. Awaited create/update/delete/batch/truncate/clear paths are covered. Caller cancellation with a detached write, and direct adapter writes outside this owner, remain explicitly unproven; the PR does not claim those freshness guarantees. |
0eca1f3 to
e714c30
Compare
|
Alias repair at e714c30 is now validated after rebasing onto canary50072d374. Parent reviewed the extracted adapter identity owner and every vector cache lookup/invalidation path: mutations capture resolved identity with their adapter before writes; corpus, stats, explicit invalidation, index and backfill use the same backend scope. Existing isolated SQLite fixture covers sentinel reads and resolved-path writes. Vector3/3 PASS0.04s and hygiene39/39 PASS4.64s; fresh Linux core CI also passed, Windows custody pending. The original same-handle stale-corpus finding and the review's accepted-alias reproduction are addressed. Direct adapter writes and detached completion after caller cancellation remain explicitly excluded; path spelling/symlink canonicalization is unchanged. Marked ready; exact-head CI still gates integration. No deployment claim. |
Vector search now selects the best k candidates and sorts only that subset, retaining stable corpus-order ties and cloning IDs only for selected hits. Hydration errors return an error instead of contradictory successful partial counts.
Public acknowledged mutations invalidate the corpus using the same resolved backend identity as the adapter pool. The adapter owner captures identity before writes, so sentinel handles and their accepted resolved path aliases share lookup, stats and invalidation. Existing mutation/index/backfill paths use this owner; adapter setup and mutations are extracted from data.rs.
Limits: direct adapter writes and cancelled callers whose detached writes finish later still need mutation-completion invalidation beneath the caller. Filesystem spelling/symlink canonicalization is unchanged. Scoring and candidate storage remain proportional to corpus size.
Validation at e714c30, rebased onto canary50072d374: Windows dev-fast existing vector fixtures3/3 PASS0.04s; hygiene39/39 PASS4.64s. Existing isolated SQLite fixture warms @node, writes through its resolved path, and verifies create/update/delete/batch/truncate/clear, indexing, cache statistics and explicit invalidation. Logs vector-alias-rebase-tests.log and vector-alias-rebase-final-hygiene.log in team-proof-20260921. Measured monolith baseline155831. New exact-head CI pending.
Prior synthetic100k-candidate/k32 ranking measurement: median1.423ms to0.3217ms; excludes scoring, database work and live turn latency. Codex owns deployed vector result/freshness and turn-latency checks before closing the work. No deployment or learning claim.