guanghu/docs/adr/0034-git-repo-required-for-vault.md
冰朔 8739805f99
Some checks failed
Auto-update PR branches / Update open PR branches (push) Has been cancelled
CI / Frontend Static Quality Checks (push) Has been cancelled
CI / Frontend Tests & Coverage (push) Has been cancelled
CI / Rust Tests & Quality Checks (push) Has been cancelled
CI / Linux build verification (push) Has been cancelled
Release (Alpha) / Compute alpha version (push) Has been cancelled
Release (Alpha) / Build release artifacts (push) Has been cancelled
Release (Alpha) / GitHub Release (alpha) (push) Has been cancelled
Release (Alpha) / Update docs and release pages (push) Has been cancelled
Deploy docs / Build VitePress site (push) Has been cancelled
Deploy docs / Deploy to GitHub Pages (push) Has been cancelled
光湖开源源码快照 · Tolaria AGPL 分叉基线 · 独立更新链
2026-07-05 17:45:16 +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.