Migrating from v0.4.x to v0.5.0
v0.5.0 moves the storage of gest from flat TOML and Markdown files in a .gest/ directory to a single
SQLite database, which gest opens through the libsql library. If you have a v0.4.x project, the
gest migrate command imports all of it into the new database in one run.
This guide covers these topics:
- How to run the migration
- How the data maps from the old layout to the new one
- What to check afterward
- What changes for you as a user
- Why the storage model changed
- How to roll back if something goes wrong
Before you migrate
-
Find your v0.4.x data. In v0.4.x, a local-mode project stored its data in
.gest/at the project root. A global-mode project stored its data under$XDG_DATA_HOME/gest/<sha256(cwd)[..8]>/, where the name of the directory is the first 8 characters of a SHA-256 hash of the path of the project.gest migratefinds either layout by itself, but you need to know which one you have to back it up.While you are still on v0.4.x, ask v0.4 for the project directory:
gest config get storage.project_dirOnly the v0.4.x binary has this key, and v0.5.0 removed it. So run the command before you upgrade.
-
Back it up. Copy your old project directory to a safe place. Use the path from the step before:
cp -r "$(gest config get storage.project_dir)" ~/gest-v0.4-backupOr, if you already know the layout:
# For local-mode v0.4 projects cp -r .gest ~/gest-v0.4-backup # For global-mode v0.4 projects (example hash; run `ls ~/.local/share/gest/` # to find yours) cp -r ~/.local/share/gest/<old-hash> ~/gest-v0.4-backup -
Upgrade gest. Install v0.5.0:
gest self-updategest --versionnow reports 0.5.0 or higher. -
Run the migration. From the root of your project, run:
gest migrate --from v0.4You do not need to run
gest initfirst. If the current working directory has no project yet,gest migratecreates one as part of the import.
Run the migration
gest migrate --from v0.4 does these steps:
-
It looks for your old
.gest/directory in the current directory, then in each parent directory. Last, it checks the global location that v0.4.x used,$XDG_DATA_HOME/gest/<sha256(cwd)[..8]>/. -
It uses the v0.5.0 project of the current working directory, or it creates a new project for that directory.
-
It reads every
.tomlfile undertasks/andtasks/resolved/, and adds each one as a task. Each task gets a new ID. -
It reads every
.mdfile underartifacts/andartifacts/archive/, and adds each one as an artifact with a new ID. Each file underartifacts/archive/becomes an archived artifact. Thetypefield of the old file becomes a tag. -
It reads every
.tomlfile underiterations/anditerations/resolved/, and adds each one as an iteration with a new ID. It adds the tasks of each iteration through their new IDs, all in phase 1. -
It adds the tags of every record.
-
It adds the notes of each task and iteration. An author record is created for each name that wrote a note or that a task is assigned to.
-
Last, it adds the links of each task and iteration as relationships. It maps the old ID of each target to its new ID, so a link can name any task, artifact or iteration in the import. A link whose target is not in the import is skipped with a warning. v0.4.x wrote each link on both records, so the migrator keeps one relationship for each pair, as
gest task linkmakes. Between two iterations it keeps both, asgest iteration linkmakes. An artifact in the task list of an iteration becomes arelates-tolink from the iteration. -
It prints a summary line:
migrated 42 tasks, 17 artifacts, 5 iterations, 23 notes, 61 relationships
Explicit source path
The search may not find your data, for example when you moved the directory, or when you import from
another checkout. Then pass --path:
gest migrate --from v0.4 --path /some/backup/.gestSkipped files
When the migrator cannot parse a file, it logs a warning and counts the file as skipped. Then you see a summary line like this one:
skipped 3 files (the warnings above say why)The warnings name each file that failed and the reason, and they print at the default log level. To
see more detail, run gest -vv migrate --from v0.4. Common causes are files that someone edited by
hand away from the v0.4.x format, and partial writes from an interrupted v0.4.x command.
How data maps from v0.4 to v0.5
| v0.4.x location | v0.5.0 destination |
|---|---|
tasks/<id>.toml |
tasks table (status preserved) |
tasks/resolved/<id>.toml |
tasks table (status done / cancelled) |
artifacts/<id>.md |
artifacts table + sync mirror file |
artifacts/archive/<id>.md |
artifacts table with archived_at set |
iterations/<id>.toml |
iterations table (status active) |
iterations/resolved/<id>.toml |
iterations table (status active) |
Task assigned_to: "alice" |
authors row + tasks.assigned_to FK |
Task and iteration notes |
notes table |
Task events |
Not imported |
Task and iteration links |
relationships table |
Task/Iteration metadata (TOML table) |
JSON column on the row |
Artifact metadata (YAML frontmatter) |
JSON column on the row |
Artifact type: "spec" |
spec tag on the artifact |
Artifact tags: [a, b, c] |
tags + entity_tags rows |
The migration does not keep the IDs of v0.4.x. Each task, artifact and iteration gets a new ID, so an
old ID in a commit message, a pull request or a note no longer finds its record. Inside the import,
gest maps the old IDs to the new ones, for the tasks of each iteration and for every link. The
migration also leaves resolved iterations active. Complete or cancel them again with
gest iteration complete or gest iteration cancel.
After the migration
-
Check the counts. Compare the summary of the migration with what you expect:
gest task list --all --json | jq 'length' gest artifact list --all --json | jq 'length' gest iteration list --all --json | jq 'length'Each count must match the number of files in
tasks/,artifacts/anditerations/of your old.gest/directory, or exceed it if the database already had records. -
Check a few records. Pick a task, an artifact and an iteration that you know well. Look at each one with
gest <entity> show <id>, and check its title, description, tags, links and notes. Find the records by title, because their IDs are new. -
Search your project. Run a search that you know:
gest search "is:task tag:spec"If you used
type:filters before, change your scripts and your shell history to usetag:. -
Turn on
.gest/sync (optional). If you usedgest init --localon v0.4.x and want the sync to keep working, check thatstorage.syncis stilltrue, which is the default. Then run any command. On its first export, the sync layer writes the.gest/files from the new database. -
Remove old overrides of subdirectories. If your old
gest.tomlhas any of these keys, delete them, because gest no longer reads them:[storage] project_dir = "..." # remove state_dir = "..." # remove artifact_dir = "..." # remove task_dir = "..." # remove iteration_dir = "..." # remove -
Remove the old
.gest/directory, but only when you are happy with the result. The migrator does not delete the source. It leaves everything in place, so that you can compare and check. When you are sure that the migration is correct, run:rm -rf .gest # for local-mode v0.4 data rm -rf ~/.local/share/gest/<old-hash> # for global-mode v0.4 dataIn a local-mode project,
.gest/can also hold the new database,.gest/gest.db. Check where your database is withgest config showbefore you delete the directory. Do this step only after you have checked that the database has everything.
What changes for you
v0.5.0 looks different in these ways:
gest.dbis the source of truth. The data lives in SQLite, in<data_dir>/gest.db, or in.gest/gest.dbfor a project with a.gest/directory. For a local-mode project, the files in.gest/become a copy that gest rewrites from the database.- The
typeof an artifact is gone. Tags give the category now. The migrator turns eachtype: "spec"into aspectag. - The
type:filter of the search is gone. Usetag:spec, or another tag, instead. artifact createtakes the title as its first argument. The--titleand--typeflags no longer exist.-tnow means--tag.- Several environment variables are gone. v0.5.0 removed or renamed
GEST_PROJECT_DIR,GEST_STATE_DIR,GEST_ARTIFACT_DIR,GEST_TASK_DIR,GEST_ITERATION_DIRandGEST_LOG_LEVEL(with a single underscore). The Configuration reference gives the new names. - The undo history lives in the database. There is no separate directory for state any more. Undo works on the database that the command ran against.
See the v0.5.0 changelog entry for the full list.
Why v0.5.0 moved to SQLite
The main reason was the coordination of worktrees, not the speed of storage.
In v0.4.x, both modes of storage took the current working directory as the identity of the project:
- Local mode wrote to
.gest/inside the worktree. So two worktrees of the same repository had two separate stores, and an agent infeature-a/could not see the tasks that someone created inmain/. - Global mode named the store by
sha256(cwd)[..8], a hash of the working directory. So each worktree had a different hash and a different project, although they were the same project. Global mode had the same problem as local mode.
In neither mode could parallel agents share a live view of the tasks, artifacts and iterations of one project. Parallel agents are the main purpose of gest.
v0.5.0 makes the identity of a project explicit. A project is a row in a single global database, and each extra checkout joins it as a workspace. From a second worktree:
cd ../myapp-feature-a
gest project # in the original checkout, copy the project id
gest project attach <project-id>After the attach, both checkouts find the same project row and share the same tasks, artifacts and iterations. gest no longer hashes the working directory, so two worktrees of one repository no longer end up in separate projects.
When the identity of a project no longer came from the file system, SQLite was the natural store. It gives atomic writes across records, so a task, its tags and its relationships are saved together or not at all. It gives real queries for dependency graphs and for filters by tag. It also gives safe access for several agents that use the same store at the same time. The flat files could not give these three things. The three were benefits of the change, and not its reason.
For a local-mode project, a sync layer still copies the database to YAML and Markdown files in
.gest/. Each kind of record has its own directory, with a singular name, such as task/,
artifact/ and iteration/. So you can still read the data and commit it to git. The database is
still the source of truth.
Discussion #28 has the original RFC, and ADR-0013 records the decision.
Rolling back
If the migration gave results that you did not expect, you can go back:
- Keep the v0.4.x
.gest/directory. The migrator never changes the source. If you did not do the cleanup step above, your old data is intact. - Install v0.4.x again.
cargo install gest --version 0.4.4installs the last v0.4 release. - Delete the v0.5.0 database. Remove
<data_dir>/gest.db, or.gest/gest.dbin a local-mode project. On Linux,<data_dir>/gest.dbis usually~/.local/share/gest/gest.db. Rungest config showto check. The v0.4.x binary does not know about SQLite storage, so it ignores the file. Its removal keeps your data directory clean. - Restore your backup. Copy
~/gest-v0.4-backupfrom step 2 of the list before the migration back to its original location.
Please also open an issue that says what went wrong. The migrator is new, and the maintainers can fix the edge cases of v0.4.x files more easily when they see them.
See also
- gest migrate, the CLI reference of the command
- Configuration, the new config sections and environment variables
- ADR-0013, the decision to move to SQLite-first storage