Skip to content

feat(desktop): dual storage mode (local vs cloud), OS keyring session persistence, and dev isolation - #17

Merged
facyndev merged 19 commits into
developfrom
feature/desktop-dual-storage
Oct 24, 2026
Merged

facyndev merged 19 commits into
developfrom
feature/desktop-dual-storage

Conversation

@facyndev

Copy link
Copy Markdown
Owner

Summary

Implements the Desktop Dual Storage feature (local appdata vs cloud REST API) end-to-end along with OS keyring session persistence and isolated desktop development handoff:

  1. Local Storage Mode (appdata):
    • WorkspaceSnapshot port in application and atomic JSON backend FsSnapshotStore (workspaces.json) with corrupt-file quarantine (.corrupt).
    • Tauri commands snapshot_load / snapshot_save and frontend hydration/persistence queue with Pane.seq counter recovery (adoptPaneSeq).
  2. Cloud Storage Mode (REST API):
    • Extended REST API (PATCH/DELETE /workspaces/:id and /sessions/:id, PATCH /sessions/:id/terminals/:terminalId, PUT /sessions/:id/terminals/order, explicit idempotent UUIDs, and terminal agent/minimized metadata).
    • AccessTokenProvider port with single-flight token refresh in AuthStore and CloudSnapshotStore (ureq 3 + rustls) reconciling create/update/delete/reorder with deterministic UUID v5 mapping for local IDs.
  3. Onboarding, Settings & Local-to-Cloud Migration:
    • First-run Onboarding and SettingsDialog (storage.json), CloudGate when cloud mode has no active session, visible-but-inactive collaboration UI in local mode (data-collab-inactive="true"), and additive local?cloud workspace migration on mode switch while preserving local files.
  4. OS Keyring Session Persistence & Dev Isolation (RFC 8252):
    • Persists refresh_token + UserView in the native OS credential store (keyring v3: Windows Credential Manager / macOS Keychain / Linux Secret Service) isolated between opencollab (prod) and opencollab-dev (dev), keeping access_token strictly in RAM and preserving sessions across transient network/5xx errors.
    • Normalizes Tauri bundle identifiers (com.opencollab.desktop / com.opencollab.desktop.dev), isolates dev PKCE handoff (client=desktop-dev ? opencollab-dev://auth/callback), and standardizes monorepo dev scripts (pnpm dev, pnpm desktop:dev, pnpm api:dev, pnpm web:dev).

Verification

  • cargo fmt --all --check: 0 diffs
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 259 passed, 0 failed
  • pnpm typecheck: 7/7 passed
  • pnpm -r test: 408 passed across all packages (domain, contracts, ui, web, desktop, api)
  • pnpm --filter @opencollab/desktop test:e2e: 14/14 scenarios passed

A failed snapshot_load used to enable saving, so the first later mutation overwrote a still-valid snapshot with the default structure. Persistence now stays disabled for the session unless a load succeeds or the core reports no snapshot.
Add rename/delete for workspaces and sessions, terminal update and atomic reorder, explicit idempotent create ids, and terminal agent/minimized metadata. Persist the new fields with a Prisma migration and cover the contract with integration tests.
Implement the SnapshotStore cloud adapter with a blocking ureq/rustls client, deterministic UUID v5 mapping for local ids, and create/update/delete/reorder reconciliation that fails closed. Extract access-token refresh from auth_status behind an application port and cover both adapters with mock-server and unit tests.
@facyndev
facyndev merged commit c308d6e into develop Oct 24, 2026
8 checks passed
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