Repository navigation
A user erasure keeps the user's cancel on another writer's open ingest job, without the user's identity - #362
Merged
Merged
Conversation
…t job, without the user's identity delete_ingestions_by_user deleted every loom.knowledge_ingest_cancels row the user wrote. A cancel row carries the canceller's identity, not the job owner's, and cancel_requested matches on (org, namespace, ingestion_id) alone, so erasing a writer who cancelled another writer's pending or processing job un-cancelled it: the job ran on and published the document. Before the user's rows go, the step now copies the user's cancels on jobs that another writer owns and that are still pending or processing, with only org, namespace, ingestion_id and requested_at; agent, user_id and session_id take their '-' defaults and actor ''. The copy holds no identity and no content. The saga trace stub counted any INSERT into a table as a rewrite of the scope's rows there; a copy whose column list leaves out user_id now is not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s from knowledge.domain The copy now runs under sequential_reads(), so a replica behind the cancel or the job cannot copy nothing while the replicated delete still takes the cancel. The open states move from knowledge.store.ingestions to knowledge.domain.ingest_states, which the erasure store may import, and are bound as a parameter instead of spelled again. The test fixes requested_at, compares every column of the copies, and covers a job an agent owns with no end user. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… query is as on main
The previous commit put {open:Array(String)} into _USERS_OWN_ORIGINALS,
whose callers bind no open parameter, and left the cancel copy spelling
the states. ingest_states keeps only OPEN_STATES; DONE_STATES had no reader.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ames the one copy it lets through _USERS_OWN_ORIGINALS spelled the open states again; it now binds OPEN_STATES like the cancel copy, so the two cannot drift apart. The saga stub keeps every INSERT a rewrite except the cancel copy itself. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…is tested and its write is named in the erasure saga's design Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ames the empty actor plainly Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…nd both pages list the identity columns in table order Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
fix/erasure-keeps-others-cancels
branch
from
November 7, 2026 13:22
40575c8 to
98421de
Compare
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):
Erasing a user no longer un-cancels another writer's document ingest that the user had cancelled: the cancel is kept without the user's identity.
Why
A row of
loom.knowledge_ingest_cancelscarries the canceller's identity, not the job owner's, andingestions.cancel_requestedmatches on(org, namespace, ingestion_id)alone.delete_ingestions_by_userdeleted every cancel row with the eraseduser_id. So when writer A cancelled writer B's pending or processing ingest and A was then erased, the cancel went with A's rows and B's job ran on and published the document.delete_ingestions_by_usernow first copies A's cancels on jobs that another writer owns and that are stillpendingorprocessing(read fromloom.knowledge_ingestions FINAL), keeping onlyorg,namespace,ingestion_idandrequested_at.agent,user_idandsession_idtake their'-'defaults andactor'', so the copy names nobody and holds no content. Then A's rows go as before. Cancels on A's own jobs, or on jobs that already ended, go with no copy. The copy runs undersequential_reads(): a replica behind the cancel or the job would copy nothing while the replicated delete still takes the cancel.OPEN_STATESmoves fromknowledge.store.ingestionstoknowledge.domain.ingest_states, whicherasure.storemay import, and the new statement binds it as a parameter;DONE_STATES, which nothing read, is gone. The queries that spelled the open states before this change (_USERS_OWN_ORIGINALS, the ingest queue'sdueandHELD_SQL) are left as they are.The saga trace stub (
tests/unit/erasure_saga_stub.py) counted anyINSERTinto a table as a rewrite of the scope's rows there, which made the following count read zero and skip the delete. It now counts everyINSERTas a rewrite except this copy (steps_memory._KEEP_OTHERS_CANCELS).The copy names no principal, so its
actoris empty, and the table has nosource_classcolumn;docs/architecture/memory-architecture.md(erasure saga) says so, next to the feature page.Scope and risk
User-scope erasure of ingestion rows only. One extra
INSERT ... SELECTper user erasure. A retried step may copy the same cancel twice;cancel_requestedreadsLIMIT 1, and the table's 30-day TTL drops both.Compatibility, rollout and rollback
Tests
tests/unit/test_erasure_ingest_cancels.py(clickhouse-local), which also checks the copy runs undersequential_reads(): Alice's cancels on Bob's pending job, Bob's cancelled job, her own processing job and an agent's job with no end user; afterdelete_ingestions_by_user(org, "alice")only Bob's open job and the agent's read cancelled, each by a row with no identity whose every column is compared (itsrequested_atkept), and Alice's ingestion is gone. Fails onmain, passes here.tests/unit/test_erasure_step_order.py: the user saga'sdocuments.tombstonetrace now holds the copy before the deletes, and still deletesloom.knowledge_ingest_cancels.test_erasure_documents.py,test_package_contracts.py,test_erasure_repo.py,test_erasure_audit_actor.py,test_new_mutations_bind_parameters_only.py,test_knowledge_inspect_ingest_sql.py,test_namespace_tune_documents_sql.py,test_doc_links.py,test_public_copy.py: pass on this head.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.
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.main; no merged migration is edited.frontend/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