managarten/services/mana-sync/internal
Till JS cf3d93fac1 test(sync): extract WriteBackup + 4 Go integration tests
Refactor: HTTP handler becomes a thin shim over a pure WriteBackup(w,
userID, createdAt, iter) function. RowIterator abstracts the store, so
tests feed synthetic ChangeRow slices and production feeds
StreamAllUserChanges. Zero behavior change in production — same bytes
on the wire.

Tests (all pass):

- TestWriteBackup_Roundtrip: three rows across two apps, assert zip has
  2 entries, events.jsonl has 3 JSON lines in order, insert omits
  fieldTimestamps, update surfaces them, manifest apps are sorted,
  eventsSha256 equals a recomputed sha of the decompressed body.
- TestWriteBackup_EmptyUser: empty userID refused up-front.
- TestWriteBackup_NoRows: zero-row export still produces a valid zip
  with an empty events.jsonl and a manifest with eventCount=0 and a
  non-empty sha (sha of empty input).
- TestWriteBackup_DefaultsSchemaVersionZeroRowsToOne: legacy rows with
  schema_version=0 clamp to 1 so the manifest never claims a protocol
  version that never existed.

Paired with the vitest zip parser suite on the TS side, this closes
the Go-writes / JS-reads round-trip without needing live mana-sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 17:44:37 +02:00
..
auth feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
backup test(sync): extract WriteBackup + 4 Go integration tests 2026-04-14 17:44:37 +02:00
billing feat(sync): Phase 2 — server-side billing gate, cron charging, email notifications 2026-04-10 22:28:57 +02:00
config feat(sync): Phase 2 — server-side billing gate, cron charging, email notifications 2026-04-10 22:28:57 +02:00
store feat(sync): schemaVersion + eventId on wire (M2 protocol hardening) 2026-04-14 15:25:32 +02:00
sync feat(sync): schemaVersion + eventId on wire (M2 protocol hardening) 2026-04-14 15:25:32 +02:00
ws feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00