# `Statifier.Validator.Checks.DefaultEntry`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.6.0/lib/statifier/validator/checks/default_entry.ex#L1)

Check 7 (spec 3.3): a compound `<state>` with no `initial`
attribute and no `<initial>` element falls back to entering its first
child in document order (spec 3.3). That fallback is only legal when the
first child is itself enterable - a `:history` pseudo-state is not, since
spec 3.10 makes it entered only by a transition that targets it
explicitly - "enterable" here means "not a history pseudo-state".

Reports `{:default_entry_not_enterable, id, :history}` once per offending
state, at the first child's own `location`. Fires only when all five
conditions hold: `kind: :state`, no `initial` attribute, no
`initial_element`, a non-empty `states` list, and that list's first
element has `kind: :history`. A state with no children at all (atomic -
nothing to default into) and a state whose history child is not first (a
legal sibling of a real default target) both report nothing.

`kind: :state` is load-bearing, and deliberately narrower than
`Statifier.Validator.Context.compound?`, which counts `:parallel` too.
A `<parallel>` enters *every* one of its regions on entry (spec 3.4), so
it has no positional default entry for a leading `<history>` to be wrong
about - and SCION's `history3`, `history4`, `history4b`, and `history5`
all open a `<parallel>` with exactly that child order. Widening this to
`compound?/1` rejects four valid conformance documents.

# `check`

```elixir
@spec check(
  document :: Statifier.Document.t(),
  context :: Statifier.Validator.Context.t()
) :: [
  Statifier.Validator.Error.t()
]
```

Returns a `:default_entry_not_enterable` error for every compound `<state>`
that has neither an `initial` attribute nor an `<initial>` element and
whose first child in document order is a `:history` pseudo-state - since
document-order fallback would otherwise try to enter a state spec 3.10
forbids entering that way. Returns `[]` when every implicit default entry
in the document lands on a real state.

---

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