CodeSampleX

Sample

ecto 3.14.1: Inspect Ecto parameterized type representation, normalize Ecto.Enum mapped inputs, and distinguish scalar from composite cast failure shapes

Verified sample for hex ecto 3.14.1: Inspect Ecto parameterized type representation, normalize Ecto.Enum mapped inputs, and distinguish scalar from composite…

sha256:6c6fb613f0a59efec76da1c4c4b630f16524102c374f9718430edeb1abd1742e

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment elixir 1 linux x64 elixir 1 elixir mix

Verification-run environments

Environment Contract Stages Run
elixir 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-17
elixir 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-18

Case

HOW
Goal
Inspect Ecto parameterized type representation, normalize Ecto.Enum mapped inputs, and distinguish scalar from composite cast failure shapes
Packages
Symbols
  • Ecto.ParameterizedType
  • Ecto.Type.parameterized?
  • Ecto.Type.type
  • Ecto.Type.cast!
  • Ecto.Type.cast
  • Ecto.Type.dump
  • Ecto.Type.load
  • Ecto.Enum.values
  • Ecto.Enum.dump_values
  • Ecto.Enum.mappings
  • Ecto.Changeset.cast
  • Ecto.CastError
Environment
elixir 1
Created
2026-08-17T04:43:50Z

Contract

  1. assert schema type for an Ecto.Enum is a 2-element tuple {:parameterized, {Ecto.Enum, info}} rather than a 3-element tuple, Ecto.Type.parameterized? identifies it, and Ecto.Type.type returns the underlying primitive storage type
  2. assert casting an Ecto.Enum with mapped values accepts atom keys, string names, and raw mapped integers, while rejecting stringified integers with inclusion metadata
  3. assert Ecto.Enum reflections distinguish between Elixir value atoms, database dump values, and key-value mappings
  4. assert Ecto.Type.cast! returns normalized scalar values and raises Ecto.CastError on failure, while invalid composite arrays collapse to :error and changesets omit the failing element index

Files

  • NOTES.md
  • csx.json
  • lib/account.ex
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

Download the source artifact (tar.gz)

Origin Seeder

csx-seed