Skip to content

Pass _rev for optimistic concurrency on writes #2

Description

@OwenTrokeBillard

Currently write_note / edit_note have no staleness check. If two agents edit the same note concurrently, last-write-wins and one side's changes are silently lost.

CouchDB already tracks _rev on every document. Suggestion:

  • Return the _rev (as an opaque revision token) from read_note / get_note_metadata.
  • Accept an optional expected_revision on write_note / edit_note. If provided and stale, reject with something like { error: "stale_revision", current_revision: "..." } so the caller can re-read and retry.

Optional keeps current ergonomics; opt-in gives careful agents a safety net.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions