From a006440f59bf99380e179cc2963cb98d4d894d3a Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 8 Jul 2026 16:22:17 +0200 Subject: Add head/draft/autosave hierarchy to Node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduces autosave_id as a third, unversioned layer above draft/head, with lock_for_editing!, autosave!, and save_draft! as the new entry points. Also fixes a real bug in wipe_draft!: its "no draft" branch unconditionally released the lock, which was safe when "no draft" only ever meant "nothing is happening" — no longer true now that a lock can exist with only an autosave beneath it. lock_for_editing! deliberately does not call wipe_draft! at all, for the same reason: an intruder calling it while a lock was genuinely held would otherwise silently steal it via wipe_draft!'s own unlock side effect, caught by the new two-user lock test. --- db/migrate/20260708095943_add_autosave_id_to_nodes.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20260708095943_add_autosave_id_to_nodes.rb (limited to 'db') diff --git a/db/migrate/20260708095943_add_autosave_id_to_nodes.rb b/db/migrate/20260708095943_add_autosave_id_to_nodes.rb new file mode 100644 index 0000000..eedcc00 --- /dev/null +++ b/db/migrate/20260708095943_add_autosave_id_to_nodes.rb @@ -0,0 +1,5 @@ +class AddAutosaveIdToNodes < ActiveRecord::Migration[8.1] + def change + add_column :nodes, :autosave_id, :integer + end +end -- cgit v1.3