Skip to content

Fix nil handling and prepare strukt_fork 0.4.1 - #8

Merged
fishtreesugar merged 2 commits into
cdc-fixesfrom
codex/nil-handling-and-docs
Nov 5, 2026
Merged

fishtreesugar merged 2 commits into
cdc-fixesfrom
codex/nil-handling-and-docs

Conversation

@fishtreesugar

Copy link
Copy Markdown
Owner

Explicit nil updates could leave existing embeds unchanged, while omitted fields could be recast and unexpectedly change stored values. This fixes those inconsistencies and prepares strukt_fork 0.4.1.

Changes

  • Clear single embeds with nil and normalize nil embed collections to []; preserve omitted fields and pending embedded updates across successive changesets.
  • Preserve source-mapped fields supplied through structs, honor required: false, and align generated nullable types with validation rules.
  • Add 19 regression/behavior tests and a polymorphic embeds guide covering creation, updates, mixed lists, validation, and JSON. Clarify parameter precedence and API differences.
  • Upgrade ExDoc to 0.40.4 and its documentation dependencies; correct the Ecto.Type.load/1 callback reference.
  • Set version and installation instructions to 0.4.1, finalize the changelog, include guides in the Hex package, and point documentation source links at the planned 0.4.1 tag.

Compatibility

Unlike 0.4.0, explicit nil updates to populated embeds now clear them. Clearing observes required validation and ordinary Ecto embed on_replace policies, so on_replace: :raise can reject updates that were previously ignored. JSON loading continues to follow Ecto/PolymorphicEmbed loading semantics, as documented.

Validation

  • mix test --warnings-as-errors: 76 tests passed locally on Elixir 1.20.5.
  • mix format --check-formatted and git diff --check passed.
  • mix docs --warnings-as-errors passed with zero warnings.
  • All 9 Elixir examples in the polymorphic embeds guide executed successfully.
  • Built strukt_fork-0.4.1.tar and verified version, packaged guides, and absence of development artifacts.
  • Hex publish dry-run reached the local signing-in/authentication step but could not finish without unlocking the local Hex key. No package or documentation was published.

The release tag has not been created or pushed; publish after this PR is merged.

@fishtreesugar
fishtreesugar merged commit 1be6b33 into cdc-fixes Nov 5, 2026
8 checks passed
@fishtreesugar
fishtreesugar deleted the codex/nil-handling-and-docs 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