Skip to content

Add unit tests for sync engine merge/push reconciliation #17

Description

@dm807cam

Problem

rehydrate-sync/src/execute.rs and rehydrate-sync/src/push.rs have zero unit test coverage. The merge/reconciliation logic — exactly where a silent data-loss bug would hide — is currently exercised only by tests/full_pull_smoke.rs, which requires a real reMarkable plugged in over USB and is #[ignore] by default.

This was identified in the v1.0.0 release-readiness review as the highest-leverage post-ship gap.

Why this matters

  • Pull/push reconciliation decides what wins when the tablet and the local library disagree. A regression here can silently drop a document version or overwrite a newer side.
  • The CHANGELOG v0.9.0 already flagged "no IPC test harness" as a 1.0 punch list item — the sync engine gap is the same shape one layer down.
  • We can't catch this in CI today: smoke tests need a physical device.

Suggested approach

  • Build a MockDevice (or extend rehydrate-device::fake) that returns scripted manifests, blob bytes, and write outcomes.
  • Cover at minimum:
    • Pull: new doc, updated doc, deleted-on-tablet doc, folder move, identical hash (no-op)
    • Push: new doc upload, version restore, archive (soft-delete propagation on next sync), folder rename
    • Reconciliation: both sides changed (current resolution policy), tombstone semantics, clock-skew guard
  • Run on every PR (already cheap — no device, no network).

References

  • crates/rehydrate-sync/src/execute.rs
  • crates/rehydrate-sync/src/push.rs
  • crates/rehydrate-sync/tests/full_pull_smoke.rs (the only existing coverage)
  • crates/rehydrate-device/src/fake.rs (likely starting point for the mock)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions