Skip to content

Align sync-server record and CRDT transports - #178

Merged
h4yfans merged 1 commit into
mainfrom
arch/phase-07-server-alignment
Apr 8, 2026
Merged

Align sync-server record and CRDT transports#178
h4yfans merged 1 commit into
mainfrom
arch/phase-07-server-alignment

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

What

Align the sync server with the adapter-driven client sync model by separating record-sync and CRDT transport handling, preserving legacy record endpoints, and adding per-domain sync telemetry.

Why

Phase 07 requires the server transport to match the new client sync architecture. The existing sync route mixed record and CRDT validation, batching, quota handling, and logging in one place, which made the transport boundary harder to reason about and harder to observe per domain.

How

  • grouped record transport behind shared handlers and added /sync/records/* aliases while keeping the legacy /sync/push, /sync/pull, /sync/changes, /sync/manifest, and /sync/status routes working
  • moved record batch intake into processRecordPushBatch and reused shared payload hydration helpers in the sync service instead of keeping that orchestration in the route layer
  • added SyncTelemetry structured logs for accepted/rejected record mutations, replay/conflict/quota rejects, per-domain record traffic, CRDT update/snapshot volume, and latency buckets
  • extended sync route tests to cover record transport aliases and CRDT endpoint separation

Type

  • feat — new feature
  • fix — bug fix
  • refactor — restructure without behavior change
  • style — visual/UI only
  • perf — performance improvement
  • test — adding or updating tests
  • chore — tooling, deps, config
  • docs — documentation only
  • ci — CI/CD changes

Test plan

  • Unit tests added/updated

  • Integration tests added/updated

  • Manual testing (describe below)

  • pnpm --filter @memry/sync-server test -- src/routes/sync.test.ts src/services/sync.test.ts

  • pnpm typecheck:sync-server

Checklist

  • Self-reviewed the diff
  • No hardcoded secrets or credentials
  • Files stay under ~500 LOC
  • Follows immutable data patterns

@h4yfans
h4yfans merged commit b0f69a7 into main Apr 8, 2026
3 checks passed
@h4yfans
h4yfans deleted the arch/phase-07-server-alignment 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