mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 21:10:48 +00:00
* Block empty/shrunk pushes when sync base is null (#779) The shrink guard (detectSuspiciousShrink) returned suspicious:false whenever base was null, which is exactly the condition on a fresh install, after unlock-key re-derivation, or when the encrypted base blob fails to decrypt. A device in that state could push a degraded/empty payload and overwrite populated cloud data — the failure mode reported in #779 (Mac → OneDrive → Win11 wiping the keychain on both ends). Accept an optional remote-payload fallback in the guard and use it when base is missing. Plumb the already-decrypted remote payload from the merge branch, and decrypt checkResult.remoteFile on demand in the direct-upload and syncAll branches when base is null. Legitimate cases stay untouched: - no base AND no remote → still not-suspicious (genuinely empty). - outgoing grew past remote → lost is negative, guard skips. - base present → behaviour unchanged, remote fallback ignored. * Harden OneDrive 404 handling, restore barrier, multi-provider divergence (#779) Follow-up fixes on top of the shrink-guard change for the same root incident. - OneDriveAdapter: findSyncFile/downloadSyncFile now retry with short backoff when the Graph API returns "not found". A file uploaded by another device can transiently 404 for seconds while the OneDrive client propagates it, and treating that as "cloud is empty" was a key step in how #779 escalated. The retry is bounded (2 extra attempts, 1.5s/3s backoff) and only fires on null/404 results. - useAutoSync.isRestoreInProgress: self-clear the restore-barrier storage key when its deadline is in the past, and treat a deadline more than 10 minutes in the future as corrupt (clock skew, pathological holdMs, or tampered value) instead of letting it lock auto-sync. - CloudSyncManager + SyncEvent: when the existing divergent-provider- bases check fires, emit a PROVIDERS_DIVERGED event in addition to the console.warn so the UI can surface the warning (was otherwise silent and a known path for one provider's merged payload to overwrite a differently-configured provider's data).