# `AshWorkflow.Entities.Undo`
[🔗](https://github.com/team-alembic/ash_workflow/blob/v0.12.0/lib/ash_workflow/entities/undo.ex#L1)

Configures undo for a workflow.

Undo rewinds a record to the state it occupied before its most recent state
change, and records that rewind as a *new* transition log row whose
`undoes_id` points at the row it reverses. The log is never mutated: history
stays append-only, and both readings of it remain derivable — what actually
happened, and what stands after corrections.

    undo do
      within {30, :minutes}
      same_actor? true
    end

Undo is opt-in twice over. The `undo` block enables the feature, and each
transition that may be rewound must be marked `undoable?: true`. A workflow
with an `undo` block but no undoable transitions is rejected at compile time.

Requires a `transition_log` — there is nothing to rewind to without one.

# `t`

```elixir
@type t() :: %AshWorkflow.Entities.Undo{
  __spark_metadata__: term(),
  policy: term() | nil,
  same_actor?: boolean(),
  within: {pos_integer(), AshWorkflow.Entities.Timeout.duration_unit()} | nil
}
```

# `attribute_schema`

# `window_seconds`

```elixir
@spec window_seconds(t()) :: pos_integer() | nil
```

Returns `within` as a count of seconds, or `nil` when no window is configured.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
