feat(api): namespace management β move, rename/merge, delete with strategy (#1181) - #1183
Merged
Conversation
β¦ategy (#1181) Namespaces are a derived view over the memories.namespace column, but there was no sanctioned path to fix mistakes: no move, rename, or delete operation existed anywhere, and deprecated-only ghost namespaces looked identical to active ones in listings. - PUT /memory accepts namespace (move β plain column update, no re-embed) - POST /namespaces/rename: atomic rename; existing target = merge - POST /namespaces/delete: explicit strategy β refuse (default, 409), merge (move to target, name vanishes), deprecate (soft-delete only) - GET /namespaces?with_counts=true adds active/deprecated breakdown - CLI: uteke namespace move|rename|delete (delete requires --confirm) - MCP: uteke_namespace_rename, uteke_namespace_delete, namespace field on uteke_update
π Cora AI Code Reviewβ No issues found. Code looks good! Review powered by cora-code Β· BYOK Β· MIT |
CI builds enable the onnx feature (via uteke-server's dependency declaration) but the runner has no ORT model file, so Uteke::open()'s default onnx backend fails at first remember(). Use open_with_backend(None) β the same storage-only pattern the server tests use β so the namespace tests exercise DB semantics without an embedder.
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
Namespace management across all surfaces (#1181) β namespaces are a derived view over the
memories.namespacecolumn, and this adds the sanctioned operations the issue proposed (additive, non-breaking):Uteke::move_memory(id, ns)(plain column update, no re-embed β embeddings are content-based),Uteke::rename_namespace(from, to)(single atomic UPDATE; existing target = merge, returns{from, to, moved, target_existed}),Uteke::delete_namespace(name, strategy, target)with explicit memory-fate strategies:refuse(default β validation error while any memory incl. deprecated references the name),merge(move all memories totarget, the name vanishes naturally),deprecate(soft-delete via the feat: deprecate_with_reason() + promote() + Store undeprecateΒ #929 lifecycle β restorable via promote, never hard-deleted). Shared name validation (non-empty, β€128 chars), recall-cache invalidation for old+new namespaces, vector-index removal on deprecate.PUT /memoryaccepts optionalnamespace; newPOST /namespaces/renameandPOST /namespaces/delete(refuse β 409 Conflict, other validation β 400);GET /namespaces?with_counts=truenow returns additiveactive/deprecatedfields whilecountstays the total (deprecated-only ghost namespaces become visible for what they are).uteke namespace move|rename|deleteβ delete requires--confirm(same guard as the destructive-command convention).uteke_namespace_rename,uteke_namespace_delete, and anamespacefield onuteke_update.docs/api-reference.mdregenerated via docgen;docs/cli-reference.mdnamespace section updated; CHANGELOG under[Unreleased]β Added.Why
#1181: agents (or humans) writing to a typo'd namespace had no sanctioned fix path β the name only disappeared when its last memory was manually moved, and listings could not distinguish active from deprecated-only namespaces. The design keeps the derived-view model (no new tables, no schema change) and follows the soft-delete lifecycle philosophy: there is deliberately no hard-delete path.
Testing
operations.rs): move updates namespace + old name vanishes from listings + unknown ID βOk(false); rename moves all memories, merge reportstarget_existed, same-name/unknown-source rejected; all three delete strategies β refuse blocks non-empty, merge relocates and removes the name, deprecate soft-deletes without data loss (memory stays stored,deprecated = true, lifecycle counts show 0 active / N deprecated), unknown strategy rejected.tiny_http::TestRequest, embedder-free): PUT /memory namespace move verified via GET /memory + listings; rename/merge endpoint contract (moved,target_existed); refuse β 409 with "refus*" message; merge delete removes namespace from listings;with_counts=truelifecycle split (0 active / 1 deprecated / count 1).cargo fmt --allβ Β·cargo clippy --workspace --all-targets -- -D warningsβ Β·cargo test --workspaceβ (0 failures) Β·cora review --stagedβ (No issues found) Β· docgen regenerated (freshness check will verify).