verify-sync-convergence
БесплатноБез исполняемых скриптовНе проверенModel-checks, with TLA+ and TLC, that one task synced between two web devices and PocketBase ends with every copy holding the newest edit, so a change can't…
от vscarpenter★ 41 звезда на GitHubОб этом скилле
Verify sync convergence
The model lives in docs/formal/sync-convergence/. It follows one task on two web devices (A and B) and the PocketBase server. It covers the push queue, the pull cursor, last-write-wins, realtime events, the far-future hold-off, and one fullSync at a time per device.
The property and the harm
The property: once both devices are quiet, both devices and the server hold the same copy of the task, and it's the newest edit either device made by client_updated_at.
The harm when it breaks: an edit you made shows on one device and never reaches the other, with no error that says so.
"Quiet" means each device has no pending queue row, no sync running, no realtime event on its way, and a completed pull after the server's last write. The model splits the property into two rules so a counterexample says which half broke, and adds a third rule that guards the hold-off:
| Rule | In plain words |
|---|---|
QuietMeansSameCopy |
Once both devices are quiet, both show the server's copy. |
QuietMeansNewestEdit |
Once both devices are quiet, the server holds the newest edit. |
UnsentEditStays |
An unsent edit stays on screen until a newer edit replaces it. A fast clock's copy never replaces it. |
Run it
bash docs/formal/sync-convergence/check.sh
It runs every config through bash scripts/tlc.sh, which pins and hash-checks TLC 1.7.4 on Java 21. It prints one line per config and exits 0 only when every result matches its expected outcome. The full run takes about two minutes. Name configs to run only those, such as bash docs/formal/sync-convergence/check.sh SyncConvergence FindingPushRace. The last lines print the folder that holds TLC's output for each config, counterexamples included.
Expected result at the sync commit:
| Config | Expected | What it adds to the code |
|---|---|---|
SyncConvergence |
holds (414,897 states) | Nothing: edits on both devices, pushes that fail and retry, syncs that fail, lost realtime events |
FastClockHoldOff |
holds (1,629,373 states) | A client with a fast clock saves the task once; checks only UnsentEditStays |
FindingOtherTaskCursor |
breaks QuietMeansSameCopy |
Another task's record moves the shared pull cursor (finding 1) |
FindingPushRace |
holds | The other device writes between a push's read and its write, and the server refuses the stale write (finding 2, fixed) |
FindingRetriesRunOut |
breaks QuietMeansSameCopy |
Pushes keep failing until a row's retries run out (finding 3) |
FindingFastClock |
breaks QuietMeansSameCopy |
A client with a fast clock saves the task once (finding 4) |
BrokenPushOverwritesNewer |
breaks QuietMeansNewestEdit |
Push drops its isRemoteNewer check |
BrokenFailedPushDropsRow |
breaks QuietMeansNewestEdit |
A failed push dequeues its row |
BrokenCursorFollowsClock |
breaks QuietMeansSameCopy |
Every pull moves the cursor to now minus the overlap |
BrokenApplyIgnoresStamps |
breaks UnsentEditStays |
Pull and realtime skip the strictly-newer check |
BrokenNoHoldOff |
breaks UnsentEditStays |
holdsOffFarFutureRemote always says no |
BrokenPushWithoutCompare |
breaks QuietMeansSameCopy |
The server writes without comparing the version the push read, the bug 40a8bc5 fixed |
Each finding config differs from a config that holds by one environment constant, so its break comes from that one addition. The broken variants are code mutations, chosen with the Variant constant, that prove each rule can fail. A finding config that starts to hold means someone fixed that finding, and a broken variant that starts to hold means the model stopped checking that rule. Either one is a reason to look, not a pass.
Read every result, failing or passing, with the /statechart skill, giving it SyncConvergence.tla, the config, and the view at docs/formal/sync-convergence/view.mjs. It tells each counterexample as its shortest path in the reader's words. The configs that hold have hundreds of thousands of states, too many to draw, so for them expect a report of the rules that hold rather than a chart.
Sync commit
9c0d443 (test(e2e): wait for the drawer's title focus before typing a subtask). At that commit, every file in the coverage record matches what the model describes. Move this line forward only after you've read the diff of every covered file since 9c0d443. You must also confirm that the model still describes the code at the new commit. To see what changed, uncommitted edits included:
git diff --stat 9c0d443 -- lib/sync lib/tasks/crud lib/constants/sync.ts docker/pb_hooks/task-write-contract.js
Coverage record
Each comment in SyncConvergence.tla names the function its step models.
| Model part | File | Function |
|---|---|---|
YouEdit |
lib/tasks/crud/update.ts, lib/tasks/crud/helpers.ts, lib/sync/queue.ts |
updateTask, runTaskSyncTransaction, SyncQueue.enqueue (no merging: one row per edit) |
Установить verify-sync-convergence в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл verify-sync-convergence?
Model-checks, with TLA+ and TLC, that one task synced between two web devices and PocketBase ends with every copy holding the newest edit, so a change can't silently lose an edit or leave a device stuck on an old copy. Use when a change touches lib/sync/queue.ts, lib/sync/pb-push.ts, lib/sync/pb-pull.ts, lib/sync/pb-sync-engine.ts (fullSync, applyRemoteChange, updateSyncCursor), lib/sync/task-mapper.ts (clampClientTimestamp, pocketBaseToTaskRecord), lib/sync/pb-sync-helpers.ts (fetchRemoteTaskEntry, holdsOffFarFutureRemote, isBeyondClockSkew), lib/sync/sync-coordinator.ts, lib/sync/pb-realtime.ts, lib/sync/retry-manager.ts, SYNC_CONFIG in lib/constants/sync.ts, or a local write path that enqueues a sync row (lib/tasks/crud/update.ts, helpers.ts, and the other writers in lib/tasks/crud/).
Как установить скилл verify-sync-convergence?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл verify-sync-convergence запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic