Repository navigation
fix(kb): last_sync_at only moves forward, so an earlier-finishing sync cannot widen the next window (#20758) - #20801
Merged
Merged
Conversation
…c cannot widen the next window (#20758)
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
Owner
Author
|
Code review on PR #20801 (head 01bc846): APPROVE Checked against the three ACs of #20758. All are met; no CRITICAL, HIGH or MEDIUM finding.
|
…s holds, so a run behind it cannot set an older one (#20758)
Owner
Author
|
Code review on PR #20801 (head a202384): APPROVE Delta review of a202384 against 01bc846 (one commit). LOW 1 is resolved:
|
This was referenced Nov 4, 2026
Merged
Merged
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20758
Thinking Path
Since #20556, every sync path (scheduler, connector create, Sync button) holds the per-connector lease, so two runs overlap only after a lease is lost. In that window, the run that finishes first could still set an older
last_sync_atover a newer one. The next incremental sync would then use the older value assinceand re-read more than it needs to. This makes the time monotonic at both places it is written:instance.config.last_sync_atis assigned only when it is unset or older._aware()before comparing. A naive time is read as UTC, an ISO string is parsed withparse_utc_iso(Zor offset), and an unreadable stored value is logged and replaced.What Changed
autobot-backend/api/_connector_sync_result.py_aware,_is_later;_write_last_synctakes a datetime and keeps a later stored time;record_last_synccompares before setting the live valueautobot-backend/api/connector_sync_result_19714_test.pyVerification
api/connector_sync_result_19714_test.py: 15 passed. New tests:test_an_earlier_finishing_run_keeps_the_later_stored_timetest_a_later_run_still_moves_the_stored_time_forward(the control, with aZ-suffixed stored time)test_an_unreadable_stored_time_is_replacedtest_out_of_order_completion_leaves_the_later_time_everywhere: the newer run finishes first, then the older one. Both the stored and the live time stay at the newer run's.Mutation check: with
_is_laterforced toTrue(the old unconditional write), the earlier-finishing test and the out-of-order test fail (2 failed, 13 passed).Model Used
Claude Opus 5.5