Skip to content

fix: prevent --rebuild from instantly terminating on stale page limits#95

Draft
ccage-simp wants to merge 1 commit intoafar1:mainfrom
ccage-simp:fix/stale-rebuild
Draft

fix: prevent --rebuild from instantly terminating on stale page limits#95
ccage-simp wants to merge 1 commit intoafar1:mainfrom
ccage-simp:fix/stale-rebuild

Conversation

@ccage-simp
Copy link
Copy Markdown
Contributor

@ccage-simp ccage-simp commented Apr 15, 2026

Issue: ft sync --rebuild terminates instantly on first page if bookmarks already exist

Describe the bug
When running ft sync --rebuild on an existing cache, the sync process instantly terminates with "caught up to
newest stored bookmark". The --rebuild flag is supposed to crawl the entire timeline, but because no new
bookmarks are added on the first page, the stalePages counter triggers and halts the loop.

To Reproduce

  1. Sync some bookmarks so you have a local cache.
  2. Run ft sync --rebuild.
  3. The command exits almost immediately after fetching the first page.

Expected behavior
In --rebuild mode, the sync should only be considered "stale" if the API returns 0 total records on a page, not 0
new records.

Suggested Fix
In src/graphql-bookmarks.ts, update the stalePages counter logic to differentiate between incremental and
rebuild mode:

// In incremental mode, a stale page is one that didn't add any *new* bookmarks.
// In rebuild mode, we expect added to be 0 (just merging), so a stale page is
// one that returned no records at all from the API.
stalePages = (incremental ? added === 0 : result.records.length === 0) ? stalePages + 1 : 0;

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