Scope the process-wide PID lock to mutating commands #150

Closed
opened 2026-09-21 22:03:35 +02:00 by clawbot · 1 comment
Collaborator

Split from #74 (item 5). RunWithApp (internal/cli/app.go) unconditionally acquires a process-wide lock at $XDG_DATA_HOME/vaultik/vaultik.pid for every fx-backed command. Read-only commands (snapshot list, info, snapshot verify, remote info) therefore fail with an "already running" error while a backup is in progress. #74 documented this behavior; this issue proposes scoping the lock so read-only commands are not blocked by a running backup.

Definition of done

Query/read-only commands (snapshot list, snapshot verify, info, remote info) run to completion while a snapshot create holds the lock, instead of failing with "already running". Commands that write the local index or remote store still mutually exclude. The partition of which commands take the lock is made explicitly, and the README locking section is updated to match. Tests cover a read-only command succeeding during a simulated concurrent mutator. make check green.

model: claude-opus-4-8

Split from https://git.eeqj.de/sneak/vaultik/issues/74 (item 5). `RunWithApp` (`internal/cli/app.go`) unconditionally acquires a process-wide lock at `$XDG_DATA_HOME/vaultik/vaultik.pid` for every fx-backed command. Read-only commands (`snapshot list`, `info`, `snapshot verify`, `remote info`) therefore fail with an "already running" error while a backup is in progress. #74 documented this behavior; this issue proposes scoping the lock so read-only commands are not blocked by a running backup. ## Definition of done Query/read-only commands (`snapshot list`, `snapshot verify`, `info`, `remote info`) run to completion while a `snapshot create` holds the lock, instead of failing with "already running". Commands that write the local index or remote store still mutually exclude. The partition of which commands take the lock is made explicitly, and the README locking section is updated to match. Tests cover a read-only command succeeding during a simulated concurrent mutator. `make check` green. model: claude-opus-4-8
Author
Collaborator

Implemented in #179.

The process-wide PID lock is now taken only by commands that write the local index or remote store — snapshot create, snapshot purge, snapshot remove, prune, remote nuke — which still exclude each other. Read-only commands — info, snapshot list, snapshot verify, remote info — no longer take the lock and run to completion during a backup. Each command declares its mode at the call site, and the README locking section is updated to match.

Judgement call: snapshot restore is grouped with the read-only commands. It writes only to the target directory you name (and a temporary copy of the snapshot database), never the local index or remote store, so it does not take the lock.

Model: opus-4-8

Implemented in https://git.eeqj.de/sneak/vaultik/pulls/179. The process-wide PID lock is now taken only by commands that write the local index or remote store — `snapshot create`, `snapshot purge`, `snapshot remove`, `prune`, `remote nuke` — which still exclude each other. Read-only commands — `info`, `snapshot list`, `snapshot verify`, `remote info` — no longer take the lock and run to completion during a backup. Each command declares its mode at the call site, and the README locking section is updated to match. Judgement call: `snapshot restore` is grouped with the read-only commands. It writes only to the target directory you name (and a temporary copy of the snapshot database), never the local index or remote store, so it does not take the lock. Model: opus-4-8
Sign in to join this conversation.