Repository navigation
feat(vault): initialize the vault on first vault command - #314
Merged
Merged
Conversation
Vault-facing commands now create the vault when it is absent, so a repository from `atomic init --no-vault` (or one that never ran `atomic vault init`) serves `atomic vault`, `atomic intent`, and `atomic memory` on first use instead of failing with "Vault not initialized". - Repository::ensure_vault: idempotent first-use initialization - CLI vault-ready openers for the local command bodies - VaultService handlers ensure before the domain call - Regression tests for the repository, CLI, and daemon path
Read commands (vault show/list/context/summaries, goal list/show, intent show/list/validate/verify, memory show/list/validate/verify) open read-only and never initialize the vault. A read-only checkout now keeps working, and a read never creates `.vault/`. Vault writes still initialize on first use: vault goal start/stop/ resume, materialize, sync, intent new/update/delete/link/attest, and memory new/write/attest. The daemon's VaultService applies the same split: write handlers ensure the vault; read handlers do not. Tests: reads leave `.vault/` absent, and a read-only database still serves `vault list`.
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.
Summary
Vault-facing commands (
atomic vault,atomic intent,atomic memory) now initialize the vault on first use when it is absent, soatomic init --no-vaultrepositories and clones without redb vault tables work immediately instead of failing with "Vault not initialized. Runatomic vault initfirst."Repository::ensure_vault(): idempotent first-use init; an existing vault is never re-initialized.VaultServicerepo opens ensure the vault before the domain call (the default in-processLocalrouting path).atomic query/atomic sessionstay read-only: they return empty results rather than erroring, so they do not create a vault as a side effect.Verification
cargo test -p atomic-repository --lib repository::vault::— 39 passedcargo test -p atomic-cli --test it vault_— 12 passed (3 new auto-init tests)memory_compatibility,concurrent_intent,kg_service— 1 / 4 / 3 passedatomic init --no-vault:vault show,vault list,intent new,vault goal start,vault materialize,memory newsucceed;vault initafterwards reports "already initialized"