From 76e933156c71ad4c0b76606f93ccaeb142c9f915 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Wed, 8 Jul 2026 10:11:29 -0700 Subject: [PATCH 1/2] Delete old-persistence migration tech-debt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have effectively zero users, so all code that reads or upgrades OLD persisted formats is dead weight. Remove it; keep only the current write formats. A corrupt/unreadable save is now logged and discarded so startup always continues fresh rather than throwing at the boot boundary. Removed: - Session v1→v2→v3 migration (legacy shapes, guards, migrate* fns) — session-types.ts - Dockview `layout` → Lath `lathLayout` upgrade reader — dockview-convert.ts (+test), the `PersistedSession.layout` field, `persistedLathLayout` fallback - Pre-Lath `PersistedDoor` positioning fields + `legacyTokenFromDoor` + `edgeForDoorDirection` + door-alias canonicalization in leafMetaFromDoor / LathHost - Pre-workspace bare-session → PersistedWindow migration in readPersistedWindow - `migrateTodoState` + legacy `ALERT_DISABLED` status handling — alert-manager.ts - Browser `renderMode` legacy-blob resolution (`surfaceType: iframe/agent-browser`, `poppedOut`) + BrowserPanel canonicalization effect - WebKit localStorage → Rust store one-time migration (the SUNSET branch) — tauri-adapter.ts Hardening: readPersistedSession / readPersistedWindow warn-and-return-null on unreadable content; loadSessionState parses defensively so bad JSON degrades to a fresh start instead of throwing. Specs updated to match (transport, tiling-engine, standalone, alert, dor-browser, layout, glossary); spec-lint passes. Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/specs/alert.md | 2 - docs/specs/dor-browser.md | 11 +- docs/specs/glossary.md | 8 +- docs/specs/layout.md | 16 +- docs/specs/standalone.md | 31 -- docs/specs/tiling-engine.md | 28 +- docs/specs/transport.md | 18 +- lib/src/components/Wall.tsx | 23 +- lib/src/components/wall/BrowserPanel.tsx | 18 +- lib/src/components/wall/LathHost.tsx | 6 +- .../wall/agent-browser-surface-controller.ts | 4 +- lib/src/components/wall/browser-surface.ts | 26 +- .../components/wall/lath-wall-engine.test.ts | 59 --- lib/src/components/wall/lath-wall-engine.ts | 61 +-- lib/src/components/wall/wall-types.ts | 5 +- lib/src/lib/alert-manager.ts | 14 +- lib/src/lib/lath/dockview-convert.test.ts | 129 ------ lib/src/lib/lath/dockview-convert.ts | 169 -------- lib/src/lib/lath/persistence.ts | 11 +- lib/src/lib/lath/test-fixtures.ts | 46 +- lib/src/lib/reconnect.test.ts | 49 --- lib/src/lib/reconnect.ts | 10 +- lib/src/lib/session-migration.test.ts | 401 ------------------ lib/src/lib/session-restore.test.ts | 25 +- lib/src/lib/session-restore.ts | 14 +- lib/src/lib/session-save.ts | 5 +- lib/src/lib/session-types.ts | 218 ++-------- lib/src/lib/session-window.test.ts | 26 -- lib/src/lib/window-persistence.test.ts | 6 - lib/src/lib/window-persistence.ts | 18 +- lib/src/stories/Baseboard.stories.tsx | 5 - lib/src/stories/ShellCwd.stories.tsx | 5 - standalone/src/tauri-adapter.ts | 26 +- standalone/src/tauri-session-store.test.ts | 12 +- 34 files changed, 156 insertions(+), 1349 deletions(-) delete mode 100644 lib/src/lib/lath/dockview-convert.test.ts delete mode 100644 lib/src/lib/lath/dockview-convert.ts delete mode 100644 lib/src/lib/session-migration.test.ts diff --git a/docs/specs/alert.md b/docs/specs/alert.md index 929bf355..ca0536e9 100644 --- a/docs/specs/alert.md +++ b/docs/specs/alert.md @@ -33,8 +33,6 @@ Public `status` is a projection — first match wins: Persist `status`, `watchingEnabled`, `todo`, and sanitized `notification`. Restore `todo` and `notification`, then restart WATCHING only if `watchingEnabled` is true. Restore must not recreate protocol progress, command-exit arms, or a fresh ring; replay filtering in `docs/specs/terminal-escapes.md` prevents old terminal output from firing notification side effects again. -Source of truth: `migrateTodoState` in `lib/src/lib/alert-manager.ts` defines the legacy-TODO-value migration to boolean. - ## Attention `attentionSessionId` is set only by explicit user actions that plausibly mean "I am looking at this Session": diff --git a/docs/specs/dor-browser.md b/docs/specs/dor-browser.md index 9ae1b2a1..a939d5ca 100644 --- a/docs/specs/dor-browser.md +++ b/docs/specs/dor-browser.md @@ -25,8 +25,8 @@ Two independent axes define a browser pane: | Render | `ab-screencast`, `ab-popout`, `iframe` | The render axis is a pane parameter, not a separate surface type. The `dor` CLI -still reports `iframe` or `agent-browser` as a legacy/informative surface type; -that is derived from `renderMode`. +still reports `iframe` or `agent-browser` as an informative surface type derived +from `renderMode` (never stored). Source of truth: `lib/src/components/wall/BrowserPanel.tsx`, `lib/src/components/wall/browser-surface.ts`, `lib/src/components/Wall.tsx` @@ -46,15 +46,12 @@ type BrowserPanelParams = { wsPort?: number; binaryPath?: string; syncEngaged?: boolean; - poppedOut?: boolean; // legacy migration only }; ``` Invariants: -- `renderMode` is canonical. Legacy params (`surfaceType: 'iframe'`, - `surfaceType: 'agent-browser'`, `poppedOut`) are migrated by - `resolveRenderMode`. +- `renderMode` is canonical. - `url` is the canonical target across render swaps and relaunches. Agent-browser mirrors the newest non-blank active tab URL into params; iframe persists only navigations initiated by Dormouse chrome. @@ -513,7 +510,7 @@ Source of truth: `lib/src/lib/platform/types.ts`, When changing browser-surface behavior: -- `renderMode` is canonical. Never reintroduce `surfaceType: 'iframe' | 'agent-browser'` or `poppedOut` as stored state — extend the `resolveRenderMode` migration instead, and update the kind-mapping table in `docs/specs/glossary.md` if adding a render mode. +- `renderMode` is canonical. Never reintroduce `surfaceType: 'iframe' | 'agent-browser'` or `poppedOut` as stored state; update the kind-mapping table in `docs/specs/glossary.md` if adding a render mode. - Never move a browser surface's DOM. Lath's leaf div is never re-parented, so an `