# AZ804: A synced permission reads the clock

The sync index stores who may read each row, and works it out again when a write changes what it reads. A condition that reads the clock or chance (`now()`, `current_date`, `'today'`, `random()`) changes with no write, so the index can't follow it. Shares that start or end later are followed: `authz.sync_tick()`, run on a schedule, works out again the readers of those whose start or end passed. Leave the condition out of what a synced permission reads, or say it with a share that ends.

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 {published_at < now()}
sync role sync_engine
sync app.docs : view
```

```
line 5: {published_at < now()} (a condition of what is synced) reads now(), which changes without a write, so the sync index can't follow it. Leave the clock out of what a synced permission reads: a share that ends is followed (authz.sync_tick()) [AZ804]
```

## Fixed

```authz
app role app_user
type user = app.users
type doc = app.docs
  owner : user = owner_id
  can view = owner and {published}
sync role sync_engine
sync app.docs : view
```
