Skip to content

feat(browser): per-tab persistence + legacy state.json retirement#153

Merged
BunsDev merged 1 commit into
mainfrom
feat/browser-per-tab-persistence
May 28, 2026
Merged

feat(browser): per-tab persistence + legacy state.json retirement#153
BunsDev merged 1 commit into
mainfrom
feat/browser-per-tab-persistence

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 26, 2026

Summary

Layer C of the per-tab browser work (builds on Layer A 9de9e07 visibility fix and Layer B e59094e4 per-tab data dir, both already on main).

  • SQLite-backed browser pane persistence. New browser_panes table keyed by stable per-pane UUID; LeafContents::Browser(BrowserPaneSnapshot { session_id, state }) is wired through app-state save/restore and launch-config conversion. Browser panes now restore into the same workspace tab they were opened in, with the same intra-pane tab list and WebKit data-dir identity.
  • Retire the legacy ~/.warp/config/browser/state.json JSON path. The old single-pane-into-tab-0 fallback is redundant with SQLite app-state restore and could create duplicate panes if both paths fired; this removes the legacy module, restore/write callsites, and close-time JSON writes.
  • One-shot launch cleanup plus UUID hardening. Startup deletes any orphaned legacy browser/state.json, and restored browser session IDs are validated as UUID v4 values before they can be used as data-dir path components.

Test plan

  • cargo fmt --check
  • ./script/check_ai_attribution
  • ./script/check_rebrand
  • git diff --check origin/main...HEAD
  • cargo test -p warp-app browser::data_dir --features gui
  • cargo check -p warp-app --bin cast-codes --features gui
  • Manual: open browser pane in tab 1, navigate to a site, fully quit the app, relaunch; pane returns in tab 1 with the same tab list and active tab.
  • Manual: open browser panes in two workspace tabs and confirm Linux/Windows data-dir isolation. On macOS, wry 0.38 still uses WKWebsiteDataStore.defaultDataStore, but the per-pane directory is created for future plumbing.
  • Manual: with legacy ~/.warp/config/browser/state.json present, launch once and confirm it is removed; relaunch and confirm the cleanup is idempotent.

Copilot AI review requested due to automatic review settings May 26, 2026 23:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SQLite-backed persistence for embedded browser panes, replacing the legacy single JSON browser/state.json restore path with per-pane snapshots tied to app-state restoration.

Changes:

  • Adds browser_panes schema/model/migration support and wires browser panes through app-state save/restore.
  • Updates browser pane/view snapshots to carry stable per-pane session IDs and browser tab state.
  • Removes legacy JSON persistence and adds best-effort cleanup for old browser/state.json.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/persistence/src/schema.rs Adds Diesel schema for browser_panes.
crates/persistence/src/model.rs Adds browser pane persistence model and constants.
crates/persistence/migrations/2026-05-26-160000_add_browser_pane/up.sql Creates browser pane persistence table.
crates/persistence/migrations/2026-05-26-160000_add_browser_pane/down.sql Drops browser pane persistence table.
app/src/workspace/view.rs Removes legacy browser restore/write path and creates new pane UUID sessions.
app/src/persistence/sqlite.rs Saves/restores browser panes through app-state SQLite.
app/src/pane_group/pane/browser_pane.rs Snapshots browser panes into app-state.
app/src/pane_group/mod.rs Restores browser panes from app-state snapshots.
app/src/launch_configs/launch_config.rs Excludes browser panes from launch-config conversion.
app/src/browser/persistence.rs Removes legacy JSON persistence implementation.
app/src/browser/mod.rs Removes legacy persistence module export.
app/src/browser/data_dir.rs Adds cleanup for the legacy state file.
app/src/browser/browser_view.rs Stores session IDs in browser views and removes legacy close persistence.
app/src/app_state.rs Adds browser pane snapshot type and marks it persisted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/persistence/sqlite.rs
Comment thread crates/persistence/migrations/2026-05-26-160000_add_browser_pane/up.sql Outdated
Persist embedded browser panes in SQLite app state with stable per-pane UUID session IDs, restore them into their owning workspace tabs, and retire the legacy single-pane browser/state.json path.

Also validate restored browser session IDs as UUID v4 values before using them as WebKit data-directory path components, regenerating invalid legacy values defensively.
@BunsDev BunsDev force-pushed the feat/browser-per-tab-persistence branch from 6f50f46 to d133182 Compare May 28, 2026 04:51
@BunsDev BunsDev merged commit a1548dd into main May 28, 2026
19 of 23 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.

2 participants