Original AI-generated concept illustration. Fictional interfaces and property details, not an actual product screenshot.
Imagine a fictional property-listing editor used by two colleagues. Mira and Dev open the same draft. Mira corrects “two bedrooms” to “three bedrooms” after checking the property details, advancing revision 7 to revision 8. Dev asks an AI assistant to improve the description, reviews its wording, and clicks Save.
Dev’s browser still holds the old bedroom count. If the server accepts the entire draft unconditionally, a polished description can quietly erase Mira’s correction.
The useful question at save time is: Is the version this draft was based on still current? A conditional save makes that question part of the server’s write operation, rather than a warning the interface hopes everyone notices.
Keep the baseline with the draft
When the editor loads a listing, retain three things together: the saved content, its ETag, and a separate working copy. Start AI generation from that captured baseline. Do not fetch a newer tag later and attach it to output generated from older content.
A server might return this illustrative header excerpt, not a complete HTTP message:
ETag: "listing-42-r7"
The corresponding save includes:
If-Match: "listing-42-r7"
If-Match uses strong comparison against the selected representation. If the condition is false, the server must not perform the requested change; the usual response is 412 Precondition Failed. RFC 9110, section 13.1.1
Clients should treat tags as opaque values, preserving their quotes. A weak tag such as W/"listing-42-r7" never satisfies this comparison. Removing W/ does not turn it into a trustworthy strong validator. Also, If-Match: * tests existence, not whether the editor has the latest revision. MDN’s If-Match reference
For this proposed design, use one stable JSON representation for editing. Issue a new revision whenever its saved representation changes, including changes made by imports or background jobs. If serialization or representation variants can change independently, account for them in validator generation too. A revision number is useful only when the server maintains that invariant.
Make comparison and writing one operation
A separate “check version” request cannot protect the later save. Another writer can commit in the gap. Even checking inside the save handler is insufficient if the database permits a competing update between comparison and persistence.
Here is untested, framework-neutral pseudocode, not a deployable handler. This endpoint’s contract requires an explicit revision-tag list rather than a wildcard; its parser enforces that contract and rejects malformed input. Weak tags remain weak and cannot match.
save_listing(request):
authorize_and_validate_request(request)
if request.IfMatch is missing:
return 428 with retry_instructions, CacheControl="no-store"
candidates = parse_revision_tag_list(request.IfMatch)
begin_transaction()
try:
listing = select_listing_for_update(request.listing_id)
if listing is absent:
rollback()
return 404
current = strong_etag_for_edit_representation(listing)
if not any_strong_match(candidates, current):
rollback()
return 412
replace_saved_draft(listing, request.draft)
advance_representation_revision(listing)
persist(listing)
saved = snapshot_edit_representation(listing)
commit()
catch error:
rollback_if_active()
raise error
return 200 with body=saved # no response validator shown
The lock must cover reading the current version, comparing it, and writing the replacement. PostgreSQL row locks normally remain held until transaction end, providing one possible building block. PostgreSQL row-level locking documentation
Every writer must preserve the same versioning rules. Keep model generation and human review outside the transaction; a database lock should not wait for someone to finish editing.
The 428 response is an optional API policy, not a universal requirement for every server. It means this server requires a conditional request. Explain how to fetch a baseline and resubmit; responses with this status must not be cached. RFC 6585, section 3

Original AI-generated concept illustration with fictional people, interface and property details. An atomic version check protects the newer edit; the article explains the already-applied exception for a lost response.
Make a conflict recoverable
When Dev receives 412, leave the working copy intact. Fetch the latest listing into a separate buffer and present a three-way comparison:
- Base: the content Dev originally loaded.
- Mine: Dev’s reviewed AI-assisted draft.
- Current: the latest saved content, including Mira’s correction.
Compare each side against the base. Distinct field changes may be straightforward to combine, but rewritten paragraphs can overlap semantically even when their text differs. Highlight the bedroom discrepancy for review instead of asking another model to decide which factual claim wins.
After reconciliation, associate the reviewed result with the newly fetched baseline and its tag. Save conditionally again. If another edit arrives during review, repeat the comparison without discarding anyone’s work. Avoid an automatic “retry with latest tag” button: it would authorize the stale replacement without resolving the conflict.

Original AI-generated concept illustration. Fictional collaborators compare the base, working draft and current saved version; not an actual product screenshot.
Treat a missing response as uncertainty
Suppose Dev’s save commits, but its response disappears. Retrying with the original tag can produce 412 because the first save advanced the revision. That does not prove the first attempt failed.
HTTP permits a success response when the server can determine that the requested change was already applied. The simpler handler above deliberately does not implement that optional recovery path. RFC 9110, section 13.1.1
Retain the draft and fetch current state before deciding what happened. If duplicate-operation recognition is needed, design a durable operation record and its retention rules explicitly; do not guess from a timeout.
Six tests before shipping
- Ordinary save: a current tag succeeds, and a subsequent fetch reflects the saved draft and updated validator.
- Stale editor: Mira saves first; Dev’s stale request gets
412 without overwriting her correction.
- Concurrent saves: release two changed drafts together using the same tag; only one replacement commits.
- Validator contract: missing tags receive the documented
428; weak tags cannot match; wildcards cannot bypass revision protection.
- Conflict recovery: preserve the working copy, compare all three versions, and reject another stale reconciliation if a third change intervenes.
- Lost response: commit a save, drop its response, and retry. Verify that the client reconciles uncertainty rather than claiming the original save failed.
AI-assisted editing can make drafting faster. Conditional saves keep that speed from silently replacing a colleague’s more recent work.