| … | … | @@ -619,6 +619,23 @@ export async function bootSwarmDevice ({ storage, deviceMnemonic, did, signingKe |
| 619 | 619 | // per-repo forceResync). resyncDid() BUMPS the gen; the daemon reopens on next boot — a poisoned base |
| 620 | 620 | // can't be live-closed (it aborts on apply), so boot-reopen (never opening the poisoned base) is the |
| 621 | 621 | // correct shape. Nothing is deleted: the old poisoned cores stay on disk in the shared store. |
| 622 | // |
| 623 | // ⛔ DO NOT "SIMPLIFY" THIS INTO autobase's setLocal(key,{keyPair}) WRITER ROTATION. That undocumented |
| 624 | // API (autobase/index.js:489) looks like it should replace the whole second-Corestore apparatus below — |
| 625 | // rotate onto a fresh keypair in place, drop the side store, drop the _sideStore.replicate ordering in |
| 626 | // bootMultiDevice. Characterized against 7.28.1 (2026-08-12) and it does NOT work here, for three |
| 627 | // independent reasons: |
| 628 | // 1. NOT A CLEAN SLATE. _rotateLocalWriter calls LocalState.moveTo(old,new), which copies the |
| 629 | // linearizer updates AND the autobase/boot record onto the new writer, and the base stays in the |
| 630 | // same store with its stale view cores. The fresh primaryKey is the whole point of a side store. |
| 631 | // 2. IT ASSERTS ON AN INDEXER. _rotateLocalWriter nulls localWriter before _updateLinearizer calls |
| 632 | // _clearLocalIndexer, which asserts localWriter !== null — a bare AssertionError with an EMPTY |
| 633 | // message, leaving a half-rotated base. A poisoned node is usually the creator, i.e. the sole |
| 634 | // indexer. Even with that fixed, rotating the sole indexer leaves the room with ZERO indexers. |
| 635 | // 3. IT DE-ADMITS ANYWAY. The rotated key is not in the writer set, so an indexer still has to |
| 636 | // addWriter it — the same online-indexer dependency the fresh-corestore re-join already has. |
| 637 | // So the second Corestore + the side-store replication ordering are load-bearing, not incidental. |
| 638 | // Evidence + probes: memory/reference_autobase-setlocal-writer-rotation, pear-git#35. |
| 622 | 639 | const RESYNC_DIR = 'statebase-resync' |
| 623 | 640 | const did16For = (did) => b4a.toString(crypto.hash([NS('room-key'), b4a.from(did)]), 'hex').slice(0, 16) |
| 624 | 641 | |