Skip to content

test(contracts): add sync cluster schema coverage - #236

Merged
h4yfans merged 1 commit into
mainfrom
debt/phase-4-u5-contracts-sync
Apr 16, 2026
Merged

test(contracts): add sync cluster schema coverage#236
h4yfans merged 1 commit into
mainfrom
debt/phase-4-u5-contracts-sync

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Phase 4 U5 — Vitest coverage for the six sync-cluster Zod contracts in packages/contracts.

  • sync-api.test.ts — push/pull envelopes, pagination cursors, batch size, conflict response, device keys (79 tests)
  • sync-payloads.test.ts — per-item payload shapes + Phase 8 fieldClocks regression (48 tests)
  • ipc-sync.test.ts — composition barrel: SYNC_CHANNELS / SYNC_EVENTS merge integrity (12 tests)
  • ipc-sync-ops.test.ts — queue/retry/cursor/manifest IPC shapes (16 tests)
  • ipc-crdt.test.ts — Yjs update envelope (Uint8Array, sequence, note/journal discriminator) (18 tests)
  • ipc-events.test.ts — device-ready + sync event bus payloads (21 tests)

194 tests, 100% line/branch/function coverage across the 10 source files touched by these tests.

No production code changes. No z.record(z.unknown()) Zod v4 quirks found in the sync cluster.

Test plan

  • pnpm --filter @memry/contracts exec vitest run — 194/194 passing
  • pnpm --dir apps/desktop test:coverage — 6066 passing, 1 skipped, no failures
  • Coverage >= 80% per file (actual: 100% on all 10 source files)
  • No edits to vitest.config.ts or files outside the 6 new test files

Adds Zod schema validation tests for the 6 sync-domain contracts:
- sync-api: push/pull envelopes, cursors, conflict response, device keys
- sync-payloads: per-type payloads with Phase 8 fieldClocks regression
- ipc-sync: merged channel barrel composition
- ipc-sync-ops: queue/retry/cursor/manifest IPC shapes
- ipc-crdt: Yjs update envelope (Uint8Array, sequence, discriminator)
- ipc-events: device-ready and sync event bus schemas

194 tests, 100% line/branch/function coverage across all 6 source files.
@h4yfans
h4yfans merged commit df70f2d into main Apr 16, 2026
4 checks passed
h4yfans added a commit that referenced this pull request May 6, 2026
Adds Zod schema validation tests for the 6 sync-domain contracts:
- sync-api: push/pull envelopes, cursors, conflict response, device keys
- sync-payloads: per-type payloads with Phase 8 fieldClocks regression
- ipc-sync: merged channel barrel composition
- ipc-sync-ops: queue/retry/cursor/manifest IPC shapes
- ipc-crdt: Yjs update envelope (Uint8Array, sequence, discriminator)
- ipc-events: device-ready and sync event bus schemas

194 tests, 100% line/branch/function coverage across all 6 source files.
@h4yfans
h4yfans deleted the debt/phase-4-u5-contracts-sync branch May 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant