docs(features): state that local-draft ids are never reused (09-08)

Revisions restart at 1 after a delete, so a reused draft id lets a stale tab
overwrite a new draft. The sample now states the fresh-id premise the port's
revision contract requires, and when tombstones are needed instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-25 23:20:22 +09:00
co-authored by Claude Opus 5.5
parent 96391dc69a
commit 8784354871
2 changed files with 11 additions and 0 deletions
@@ -10,6 +10,7 @@ export type LocalDraftRecord = Readonly<{
export type SaveLocalDraftCommand = Readonly<{
draft: LocalDraft;
/** Only unambiguous while draft ids are never reused (see LocalDraft.draftId). */
expectedRevision: number | null;
idempotencyKey: string;
}>;
@@ -1,4 +1,14 @@
export type LocalDraft = Readonly<{
/**
* 09-08. One id per draft, never reused after the draft is removed. The
* repository deletes without a tombstone and a recreated record starts again
* at revision 1, so a tab still holding revision N of the removed draft
* could compare-and-swap over a new draft that reused its id (the capability
* port's revision contract says so: IndexedDbWriteReceipt.revision in
* src/application/ports/browser-file-storage/indexeddb-port.ts). A fresh id
* per draft (for example crypto.randomUUID()) makes that stale save a
* CONFLICT; a product that must reuse ids needs tombstones instead.
*/
draftId: string;
title: string;
body: string;