Skip to content

Prepare 0.4.2: fix pair-list casting and generated types - #10

Merged
fishtreesugar merged 3 commits into
cdc-fixesfrom
codex/fix-pair-list-casting-and-types
Nov 6, 2026
Merged

fishtreesugar merged 3 commits into
cdc-fixesfrom
codex/fix-pair-list-casting-and-types

Conversation

@fishtreesugar

@fishtreesugar fishtreesugar commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

In 0.4.1, passing the pair list returned by Enum.filter/2 or Enum.reject/2 on a string-keyed map could silently drop source-mapped values. For example, a supplied "phone" value could leave phone_number: nil while construction returned {:ok, struct}. This restores source-name mapping and recursive normalization and prepares strukt_fork 0.4.2.

Changes

  • Normalize valid atom/string-keyed pair lists before source mapping and embed identity matching, including ordinary embedded records and direct changeset inputs. Preserve field errors for malformed embedded lists.
  • Let Ecto report malformed top-level parameters as Ecto.CastError; support :invalid as an invalid changeset.
  • Include attribute-defined primary keys and generated timestamps in typespecs, covering custom and parameterized IDs, renamed/disabled timestamps, and nullable generated fields. Type :id as integer() to include accepted negative values.
  • Document the 0.4.1 foreign-struct restriction for both ordinary single embeds and lists, with per-child Map.from_struct/1 migration guidance. Clarify nested changeset inputs and the existing changeset/2 chaining limitation.
  • Add 27 regression and boundary tests.
  • Set the project version, README dependency example, and changelog to 0.4.2. Documentation source links use the versioned tag.

Validation

  • mix test --warnings-as-errors: 201 tests passed on Elixir 1.20.5 / OTP 29.
  • mix format --check-formatted and git diff --check: passed.
  • mix docs --warnings-as-errors: passed.
  • mix hex.build: passed; package metadata verified as strukt_fork 0.4.2.
  • The reported phone-number reproduction and foreign-struct migration example were executed successfully.
  • GitHub Actions: all four configurations passed for 9ae8bf3 (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 8393da4 into cdc-fixes Nov 6, 2026
8 checks passed
@fishtreesugar
fishtreesugar deleted the codex/fix-pair-list-casting-and-types 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