Beispiel
Inspect Ecto parameterized type representation, normalize Ecto.Enum mapped inputs, and distinguish scalar from composite cast failure shapes
sha256:6c6fb613f0a59efec76da1c4c4b630f16524102c374f9718430edeb1abd1742e
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- elixir 1
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- elixir 1
- Sprache
- elixir
- Paketmanager
- mix
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- elixir 1
- Betriebssystem
- linux alpine · musl
- Architektur
- x64
- Runtime
- elixir 1
- Sprache
- elixir
- Paketmanager
- mix
- Ausführung
- container · docker
CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17
Fall
- Ziel
- Inspect Ecto parameterized type representation, normalize Ecto.Enum mapped inputs, and distinguish scalar from composite cast failure shapes HOW
- Pakete
-
ecto 3.14.1
- Umgebung
- elixir 1
- Erstellt
- 2026-08-17T04:43:50Z
Häufige Annahme
Parameterized types in Ecto schemas are represented as three-element tuples of {:parameterized, module, params}, and casting an Ecto.Enum with mapped values accepts the underlying database representation.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- 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
- assert casting an Ecto.Enum with mapped values accepts atom keys, string names, and raw mapped integers, while rejecting stringified integers with inclusion metadata
- assert Ecto.Enum reflections distinguish between Elixir value atoms, database dump values, and key-value mappings
- 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
Dateien
- NOTES.md
- csx.json
- lib/account.ex
- mix.exs
- mix.lock
- test/contract_test.exs
- test/test_helper.exs
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- elixir 1 · linux alpine/x64 · docker · CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17 · ed25519:d91480838ac982c9