Remote / foldkit-remote

Retention and garbage collection

Remote is a cache, so it should be allowed to forget facts no active feature needs.

Data.subscriptions derives retention roots from the active Surfaces of every call on the domain, so a call's retain entry never collects what another call reads; connections given to any call are kept the same way. A root keeps:

  • the entities and fields its Projection requires;
  • referenced targets reached by nested selections;
  • retained connections and the selected fields of their visible items;
  • data touched by pending optimistic work.

After the configured grace period, RetentionChanged enters the Model and the pure Remote reducer collects unreachable cache data. An inactive Surface that is not otherwise retained may therefore lose its cache, which is safe because the server remains authoritative and the planner can refetch it.

This is another important difference from Sync: Remote recovery may discard and refetch; Sync recovery must preserve unsent client intent.