super-productivity/packages/sync-core/tests
Johannes Millan 87f092bee3 fix(sync): correct error class names, JSDoc, and missed cache-clear
Findings from a multi-agent review of the recent sync extraction:

- Seven error classes in @sp/sync-providers shipped with a leading
  space in `name`, and `UploadRevToMatchMismatchAPIError` was further
  truncated to ' UploadRevToMatchMismatchAP'. Consumers use instanceof
  so runtime behavior was preserved, but stack traces, error envelopes,
  and structured-log meta carried the broken names. Added a regression
  test asserting instance.name matches ErrCtor.name for all 14 classes.
- @sp/sync-core decryptBatch JSDoc claimed Argon2 errors are never
  silently masked as legacy fallbacks, contradicting the actual
  catch-and-decryptLegacy path. The fallback is part of the public
  wire-format contract; rewrote the comment to match the implementation
  and reference the module-level wire-format spec.
- SuperSyncEncryptionToggleService.enable/disableEncryption promised
  "Clear cache on success" but never called clearSessionKeyCache().
  Added the call on the success path in both methods, matching the
  pattern used by EncryptionPasswordChangeService and
  FileBasedEncryptionService.
- Removed packages/sync-core/tests/ports.spec.ts — 57 LOC of
  vi.fn().mockResolvedValue type-assertion tests with no production
  code under test. Port shapes are enforced at the host via
  `implements` clauses with real behavioral coverage in sibling specs.
2026-05-13 19:49:26 +02:00
..
compression.spec.ts refactor(sync-core): extract compression helpers 2026-05-11 21:41:02 +02:00
conflict-resolution.spec.ts refactor(sync-core): extract conflict resolution helpers 2026-05-11 18:46:54 +02:00
download-planning.spec.ts refactor(sync): extract snapshot hydration planning 2026-05-12 00:52:50 +02:00
encryption.spec.ts fix(sync): harden encryption batching and SuperSync abort timer 2026-05-13 17:26:55 +02:00
error.util.spec.ts refactor(sync): extract sync file prefix helpers 2026-05-11 21:21:25 +02:00
full-state-op-types.spec.ts refactor(sync-core): configure full-state op classification 2026-05-11 20:36:48 +02:00
remote-apply.spec.ts refactor(sync-core): move remote apply coordinator behind ports 2026-05-11 23:17:13 +02:00
replay-coordinator.spec.ts refactor(sync-core): prepare core boundary for providers 2026-05-12 16:37:12 +02:00
sync-file-prefix.spec.ts refactor(sync): extract sync file prefix helpers 2026-05-11 21:21:25 +02:00
sync-import-filter.spec.ts refactor(sync-core): extract sync import filter decision 2026-05-11 18:47:53 +02:00
upload-planning.spec.ts refactor(sync-core): extract upload planning helpers 2026-05-11 23:23:05 +02:00
vector-clock.spec.ts refactor(sync): move vector clocks to sync-core 2026-05-11 15:21:08 +02:00