Skip to content

resolveStoreBoot

resolveStoreBoot(storePath, opts): Promise<StoreBootResolution>

Defined in: packages/client/src/store-boot.ts:313

Resolve where a store boots and finish any destructive/candidate work the verdict demands, then return the dataDir + storageBackend the mint seam opens at. The full plan boot classification 1–6, EXECUTED:

  • memory overridememory:// passthrough, no classification (the sanctioned test/ephemeral lane has no meta machinery).
  • non-browser (no idb, no opfs handles) → file:// passthrough, no classification (the filesystem backend has no meta machinery either).
  • browser → read the meta record (readStoreMetaRecord; StoreMetaUnreadableError propagates = fail closed, invariant 12), map META_STORE_UNAVAILABLE to a provable absence (no idb ⇒ no record and no existing idb store), observe the commitment namespace and the recordless idb fact, classify, and execute:
    • resume-deletion → complete the destructive lifecycle, then RE-CLASSIFY from the now-clean state (bounded by MAX_DELETION_RECLASSIFY).
    • delete-candidate-and-rebuild → delete the stale sentinel AND the candidate directory (a barrier-gap crash’s sentinel must never survive) AND the record, then RE-CLASSIFY from the now-recordless state — so an idb store at this path is opened in place rather than shadowed by the rebuild.
    • repair-record-then-open-committed → write opfs-committed, then open committed.
    • open-committed → open the committed opfs store (open failures are HARD at mint time; the bounded retries for transient UnknownError-class failures live in the mint seam’s factory-call wrapper). A record already at opfs-committed takes the WARM FAST PATH: it is classified straight off the record, so neither the commitment-namespace observation nor the recordless-idb probe runs at all (both are irrelevant to classification 2).
    • boot-idb-authoritative → write idb-authoritative FIRST when there is no record yet (recordless idb), then idb://. TERMINAL: a store’s backend is fixed at first mint, so an idb store stays idb whatever this boot’s capabilities are — the only route to another backend is a deliberate destroy + a fresh boot.
    • virgin-create → with opfs access, beginFreshCandidate (record opfs-candidate BEFORE the directory) → opfs:// UNCOMMITTED (barrier is step 10b/11); without opfs access, idb-authoritativeidb://.

string

ResolveStoreBootOptions

Promise<StoreBootResolution>