Skip to content

feat: implement algebraic migration system for ZIO Schema #519#1048

Open
golproductions wants to merge 1 commit intozio:mainfrom
golproductions:feat/migration-system-519
Open

feat: implement algebraic migration system for ZIO Schema #519#1048
golproductions wants to merge 1 commit intozio:mainfrom
golproductions:feat/migration-system-519

Conversation

@golproductions
Copy link
Copy Markdown

/claim #519

This PR implements the pure, algebraic migration system for ZIO Schema 2. It transitions structural transformations into first-class, serializable data, satisfying all requirements for schema evolution without runtime baggage.

Key Implementation:

  • Law-Abiding Interpreter* Added DynamicMigration with a foldLeft interpreter to ensure Identity and Associativity laws.
  • DynamicOptic Pathing: Implemented a comprehensive DynamicOptic system for selecting Fields, Enums (Cases), and Collections.
  • Pure Action ADT: Created serializable MigrationAction types (AddField, Rename, Join, Split, etc.) that operate purely on DynamicValue.
  • Builder DSL: Added MigrationBuilder to allow users to define migrations using a type-safe API that can be backed by macros.

Laws Verified:

  • Identity: Empty migrations preserve the original DynamicValue.
  • Associativity: Sequential composition via ++ is associative.
  • Structural Reverse: Each action maps to its logical inverse.

Validation:
Included AlgebraicMigrationSpec which verifies the interpreter's behavior against complex record and enum structures.

@golproductions golproductions requested a review from a team as a code owner March 16, 2026 10:00
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Your Name seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants