Deploy every guard for a stage being entered (idempotent upsert), but only
while the instance is still committed to that stage. A deploy that lost the
race to a newer transition would otherwise re-lock a stage the instance
already left — a stale lock the newer transition's retract can't see. A
vanished instance (undefined) likewise no-ops: undefined !== stageName.
An aborted instance also no-ops: it parks on its stage forever, so a stale
deploy landing after abort's retract would re-lock the subjects with no
remaining path to delete them. The gate is abortedAt, not completedAt —
a normal move into a terminal stage stamps completedAt in the same
persist and must still deploy that stage's guards.
Deploy every guard for a stage being entered (idempotent upsert), but only while the instance is still committed to that stage. A deploy that lost the race to a newer transition would otherwise re-lock a stage the instance already left — a stale lock the newer transition's retract can't see. A vanished instance (
undefined) likewise no-ops:undefined !== stageName.An aborted instance also no-ops: it parks on its stage forever, so a stale deploy landing after abort's retract would re-lock the subjects with no remaining path to delete them. The gate is
abortedAt, notcompletedAt— a normal move into a terminal stage stampscompletedAtin the same persist and must still deploy that stage's guards.