sync-invariant-check

Validates sync code changes against eight production-derived invariants before shipping.

Updated Jun 15, 2026
One-click install
npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill sync-invariant-check-ravenslight2010
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-invariant-check
Source: https://github.com/ravenslight2010/Production-run-calculator/tree/main/.agents/skills/sync-invariant-check
Command: npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill sync-invariant-check-ravenslight2010

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Sync-related changes in this codebase (LWW stamps, SSE handlers, reset epochs, wake handoffs) have repeatedly caused production incidents like reverted run lifecycles, wiped run values, and stale data resurrection. This Skill gives an agent a concrete pre-ship checklist so every sync change is verified against the invariants that trace back to real incidents. ## Core Features & Use Cases - Change-to-invariant mapping: A quick-reference table maps the file or area you modified (e.g. PUT /sync/today, protectRunValues, buildSyncPayload) to the exact invariant sections that must be checked. - Eight invariant sections: Covers run-meta LWW stamps, SSE stamp source via overlayRunMetaStamps, ?today= client date scoping, the 10 MB body limit, fail-closed epoch/reset guards, empty-over-populated protection, sleeping-device wake handoff, and per-run auto-track claim ownership. - Focused validation commands: Provides the exact vitest invocations for the sync, reset, wake-guard, and blank-value regression suites, plus a copy-paste PR review checklist. - Use Case: After editing home.tsx sync handlers, run through the checklist to confirm SSE receive uses overlayRunMetaStamps, ?today= is threaded on every request, and the wake-handoff regression tests pass before merging. ## Quick Start Review my changes to routes/sync.ts and home.tsx against the sync invariant checklist and tell me which invariants I need to verify.

Frequently Asked Questions about sync-invariant-check

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check sync code changes before shipping?

Use the quick-reference table to map your changed files to the relevant invariant sections, then verify each listed rule and run the focused vitest regression commands. Finish by copying the PR checklist into your review.

What files trigger the sync invariant checklist?

It triggers on changes to routes/sync.ts, protectRunValues.ts, storage.ts sync helpers, home.tsx sync handlers, any field added to SyncPayload, RunMeta, or DEFAULT_VALUES, wake/foreground recovery code, and automatic claim coordination.

Why does sync need a 10mb body limit instead of the Express default?

Day-state sync payloads embed full per-run recipe FormValues for every run, and real multi-run days exceed the Express default of about 100 KB. Without the 10mb limit every write fails with 413 and sync silently breaks.

What is the difference between this skill and state-accuracy-check?

This skill covers sync transport, persistence, LWW stamps, reset epochs, SSE merge, and sleeping-device adoption. Timer and counter math, auto-track bookkeeping, and pause/resume belong to state-accuracy-check; read both when a wake handoff crosses the boundary.

Why do run values get wiped after a refresh?

That is the empty-over-populated failure: a transiently blank form is pushed with a real edit stamp and clobbers stored values. The guard in protectRunValues.ts must recognize all blank shapes and advance the surviving value's stamp to Date.now().