[codex] Revert optimistic workspace Electric transaction work

Merged
SA
6mo ago
+719-730

Summary

Reverts #4707 (feat: optimistic workspace creation + Electric write-sync correctness). This brings back the pre-#4707 workspace creation flow, including the renderer-side workspace-creates store/manager, and removes the TanStack DB optimistic workspace insert + Electric txid-confirmed sync rewrite.

Why

The TanStack DB / Electric SQL transaction work needs to be backed out while we revisit the approach. This PR is a straight revert of the merged squash commit 0a40cf2e.

Impact

  • Restores the prior workspace create sidecar flow and associated sidebar creation-status UI.
  • Removes the Electric shape-stream retry handler and txid/no-op write-path changes introduced by #4707.
  • Removes the Electric-confirmed deletion wait introduced by #4707.

Validation

  • bun run lint:fix
  • bun run lint

Open in Stage

Summary by cubic

Reverts the optimistic workspace creation and Electric write-sync path from #4707. Restores the previous renderer-driven create flow with in-flight tracking, removes txid-based sync, and simplifies server/router responses.

  • Refactors

    • Restore renderer-side in-flight tracking with useWorkspaceCreatesStore and WorkspaceCreatesManager; replace failedWorkspaceCreates local collection.
    • Sidebar and workspace UI now use creationStatus (preparing/generating/creating/failed); failed rows can be dismissed; shortcuts ignore in-flight items.
    • Cloud-row fallback: show created workspaces immediately from host response until Electric sync arrives.
    • Remove isSynced gating and deletion sync waits; simplify delete dialog.
    • Creation entry points (New Workspace, task/issue run, adopt worktrees) await submit() and toast success/failure; redirect to canonical id when it differs from the snapshot id.
    • Workspace route/title read from synced row or in-flight/cloud row; show creating/error states inline.
    • Drop txid plumbing across v2-workspace, v2-project, v2-host, and chat routers; mutations return rows/flags only. Simplify getCurrentTxid usage.
  • Dependencies

    • Remove @electric-sql/client from apps/electric-proxy; inline protocol params and drop Electric write-sync/error handling in collections.

Summary by CodeRabbit

  • New Features

    • Added creation status tracking for in-flight workspaces with visual indicators (preparing, generating-branch, creating, failed).
    • Improved workspace creation error handling with retry and dismiss options.
  • Bug Fixes

    • Enhanced workspace state synchronization for faster UI updates.
    • Improved handling of failed workspace creation scenarios with better recovery flows.
  • Improvements

    • Better visual feedback during workspace creation process.
    • Optimized workspace availability detection and display in the interface.

Review Change Stack