Epic A of #962. The engine only; the manual action is #966.
A1 wrote the diagnosis as failing tests first, and they were red for the right
reason: no sweep existed and six BlobStore methods did not. Also lands a
control test asserting that DELETE alone does not shrink the database, which
passes today and must keep passing, since it is the entire reason a VACUUM step
exists.
A2, the timestamps. A second blob, __msgrows_migrated_at, keyed by store key.
Deliberately NOT a reshape of __msgrows_migrated: that marker is read on every
save and every load through a cache, so changing its shape would put a
migration of its own on the hottest storage path. Owner decision 2026-10-22.
An install that migrated before this ships has no timestamp, so backfillMigratedAt
stamps it on FIRST SIGHT and the sweep skips anything it stamped this pass:
updating the app can never delete a blob on the spot, and every key gets the
full 30 days measured from when we first knew about it.
A3, the sweep. Eligibility is age plus a fresh verification, never the marker
alone, which is the difference between "we recorded that this migrated" and
"we just confirmed it". missingFromRows returns null for "could not tell" and
an empty list for "verified nothing missing", and those are deliberately
different values: collapsing them is how the only copy of an unreadable
history gets deleted.
A4, one VACUUM, only when something was deleted. A failure there is logged and
tolerated: the deletes already happened and were each verified, so it costs
space and not data, and the next sweep retries it.
The comparison rule now lives in ONE place, _absentFrom, used by both the
migration gate and the sweep. The gate still decodes its own blob, because a
second compute over multiple megabytes on the migration path would cost more
than the duplication saves, so the rule is shared even though the decode is
not.
Wired into main.dart's existing post-frame callback, beside the #906 exit-info
collector, for the same reason: storage hygiene must never be on the path to a
usable screen. The catchError sits at that fire-and-forget call site rather
than inside run(), so #966's button still gets a failure it can report.
scoping_inventory gained the new key, because the #853 gate caught it exactly
as designed. Its verdict is globalOnPurpose for the same reason as the marker:
it is keyed BY store keys that already carry the radio.
15 tests, the plan's whole acceptance bar: the 29-day and 30-day boundaries;
one missing row refuses AND the same key clears once its rows are complete,
which is what proves the gate discriminates rather than never deleting; an
undecodable blob refuses; an unstamped key is stamped not deleted; an
unmigrated key is untouched; contacts, discovered_contacts and path_history_
are asserted non-candidates BY NAME; a DM key sweeps through the DM converter;
and every kept blob is byte-identical across the sweep and VACUUM with the row
count unchanged.
A5, verification against a copy of the owner's real database through the
production sweep:
blob keys: 470, migrated history keys aged: 47
cleared 40, refused 0, 17367040 bytes returned (16.56 MiB)
kept keys missing: 0, byte-changed: 0
integrity_check: ok, rows 29949 -> 29949
47 aged and 40 cleared because the other 7 migrated through the empty-blob
path and never had a blob to reclaim.
Full suite 1,469 pass, 1 skipped, up from 1,454. analyze clean, format clean.
Task: meshcore-open-5vt
Agent Mail: TealGlen
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>