Restore Campaign State
Install a saved campaign state document wholesale — the undo for a bad write.
Written after a board migration replaced a live league’s cells outright:
the hand-authored map_spec s, their rendered previews and the per-cell
game_config went with them, and every historical frame’s owners was
emptied. Nothing could put a saved copy back a field at a time — cell-map
404s for a cell id the damaged board no longer has, so per-cell restoration
cannot even BEGIN until a board of the right shape exists again.
A raw wholesale write does already exist: PUT /v2/leagues/{league_id}/commissioner-state validates a campaign document’s
SHAPE and stores it. Shape is the least of what can be wrong with a restore,
and this route is that write carrying the guards the incident showed were
missing — see _assert_restorable for the refusals, all of which name the
disagreement and which side has to move.
THE EPOCH IS NOT RESTORED, IT IS FORCED FORWARD to max(stored, document) + 1.
Taking it from the document is the obvious reading and the wrong one, twice.
A round that started against the board being replaced persists through
runner._write_state, which drops that write only when the epoch has
MOVED (fresh.epoch != state.epoch) — so a document whose epoch happens to
equal the stored one leaves an in-flight round free to write its whole
state, computed against the damaged board, over the restore seconds later.
And the epoch namespaces round idempotency keys
(campaign:{league}:e{epoch}:{n}), so restoring an earlier epoch would let
the coming rounds collide with keys the previous war already spent and adopt
its orphans. Forcing it forward costs one field of byte-identity and buys
both; the document round-trips exactly otherwise. The residual race is
_write_state’s own unlocked re-read, which predates this route.
Dry-run by default, like migrate-board. The dry report is the whole point of running it first: it counts what the restore gives back and what it takes away against what is stored right now.
Authorizations
Bearer token issued by Softmax
Path Parameters
^league_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$Response
Successful Response
The response is of type Response Restore Campaign State V2 Leagues League Id Campaign Restore State Post · object.