staleRefReads property

int staleRefReads
getter/setter pair

How many reads of a ref answer with the sha it held before its most recent write — a read replica that has not caught up.

Zero by default, because a fake that lags on every read would make every other test slow and non-obvious. Set it to model what GitHub actually does: a ref write goes to the primary, but GET /git/ref/… is served from a replica and carries no read-after-write guarantee, so a reader can be handed the commit it just replaced. That is not a rare pathology — it is the documented contract, and a fake that pretends the ref is linearizable lets a backend ship a head that silently reads back null after a successful save.

Only ref reads lag. Objects are content-addressed, so a read by sha cannot be stale and is never delayed here.

Implementation

int staleRefReads = 0;