A publish endpoint with no concurrency protection. Click the buggy button twice in rapid succession to trigger a duplicate write. The safe endpoint uses a lock and existence check.
A race condition occurs when two concurrent operations read the same state and both decide to write, producing duplicate or corrupted results. This is common in publish/create flows where the check-then-act sequence is not atomic.
| Bug | Click "Publish (Buggy)" twice rapidly → 2 duplicate records appear in the list |
| Correct | Click "Publish (Safe)" twice → second click is deduplicated by the lock |
| Reset | Clear published list between test runs |
Publish (Buggy) twice as fast as possible