Engineering Analysis · Global
Stop a stale admin tab from overwriting newer edits
Use an HTTP precondition and a clear review state when two people edit the same record.
By Launchr Space ·
The expensive bug is not the error a user can see. It is the old tab that saves without complaint and erases a colleague’s change. Inventory forms, approval notes, and content settings are common places to look. HTTP already provides the vocabulary for a conditional write: a server can supply an entity tag, and the client can send that tag back with If-Match when it tries to save.
Treat the tag as a version check, not a lock
Have the editor retain the version it loaded, then submit that exact version alongside its changes. RFC 9110 specifies strong comparison for If-Match; a weak cache validator is not a substitute. Check that the revision still matches as part of the write itself. A version checked in one operation and written in another can still race. Define separately what should happen when a caller sends no precondition, rather than letting legacy callers silently bypass the rule.
Preserve the text on a failed save
For a stale version, return a clear precondition failure and leave the current record untouched. Keep the person’s edits in the browser and offer a way to compare against the latest saved record. Explain what happened without suggesting the old save succeeded. For an approval checkbox or state transition, require a human to review the new state before retrying. A blind retry with the newest tag recreates the bug this feature was intended to solve.
Make the two-tab test part of release
Open the same record twice in a test environment. Save a change in the first tab, then save differently from the second. Verify one write is stored, the stale request receives a 412, and the second editor still shows its draft. Add a happy-path check that a fresh editor can load and update the new revision. Test each client that writes the record, including admin UI, imports, and any service that can update it outside the browser. Check that the API response identifies the affected record without leaking another editor’s draft.