refactor(settings): replace vault with SQLite MVCC versioning (#1297)#1302
Open
refactor(settings): replace vault with SQLite MVCC versioning (#1297)#1302
Conversation
Remove rara-vault crate, its workspace references, and the old vault design doc. The crate was never imported by any other crate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…1297) Extend SettingsTool with MVCC-aware actions so mita can inspect version history and rollback settings. The tool now holds Arc<SettingsSvc> directly instead of Arc<dyn SettingsProvider>. New actions: - version: returns current global version number - history: returns the last 20 version log entries - snapshot: returns settings at a given version (key = version number) - rollback: reverts to a given version (forward operation, creates new version) Closes #1297 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rewrite backend-admin AGENT.md to document MVCC append-only versioning, SettingsSvc public API, and forward-only rollback semantics - Remove vault from harness-engineering.md layer map - Remove rara-vault from devtool check-deps layer config Closes #1297
…se structs (#1297) - SettingsAction enum replaces string-matched action field - Typed SnapshotResponse/RollbackResponse/VersionResponse replace json! macros - Dedicated `version` param field instead of overloading `key` - Extract MASK_VISIBLE_LEN, DEFAULT_VERSION_LIMIT, TOOL_HISTORY_LIMIT constants - Remove redundant .map_err(anyhow) on already-anyhow Results
- P0: wrap version bump + log append in a single SQLite transaction to prevent race conditions between concurrent writes - P1: use axum .nest() for version routes to avoid wildcard collision - P1: validate target_version range in rollback_to() to prevent accidental data deletion on non-existent version - P2: fix list_versions to limit by distinct version count, not row count - P2: log warning instead of silently falling back when list() fails - P2: replace unwrap() with expect() in batch_update - P3: update module doc from "Flat KV" to "MVCC-versioned" - P3: strip settings. prefix from VersionEntry keys for API consistency - P3: use char-based masking in maybe_mask to prevent UTF-8 panics Closes #1297
- P1: validate version range in snapshot() — reject future/negative versions instead of silently returning latest snapshot - P1: mask sensitive values in tool History and Snapshot actions — previously bypassed maybe_mask, leaking full secrets to agents - P2: decode JSON-encoded string values in list_versions() — return plain strings consistent with get/list/snapshot APIs - Return 404 (not 500) from snapshot/rollback HTTP endpoints when the requested version does not exist Closes #1297
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
rara-vaultcrate (1,260 lines deleted, zero dependents)settings_versiontable as sole settings storageSettingsSvcto read/writesettings_versionexclusively (dropsKVStoredependency)GET /versions,GET /versions/current,GET /versions/{n},POST /versions/{n}/rollbackSettingsToolwithversion,history,snapshot,rollbackactionsType of change
refactorComponent
core,backendCloses
Closes #1297
Test plan
cargo check --workspacepassescargo clippy --workspace --all-targets --all-features --no-deps -- -D warningspassescargo +nightly fmt --all -- --checkpasses