Remote / foldkit-remote

Limits

  • RemoteRpc's schemas are the wire contract, carried by Effect RPC, by JSON over POST (Remote.http), or over a MessagePort; the application supplies deployment layers. ReadBatch and LiveRequirement carry REMOTE_PROTOCOL_VERSION, and a mismatched version fails with RemoteProtocolError rather than silently drifting.
  • One request may name at most MAX_FIELDS_PER_REQUEST (256) fields of one entity and nest relations at most MAX_RELATION_DEPTH (8) levels; the wire rejects larger inputs. A live stream carries at most MAX_LIVE_QUERIES (32) lists, and a many relation read whole is bounded by the server's Source (maxCollection in foldkit-remote-drizzle).
  • The wire LiveChange union carries entity patches/deletes and connection insert/remove/invalidate changes; RemoteServer.live serves them as a stream.
  • Coalescing is scoped to one RemoteClient layer. Separate layers do not share batches.
  • Retention keeps what active Surfaces (and explicit retain entries) reach, and what the Surfaces left reached while it fits the budget (Remote.make({ budget }), entries of rows and lists). Past it, the Surface left longest ago loses its cache on RetentionChanged. The budget is a count of entries, not bytes: a row with a large field costs what a small one does.
  • Two applications with the same Model type are not distinguishable by TypeScript alone; Data.subscriptions also checks the Surface owner token at runtime.
  • staleWhileRevalidate({ maxAge }) ages rows and lists alike; a list's age is that of its last whole page; a later page or a live event does not date it; a row's is that of its oldest field, so a write of some fields can bring the row's refetch forward, never put it off.
  • RemoteData is a closed union.
  • A Selection must choose at least one field; an empty Selection would require nothing and misleadingly read Ready for every id, so it is rejected.