Skip to content

Don't scan from stale history before a kept clone fetches - #256

Merged
MHohlios merged 2 commits into
mainfrom
wiffletree/don-t-scan-from-stale-history-before-a-kept-clon
Nov 2, 2026
Merged

MHohlios merged 2 commits into
mainfrom
wiffletree/don-t-scan-from-stale-history-before-a-kept-clon

Conversation

@MHohlios

@MHohlios MHohlios commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

When a Mac rejoins a Space with a kept storage clone, its scan marks start at the join head, which the kept clone had not fetched yet. A pull scan before the first fetch fell back to the clone's old head and moved the mark back there, so the next pull rescanned everything pushed while the Mac was away and raised alerts for old commits.

  • place_storage (storage.rs): when the clone is kept, it fetches the staging clone's HEAD (the join head) before the staging clone is dropped. A local fetch, no network.
  • advance (alerts.rs): the scan waits only while the clone's head is at or behind the mark, which is the case before the first fetch. After a rewrite, the merge-base restart runs as before, and a mark that is ever missing restarts at the head, so the scan never stalls.

Trade-off: if main is reset to an ancestor and nothing new is pushed, open alerts are re-checked only when the next commit arrives. Nothing goes unscanned.

A follow-up to #235.

Tests:

  • a_kept_clones_first_scan_waits_for_its_fetch_and_scans_no_old_history: the mark waits and no old commit raises an alert; before the fix the mark moved back and the next pull raised a phone alert.
  • a_rewrite_before_a_kept_clones_first_fetch_scans_what_follows: rejoin, rewrite main, push a phone number, pull; one alert for the new commit only. A first version of this fix stalled here with no alert.

Reviewed with Wiffletree: 1 full review and 0 re-checks, 2 rounds (Tests, Claude, Style)

@MHohlios
MHohlios force-pushed the wiffletree/don-t-scan-from-stale-history-before-a-kept-clon branch from 9bd9f8d to 2a218e5 Compare November 2, 2026 21:04
mhohlios added 2 commits November 2, 2026 16:11
A kept clone's first pull scan could run before its first fetch, when
the mark it joined at is not in the clone yet. The scan then moved the
mark back to the clone's old head, and the next pull rescanned commits
pushed while the Mac was away. A mark the clone does not have now waits.
A kept clone rejoining a Space now fetches the head it joined at from
the staging clone, so its pull scan's mark is always a commit it has.
The scan waits while the head is at or behind the mark, instead of
waiting on a missing mark, which a rewrite before the first pull left
missing for good.
@MHohlios
MHohlios force-pushed the wiffletree/don-t-scan-from-stale-history-before-a-kept-clon branch from 2a218e5 to 57a01bf Compare November 2, 2026 21:21
@MHohlios
MHohlios merged commit c5e9eb6 into main Nov 2, 2026
9 checks passed
@MHohlios
MHohlios deleted the wiffletree/don-t-scan-from-stale-history-before-a-kept-clon branch November 2, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant