Repository navigation
feat: read the workspace state from profile-state.db (Orca 1.4.214 and later) - #1
Open
AlbertoSanmartinMartinez wants to merge 2 commits into
Open
AlbertoSanmartinMartinez wants to merge 2 commits into
AlbertoSanmartinMartinez wants to merge 2 commits into
Conversation
Orca 1.4.224 keeps the profile state in profile-state.db, a SQLite database with one JSON document per former top-level key of orca-data.json. A profile of this version has no orca-data.json, so the installer stopped with "Orca state was not found". The installer now finds profile-state.db first and orca-data.json second in each profile. The sync process reads the workspaceSession, repos and folderWorkspaces rows with a read-only SQLite connection. Profiles that store orca-data.json continue to work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Orca 1.4.214 and later import orca-data.json into profile-state.db once and never update the JSON file again. An installation made before the Orca update keeps orca-data.json in config.json, so the panel showed an old workspace without an error. The sync process now reads profile-state.db when it is next to the configured orca-data.json, and doctor shows that file. The docs name Orca 1.4.214 as the first version with profile-state.db. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Orca 1.4.214 and later keep the profile state in
profile-state.db, a SQLite database. A new profile on these versions has noorca-data.json. Because of this,python3 install.pystops with "Orca state was not found. Open Orca, or pass --orca-state PATH.", and the watcher cannot find the selected workspace.A profile that existed before the update keeps its old
orca-data.json. Orca imports that file once and never updates it again (legacy-json README: "The original JSON remains unchanged after import and may be much older than SQLite", L19). An installation made before the Orca update thus reads a stale file, and the panel shows an old workspace without an error. The same README names v1.4.214 as "the first stable SQLite release" (L28).The new format
profile-state.dbhas aprofile_state_documentstable with the columnsdomain,payload,domain_version,revision,updated_atandcontent_hash. Each row holds one former top-level key oforca-data.json. Thepayloadof theworkspaceSession,reposandfolderWorkspacesrows has the same shape as before (domain_version1). Thusresolve_workspacedoes not change.Changes
workspace.py: in each profile, discovery looks forprofile-state.dbfirst andorca-data.jsonsecond. When the state file is a database,read_selectionreads only the three rows above, with a read-only (mode=ro) SQLite connection. The 16 MiB limit applies to each document. A SQLite error gives the same "Cannot read Orca's current workspace" message as a bad JSON file.config.json(or--orca-state) names anorca-data.jsonand aprofile-state.dbis in the same folder, the sync process reads the database.doctorshows that file. Existing installations thus keep working after an Orca update, without a new install.--profileor--orca-state. The installer does not select one silently.install.py: the--orca-statehelp text names both files.buildfrom a database.llms.txtand the changelog. I regenerated the mirrors withscripts/build_docs.py.Orca keeps the database in WAL mode. A read-only reader does not block the writes of Orca, and it sees only committed state. When Orca is closed, SQLite can create empty
-waland-shmfiles next to the database. The database file itself does not change, and a test checks this.Validation
python3 -m unittest discover -s tests -v: 24 tests pass on Python 3.15 and macOS. I did not run Python 3.9 locally. The CI matrix covers it.python3 scripts/check_public.pypasses.install.pyand registered the runtimepluginfolder under Settings → Plugins → Development. The installer foundprofile-state.dband opened the Git Graph Sync terminal. When I switched worktrees in the left sidebar, the sync output followed each switch (parallel→pipelines-delivery→parallel, 400 commits each) and rewrotepanel.html. Each state read took about 2 ms.🤖 Generated with Claude Code