Repository navigation
A user erasure tombstones only the shared embeddings of the namespaces its shared rows live in - #221
Merged
Merged
Conversation
…s its shared rows live in The shared-embeddings step read the keys of the loom.shared rows promoted from the erased user and tombstoned every scope='shared' embedding of those keys in the org. A shared row of the same key spelling in another namespace, promoted from someone else, lost its embedding and dropped out of vector search while its loom.shared row stayed live. The step now reads (namespace, memory_key) pairs and tombstones by the pair. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A shared row of the same key in another namespace, promoted from someone else, keeps its embedding: two shared embeddings are stored and read back. The stub test's docstring says only what it checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A user_id erasure no longer tombstones the shared embedding of another namespace's shared memory that has the same key, so that memory stays in vector search.
Why
Failing case: in one org,
team-aholds aloom.sharedrowuser_employerpromoted from useru1, andteam-bholds a shared rowuser_employerpromoted fromu2.erasure.request {scope_type: "user_id", scope_value: "u1"}runsshared_embeddings.tombstone, which readSELECT DISTINCT memory_key FROM loom.shared ...and tombstonedloom.memory_embeddings WHERE org = o AND scope = 'shared' AND memory_key IN ['user_employer']. That filter has no namespace, soteam-b's shared embedding (its excerpt and vector) was tombstoned. Itsloom.sharedrow stayed live, so the fact dropped out of vector search for a user nobody erased.Pattern: the key alone is not an identity across namespaces.
server/erasure/store/predicates.pyalready says so for the link tables, and the other user-scope steps match on(namespace, memory_key).Fix: the step reads
(namespace, memory_key)pairs from the shared rows promoted from the user and tombstones byPARENT_KEYS_IN, the same bound pair predicate the link steps use, sliced withchunks.Scope and risk
Touches only
tombstone_shared_embeddings_by_user. The matched set can only shrink: every embedding it still tombstones was tombstoned before. The census does not count this table for the user scope (shared*.tombstoneis a step-only table), so the residue check is unchanged.Compatibility, rollout and rollback
Tests
tests/unit/test_erasure_shared_embeddings_sql.py::test_a_shared_row_of_the_same_key_in_another_namespace_keeps_its_embeddingruns the step on clickhouse-local over two shared embeddings of keyk1, inteam-a(promoted from the erased user) andteam-b(promoted from another user). It fails on main's step (2 == 1: both are tombstoned) and passes now: onlyteam-a's is tombstoned.tests/unit/test_erasure_repo.py::test_tombstone_shared_embeddings_by_user_names_each_namespace_with_its_keyfailed before the fix (the read selected the key alone) and passes after: the read selectsnamespace, memory_key, the count and the mutation bind(namespace, memory_key) IN {keys:Array(Tuple(String, String))}with[("team-a", "k1")].tests/analyzer/shapes.txtregenerated (python -m tests.analyzer.corpus --write); the corpus stub row for the read now carriesnamespace.tests/unit/test_erasure*.py,tests/unit/test_clickhouse_mutation_inventory.py,tests/analyzer/test_corpus.py,make format lint, mypy on the module.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked the shared-embedding writer (
promote.pystamps the shared row's namespace on the embedding) and the analyzer shape diff.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code