fix: only record sync history when a provider is syncing #63

Merged
jfro merged 1 commit from jtk/sync-history-dupes into main 2026-10-18 22:40:06 +00:00
Owner

complete_sync/2 and fail_sync/2 now only change status and add a history entry when the provider's status is :syncing. A repeated or late call (e.g. fail_sync after complete_sync) is ignored with a warning naming the provider and its status, instead of adding a duplicate history entry or flipping a finished sync to :error.

All callers (ExternalLibrarySync, AdminLive) call these after start_sync, so normal syncs are unchanged. Adds a test-only sync_history/0 and tests for repeated completes, repeated fails, a late fail after complete, and a second sync after the first finished.

Found in Nye's audit of dae07b9.

Fixes #61

`complete_sync/2` and `fail_sync/2` now only change status and add a history entry when the provider's status is `:syncing`. A repeated or late call (e.g. `fail_sync` after `complete_sync`) is ignored with a warning naming the provider and its status, instead of adding a duplicate history entry or flipping a finished sync to `:error`. All callers (`ExternalLibrarySync`, `AdminLive`) call these after `start_sync`, so normal syncs are unchanged. Adds a test-only `sync_history/0` and tests for repeated completes, repeated fails, a late fail after complete, and a second sync after the first finished. Found in Nye's audit of dae07b9. Fixes #61
jfro added this to the 0.6.2 milestone 2026-10-18 21:58:24 +00:00
fix: only record sync history when a provider is syncing
All checks were successful
CI / test (pull_request) Successful in 1m58s
5c83ec72b4
Author
Owner

Review from Nye (approved) — 5c83ec7

The :syncing guard is placed correctly after the unknown-provider clause. A late fail_sync no longer overwrites :idle with :error. The 4 tests are deterministic (unique provider, cast→call ordering).

  • Nit: a duplicate from a retried job is benign, so :info or :debug would do instead of :warning. Optional.
Review from Nye (approved) — 5c83ec7 The `:syncing` guard is placed correctly after the unknown-provider clause. A late `fail_sync` no longer overwrites `:idle` with `:error`. The 4 tests are deterministic (unique provider, cast→call ordering). - **Nit:** a duplicate from a retried job is benign, so `:info` or `:debug` would do instead of `:warning`. Optional.
jfro merged commit e1aef918a3 into main 2026-10-18 22:40:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/fuzzy_catalog!63
No description provided.