Remote / foldkit-remote-drizzle

Field authorization stays in RemoteServer

The adapter never decides what a principal may read. It compiles only the fields RemoteServer has already allowed:

ts
const UserSource = source(User, {
  authorize: (principal: { readonly canReadEmail: boolean }, fields) =>
    fields.filter(field => field !== 'email' || principal.canReadEmail),
})

When a client asks for [id, name, email], RemoteServer runs authorize first and narrows the field list to [id, name], so the Drizzle source only selects id and name.

filter is RemoteServer.entity's per-record decision, passed through the same way: the Source reads the fields its plan names, and RemoteServer applies the plan to each record. foldkit-guard/server's GuardServer.filter is one.

shared names the fields every principal reads alike, of every row, so a live hub sends a declared write's value of one without a read per principal (see foldkit-remote-server's "Fields every principal reads alike").

A request for a field the Entity does not declare never reaches the read. The Source still always selects the id needed to normalize rows.

reader(binding, run) is the lower-level injected-executor form when the database is not provided as the DrizzleDatabase service or when you want to test the projection compiler directly. It handles scalar and singular-ref normalization, but collection loading/computed fields belong to source.