Skip to content

Preserve the local cache across startup and sync failures - #203

Open
rsheyd wants to merge 2 commits into
romaintb:mainfrom
rsheyd:agent/persistent-cache-lifecycle
Open

Preserve the local cache across startup and sync failures#203
rsheyd wants to merge 2 commits into
romaintb:mainfrom
rsheyd:agent/persistent-cache-lifecycle

Conversation

@rsheyd

@rsheyd rsheyd commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain the SQLite cache between normal application runs
  • load cached projects and tasks immediately while the initial Todoist sync runs
  • keep cached data visible when startup sync or cache refresh fails
  • reuse the persisted Todoist backend record instead of creating a duplicate on every launch
  • replace successful remote snapshots atomically so remotely removed objects do not linger

Why

Terminalist currently deletes its cache during ordinary startup. That makes startup depend on a successful Todoist request, leaves the UI without useful data when the network is unavailable, and can invalidate a database file that another running process still has open.

The cache is now durable. Remote data is fetched before beginning a database transaction, and the backend-specific snapshot is replaced within that transaction. A failed write rolls back to the last usable cache; a failed remote sync leaves the cached view intact.

User impact

Users see their cached task data immediately at startup and can still inspect it if Todoist is temporarily unavailable. Successful syncs continue to refresh the cache authoritatively.

Validation

  • cargo fmt --all -- --check
  • cargo test (59 unit/integration tests and 2 doc tests passed)
  • regression coverage for database reuse, offline startup, transactional rollback, and removal of objects absent from a successful snapshot

@rsheyd
rsheyd marked this pull request as ready for review August 1, 2026 15:05
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