All packsOffline Sync EngineSolve
postgres collation locale string comparison bug hybrid logical clock
JavaScript and locale-collated Postgres don't sort strings the same way
A Hybrid Logical Clock encoded as a string relies on byte-wise comparison to break ties -- Postgres's default locale collation can order the same strings differently.
This is one of the things Offline Sync Engine already handles. Let your app keep working with no internet, then merge the changes correctly when it reconnects.
Is this you?
This pack's clock is a lexicographically ordered string, so "which write is newer" reduces to a plain string comparison -- and it has to give the same answer on the client (JavaScript, always byte-wise) and the server (Postgres, whatever collation the column uses). Under a locale collation like en_US.UTF-8 -- the default on most managed Postgres -- punctuation and length differences in the tiebreaking client id can sort differently than the same comparison in JavaScript, so the server and a client can permanently disagree about which of two same-timestamp writes actually won.
Why this one is easy to get wrong
A text column in Postgres works exactly like a string in JavaScript for every ordinary case an agent is likely to test manually -- the divergence only shows up on same-millisecond, same-counter ties whose client-id tiebreak happens to sort differently under a specific locale collation, a scenario that requires either bad luck or a specifically constructed test to hit, not something normal manual testing surfaces.
What you get instead
ARCHITECTURE.md pins the column as hlc text COLLATE "C" specifically to force byte-order comparison in SQL, matching JavaScript's native string comparison exactly. On top of that, clientId itself is constrained to [A-Za-z0-9-]+ (UUIDs qualify) and the push validator enforces it, so even an unusual client id can't introduce a comparison edge case the COLLATE "C" column wasn't designed to handle.
Source: ARCHITECTURE.md 'HLC (Hybrid Logical Clock)' — checkable in the pack you receive
How you actually use this
You don’t install a library or wire up an SDK. Your own coding agent builds the code in your project, and you keep it — no runtime dependency on us.
Step 1
Download and unzip
You get a folder: the docs that tell an agent what to build, a starting skeleton, and the test suite that decides when it's done.
Step 2
Open it in Claude Code or Cursor
Point your coding agent at the folder. Nothing to install, no account with us, no API key.
Step 3
Paste one prompt
The pack contains the exact prompt. Paste it as your first message and leave it alone — it works through the build itself, choosing a cheaper or stronger model per task.
Step 4
Run ./verify.sh
One command. It prints a pass or fail for every check. Green means the build is done — the same script we ran to produce the receipt on this page.
Typical build: about 12 minutes of your agent working, mostly unattended. Then you integrate the working module into your app the way you would any code you’d written yourself.
Why you can believe this
2 of 3 runs passedWe ran this pack from an empty folder 3 times and published exactly what happened — every check, the model, the token cost, the wall time. Not a testimonial, and not our opinion: the same verify.sh you run yourself. Read the full receipt →