AZ806: A synced permission reads other rows
The sync index works a row's readers out again when a write changes what they read: the row, its links, the shares, the trees. A condition that reads more than its row (a subquery, a function of the app's), in a permission, a type's or a link table's where, can change with a write to a table the index doesn't follow. Inheritance is the exception: a condition that limits it is followed by its closure table. Say it with a relation, or with a condition on the row's own columns.
Reported when the policy is compiled: rowstile check, the editor, rowstile dev.
The mistake
authz
app role app_user
type user = app.users
type doc = app.docs
owner : user = owner_id
can view = owner and {not exists (select 1 from app.holds h where h.doc_id = this.id)}
sync role sync_engine
sync app.docs : viewline 5: {not exists (select 1 from app.holds h where h.doc_id = this.id)} (a condition of what is synced) reads more than its row (a subquery, or a function of the app's): no write to what it reads tells the sync index, so it can't follow it. Say it with a relation, or with a condition on the row's own columns [AZ806]Fixed
authz
app role app_user
type user = app.users
type doc = app.docs
owner : user = owner_id
can view = owner and {not held}
sync role sync_engine
sync app.docs : view