Skip to content

Conversation

@vadimpiven
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: d590e91

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@platforma-sdk/model Patch
@milaboratories/pl-model-middle-layer Patch
@milaboratories/pf-driver Patch
@milaboratories/pl-middle-layer Patch
@milaboratories/uikit Patch
@platforma-sdk/test Patch
@platforma-sdk/ui-vue Patch
@milaboratories/milaboratories.monetization-test.model Patch
@milaboratories/milaboratories.monetization-test.ui Patch
@milaboratories/milaboratories.ui-examples.model Patch
@milaboratories/milaboratories.ui-examples.ui Patch
@milaboratories/milaboratories.ui-examples Patch
@milaboratories/milaboratories.pool-explorer.model Patch
@milaboratories/milaboratories.pool-explorer Patch
@platforma-sdk/block-tools Patch
@milaboratories/milaboratories.pool-explorer.ui Patch
@milaboratories/milaboratories.monetization-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@notion-workspace
Copy link

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vadimpiven, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the interface for creating DataModel instances within the @platforma-sdk/model package. The primary goal is to introduce a more robust and type-safe builder pattern for defining data models, particularly those involving version migrations. By separating the construction logic into a dedicated DataModelBuilder, the changes aim to improve developer experience, reduce potential errors, and provide clearer guidance on how to set up data models with their respective migration paths. Additionally, minor validation improvements and documentation enhancements are included.

Highlights

  • New DataModelBuilder Class: Introduced a dedicated DataModelBuilder class to facilitate the creation of DataModel instances, especially when defining complex migration chains. This new builder provides a more structured and type-safe way to configure data models.
  • Refactored DataModel Creation Interface: The previous static DataModel.from() and .create() methods have been replaced with a builder pattern using new DataModelBuilder().from(...).migrate(...).init(...). This enhances type safety by guiding the user through the migration chain definition and ensuring all versions are covered.
  • Improved Version Definition Validation: The defineDataVersions utility now includes validation to ensure that all version values are non-empty strings, preventing potential issues with invalid version keys.
  • Enhanced Type Safety in Migration Chains: The new builder classes (DataModelMigrationChain, DataModelBuilderWithRecover) leverage TypeScript's type system to enforce correct usage of migration functions, ensuring that input and output types match the defined versioned data structures. New compile-time checks were added to tests to verify this.
  • Updated Documentation and Examples: Extensive updates to JSDoc comments and code examples have been made across DataModel and the new builder classes to clearly explain the new interface and usage patterns.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and well-executed refactoring of the DataModel creation interface. The new DataModelBuilder provides a much more type-safe and intuitive fluent API for defining data models with migrations. By using a state machine pattern with different builder classes, it cleverly enforces the correct sequence of method calls at compile-time, which is a great improvement for developer experience and robustness. The code is clean, well-documented, and the tests have been updated accordingly. I have one suggestion to correct a comment in a test file.

A point of consideration: this is a breaking API change, but the changeset is for a patch release. According to semantic versioning, breaking changes usually warrant at least a minor version bump. You may want to review if patch is the intended version increment.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.10%. Comparing base (0325aea) to head (d590e91).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sdk/model/src/block_migrations.ts 88.88% 2 Missing ⚠️
sdk/model/src/block_storage.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1403   +/-   ##
=======================================
  Coverage   53.09%   53.10%           
=======================================
  Files         239      239           
  Lines       13364    13369    +5     
  Branches     2735     2736    +1     
=======================================
+ Hits         7096     7099    +3     
  Misses       5367     5367           
- Partials      901      903    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return { ...data, description: `Migrated: ${data.labels.join(', ')}` };
})
.create<BlockData>(() => ({ numbers: [], labels: [], description: '' }));
.init(() => ({ numbers: [], labels: [], description: '' }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use classic build method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that would look good

@vadimpiven vadimpiven added this pull request to the merge queue Jan 28, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2026
@vadimpiven vadimpiven enabled auto-merge January 28, 2026 10:36
@vadimpiven vadimpiven added this pull request to the merge queue Jan 28, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2026
@vadimpiven vadimpiven added this pull request to the merge queue Jan 28, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2026
@vadimpiven vadimpiven added this pull request to the merge queue Jan 28, 2026
Merged via the queue into main with commit 57799dd Jan 28, 2026
17 checks passed
@vadimpiven vadimpiven deleted the MILAB-5516_4 branch January 28, 2026 11:53
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.

3 participants