Skip to content

Entities 0.4.1: Anonymous public form submissions no longer crash

Entities 0.4.1 fixes public entity forms sent by visitors who are not signed in. Every such submission crashed with a database error instead of being saved.

The public form passed “no author” as an explicit empty value, and the save read that as an author having been given, so it skipped filling one in and the insert failed. An explicit empty author now means the submission has no author and is stored that way, which works from PhoenixKit 2.4.0, where the column allows it. On an older core, the save returns an error instead of crashing. Code that leaves the author out entirely still gets the first administrator filled in, as before, and that fill-in no longer mixes key styles in a way the save refused.

The admin forms, the data navigator and the public form also replace daisyUI 4 class names, such as input-bordered and label-text, with their daisyUI 5 equivalents.

Full release notes: Entities 0.4.1

0.4.1 · 14 August 2026

Fixed

  • Anonymous public submissions crashed with a not_null_violation. The public entity form is deliberately unauthenticated, so it passed created_by_uuid as an explicit nil — but create/2 decided “was a creator provided?” with Map.has_key?/2, which reads an explicit nil as provided. The auto-fill was skipped and the insert raised Postgrex 23502 out of an unauthenticated controller.

    An explicit nil now means “this submission has no author” and is stored as NULL (from core 2.4.0’s V169, where the column became nullable); a key that is absent entirely still gets the documented auto-fill, so internal callers are unchanged. Against an older core whose chain predates V169 the column is still NOT NULL and a missing creator comes back as a changeset error rather than a raise, so the module stays correct on both sides of the pin (#30, BeamLabEU/phoenix_kit#706).

    Auto-filling the first administrator was implemented first and rejected: it puts a named person in front of every anonymous submission wherever a creator is rendered, and files those submissions in that person’s audit trail.

  • The auto-fill could produce a map mixing atom and string keys, which Ecto.Changeset.cast/3 refuses. Both EntityData and PhoenixKitEntities.maybe_add_created_by/1 now write the creator under the key form the caller is already using.

Removed

  • priv/entities/ untracked from the repo. It held 28 committed JSON files, every one a test dropping (imp_conflict_*, imp_sel_a_*, imp_via_storage_*, ctx_draft, ef_test, *_widget), and because mix.exs ships priv they were published to Hex and landed in consumers’ priv/entities/ — the directory Storage.default_path/0 reads back. write_entity/2 creates the directory on demand, so nothing depended on it existing. This did not stop them shipping — see 0.4.2.

Entities 0.4.1. Install or update: {:phoenix_kit_entities, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.