# `MishkaCmsCore.Runtime.Resources.Validations.PageCodeCompiles`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__validations/page_code_compiles.ex#L5)

Refuses a page whose code will not compile, at the action boundary, before it is stored.

A page's `template`, `events`, `infos` and `helpers` are Elixir by the time
`MishkaCmsCore.Runtime.Compilers.LiveViewCompiler` is finished with them, and until this validation
existed nothing read them first. What followed was quiet in a way that is worse than a crash: a
page whose `precompile` is false — the default — is not compiled when it is saved, so the save
succeeded, `MishkaCmsCore.Runtime.RuntimeStatus` reported `Ready`, and the first visitor got the
500. A page whose module was already loaded kept serving the previous version, because the old code
is only purged on the success branch, so the author's change simply never appeared.

Running the check here rather than in a form means every writer gets it — the page form, the
builder, the JSON:API and a seed script alike — which is the same reason `PathFormat` lives here.

The error is attached to the attribute it came from, so a form puts it under the right box.
`MishkaCmsCore.Runtime.PageBuilder.CodeCheck` explains what it can and cannot catch.

---

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