Repository navigation
LEARN SL-9: discovery erasure - #148
Open
ViperJuice wants to merge 2 commits into
Open
ViperJuice wants to merge 2 commits into
ViperJuice wants to merge 2 commits into
Conversation
After a discovery's deletion, by request or by an imported deletion record, its recovered metadata row and the notice rows naming its items are deleted in the same transaction, and the deletion answers as finished only once its closing checkpoint completes; while a reader blocks it, it answers with the existing storage failure, committed, and a repeat finishes it, as delete_task does since SL-2. An import whose bundle carries a discovery deletion record checks its closing checkpoint the same way; an import without one is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
An imported discovery's request digest is a digest of its record, domains included, so after a deletion it could confirm a guessed label. Both deletion paths now clear it. State the discovery_content_artifacts and maintenance cursor limits and where SQLite's temporary files go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
LEARN SL-9, discovery erasure. This is the plan's lane for #138, #144 and the
delete-discoveryhalf of #21 (plans/phase-plan-v1-LEARN.md: SL-9, the row "Deletion propagation" and the list "This plan may not claim").A finished deletion of a discovery, whether requested or imported, now leaves neither the discovery's recovered metadata nor a notice row naming its items in the store's files. Until the erasure has finished, the deletion answers as
delete_taskhas since SL-2 (#123): with the existing storage failure, the deletion already committed. No schema, contract, doc or other test changes.What changed, by function
All changes are in
src/jevdrill/storage.py.delete_discoveryrecovered_discovery_metadatarow, which holds its domain labels (Storage: a deleted discovery's recovered metadata stays in the store #144);lifecycle_noticesandnoticesrows (Storage: delete_discovery leaves lifecycle notices for the archives it retires #138). A discovery's content items are staged with the discovery's identity as their task, so every notice about them is filed under it.UPDATE discoveries, which clears seed, result and trace, now also clearsrequest_digest. For an imported discovery that value iscanonical_digest(record), and the record includes the domains, so a guessed label could be confirmed against it.recover_artifacts, it runsPRAGMA wal_checkpoint(TRUNCATE)and reads the result, asdelete_taskdoes. If the checkpoint was blocked, it raises thesqlite3.OperationalErrorthatdelete_taskraises ("deleted content not yet erased; retry the request").import_recovery, the import of deletion recordsUPDATE discoveriesalso clearsrequest_digest.delete_taskanswers under a reader.main, ignoring its checkpoint.Behaviour change
Both answers stay within CLI version 1. Neither adds a status, code or field.
delete-discoveryanswers exit 4 with{"schema_version":"1","status":"storage_failure","code":"infrastructure_failure"}.recoverycommand, for an import that applied a discovery deletion record, gives the same answer.main:{"schema_version":"1","status":"deleted","work_objective_id":…};importedwith its count.mainanswersimported. The work is committed, and a repeat succeeds once the reader closes. That is a false "unfinished", which is the safe direction.The stated cost, as for
delete_task: the answer does not itself say that the deletion is committed. A caller learns that from the retry succeeding. No doc sentence says so fordelete-discoveryor for import.The control
The tests are in
tests/storage/test_discovery_erasure.py. Each assertion is its own test, and the reader is held open by the test itself, not by timing.How the checks search:
sl9-synthetic-domain-<uuid4 hex>), so no other discovery, task or catalog entry holds it. It is searched for as bytes in every file under the store's own directory: the database, its write-ahead log, any rollback journal and the artifact files.-shmfile, as SL-2's did. It holds only the log's index, never row content. Closing a descriptor on it would drop the process's SQLite locks on it (POSIX), including the held reader's, and on Windows another connection's locks can refuse the read.lifecycle_noticesandnoticesfor the discovery's content artifact identities and the discovery identity. Whole files are not searched because the plan's non-claim leaves those identities in the decisions and retries of tasks routed with the discovery.test_1_requested_deletion_erases_metadata_and_noticestest_2_imported_deletion_erases_metadata_and_noticescanonical_digest(record), computed from the discovery's record with its real label, is in none of the store's files. Shown by request and by import.test_1_and_2_finished_deletion_leaves_no_digest_of_the_discovery_record[request],[import]test_a_repeat_of_a_deleted_discovery_request_under_its_key_is_refuseddeleted, and the two checks hold.test_3_requested_deletion_is_unfinished_while_a_reader_holds_the_log1, and the two checks hold. The1counts the bundle's one carried artifact (an ordinary task's), already restored by the first import. Every row of every table is the same before and after the repeat, and there is one artifact row, so nothing is applied twice.test_3_import_applying_a_deletion_record_is_unfinished_while_a_reader_holds_the_log0) as onmain. Shown for another discovery's bundle, and for the deleted discovery's own bundle on a store that holds the deletion; the label and notices do not come back.test_3_import_applying_none_answers_as_on_main_while_a_reader_holds_the_log[another_discovery],[the_deleted_discovery_again]0and the two checks hold.test_3_import_repeated_under_the_same_reader_is_still_unfinished1(the new content), as onmain, and the deleted discovery stays erased.test_3_backup_with_an_applied_deletion_record_answers_imported_with_no_reader1and every table is unchanged.test_3_backup_with_an_applied_deletion_record_is_unfinished_while_a_reader_holds_the_logmain'sdelete_discoveryleft them. Importing the tombstone erases them, so with the reader open it raises; after the reader closes, the same import returns0, and the two checks hold.test_3_import_erasing_what_an_applied_tombstone_left_is_unfinished_while_a_reader_holds_the_log0, and the value is in no store file.test_3_import_newly_tombstoning_a_discovery_is_unfinished_while_a_reader_holds_the_logdelete-discoveryanswers(4, storage_failure body)with the reader open, then(0, {"schema_version":"1","status":"deleted","work_objective_id":…}), after which the two checks hold.test_4_delete_discovery_command_answers_a_storage_failure_then_deletedrecoverywith an encrypted bundle carrying the deletion record answers(4, storage_failure body), then(0, {"schema_version":"1","status":"imported","encrypted_bundle":null,"restored_count":0}).test_4_recovery_import_command_answers_a_storage_failure_then_importedtest_5_nothing_else_goes[request],test_5_nothing_else_goes[import]Breaks and their results
Each break was applied to a scratch copy of the source, never to this branch, and the file was run serially there.
request_digestkept on both pathsroute.db), and the repeat-under-its-key caserequest_digestkept bydelete_discoveryonlyrequest_digestkept by the import onlydelete_discovery(the PRAGMA removed)['route.db']), the digest case by request, 3-request (did not raise), 4-request ((0, deleted)instead of(4, …))delete_discoverydelete_discoverystorage.py)0) and the backup with a reader; also the three B1 cases, since that file predates the digest fixAlso run:
delete_discovery's answer check removed but its checkpoint kept: 3-request and 4-request fail, and 1 passes. That is correct, since the checkpoint still erases the label: test 1 guards erasure, not the answer.main'sstorage.py: 17 of 18 fail; only the import of another discovery's bundle passes;What the pinned host integration does with the unfinished answer
The pin is Consiliency/agent-harness at
85b29c76ecfb8cf5a94523e7da84edc44dcd250f, underphase-loop-runtime/src/phase_loop_runtime/.JevDrill.delete_objective(jevdrill_adapter.py:285-293) runs these steps in order:self.queue.delete_objective,:289, which commits injevdrill_queue.py:142-147);:291-292);self.transport.call("delete-discovery", …)(:293).JevDrillTransport.callchecks the exit code before reading the body. Any exit code other than 0 or 3 raisesOSError("JEV Drill CLI failed")(jevdrill_adapter.py:167-168), so exit 4 raises there and the body is never parsed.{"schema_version": "1", "status": "deleted", "work_objective_id": …}exactly, or the call raisesValueError("Invalid deletion acknowledgment")(:179-182).OSErrorfromdelete_objective, never as a finished deletion. There is no retry in the adapter.discover_objective(:255-257);_check_discovery(:273-274).phase-loop-runtime/tests/test_jevdrill_discovery.py:246-255raisesOSErrorfromdelete-discoveryand assertsobjective_deletedis still true.recoverycommand (jevdrill_adapter.py:102-110), so the import's answer does not reach it.The plan's non-claim, in plain words
Deleting a discovery does not remove its identities from the records of tasks that were routed with it: their routing decisions, their retries, and notices copied into those decisions. Nor does it remove request text those tasks supplied. Those records go when their task is deleted. The item-identity check therefore looks at notice rows only.
Unit and ROUTE counts
These are expected counts. Replace them with the job figures when the jobs report.
mainbefore (Windows: 8 skipped, before #142 merges)scripts/verify_route_phase.pynames its storage test files one by one, and this one is not among them. ROUTE's lint and format steps do covertests/storage.What is not shown
delete-discoverypath still passes is not shown until the nexthost.ymlrun. Its handling of exit 4 is shown above by reading the code and its own test at the pin, not by a run against this branch.importedwhile its erasure is unfinished.discovery_content_artifactsholds a digest that someone with the original content and access to the store can match. The table stays so that deleted content cannot be staged again.(scope, discovery identity, artifact identity), one per content item. The artifact identity is a digest of the scope, the discovery identity (the item's task), the kind and the content's digest.stage_artifactreads the table to refuse staging a deleted discovery's content again.maintenance_control's cursor can keep a deleted item's identity after a paused run. This was already listed in SL-2's limits, and it goes on the same issue.-shmfile, as SL-2's did, for the reason given under the control.recovery:<identity>for an imported discovery, the host's idempotency key for a requested one), with its seed emptied and its request digest, result and trace cleared;tasksrow, not marked deleted, so an export lists the discovery identity as a live task;tests/storage,tests/privacyandtests/maintenance(799 passed), plusruff check,ruff format --checkandmypy src/jevdrill. The tests intests/application,tests/cliandtests/experimentsthat call these paths were not run locally; unit CI runs them.CI at
7a2fb111e, read per job. Each run adds 18 to its base:f6ed67854mainwith #142ROUTE, read from the verification receipts: 1,235 / 1,235 / 1,234, unchanged, with 0 failures.
🤖 Generated with Claude Code