mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 13:01:24 +00:00
* fix: address Codex follow-up review on PR #720 Two issues surfaced by Codex's post-merge review of PR #720: P1 — useAutoSync.ts: startup retry exhaustion wedged auto-sync. The retry effect previously returned at `attempt >= 4` without opening `remoteCheckDoneRef`. A session with persistent inspect failures (long network outage, provider rate-limit loop) left auto-sync silently disabled for the rest of the session until restart or provider/unlock transition. After exhaustion, open the gate: the specific dangers we gate-closed against (empty-push, partial-apply push) are now covered by independent guards (`hasMeaningfulSyncData`, the apply-in-progress sentinel, and `checkProviderConflict`'s inspect-failure throw at upload time). This matches manual sync's existing semantic rather than silently strict-gating auto-sync. P2 — CloudSyncSettings.tsx: restore buttons were per-row disabled, not globally. A user could click Row A, then Row B while A was still applying — two concurrent `applyProtectedSyncPayload` calls in the same window. `withRestoreBarrier` serializes across windows but NOT same-window re-entry, so the second restore's sentinel-clear could mask a still-partial first apply. Disable every restore button while any restore is in flight. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: keep auto-sync gate closed on retry exhaust; open on manual sync Codex's re-review of PR #723 correctly flagged that opening the auto-sync gate after startup retry exhaustion reintroduces the destructive-clobber path the gate was supposed to prevent. Concrete scenario: local vault is partially lost (non-empty, just missing entries), remote has not changed since our last anchor, user edits a field after a long outage → auto-sync pushes the partially-lost vault over the intact remote. `checkProviderConflict` doesn't catch this (anchor matches), `hasMeaningfulSyncData` doesn't catch this (non-empty), and the empty-vault prompt doesn't fire. Revert the retry-exhaust gate-open. The gate now stays closed until either: 1. A startup `checkRemoteVersion` succeeds (normal path), OR 2. A `syncNow` completes successfully. A manual sync from Settings implicitly runs per-provider `checkProviderConflict` — the same inspect the startup path would have done — so a successful manual sync is equivalent to a successful startup reconciliation from the gate's point of view and opens the gate for the rest of the session. This preserves Codex's safety ask (no auto-push without a confirmed remote state) while giving the user a clear escape hatch (manual sync) that doesn't require a restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>