The Draft That Overwrote the Publish — Python Bug Hunt
Inspired by the sync-conflict horror stories of every note-taking and CMS product: an old offline draft comes back online and steamrolls the article someone…
- Language: Python
- Layer: Backend
- Difficulty: Easy
- Concepts: Sync, Timestamps
- Modelled on: Sync engines
- Visible tests: an older incoming record loses; a newer incoming record wins
- Reward: 50 XP for a complete fix
Briefing
Inspired by the sync-conflict horror stories of every note-taking and CMS product: an old offline draft comes back online and steamrolls the article someone published an hour ago. Last-write-wins needs to compare timestamps, not arrival order.
sync.py merges an incoming record with the stored one.
Bug report
BUG-LWW · Priority: High (lost content) · Reported by: editors
merge(saved, incoming) — both have updated_at:
- keep whichever has the NEWER updated_at
- ties keep the SAVED (server) copy
Observed: incoming always wins — a laptop that was offline all week just replaced today's homepage with last Tuesday's.
Logs
[sync] doc 41: incoming updated_at=1699000000 overwrote saved 1699600000The code as shipped
src/sync/sync.py (editable)
# Last-write-wins merge of a stored and incoming record.
def merge(saved, incoming):
return incoming
Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More Python bug hunts.