Skip to content

Prepare 0.4.3: fix embed lifecycle and support JSON loader overrides - #11

Merged
fishtreesugar merged 1 commit into
cdc-fixesfrom
codex/validate-embed-lifecycle-fixes
Nov 6, 2026
Merged

fishtreesugar merged 1 commit into
cdc-fixesfrom
codex/validate-embed-lifecycle-fixes

Conversation

@fishtreesugar

@fishtreesugar fishtreesugar commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Prepare strukt_fork 0.4.3. Newly created nested Strukt records now retain their generated timestamps, required embed lists reject missing or empty values, and trusted ordinary child structs keep their fields while respecting replacement policies.

Changes

  • Preserve generated timestamps across ordinary and polymorphic embeds, partial updates, and pending changesets. Keep internal generation metadata out of returned params and reject forged ordinary-map metadata.
  • Enforce required embed lists, accept action atoms such as Phoenix's :validate, support single-polymorphic :ignore, and reject :nilify on polymorphic lists at schema compilation.
  • Apply ordinary child structs consistently across APIs and honor on_replace when identities differ. Index list entries by identity and position to avoid repeated full-list scans.
  • Fix duplicate @derive application, bare/option-bearing @derives Jason.Encoder, and generated changeset clauses colliding with user definitions.
  • Make from_json/1 overridable with super/1, including definitions inside schema blocks. Return an error for non-object JSON while retaining default loading and error semantics.
  • Add 38 regression and boundary tests, update usage documentation, and set the project version, README dependency example, and changelog to 0.4.3.

Required lists and replacement policies now reject inputs previously accepted by the faulty behavior. For polymorphic lists configured with on_type_not_found: :nilify, use :ignore, :changeset_error, or :raise.

Validation

  • mix test --warnings-as-errors: 239 tests passed on Elixir 1.20.5 / OTP 29.

  • MIX_ENV=test mix compile --force --warnings-as-errors, mix format --check-formatted, and git diff --check: passed.

  • mix docs --warnings-as-errors: passed.

  • mix hex.build: passed; package metadata and contents verified as strukt_fork 0.4.3.

  • Additional regression review caught and fixed metadata cleanup crashing on improper lists inside opaque map values accepted by Ecto.

  • Local median benchmark for 2,000 ordinary embed updates improved from about 118ms to 7.3ms; updates to a pending changeset improved from about 193ms to 8.6ms.

  • GitHub Actions: all four configurations passed for 4c886eb (Elixir 1.17.3/OTP 27, 1.18.4/27, 1.19.5/28, and 1.20.0/28).

This PR prepares the release. Tagging and Hex publication follow after merge.

@fishtreesugar
fishtreesugar merged commit 292413c into cdc-fixes Nov 6, 2026
8 checks passed
@fishtreesugar
fishtreesugar deleted the codex/validate-embed-lifecycle-fixes branch November 8, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant