Skip to content

fix(serializer): default canonical modes construction#3330

Merged
icecrasher321 merged 3 commits intostagingfrom
fix/serializer-fallback
Feb 25, 2026
Merged

fix(serializer): default canonical modes construction#3330
icecrasher321 merged 3 commits intostagingfrom
fix/serializer-fallback

Conversation

@icecrasher321
Copy link
Collaborator

Summary

On adding blocks -- should have default canonical modes construct

Type of Change

  • Bug fix

Testing

Tested manually + unit tests

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 25, 2026 5:31am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

This PR fixes how canonical modes are initialized when adding blocks to workflows. Previously, blocks were created without default canonical mode settings, which could lead to inconsistent behavior. The fix ensures that:

  • When preparing block state in prepareBlockState (used for UI blocks), all canonical pairs now default to 'basic' mode
  • When creating blocks via copilot in createBlockFromParams, the same default canonical modes are now initialized
  • The serializer logic was refactored to consistently use resolveCanonicalMode instead of fallback operators, making the mode resolution more predictable

The changes maintain backward compatibility with the legacy advancedMode flag while establishing proper defaults for the newer canonical modes system.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured and follow consistent patterns across three different code paths. The logic is defensive (checking if canonical pairs exist before initializing modes), and the test update shows awareness of edge cases. Minor confidence reduction due to the complexity of the canonical mode system and potential for subtle behavioral changes in edge cases not covered by the existing test suite.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/serializer/index.ts Refactored canonical mode resolution logic to call resolveCanonicalMode consistently instead of using fallback operators
apps/sim/stores/workflows/utils.ts Added default canonical modes initialization when preparing block state, defaulting all canonical pairs to 'basic' mode
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/builders.ts Added default canonical modes initialization in createBlockFromParams, mirroring the logic in prepareBlockState

Last reviewed commit: 60ebe73

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@icecrasher321 icecrasher321 merged commit 58d0fda into staging Feb 25, 2026
12 checks passed
@icecrasher321 icecrasher321 deleted the fix/serializer-fallback branch February 25, 2026 06:05
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