fix: data integrity, route matching, namespace filter, vector growth - #970
Merged
Conversation
β¦(#P1) - crud.rs: wrap insert + tag inserts in BEGIN/COMMIT transaction for atomicity - handlers.rs: strip query string before route matching, use literal path match - lib.rs: fix graph_data namespace filter that was a no-op (is_none_or(|_| true)) - vector.rs: geometric capacity growth (2x) instead of fixed +1024 increment Why: each fix addresses a real correctness or performance issue found in audit. Tests: 476 pass, 0 fail. Clippy: 0 warnings.
| .unchecked_transaction() | ||
| .map_err(|e| Error::db("Failed to begin transaction", e))?; | ||
|
|
||
| let result = self.try_insert_memory(memory, &embedding_blob, &tags_json, &metadata_json); |
π Cora AI Code Reviewβ Blocked β critical issues found. π΄ Error (2)
Review powered by cora-code Β· BYOK Β· MIT |
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.
What
Empat perbaikan P1 dari audit cora-code v0.13.0:
crud.rs atomicity β
insert()sekarang wrap INSERT + tag inserts dalamunchecked_transaction(), konsisten dengan pattern ditags.rsdandocuments.rs. Jika tag insert gagal, seluruh operasi rollback.handlers.rs route matching β Query string sekarang di-strip sebelum route dispatch (
route_path = path.split("?").next()). Semua handler yang extract query params sekarang pakaipath.split("?")bukanp.strip_prefix(...). Menghilangkan 14 clippyredundant_guardwarnings.lib.rs namespace filter β
graph_data(namespace)sebelumnya no-op (is_none_or(|_| true)selalu return true). Sekarang query memory IDs by namespace, filter nodes bymemory_id, dan filter edges untuk consistency.vector.rs capacity growth β Fixed increment
+1024β geometric growthmax(current*2, current+4096, 1024). Amortizes to O(1) per insertion untuk dataset besar.Why
Changes
crates/uteke-core/src/memory/crud.rsβunchecked_transaction()wrappercrates/uteke-server/src/handlers.rsβroute_pathvariable + literal path matchingcrates/uteke-core/src/lib.rsβ Namespace-aware graph node/edge filteringcrates/uteke-core/src/memory/vector.rsβ Geometric capacity growth formulaTesting