Deletion follow-ups from the #13 reviews: Forget guards, lock codes and documents #60
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp#60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The correctness review and the security review of PR #59 at
c2f08bbfound no blocker. This issue holds their should-fix findings, their test gaps, and the notes from the three rework rounds that the merge did not fix. Each finding below was reproduced on synthetic data unless it says "reasoned".Forget guards (security first)
_reconcilechecks the held rows against the Tombstones (sync.py:431-433). A normal pass does not. Case: sync, copy the Mirror,forget, put the copy back,sync --once; the api reader still returns the message. Aforgetthat answerswal=busyand then loses its-walends the same way. Fix: check the held guids against the Tombstones at each writer open, or at the start of each pass.SECURITY.mdstates the window until then.salt_checkis readable in it (tombstones.py:89-125). Anyone who can write the volume can delete its rows or put back a stale copy, without the store key. Reconcile then fetches the Forgotten message again. The marker refuses a 0-byte file only. When the export file is present, the merge repairs this; otherwise nothing detects it. Fix: hold a Tombstone count, or a digest of the digest set, in the encrypted Mirror'ssync_state, and refuse a Tombstone store that holds fewer. At least,SECURITY.mdstates that the Tombstone store has no integrity protection.export_pendingis"1"(sync.py:679-684). Case: delete the export; it stays absent through 4 passes. Put an older copy back; it keeps 1 of 2 digests. A Rebuild from that file after a lost volume then brings back the later Forgets. Fix: when the export is absent, or lacks a digest that the live store holds, setexport_pendingand write it.reply_tocan keep a Forgotten guid. Case:forgetwrites the Tombstone and its Mirror transaction fails (store-unavailable), then the owner deletes the message before the nextforgetor Reconcile. Recently Deleted and the hard-deletion scan remove the row with a plainremove_row, soreply_tokeeps the guid. Reconcile looks only at held guids (sync.py:430-435,543-549,564-567).forgetagain answersunknown-message, so the README remedy fails. Fix: in Reconcile, clear eachreply_towhose salted hash a Tombstone matches; or give the Tombstone check precedence in the two deletion paths._open_tombstonesraisestombstones-unreadable, the handler opens the Mirror with_open_mirroronly to recordfailed_at(sync.py:709-715)._open_mirroralso writes theDELETION_SLICEmarker. Case: a 0.1.0 Mirror with no marker and no Tombstone file, and the create fails once. Every latersyncthen stops withtombstones-missing(exit 2). A 0-byte legacy file whose initialisation fails once ends the same way. Fix: usestore.open_writerin that handler.Codes and the sync loop
merge_exportrunsBEGIN IMMEDIATEon the live store every pass, even with no new rows, and maps every error totombstones-export-invalid(tombstones.py:250-262,sync.py:703). That is a setup code (exit 2), sosync_loopreturns. Case: a lock held for 7 s;sync --onceexits 2 after 5.2 s, andforgetprints the same code. A partly written export file also makes a running loop exit after one pass. Fix: map a lock to a code that the loop retries; skip the write transaction when there are no new rows; keeptombstones-salt-mismatchfor a salt mismatch in the export. Correct the README row: it says "Does not start", but the loop also exits mid-run, and it tells the operator to move a valid export aside.forgetcan create a Tombstone store beside an unmarked Mirror (sync.py:385). Rework round 1 item 2 saysforgetpassescreate=False. Harmless today; make it match.config.py:266-292run for every verb. A shared config whose export directory is not mounted forapistopsapiwithconfig-validation. The shipped Compose and Kubernetes configs set no export path. Decide whether the rule runs only for the verbs that write the export.Documents
interruptedrow forforget: Ctrl-C after the Tombstone commit leaves the message in the Mirror and readable. Say what thestore-unavailablerow says: the Tombstone may be written, so runforgetagain; otherwise the next Reconcile removes the message.st_devand passes (reasoned, not run). "Place it on another volume" is advice; the code does not comparest_dev. The word "atomically" for the export does not mean durable.config.example.toml:18still names the-wal,-shmand-journalrule that round 3 removed.docs/install-single-host.mdhas no steps for the export path,forgetandsync --rebuild(from the dispatch report; the file was outside the write set).Test gaps (mutations that survive)
_open_mirrorno longer marks an existing Mirror (sync.py:341-343). Every test passes. On an upgraded 0.1.0 Mirror,forgetand then a lost Tombstone file: the real code stops withtombstones-missing, the mutant exits 0 and the Forgotten message comes back. This is the main gap.merge_exportwithout_verify_export(tombstones.py:259). No test gives a well-formed export with another salt, an extra object or a damaged page to the pass merge or theforgetmerge.mirror_path=None(sync.py:402). The tests put both stores in one directory.merge_exportwithout settingexport_pending(low impact).Carried from the rework rounds
new_rows(row_id-1, limit=1)with no row andmore=true).os.replace.forget m007is accepted asm7.KEY_FILE_VERBSonly describes the code.os.linkandunlinkin_open_mirrorleaves.mirror.db.<uuid>.tmp, a second hard link to the live Mirror.salt_checkcan plant valid junk digests in an export. They are merged for good and match no message.os.replace(tombstones.py:198-199). That needs write access to the live directory already.Filed under: operator word "I grant authority to merge T4 through 21:00 aedt" sha256:cec4dd4fecbd