mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
cleanAll IS the factory reset (DeveloperScreen). It named seven tables while the schema has eleven, so a reset silently left wallet_counters, onchain_mint_quotes, mints and mint_keysets behind. That became a privacy bug in the previous commit: moving mints into SQLite meant a factory reset no longer removed the user's mints or their onchain deposit addresses. Introduced by that move and missed, because the drop list is hand-maintained and nothing pointed at it. It also cost a device. A test wallet upgrading from a genuine v26 install still failed with "duplicate column name: mintId", and the cause was this list: an earlier broken build's createSchemaQueries had created onchain_mint_quotes WITH mintId — that write COMMITTED even though the migration batch rolled back — and the factory reset then failed to remove it. Reinstalling the v26 native bundle recreated dbversion and seeded 26, so migration 31's `CREATE TABLE IF NOT EXISTS` silently skipped the leftover instead of building it fresh, and migration 33's ALTER collided with the mintId already there, taking every migration down with it. Reproduced, same error string. The list now comes from sqlite_master rather than from source. It cannot drift as tables are added, and it clears artifacts from any past bug — including exactly the leftover above, which is what a hand-written list can never do. No released build can reach that contaminated state (these commits are unpushed), so the migrations are deliberately NOT hardened with defensive DROPs: the invariant would hold — a create-migration only runs below its own version, so its table cannot legitimately exist — but the blast radius of getting that wrong is data loss, and the scenario is self-inflicted. Fully uninstalling the app is the correct recovery. Tests: 506 pass. The three new ones fail against the old list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>