Skip to content

Version History for Notes (Time Travel) #282

@ElioNeto

Description

@ElioNeto

Version History for Notes (Time Travel)

Integrate the existing TimeTravelEngine with the note storage system to provide per-note version history.

Existing Infrastructure

  • TimeTravelEngine in src/infra/time_travel.rs already supports:
    • Snapshot capture with timestamps
    • Disk persistence (JSON files)
    • Query as of a specific timestamp
    • Snapshot listing and removal
    • Eviction policy (max snapshots)

Integration Work

  1. Auto-snapshot on note write

    • After every N note writes (configurable: default 10), capture a full snapshot
    • Store snapshot in {data_dir}/time_travel/
  2. Per-note version tracking

    • Store version metadata key: __version:{note_path}{ current_version, history: [ts1, ts2, ...] }
    • When user requests history, return timestamps + labels
  3. API Endpoints

    • GET /notes/{path}/history — List available versions
    • GET /notes/{path}/history/{timestamp} — Get note content at that version
    • POST /notes/{path}/snapshot — Trigger manual snapshot
    • DELETE /notes/{path}/history/{timestamp} — Remove a specific version
  4. Restore from version

    • POST /notes/{path}/restore?timestamp={ts} — Restore note to a previous version
    • Creates a new version (not destructive)

Configuration

pub struct NoteVersionConfig {
    pub auto_snapshot_interval: usize,  // Auto-snapshot every N writes (default: 10)
    pub max_snapshots: usize,           // Max versions to keep (default: 100)
    pub snapshot_dir: PathBuf,          // Storage path for snapshot files
    pub enable_auto_snapshot: bool,     // Enable/disable auto-snapshots
}

Acceptance Criteria

  • Auto-snapshots triggered after N note writes
  • Version history endpoint returns ordered list of timestamps
  • Specific version can be retrieved
  • Restore creates new version without data loss
  • Snapshot eviction works correctly when max exceeded
  • Manual snapshot creation works
  • Integration with existing TimeTravelEngine

Parent Epic

#275

Metadata

Metadata

Assignees

No one assigned

    Labels

    featnotesNote storage and indexingobsidianObsidian-like note-taking features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions