# `AshReplicant.Resource.Verifiers.ValidateHistory`
[🔗](https://github.com/baselabs/ash_replicant/blob/v0.3.0/lib/ash_replicant/resource/verifiers/validate_history.ex#L1)

Compile-verifier for `replicant do history_strategy :scd2 ... end` (surfaced as a
Spark diagnostic; build-blocking under `--warnings-as-errors`).

When SCD2 is selected, verifies the DSL-checkable SHAPE of the host version table:
a non-empty declared business key; declared integer `valid_from_lsn` (non-nullable — the
version identity anchor) / `valid_to_lsn` (nullable so a version can stay open); a SURROGATE
primary key disjoint from the business key (no business-key attribute may be part of the
primary key — an overlapping PK caps the table at one row per business-key prefix); the `upsert_identity`
identity present with keys equal to
`business_key ++ [valid_from_lsn]`; the `history_close_action` update action present;
and any declared optional timestamp / `is_current` attributes typed correctly.

Checks SHAPE, not behavior — the partial-unique-open index, the action bodies, and
the `REPLICA IDENTITY FULL` precondition for non-PK business keys are host
obligations covered by integration tests (cf. `ValidateSensitive` checking type
shape, not ciphertext). Messages are value-free: schema structure only.

---

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