Skip to content

Plan snapshots: block-level history, restore, and diff #85

Description

@ApocDev

Everything lives in per-project SQLite, so cheap block-level version history is within reach: snapshot a block's full definition (goals, recipe rows, splits, modules, enabled flags, notes) as a JSON row, restore it later, and diff two snapshots.

Behavior

  • Manual snapshots: a "snapshot" action on a block (name optional) before attempting a big refactor.
  • Automatic snapshots: taken silently before destructive or structural operations — block delete, assistant-applied revisions, large recipe-set edits — so there's always a restore point. This is the honest answer to "undo" for big operations (small deletes get an undo toast via Consistent destructive actions: one confirm pattern, undo toast, delete non-empty blocks #83).
  • Restore: replace the block's current definition with a snapshot (which itself snapshots first, so restore is reversible).\n- Diff: show what changed between a snapshot and now — recipes added/removed, rate/split changes, module changes — in the same visual language as the coherence page's plan-vs-actual framing.

Notes

  • A block_snapshots table (block id, timestamp, optional label, JSON payload) keeps this simple; snapshots of deleted blocks double as a recycle bin.
  • Retention: cap automatic snapshots per block (e.g. last 20) so the db doesn't grow unbounded; manual ones are kept until deleted.
  • The snapshot JSON should share its schema with the block export format from Export/import: project backup and shareable block/plan JSON #82 — one serializer, two features.

Part of the block-composition epic #33.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: webWeb UI (React/TanStack/vite-plus)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions