metaedit

0004. Snapshot the writable fields before every write; revert replays it

Context

A metadata write is destructive by construction (ADR 0003): the body we send becomes the item’s state. A wrong mapping — a bad Last.fm match, an over-eager tag policy — would otherwise overwrite curated genres, tags and overviews with no way back.

Decision

Before every write, persist an immutable snapshot of the item’s current WRITABLE_FIELDS values, plus the Etag and DateLastSaved observed at read time. Revert is a normal write built from the snapshot’s fields, and is itself recorded as a new audit row.

Snapshots are never mutated or deleted. source_op distinguishes apply / revert / bulk_apply, and batch_id groups a bulk operation so a whole run can be rolled back.

Consequences

Alternatives rejected