Skip to content

feat(app): migrate localStorage openbook.workspaces → openbook.libraries (LIB-3)#136

Merged
eliotlim merged 1 commit into
mainfrom
lib-3-localstorage-migration
Jul 12, 2026
Merged

feat(app): migrate localStorage openbook.workspaces → openbook.libraries (LIB-3)#136
eliotlim merged 1 commit into
mainfrom
lib-3-localstorage-migration

Conversation

@eliotlim

@eliotlim eliotlim commented Jul 12, 2026

Copy link
Copy Markdown
Owner

LIB-3 of the workspace→library rename epic.

Migrates the persisted library-list localStorage key openbook.workspacesopenbook.libraries with a one-time read-fallback so existing users keep their list.

Migration (LibraryProvider.tsx): on read, if openbook.libraries is absent, adopt any value under the legacy openbook.workspaces (LEGACY_LIBRARIES_KEY), re-persist under the new key, and remove the old. A present new key always wins (no clobber). Malformed value → default local library (unchanged behavior).

Not the wire format: account sync builds SyncBlob.workspaces (the wire property, preserved in LIB-2) from the in-memory libraries via useLibrary() — it does NOT read this localStorage key. So this is a safe local migration, not a wire change. (Removed a stale comment that mislabeled the local key as the wire format.)

Tests: new LibraryProvider.test.tsx covers 4 cases:

  1. legacy key present, new absent → data loaded AND migrated (new key holds it, old key removed) — PASS
  2. new key present → used, legacy ignored (no clobber) — PASS
  3. neither present → empty default (local library) — PASS
  4. malformed legacy value → empty default, no throw — PASS

AccountProvider.test.tsx (seeds the legacy key) still passes via the migration path.

Verify — full pnpm run verify run locally, all green:

  • build:libs — PASS
  • typecheck (all 6 workspace projects) — PASS
  • lint (all 6 workspace projects) — PASS
  • test (unit) — PASS: ui 981, sdk 175, server 645 (ui total includes the 4 new migration tests)
  • test:e2e — PASS: server 251 checks, mcp 40 checks

Also: GeneralSettings.tsx — one comment updated (openbook.workspacesopenbook.libraries).

Scope guard: only the localStorage key + migration. No LIB-4 (openbook.space.json / SPACE_BUNDLE_FILE), no LIB-5 (workspaceId / /api/workspace/sync / roster) tokens touched.

In-repo — Manager merges after code review.

…ries (LIB-3)

Rename the persisted library-list localStorage key value to openbook.libraries, with a one-time read-fallback migration: when the new key is absent, adopt any list under the legacy openbook.workspaces key, re-persist under the new key, and remove the old. A present new key always wins. The key is local-only — account sync serializes the in-memory library list (via useLibrary()) under the separate SyncBlob 'workspaces' wire property, which is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app.book.pub Ready Ready Preview, Comment Jul 12, 2026 5:51pm

Request Review

@eliotlim eliotlim merged commit 5114642 into main Jul 12, 2026
10 checks passed
@eliotlim eliotlim deleted the lib-3-localstorage-migration branch July 12, 2026 18:04
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