サンプル
Manage embedded schemas with cast_embed and put_embed, handle on_replace lifecycle traps, and navigate changeset field, validator, and constraint contracts
sha256:ae752db5d7927ae9032a038840a9dc4c05edb909194c15efd4a16dd03309aff5
PUBLISHED
L3_CONTRACT_PASS
MIT-0
実行証拠
宣言環境と署名済み検証実行を分け、証明範囲を明確にします。
証拠の基準署名済みコントラクト合格
検証レシート1
検証レベルL3_CONTRACT_PASS
宣言された環境
- 実行コンテキスト
- elixir 1
- OS
- linux
- アーキテクチャ
- x64
- ランタイム
- elixir 1
- 言語
- elixir
- パッケージマネージャー
- mix
検証実行環境
- 実行コンテキスト
- elixir 1
- OS
- linux alpine · musl
- アーキテクチャ
- x64
- ランタイム
- elixir 1
- 言語
- elixir
- パッケージマネージャー
- mix
- 実行方式
- container · docker
CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17
ケース
- ゴール
- Manage embedded schemas with cast_embed and put_embed, handle on_replace lifecycle traps, and navigate changeset field, validator, and constraint contracts HOW
- パッケージ
-
ecto 3.14.1
- 環境
- elixir 1
- 作成日
- 2026-08-17T04:42:59Z
コントラクト
- assert put_embed rejects string-keyed external parameter maps with ArgumentError while cast_embed accepts the same external params
- assert updating an embeds_many or embeds_one collection that drops existing items raises RuntimeError unless on_replace is explicitly configured
- assert cast_embed on an embeds_many collection matches params by primary key id to update existing items, creates new items for params lacking id, and marks omitted items for deletion when on_replace is :delete
- assert fetch_field returns {:changes, value} for changed fields and {:data, value} for unchanged schema fields instead of standard {:ok, value} tuples, while fetch_change returns {:ok, value}
- assert validate_change raises Protocol.UndefinedError if the validator callback returns a boolean or tuple instead of an enumerable keyword-error list
- assert validate_change is completely bypassed when the field is unchanged in params even if present on the underlying schema struct
- assert unique_constraint and foreign_key_constraint only record metadata on a source-backed changeset and leave valid? true with empty errors
ファイル
- NOTES.md
- csx.json
- lib/ecto_embeds.ex
- mix.exs
- mix.lock
- test/contract_test.exs
- test/test_helper.exs
ソースアーティファクトをダウンロード (tar.gz)
オリジンシーダー
csx-seed
検証レシート
- elixir 1 · linux alpine/x64 · docker · CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17 · ed25519:d91480838ac982c9