Skip to content

chore(vendor): bump sphere-sdk to eea87ca (PR #331 — issue #330 browser durability)#324

Merged
vrogojin merged 1 commit into
feat/telco-webrtc-callsfrom
chore/vendor-bump-sdk-eea87ca-issue-330
May 29, 2026
Merged

chore(vendor): bump sphere-sdk to eea87ca (PR #331 — issue #330 browser durability)#324
vrogojin merged 1 commit into
feat/telco-webrtc-callsfrom
chore/vendor-bump-sdk-eea87ca-issue-330

Conversation

@vrogojin
Copy link
Copy Markdown
Contributor

Summary

Vendor bump from `0.7.5-sdk-8ebba68` → `0.7.5-sdk-eea87ca` to land sphere-sdk PR #331, which resolves issue #330 — browser Profile loses all tokens on reload.

What's in the SDK bump

Four commits on `integration/all-fixes`:

  1. `fbdb24a` fix(profile)(fix(layout)(#329): direct aggregator probe — bypass SDK pinger false-negative #330): install IDBBlockstore for browser Helia. Browser Helia was using its default `MemoryBlockstore` so every OpLog/CAR block evaporated on tab unload. Now installs `IDBBlockstore` (from `blockstore-idb@^4.0.1`) symmetric to the Node-side `FsBlockstore` install. The companion pin-shim (chore(deps): vendor-bump sphere-sdk to 50db1fd (UXF SMT path opaque embed, issue #295) #311) becomes meaningful.

  2. `0efecf0` fix(profile)(fix(layout)(#329): direct aggregator probe — bypass SDK pinger false-negative #330): inline durability gate on pointer publish. `publishAggregatorPointerBestEffort` now HEAD-verifies the just-published snapshot CID against the configured gateways BEFORE clearing `pendingPublishCid`. Closes the gap where the pointer could advertise a CID the operator gateway hadn't yet propagated. Preserves PR pinned groups #272's at-least-once Nostr ack gate. Tunable via `ProfileConfig.pointerPublishDurabilityGateMs` (default 5000ms for the factory).

  3. `04eaf32` fix(profile)(fix(layout)(#329): direct aggregator probe — bypass SDK pinger false-negative #330): read-only token-storage fallback + preserve legacy on migration. Migration step 5c no longer wipes the legacy IDB token storage; instead it writes a `migration.migratedAt` marker. `ProfileTokenStorageProvider.setFallbackTokenStorage()` wires a read-only legacy provider that is consulted at three sites inside `load()`. New `createBrowserProfileProvidersAuto()` async factory auto-detects the marker and constructs the fallback. `Sphere.clear()` wipes it too.

  4. `fcb84af` fix(profile)(fix(layout)(#329): direct aggregator probe — bypass SDK pinger false-negative #330): address code-review findings (3 blockers + 5 bugs). Adversarial review uncovered three merge blockers (the `as string` import cast bypassing bundlers, `Sphere.clear()` not wiping fallback, no auto-wiring of fallback from marker) and five bugs in the gate logic (same-CID double leg in `verifyFlushDurability`, stamp-order before verification, missing `PutFailedError` handling in `isMissError`, missing `lastTokenManifest` reset on fallback returns, double `storage:pending-publish` emit). All addressed.

Vendor diff

  • `vendor-sphere-sdk/SHA.txt`: `8ebba68` → `eea87ca`
  • `vendor-sphere-sdk/package.json`: version label updated; new `blockstore-idb: ^4.0.1` dependency entry (required by the new IDBBlockstore install path).
  • `vendor-sphere-sdk/dist/**`: rebuilt artifacts (~64 files).
  • `package-lock.json`: regenerated to include `blockstore-idb` and transitive deps.

Test plan

  • sphere-sdk own suite at the bumped SHA: 8061 unit tests passed, 2 skipped, 0 failures
  • sphere.telco `npm install` — clean
  • sphere.telco `npm run build` — clean Vite build
  • End-to-end bundling verified: `IDBBlockstore` symbol present in the built sphere.telco JS bundle. Confirms the new `import("blockstore-idb")` form is statically discovered by Vite/Rollup and the package is included in the output — addresses the BLOCKER 1 concern from the SDK's code review at the actual consumer level.
  • Browser manual verification on sphere-telco-test.dyndns.org: open fresh wallet → top-up → reload → balance preserved. The reproduction described in sphere-sdk#330 should no longer fire.

Migration impact for existing users

  • Existing wallets on this branch already migrated from legacy → Profile will see no behavior change unless the Profile blockstore fails — at which point the legacy IDB (now preserved) becomes a recovery source.
  • The migration marker (`migration.migratedAt`) is written into `sphere-storage` IDB on next migration run. Forward-compat with old SDKs (they ignore the extra key); backward-compat with new SDKs reading old wallets (no marker → no fallback wired, log warning only).
  • `Sphere.clear()` now accepts `fallbackTokenStorage` in its options and wipes it. Consumers calling `Sphere.clear({storage, tokenStorage})` without the new field will leave the legacy IDB intact (only matters for wallets that were previously migrated).

Related

…er durability)

Vendor bump from `0.7.5-sdk-8ebba68` → `0.7.5-sdk-eea87ca`.

Pulls in [sphere-sdk PR #331](unicity-sphere/sphere-sdk#331)
which addresses [issue #330](unicity-sphere/sphere-sdk#330)
— browser Profile loses all tokens on reload — via three architectural
fixes plus a follow-up commit addressing all blockers from an
adversarial code review:

1. **`profile/orbitdb-adapter.ts`** — install `IDBBlockstore` (from
   `blockstore-idb@^4.0.1`) for browser Helia so OpLog + CAR blocks
   persist across page reloads. Pre-fix Helia fell through to its
   default `MemoryBlockstore` and every block evaporated on tab
   unload. Configurable via `OrbitDbConfig.browserBlockstorePath`
   (default `'sphere-helia-blocks'`). Includes a 5s timeout on
   `open()` so a stuck IDB upgrade doesn't hang init.

2. **`profile/profile-token-storage/lifecycle-manager.ts`** — inline
   durability gate on `publishAggregatorPointerBestEffort`. HEAD-
   verifies the just-published snapshot CID against the configured
   gateways BEFORE clearing `pendingPublishCid`. On gate timeout the
   publish is classified transient (`IPFS_NOT_YET_DURABLE`), the
   marker is KEPT for retry, and the flush itself completes (PR
   #272's at-least-once Nostr ack gate is preserved). Tunable via
   `ProfileConfig.pointerPublishDurabilityGateMs` (factory default
   5000ms; direct-construction default 0).

3. **Read-only token fallback + preserve legacy on migration**
   (`profile/profile-token-storage-provider.ts`, `core/Sphere.ts`,
   `profile/migration.ts`). Migration step 5c no longer wipes the
   legacy IDB token storage; instead it writes a `migration.migratedAt`
   marker. New `SphereInitOptions.fallbackTokenStorage` / new factory
   `createBrowserProfileProvidersAuto` auto-detect the marker and
   wire a legacy `IndexedDBTokenStorageProvider` as the read-only
   fallback. Consulted at three sites inside Profile `load()`:
   `no-bundles`, `no-bundles-fetched`, and the outer-catch path.
   `Sphere.clear()` now wipes the fallback too — prevents token
   resurrection after a deliberate clear.

## Vendor diff

- `vendor-sphere-sdk/SHA.txt`: `8ebba68` → `eea87ca`
- `vendor-sphere-sdk/package.json`: version label + new
  `blockstore-idb: ^4.0.1` dependency entry (transitively required
  by the new IDBBlockstore install path).
- `vendor-sphere-sdk/dist/**`: rebuilt artifacts from sphere-sdk
  `integration/all-fixes` at `eea87ca`.
- `package-lock.json`: regenerated to include `blockstore-idb` and
  its transitive deps in the consumer (sphere.telco) tree.

## Verified locally

- `npm install` — clean, blockstore-idb resolved.
- `npm run build` — clean Vite build; `IDBBlockstore` symbol
  present in the output bundle (confirms tsup's static
  `import("blockstore-idb")` is statically discovered and
  bundled by Vite/Rollup end-to-end).
- sphere-sdk's own test suite: 8061 passed, 2 skipped, 0 failures
  at the bumped SHA.

## Why this matters

Issue #330 is a critical browser durability bug: a fresh wallet
funded then reloaded shows `tokens=0`, with the legacy IndexedDB
holding only the nametag token (Profile-mode wallets never wrote
back to legacy). The three SDK fixes close all three architectural
faults (memory blockstore, publish-before-durable, no fallback);
this vendor bump propagates them into the live sphere.telco app
on sphere-telco-test.dyndns.org.
@vrogojin vrogojin merged commit fbffc67 into feat/telco-webrtc-calls May 29, 2026
7 checks passed
@vrogojin vrogojin deleted the chore/vendor-bump-sdk-eea87ca-issue-330 branch May 29, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant