fix(startup): isolate cross-version persistence - #1190
Draft
ShiboSheng wants to merge 1 commit into
Draft
Conversation
ShiboSheng
force-pushed
the
fix/issue-840-startup-compatibility
branch
from
September 1, 2026 17:00
f78a61b to
f9db280
Compare
ShiboSheng
force-pushed
the
fix/issue-840-startup-compatibility
branch
from
September 1, 2026 19:15
f9db280 to
eed3678
Compare
ShiboSheng
marked this pull request as ready for review
September 1, 2026 20:46
ShiboSheng
marked this pull request as draft
September 1, 2026 20:50
Keep redesigned WorkStation and Agent Org state isolated from official older releases while importing compatible legacy state once. Validate the final Agent Org SQLite manifest exactly and retire only the frozen official legacy namespace. Verification: - pnpm typecheck - pnpm run lint - pnpm run check:circular - pnpm exec vitest run --config config/vitest.config.ts src/store/workstation/tabs/__tests__/storage.test.ts src/store/workstation/tabs/__tests__/workspaceState.test.ts src/store/workstation/tabRegistry/atoms.test.ts - cargo test --manifest-path src-tauri/Cargo.toml -p agent_core core::coordination::schema::tests - cargo test --manifest-path src-tauri/Cargo.toml -p agent_core downgrade_recreated_legacy_file_is_deleted_without_changing_new_bytes - cargo test --manifest-path src-tauri/Cargo.toml -p agent_core core::session::persistence::crud::ops_tests - cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings - ORGII_AGENT_ORG_REDESIGN=1 pnpm run tauri:build:fast - packaged v1.3.0/final/v1.2.6 downgrade and re-upgrade matrix Pre-commit hook ran. Total eslint: 5, total circular: 0
ShiboSheng
force-pushed
the
fix/issue-840-startup-compatibility
branch
from
September 1, 2026 21:04
eed3678 to
8fa2653
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #840
The redesigned Team experience and official v1.3.0/v1.2.6 releases could read and write overlapping startup persistence. WorkStation layouts shared the v3 local-storage namespace even though the Team snapshot shape changed, so reopening an older release after leaving a redesigned Team tab active could feed it data it could not understand. The old and redesigned Agent Org SQLite schemas also occupied the same database without a frozen ownership contract, making downgrade cleanup vulnerable to deleting or reshaping the wrong objects.
Solution
WorkStation now writes only a v4 namespace. Startup prefers committed v4 state, otherwise performs a one-time sanitized copy from v3, then falls back to v2. The importer keeps ordinary tabs, removes only incompatible Agent Org snapshots, and never changes or deletes v3 bytes, so official older releases retain their own readable layout.
Agent Org startup now freezes both sides of the database boundary: the exact 11 private tables created by official v1.3.0/v1.2.6 and the exact final manifest of 33 tables, 69 indexes, and one trigger. Initialization accepts either an empty redesigned namespace or that complete manifest, removes only the known official legacy objects in the same transaction, and fails closed before cleanup when it sees a partial or unknown redesigned schema. An exact official-v1.3 fixture and rollback/concurrency tests cover that contract. The obsolete intermediate backfill path was removed because unpublished schemas are no longer silently upgraded.
Redesigned Team definitions remain in their separate file. Recreated legacy definition files are retired without changing the redesigned file or unrelated settings.
Potential risks
Verification
pnpm install --frozen-lockfile— synchronized dependencies for the latest PR feat(agent-org): ship bounded public Team timeline #1153 base; the lockfile was unchanged.pnpm exec prettier --check src/store/workstation/tabRegistry/atoms.test.ts src/store/workstation/tabs/__tests__/storage.test.ts src/store/workstation/tabs/__tests__/workspaceState.test.ts src/store/workstation/tabs/atoms.ts src/store/workstation/tabs/index.ts src/store/workstation/tabs/storage.ts src/store/workstation/tabs/types.ts— passed.rustfmt --edition 2021 --check <changed Rust files>— passed for every Rust file changed by this PR.pnpm typecheck— passed.pnpm run lint— passed with zero warnings.pnpm run check:circular— passed across 6,402 modules.pnpm exec vitest run --config config/vitest.config.ts src/store/workstation/tabs/__tests__/storage.test.ts src/store/workstation/tabs/__tests__/workspaceState.test.ts src/store/workstation/tabRegistry/atoms.test.ts— 32/32 tests passed.cargo test --manifest-path src-tauri/Cargo.toml -p agent_core core::coordination::schema::tests— 12/12 tests passed.cargo test --manifest-path src-tauri/Cargo.toml -p agent_core downgrade_recreated_legacy_file_is_deleted_without_changing_new_bytes— passed.cargo test --manifest-path src-tauri/Cargo.toml -p agent_core core::session::persistence::crud::ops_tests— 5/5 tests passed.cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings— passed.ORGII_AGENT_ORG_REDESIGN=1 pnpm run tauri:build:fast— passed on PR feat(agent-org): ship bounded public Team timeline #1153 headaf65cf920; binary SHA-2568df6d507c333b505fe9eca28392713ed2aa71c703e78877c1413eda1c0756bf8.PRAGMA quick_checkreturnedok; redesigned Agent Org objects were exactly 33 tables, 69 indexes, and one trigger; all 11 known legacy tables were absent.cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --checkwas also run and reports pre-existing formatting differences in unrelated PR feat(agent-org): ship bounded public Team timeline #1153 base files. Those files are outside this diff and were not reformatted here.Audit
The architecture review covered ownership, type/schema contracts, transformation boundaries, write paths, initialization parity, downgrade/restart lifecycle, persistence authority, failure atomicity, legacy cleanup, and deterministic/real-app evidence. Frontend UI and performance audits were not applicable because this PR changes no React component and adds no polling, timer, cache, subscription, worker, or background lifecycle.