guanghu/docs/adr/0034-git-repo-required-for-vault.md
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08:00

2.0 KiB

type, id, title, status, date
type id title status date
ADR 0034 Git repo required — blocking modal enforces vault prerequisite active 2026-04-01

Context

ADR-0014 (git-based vault cache) and ADR-0021 (push-to-main workflow) both assume the vault is a git repository, but neither codified it as a hard enforcement. In practice, opening a non-git folder silently degraded: the cache couldn't compute a commit hash, Pulse/Changes were empty, and commit/push commands failed. The failure mode was invisible to users.

Decision

When the app opens a vault that has no .git directory, a blocking modal prevents all app use until the user either initialises a git repository (git init + initial commit, offered as a one-click action) or selects a different vault. The check is performed by a new is_git_repo Tauri command. In browser/dev mode, the check fails open (modal is skipped).

Options considered

  • Option A (chosen): Hard block via modal on vault open — unambiguous, prevents silent failures, surfaces the fix immediately. Downside: breaks existing workflows for users with non-git vaults; requires a clear escape hatch (choose different vault).
  • Option B: Soft warning banner, allow using the app without git — avoids blocking users, but silent failures persist for Pulse/Changes/commit features.
  • Option C: Auto-init git on vault open without asking — less friction, but surprising; user may not want their vault in git.

Consequences

  • Git is now a first-class prerequisite for Laputa vaults, not just implied by the cache strategy.
  • The is_git_repo command is intentionally lightweight (checks for .git existence only; does not validate remote or commit history).
  • The modal offers git init + an initial commit as a one-click path, lowering the barrier for new users.
  • Browser mode bypasses the check so dev/Storybook workflows are unaffected.
  • Re-evaluate if Laputa needs to support non-git vaults (e.g., iCloud-only, shared network drive); at that point ADR-0014 would also need revisiting.