Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

verify-sync-session

БесплатноБез исполняемых скриптовНе проверен

Model-checks, with TLA+ and TLC, which account each sync write lands in across sign-in, sign-out, switching accounts, Reset Everything, Sign out of all…

vscarpenterот vscarpenter★ 41 звезда на GitHub

Об этом скилле

Verify the sync session

A TLA+ model of the web app's sync session lives in docs/formal/sync-session/. TLC checks every order of the steps in the model. One tab runs a fullSync. Either tab can sign in, sign out, run Reset Everything, edit a task, or change Settings, and a realtime event can arrive. Each await in the code is a point where another step can run. A pass covers the model, not the whole app, so read "Bounds and what's left out" before you trust one.

The promise comes from the header of lib/sync/sync-session.ts. A sync belongs to the account that was signed in when it started. Once sync is off or sync_config names another account, that sync writes nothing more. The model checks the harm that promise exists to prevent.

The rules

Each rule is an INVARIANT in SyncSession.tla.

Rule What the app promises The harm when it breaks
NoRecordInAnotherAccount No account's server copy ever holds a task or queued edit from another account. One person's tasks show up in someone else's account, on every device that account uses.
DeviceHoldsOnlyTheSignedInAccount While sync is on for an account, this device holds only that account's tasks and queued edits. The next push or sign-in uploads the other account's tasks into this one.

TypeOK keeps each variable in its range. It guards the model, not the app.

What the model found (2026-11-08)

The code broke both rules on that date. Every path below was replayed against the real code, and the replay showed the task in the wrong account. All four findings were fixed on 2026-11-11, and no finding is open. Each fix has a Broken value and a Broken*.cfg that undo it. The paths below are how each one broke before its fix.

  1. push-reads-queue-unfenced (fixed 2026-11-11). pushLocalChanges checked the SDK principal once, then read the queue with no assertSyncSessionCurrent. The fix: readPendingForSession reads the queue inside a transaction that makes that check, and the push repeats it before each row and inside each queue write. BrokenPushQueueFence.cfg removes the queue check and breaks the rule again. The paths below are how it broke before the fix. TLC's path: you sign in as A, and a sync for A starts. You sign in as B in a dialog left open in another tab. persistSyncConfig switches to B, since the device holds no tasks yet. B's task arrives and you edit it. A second sign-in as A saves A's token before its own save refuses it. resolvePushPrincipal now passes for A, the push reads B's edit, and upsertRemoteTask creates it with owner: A under A's token. The server accepts it. A second replay found a way in with no stale dialog. The sync tab's authRefresh was in flight while the other tab signed out and signed in as B. Its late response then saved A's token over B's, because clearPocketBase only detaches the tab that calls it. The refresh runs on every sync in a token's last seven days.
  2. sign-out-reads-config-early (fixed 2026-11-11). disableSync called getSyncConfig() before resetSyncConfigState opened its transaction, then wrote the signed-out row from that copy. If A's sign-in saved in between, the row it wrote kept no localTaskOwnerUserId. A's task stayed on the device with no owner recorded, so B could sign in. Then populateFromExistingTasks queued A's task, and B's push uploaded it to B. It needed a Sign out click in a dialog that still showed an older session, within the moment A's sign-in took to save. The fix: disableSync reads nothing first, and resetSyncConfigState reads the row inside its transaction. BrokenSignOutRead.cfg moves the read back before the transaction and breaks the rule again.
  3. settings-writes-stale-config (fixed 2026-11-11). updateAutoSyncConfig called updateSyncConfig, which read the row and put {...current, ...updates} with no transaction. One path matched finding 2. The shortest break ran the other way. Settings read A's row while B's sign-in saved, then wrote A's row back. B's task then sat on a device whose sync_config named A. The toggle showed only while that tab believed sync was on, and the window was one IndexedDB round trip. The fix: updateSyncConfig reads and writes the row in one rw transaction over syncMetadata. BrokenSettingsWrite.cfg splits the read from the write and breaks the rule again.
  4. populate-after-sign-in (fixed 2026-11-11). persistSyncConfig committed its transaction, then populateFromExistingTasks read db.tasks and enqueued each task with no session check. If Reset Everything erased local data between that read and the enqueues, A's task was queued into an empty device. B could then sign in, since the guard counts tasks and not queue rows, and B's push uploaded A's task. The reset had to fit between a few IndexedDB round trips. The fix: the sign-in transaction also scopes syncQueue and calls populateFromExistingTasks itself. The config and the queue rows commit t
Полный SKILL.md на GitHub

Установить verify-sync-session в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл verify-sync-session?

Model-checks, with TLA+ and TLC, which account each sync write lands in across sign-in, sign-out, switching accounts, Reset Everything, Sign out of all devices, and a second open tab, so a change can't upload one account's tasks into another account. Use when a change touches lib/sync/sync-session.ts, pb-sync-engine.ts (fullSync, runSyncPasses, applyRemoteChange), pb-push.ts (pushLocalChanges, resolvePushPrincipal), pb-pull.ts (pullRemoteChanges, applyRemoteRecords), pb-realtime.ts, pb-auth.ts (ensureValidAuth, refreshAuthOutcome), pocketbase-client.ts, sign-out-everywhere.ts, sync-coordinator.ts, queue.ts (getPending, populateFromExistingTasks), lib/sync/config/ (disableSync, updateSyncConfig), lib/reset-everything.ts, lib/reset-local-data.ts, lib/tasks/crud/helpers.ts (runTaskSyncTransaction), components/sync/use-sync-auth-dialog.ts (persistSyncConfig), the tasks API rules in scripts/setup-pocketbase-collections.sh, or any code that writes sync_config, the sync queue, or local task rows on behalf of a sync. Also use when adding a new sync write path.

Как установить скилл verify-sync-session?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл verify-sync-session запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить verify-sync-session с